List of usage examples for com.vaadin.ui VerticalLayout addStyleName
@Override public void addStyleName(String style)
From source file:de.fatalix.bookery.view.common.SuggestLaneLayout.java
License:Open Source License
public void loadLane(String title, List<BookEntry> bookEntries, String searchLink) { layout.removeAllComponents();/*ww w . j a va2 s .com*/ titleLabel.setValue(title); this.searchLink = searchLink; if (bookEntries.isEmpty()) { layout.addComponent(createEmptyDummy()); } else { boolean firstBookCover = true; for (BookEntry bookEntry : bookEntries) { VerticalLayout bookCoverLayout = createBookCoverLayout(bookEntry); if (firstBookCover) { bookCoverLayout.addStyleName("mobile"); firstBookCover = false; } else { bookCoverLayout.addStyleName("desktop"); } layout.addComponent(bookCoverLayout); } layout.addComponent(moreLink); layout.setComponentAlignment(moreLink, Alignment.MIDDLE_CENTER); } }
From source file:de.fatalix.bookery.view.common.SuggestLaneLayout.java
License:Open Source License
private VerticalLayout createBookCoverLayout(final BookEntry bookEntry) { Image image = new Image(); image.setDescription(bookEntry.getTitle() + " von " + bookEntry.getAuthor()); image.setHeight("200px"); image.setWidth("130px"); image.setImmediate(true);//from w ww. ja va 2 s.c o m if (bookEntry.getThumbnail() != null) { StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getThumbnail()); image.setSource(new StreamResource(source, bookEntry.getId() + "_thumb.png")); } else if (bookEntry.getCover() != null) { StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getCover()); image.setSource(new StreamResource(source, bookEntry.getId() + ".png")); } VerticalLayout result = new VerticalLayout(image); result.setHeight("210px"); result.addStyleName("pointer-cursor"); result.addStyleName("book-cover"); result.setComponentAlignment(image, Alignment.MIDDLE_CENTER); result.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { bookDetailLayout.loadData(bookEntry); bookDetailLayout.setLayoutVisible(true); } }); return result; }
From source file:de.fatalix.bookery.view.home.HomeView.java
License:Open Source License
@PostConstruct private void postInit() { VerticalLayout root = new VerticalLayout(); root.setSpacing(true);/*w w w. jav a 2 s .co m*/ root.setMargin(true); root.addComponents(bookCount, watchListLane, newBooksLane, mostLikedLane, mostLoadedLane); root.addStyleName("bookery-view"); bookCount.addStyleName(ValoTheme.LABEL_BOLD); this.setCompositionRoot(root); }
From source file:de.metas.ui.web.vaadin.components.navigator.MFViewDisplay.java
License:Open Source License
public MFViewDisplay(final UI ui) { super();// w w w . j av a 2 s. c om final VerticalLayout content = new VerticalLayout(); content.addStyleName(STYLE); // // Lane: title { final Button icon = new Button(); icon.setPrimaryStyleName(STYLE + "-title-icon"); icon.setIcon(FontAwesome.BARS); icon.addClickListener(event -> toggleMenuPanel()); titleLabel = new Label(); titleLabel.setPrimaryStyleName(STYLE + "-title-text"); final HorizontalLayout panel = new HorizontalLayout(icon, titleLabel); panel.addStyleName(STYLE + "-title-lane"); content.addComponent(panel); } // // Lane: menu { menuPanel = new MenuPanel(); menuPanel.setHiddenByStyle(false); content.addComponent(menuPanel); } viewContainer = new ViewContainer(); content.addComponent(viewContainer); setCompositionRoot(content); ui.setContent(this); }
From source file:de.metas.ui.web.vaadin.window.view.WindowViewImpl.java
License:Open Source License
@Override protected Component createUI() { final VerticalLayout content = new VerticalLayout(); content.addStyleName(STYLE); ///*from w w w .j ava 2 s.c om*/ // Lane: Rating & actions { actionsPanel = new HorizontalLayout(); actionsPanel.addStyleName(STYLE + "-actions-lane"); content.addComponent(actionsPanel); } // // Lane: document summary { final HorizontalLayout panelSummary = new HorizontalLayout(); panelSummary.addStyleName(STYLE + "-summary-lane"); content.addComponent(panelSummary); // Component: navigation buttons and document summary text { this.recordSummaryEditor = new LabelEditor(WindowConstants.PROPERTYNAME_RecordSummary); recordSummaryEditor.addStyleName(STYLE + "-record-summary-label"); recordSummaryEditor.setContentMode(ContentMode.PREFORMATTED); btnPreviousRecord = new Button(); btnPreviousRecord.setPrimaryStyleName(STYLE + "-record-nav-btn"); btnPreviousRecord.setIcon(FontAwesome.CARET_LEFT); btnPreviousRecord.addClickListener( event -> commitChangesAndFireAction(WindowConstants.ACTION_PreviousRecord)); btnNextRecord = new Button(); btnNextRecord.setPrimaryStyleName(STYLE + "-record-nav-btn"); btnNextRecord.setIcon(FontAwesome.CARET_RIGHT); btnNextRecord .addClickListener(event -> commitChangesAndFireAction(WindowConstants.ACTION_NextRecord)); final HorizontalLayout recordNavigationComp = new HorizontalLayout(btnPreviousRecord, recordSummaryEditor, btnNextRecord); recordNavigationComp.addStyleName(STYLE + "-record-nav"); panelSummary.addComponent(recordNavigationComp); } // Component: current record indicators { recordIndicators = new WindowRecordIndicators(); panelSummary.addComponent(recordIndicators); } // Component: document additional summary text { this.recordAdditionalSummaryEditor = new LabelEditor( WindowConstants.PROPERTYNAME_RecordAditionalSummary); recordAdditionalSummaryEditor.addStyleName(STYLE + "-record-addsummary-label"); recordAdditionalSummaryEditor.setContentMode(ContentMode.PREFORMATTED); panelSummary.addComponent(recordAdditionalSummaryEditor); } } // // Lane: window panels bar { panelsBar = new WindowPanelsBar(); panelsBar.addStyleName(STYLE + "-tabbar-lane"); content.addComponent(panelsBar); } // // Panels container { rootEditorContainer = new HorizontalLayout(); rootEditorContainer.addStyleName(STYLE + "-content-lane"); rootEditorContainer.setSizeFull(); content.addComponent(rootEditorContainer); } // // Register editors { // registerEditor(titleEditor); registerEditor(recordSummaryEditor); registerEditor(recordAdditionalSummaryEditor); } // return content; }
From source file:de.symeda.sormas.ui.caze.CasesView.java
License:Open Source License
public CasesView() { super(VIEW_NAME); originalViewTitle = getViewTitleLabel().getValue(); criteria = ViewModelProviders.of(CasesView.class).get(CaseCriteria.class); if (criteria.getArchived() == null) { criteria.archived(false);// w w w . j av a 2 s .c o m } grid = new CaseGrid(); grid.setCriteria(criteria); gridLayout = new VerticalLayout(); gridLayout.addComponent(createFilterBar()); gridLayout.addComponent(createStatusFilterBar()); gridLayout.addComponent(grid); gridLayout.setMargin(true); gridLayout.setSpacing(false); gridLayout.setSizeFull(); gridLayout.setExpandRatio(grid, 1); gridLayout.setStyleName("crud-main-layout"); grid.getDataProvider().addDataProviderListener(e -> updateStatusButtons()); if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_IMPORT)) { Button importButton = new Button(I18nProperties.getCaption(Captions.actionImport)); importButton.addStyleName(ValoTheme.BUTTON_PRIMARY); importButton.setIcon(VaadinIcons.UPLOAD); importButton.addClickListener(e -> { Window popupWindow = VaadinUiUtil.showPopupWindow(new CaseImportLayout()); popupWindow.setCaption(I18nProperties.getString(Strings.headingImportCases)); popupWindow.addCloseListener(c -> { grid.reload(); }); }); addHeaderComponent(importButton); } if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_EXPORT)) { PopupButton exportButton = new PopupButton(I18nProperties.getCaption(Captions.export)); exportButton.setId("export"); exportButton.setIcon(VaadinIcons.DOWNLOAD); VerticalLayout exportLayout = new VerticalLayout(); exportLayout.setSpacing(true); exportLayout.setMargin(true); exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL); exportLayout.setWidth(200, Unit.PIXELS); exportButton.setContent(exportLayout); addHeaderComponent(exportButton); Button basicExportButton = new Button(I18nProperties.getCaption(Captions.exportBasic)); basicExportButton.setId("basicExport"); basicExportButton.setDescription(I18nProperties.getString(Strings.infoBasicExport)); basicExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); basicExportButton.setIcon(VaadinIcons.TABLE); basicExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(basicExportButton); StreamResource streamResource = new GridExportStreamResource(grid, "sormas_cases", "sormas_cases_" + DateHelper.formatDateForExport(new Date()) + ".csv"); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(basicExportButton); Button extendedExportButton = new Button(I18nProperties.getCaption(Captions.exportDetailed)); extendedExportButton.setId("extendedExport"); extendedExportButton.setDescription(I18nProperties.getString(Strings.infoDetailedExport)); extendedExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); extendedExportButton.setIcon(VaadinIcons.FILE_TEXT); extendedExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(extendedExportButton); StreamResource extendedExportStreamResource = DownloadUtil.createCsvExportStreamResource( CaseExportDto.class, (Integer start, Integer max) -> FacadeProvider.getCaseFacade() .getExportList(UserProvider.getCurrent().getUuid(), grid.getCriteria(), start, max), (propertyId, type) -> { String caption = I18nProperties.getPrefixCaption(CaseExportDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(EpiDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption( HospitalizationDto.I18N_PREFIX, propertyId)))))); if (Date.class.isAssignableFrom(type)) { caption += " (" + DateHelper.getLocalShortDatePattern() + ")"; } return caption; }, "sormas_cases_" + DateHelper.formatDateForExport(new Date()) + ".csv"); new FileDownloader(extendedExportStreamResource).extend(extendedExportButton); Button sampleExportButton = new Button(I18nProperties.getCaption(Captions.exportSamples)); sampleExportButton.setId("sampleExport"); sampleExportButton.setDescription(I18nProperties.getString(Strings.infoSampleExport)); sampleExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); sampleExportButton.setIcon(VaadinIcons.FILE_TEXT); sampleExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(sampleExportButton); StreamResource sampleExportStreamResource = DownloadUtil.createCsvExportStreamResource( SampleExportDto.class, (Integer start, Integer max) -> FacadeProvider.getSampleFacade() .getExportList(UserProvider.getCurrent().getUuid(), grid.getCriteria(), start, max), (propertyId, type) -> { String caption = I18nProperties.getPrefixCaption(SampleExportDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(SampleDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption( AdditionalTestDto.I18N_PREFIX, propertyId))))); if (Date.class.isAssignableFrom(type)) { caption += " (" + DateHelper.getLocalShortDatePattern() + ")"; } return caption; }, "sormas_samples_" + DateHelper.formatDateForExport(new Date()) + ".csv"); new FileDownloader(sampleExportStreamResource).extend(sampleExportButton); // Warning if no filters have been selected Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters), ContentMode.HTML); warningLabel.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(warningLabel); warningLabel.setVisible(false); exportButton.addClickListener(e -> { warningLabel.setVisible(!criteria.hasAnyFilterActive()); }); } if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_MERGE)) { Button mergeDuplicatesButton = new Button(I18nProperties.getCaption(Captions.caseMergeDuplicates)); mergeDuplicatesButton.setId("mergeDuplicates"); mergeDuplicatesButton.setIcon(VaadinIcons.COMPRESS_SQUARE); mergeDuplicatesButton .addClickListener(e -> ControllerProvider.getCaseController().navigateToMergeCasesView()); addHeaderComponent(mergeDuplicatesButton); } if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_CREATE)) { createButton = new Button(I18nProperties.getCaption(Captions.caseNewCase)); createButton.setId("create"); createButton.addStyleName(ValoTheme.BUTTON_PRIMARY); createButton.setIcon(VaadinIcons.PLUS_CIRCLE); createButton.addClickListener(e -> ControllerProvider.getCaseController().create()); addHeaderComponent(createButton); } addComponent(gridLayout); }
From source file:de.symeda.sormas.ui.contact.ContactsView.java
License:Open Source License
public ContactsView() { super(VIEW_NAME); originalViewTitle = getViewTitleLabel().getValue(); criteria = ViewModelProviders.of(ContactsView.class).get(ContactCriteria.class); if (criteria.getArchived() == null) { criteria.archived(false);/*ww w .ja v a 2 s. c om*/ } grid = new ContactGrid(); grid.setCriteria(criteria); gridLayout = new VerticalLayout(); gridLayout.addComponent(createFilterBar()); gridLayout.addComponent(createStatusFilterBar()); gridLayout.addComponent(grid); gridLayout.setMargin(true); gridLayout.setSpacing(false); gridLayout.setSizeFull(); gridLayout.setExpandRatio(grid, 1); gridLayout.setStyleName("crud-main-layout"); grid.getDataProvider().addDataProviderListener(e -> updateStatusButtons()); if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EXPORT)) { PopupButton exportButton = new PopupButton(I18nProperties.getCaption(Captions.export)); exportButton.setIcon(VaadinIcons.DOWNLOAD); VerticalLayout exportLayout = new VerticalLayout(); exportLayout.setSpacing(true); exportLayout.setMargin(true); exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL); exportLayout.setWidth(200, Unit.PIXELS); exportButton.setContent(exportLayout); addHeaderComponent(exportButton); Button basicExportButton = new Button(I18nProperties.getCaption(Captions.exportBasic)); basicExportButton.setDescription(I18nProperties.getDescription(Descriptions.descExportButton)); basicExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); basicExportButton.setIcon(VaadinIcons.TABLE); basicExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(basicExportButton); StreamResource streamResource = new GridExportStreamResource(grid, "sormas_contacts", "sormas_contacts_" + DateHelper.formatDateForExport(new Date()) + ".csv"); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(basicExportButton); Button extendedExportButton = new Button(I18nProperties.getCaption(Captions.exportDetailed)); extendedExportButton .setDescription(I18nProperties.getDescription(Descriptions.descDetailedExportButton)); extendedExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); extendedExportButton.setIcon(VaadinIcons.FILE_TEXT); extendedExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(extendedExportButton); StreamResource extendedExportStreamResource = DownloadUtil.createCsvExportStreamResource( ContactExportDto.class, (Integer start, Integer max) -> FacadeProvider.getContactFacade() .getExportList(UserProvider.getCurrent().getUuid(), grid.getCriteria(), start, max), (propertyId, type) -> { String caption = I18nProperties.getPrefixCaption(ContactExportDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption( HospitalizationDto.I18N_PREFIX, propertyId)))))); if (Date.class.isAssignableFrom(type)) { caption += " (" + DateHelper.getLocalShortDatePattern() + ")"; } return caption; }, "sormas_contacts_" + DateHelper.formatDateForExport(new Date()) + ".csv"); new FileDownloader(extendedExportStreamResource).extend(extendedExportButton); // Warning if no filters have been selected Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters)); warningLabel.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(warningLabel); warningLabel.setVisible(false); exportButton.addClickListener(e -> { warningLabel.setVisible(!criteria.hasAnyFilterActive()); }); } addComponent(gridLayout); }
From source file:de.symeda.sormas.ui.login.LoginScreen.java
License:Open Source License
private void buildUI() { addStyleName("login-screen"); // login form, centered in the available part of the screen VerticalLayout loginFormLayout = new VerticalLayout(); loginFormLayout.addStyleName("login-form"); loginFormLayout.setMargin(false);// ww w .jav a2s . c o m Component loginForm = buildLoginForm(); loginFormLayout.addComponent(loginForm); loginFormLayout.addComponent(buildLoginDetailsLayout()); // layout to center login form when there is sufficient screen space // - see the theme for how this is made responsive for various screen // sizes CssLayout loginLayout = new CssLayout(); loginLayout.setStyleName("login-form-container"); loginLayout.addComponent(loginFormLayout); // information text about logging in CssLayout loginInformation = buildLoginInformation(); // custom html layout CssLayout loginSidebarLayout = buildLoginSidebarLayout(); addComponent(loginInformation); addComponent(loginLayout); addComponent(loginSidebarLayout); }
From source file:de.symeda.sormas.ui.samples.SampleListEntry.java
License:Open Source License
public SampleListEntry(SampleIndexDto sample) { this.sample = sample; setMargin(false);//from ww w. j ava 2 s . c om setSpacing(true); setWidth(100, Unit.PERCENTAGE); addStyleName(CssStyles.SORMAS_LIST_ENTRY); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setWidth(100, Unit.PERCENTAGE); mainLayout.setMargin(false); mainLayout.setSpacing(false); addComponent(mainLayout); setExpandRatio(mainLayout, 1); HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setWidth(100, Unit.PERCENTAGE); topLayout.setMargin(false); topLayout.setSpacing(false); mainLayout.addComponent(topLayout); VerticalLayout topLeftLayout = new VerticalLayout(); { topLeftLayout.setMargin(false); topLeftLayout.setSpacing(false); Label materialLabel = new Label(DataHelper.toStringNullable(sample.getSampleMaterial())); CssStyles.style(materialLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); topLeftLayout.addComponent(materialLabel); Label dateTimeLabel = new Label( I18nProperties.getPrefixCaption(SampleDto.I18N_PREFIX, SampleDto.SAMPLE_DATE_TIME) + ": " + DateHelper.formatLocalShortDate(sample.getSampleDateTime())); topLeftLayout.addComponent(dateTimeLabel); Label labLabel = new Label(DataHelper.toStringNullable(sample.getLab())); topLeftLayout.addComponent(labLabel); } topLayout.addComponent(topLeftLayout); VerticalLayout topRightLayout = new VerticalLayout(); { topRightLayout.addStyleName(CssStyles.ALIGN_RIGHT); topRightLayout.setMargin(false); topRightLayout.setSpacing(false); Label resultLabel = new Label(); CssStyles.style(resultLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); if (sample.getPathogenTestResult() != null) { resultLabel.setValue(DataHelper.toStringNullable(sample.getPathogenTestResult())); if (sample.getPathogenTestResult() == PathogenTestResultType.POSITIVE) { resultLabel.addStyleName(CssStyles.LABEL_CRITICAL); } else if (sample.getPathogenTestResult() == PathogenTestResultType.INDETERMINATE) { resultLabel.addStyleName(CssStyles.LABEL_WARNING); } } else if (sample.getSpecimenCondition() == SpecimenCondition.NOT_ADEQUATE) { resultLabel.setValue(DataHelper.toStringNullable(sample.getSpecimenCondition())); resultLabel.addStyleName(CssStyles.LABEL_WARNING); } topRightLayout.addComponent(resultLabel); Label referredLabel = new Label(); CssStyles.style(referredLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); if (sample.isReferred()) { referredLabel.setValue(I18nProperties.getCaption(Captions.sampleReferredShort)); referredLabel.addStyleName(CssStyles.LABEL_NOT); } else if (sample.isReceived()) { referredLabel.setValue(I18nProperties.getCaption(Captions.sampleReceived) + " " + DateHelper.formatLocalShortDate(sample.getReceivedDate())); } else if (sample.isShipped()) { referredLabel.setValue(I18nProperties.getCaption(Captions.sampleShipped) + " " + DateHelper.formatLocalShortDate(sample.getShipmentDate())); } else { referredLabel.setValue(I18nProperties.getCaption(Captions.sampleNotShippedLong)); } topRightLayout.addComponent(referredLabel); } topLayout.addComponent(topRightLayout); topLayout.setComponentAlignment(topRightLayout, Alignment.TOP_RIGHT); if (UserProvider.getCurrent().hasUserRight(UserRight.ADDITIONAL_TEST_VIEW)) { Label labelAdditionalTests = new Label(I18nProperties.getString(Strings.entityAdditionalTests) + " " + sample.getAdditionalTestingStatus().toString().toLowerCase()); mainLayout.addComponent(labelAdditionalTests); } }
From source file:de.symeda.sormas.ui.samples.SamplesView.java
License:Open Source License
public SamplesView() { super(VIEW_NAME); sampleListComponent = new SampleGridComponent(getViewTitleLabel(), this); setSizeFull();/* w ww .j a va 2 s . c o m*/ addComponent(sampleListComponent); if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_EXPORT)) { PopupButton exportButton = new PopupButton(I18nProperties.getCaption(Captions.export)); exportButton.setIcon(VaadinIcons.DOWNLOAD); VerticalLayout exportLayout = new VerticalLayout(); exportLayout.setSpacing(true); exportLayout.setMargin(true); exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL); exportLayout.setWidth(200, Unit.PIXELS); exportButton.setContent(exportLayout); addHeaderComponent(exportButton); Button basicExportButton = new Button(I18nProperties.getCaption(Captions.exportBasic)); basicExportButton.setDescription(I18nProperties.getString(Strings.infoBasicExport)); basicExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); basicExportButton.setIcon(VaadinIcons.TABLE); basicExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(basicExportButton); StreamResource streamResource = new GridExportStreamResource(sampleListComponent.getGrid(), "sormas_samples", "sormas_samples_" + DateHelper.formatDateForExport(new Date()) + ".csv", SampleGrid.EDIT_BTN_ID); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(basicExportButton); Button extendedExportButton = new Button(I18nProperties.getCaption(Captions.exportDetailed)); extendedExportButton.setDescription(I18nProperties.getString(Strings.infoDetailedExport)); extendedExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); extendedExportButton.setIcon(VaadinIcons.FILE_TEXT); extendedExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(extendedExportButton); StreamResource extendedExportStreamResource = DownloadUtil.createCsvExportStreamResource( SampleExportDto.class, (Integer start, Integer max) -> FacadeProvider.getSampleFacade().getExportList( UserProvider.getCurrent().getUuid(), sampleListComponent.getGrid().getCriteria(), start, max), (propertyId, type) -> { String caption = I18nProperties.getPrefixCaption(SampleExportDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(SampleDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption( AdditionalTestDto.I18N_PREFIX, propertyId))))); if (Date.class.isAssignableFrom(type)) { caption += " (" + DateHelper.getLocalShortDatePattern() + ")"; } return caption; }, "sormas_samples_" + DateHelper.formatDateForExport(new Date()) + ".csv"); new FileDownloader(extendedExportStreamResource).extend(extendedExportButton); } }