List of usage examples for com.vaadin.shared.ui ContentMode HTML
ContentMode HTML
To view the source code for com.vaadin.shared.ui ContentMode HTML.
Click Source Link
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDragCaptionProvider.java
License:Apache License
public Element getDragCaptionElement(Widget w) { ComponentConnector component = Util.findConnectorFor(w); DDLayoutState state = ((DragAndDropAwareState) root.getState()).getDragAndDropState(); DragCaptionInfo dci = state.dragCaptions.get(component); Document document = Document.get(); Element dragCaptionImage = document.createDivElement(); Element dragCaption = document.createSpanElement(); String dragCaptionText = dci.caption; if (dragCaptionText != null) { if (dci.contentMode == ContentMode.TEXT) { dragCaption.setInnerText(dragCaptionText); } else if (dci.contentMode == ContentMode.HTML) { dragCaption.setInnerHTML(dragCaptionText); } else if (dci.contentMode == ContentMode.PREFORMATTED) { PreElement preElement = document.createPreElement(); preElement.setInnerText(dragCaptionText); dragCaption.appendChild(preElement); }/* w ww . ja v a2 s.co m*/ } String dragIconKey = state.dragCaptions.get(component).iconKey; if (dragIconKey != null) { String resourceUrl = root.getResourceUrl(dragIconKey); Icon icon = component.getConnection().getIcon(resourceUrl); dragCaptionImage.appendChild(icon.getElement()); } dragCaptionImage.appendChild(dragCaption); return dragCaptionImage; }
From source file:com.haulmont.cuba.web.widgets.CubaCapsLockIndicator.java
License:Apache License
protected void initCapsLockIndicatorContent() { getState().contentMode = ContentMode.HTML; getState().text = "<span></span>"; }
From source file:de.steinwedel.messagebox.MessageBox.java
License:Apache License
/** * Sets HTML as content to the message dialog. * * @param htmlMessage HTML as message// ww w . j a v a 2 s. co m * @return The {@link MessageBox} instance itself */ public MessageBox withHtmlMessage(String htmlMessage) { return withMessage(new Label(htmlMessage, ContentMode.HTML)); }
From source file:de.steinwedel.messagebox.MessageBox.java
License:Apache License
/** * Adds a blank space after the last added button. * * @return The {@link MessageBox} instance *//* ww w .java 2 s . c om*/ public MessageBox withButtonSpacer() { if (immutable) { throw new IllegalStateException( "The dialog cannot be enhanced with a spacer after it has been opened."); } buttonLayout.addComponent(new Label(" ", ContentMode.HTML)); return this; }
From source file:de.symeda.sormas.ui.AboutView.java
License:Open Source License
public AboutView() { CustomLayout aboutContent = new CustomLayout("aboutview"); aboutContent.setStyleName("about-content"); // Info section VerticalLayout infoLayout = new VerticalLayout(); infoLayout.setSpacing(false);/*w ww. j a v a 2 s . c o m*/ infoLayout.setMargin(false); aboutContent.addComponent(infoLayout, "info"); Label versionLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml() + " " + I18nProperties.getCaption(Captions.aboutSormasVersion) + ": " + InfoProvider.get().getVersion(), ContentMode.HTML); infoLayout.addComponent(versionLabel); Link whatsNewLink = new Link(I18nProperties.getCaption(Captions.aboutWhatsNew), new ExternalResource( "https://github.com/hzi-braunschweig/SORMAS-Project/releases/tag/releases%2Fversion-" + InfoProvider.get().getBaseVersion())); whatsNewLink.setTargetName("_blank"); infoLayout.addComponent(whatsNewLink); Link sormasWebsiteLink = new Link(I18nProperties.getCaption(Captions.aboutSormasWebsite), new ExternalResource("https://sormasorg.helmholtz-hzi.de/")); sormasWebsiteLink.setTargetName("_blank"); infoLayout.addComponent(sormasWebsiteLink); Link sormasGithubLink = new Link("SORMAS Github", new ExternalResource("https://github.com/hzi-braunschweig/SORMAS-Project")); sormasGithubLink.setTargetName("_blank"); infoLayout.addComponent(sormasGithubLink); Link changelogLink = new Link(I18nProperties.getCaption(Captions.aboutChangelog), new ExternalResource("https://github.com/hzi-braunschweig/SORMAS-Project/releases")); changelogLink.setTargetName("_blank"); infoLayout.addComponent(changelogLink); // Documents section VerticalLayout documentsLayout = new VerticalLayout(); documentsLayout.setSpacing(false); documentsLayout.setMargin(false); aboutContent.addComponent(documentsLayout, "documents"); Button classificationDocumentButton = new Button( I18nProperties.getCaption(Captions.aboutCaseClassificationRules)); CssStyles.style(classificationDocumentButton, ValoTheme.BUTTON_LINK, CssStyles.BUTTON_COMPACT); documentsLayout.addComponent(classificationDocumentButton); try { String serverUrl = new URL(((VaadinServletRequest) VaadinService.getCurrentRequest()) .getHttpServletRequest().getRequestURL().toString()).getAuthority(); StreamResource classificationResource = DownloadUtil.createStringStreamResource( ClassificationHtmlRenderer.createHtmlForDownload(serverUrl, FacadeProvider.getDiseaseConfigurationFacade().getAllActivePrimaryDiseases()), "classification_rules.html", "text/html"); new FileDownloader(classificationResource).extend(classificationDocumentButton); } catch (MalformedURLException e) { } Button dataDictionaryButton = new Button(I18nProperties.getCaption(Captions.aboutDataDictionary)); CssStyles.style(dataDictionaryButton, ValoTheme.BUTTON_LINK, CssStyles.BUTTON_COMPACT); documentsLayout.addComponent(dataDictionaryButton); FileDownloader dataDictionaryDownloader = new FileDownloader( new ClassResource("/doc/SORMAS_Data_Dictionary.xlsx")); dataDictionaryDownloader.extend(dataDictionaryButton); Link technicalManualLink = new Link(I18nProperties.getCaption(Captions.aboutTechnicalManual), new ExternalResource( "https://github.com/hzi-braunschweig/SORMAS-Project/files/2585973/SORMAS_Technical_Manual_Webversion_20180911.pdf")); technicalManualLink.setTargetName("_blank"); documentsLayout.addComponent(technicalManualLink); setSizeFull(); setStyleName("about-view"); addComponent(aboutContent); setComponentAlignment(aboutContent, Alignment.MIDDLE_CENTER); }
From source file:de.symeda.sormas.ui.caze.CaseController.java
License:Open Source License
public void openClassificationRulesPopup(CaseDataDto caze) { VerticalLayout classificationRulesLayout = new VerticalLayout(); classificationRulesLayout.setMargin(true); DiseaseClassificationCriteriaDto diseaseCriteria = FacadeProvider.getCaseClassificationFacade() .getByDisease(caze.getDisease()); if (diseaseCriteria != null) { Label suspectContent = new Label(); suspectContent.setContentMode(ContentMode.HTML); suspectContent.setWidth(100, Unit.PERCENTAGE); suspectContent.setValue(ClassificationHtmlRenderer.createSuspectHtmlString(diseaseCriteria)); classificationRulesLayout.addComponent(suspectContent); Label probableContent = new Label(); probableContent.setContentMode(ContentMode.HTML); probableContent.setWidth(100, Unit.PERCENTAGE); probableContent.setValue(ClassificationHtmlRenderer.createProbableHtmlString(diseaseCriteria)); classificationRulesLayout.addComponent(probableContent); Label confirmedContent = new Label(); confirmedContent.setContentMode(ContentMode.HTML); confirmedContent.setWidth(100, Unit.PERCENTAGE); confirmedContent.setValue(ClassificationHtmlRenderer.createConfirmedHtmlString(diseaseCriteria)); classificationRulesLayout.addComponent(confirmedContent); }//from www. j a v a 2s.co m Window popupWindow = VaadinUiUtil.showPopupWindow(classificationRulesLayout); popupWindow.addCloseListener(e -> { popupWindow.close(); }); popupWindow.setWidth(860, Unit.PIXELS); popupWindow.setHeight(80, Unit.PERCENTAGE); popupWindow.setCaption( I18nProperties.getString(Strings.classificationRulesFor) + " " + caze.getDisease().toString()); }
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);/*from w w w . j a v a2s . c om*/ } 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.dashboard.contacts.ContactsDashboardStatisticsComponent.java
License:Open Source License
@Override protected void addThirdComponent() { thirdComponent = new DashboardStatisticsSubComponent(); // Header//from ww w .j av a 2 s. c om thirdComponent.addHeader(I18nProperties.getString(Strings.headingFollowUpSituation), null, false); // Visit status of last visit thirdComponent.addMainContent(); CssLayout visitStatusCountLayout = thirdComponent.createCountLayout(true); cooperativeContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardCooperative), CountElementStyle.POSITIVE); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, cooperativeContacts); uncooperativeContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardUncooperative), CountElementStyle.CRITICAL); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, uncooperativeContacts); unavailableContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardUnavailable), CountElementStyle.RELEVANT); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, unavailableContacts); neverVisitedContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardNeverVisited), CountElementStyle.MINOR); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, neverVisitedContacts); Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setSizeUndefined(); infoLabel.setDescription(I18nProperties.getDescription(Descriptions.descDashboardFollowUpInfo)); CssStyles.style(infoLabel, CssStyles.LABEL_LARGE, CssStyles.LABEL_SECONDARY, "follow-up-status-info-button"); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, infoLabel); thirdComponent.addComponentToContent(visitStatusCountLayout); // Number of missed visits Label missedVisitsLabel = new Label(I18nProperties.getCaption(Captions.dashboardNotVisitedFor)); CssStyles.style(missedVisitsLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_UPPERCASE, CssStyles.LABEL_BACKGROUND_FOCUS_LIGHT, CssStyles.LABEL_ROUNDED_CORNERS_SLIM); thirdComponent.addComponentToContent(missedVisitsLabel); CssLayout missedVisitsCountLayout = thirdComponent.createCountLayout(false); missedVisitsOneDay = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardOneDay), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsOneDay); missedVisitsTwoDays = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardTwoDays), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsTwoDays); missedVisitsThreeDays = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardThreeDays), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsThreeDays); missedVisitsGtThreeDays = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardGtThreeDays), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsGtThreeDays); thirdComponent.addComponentToContent(missedVisitsCountLayout); subComponentsLayout.addComponent(thirdComponent, THIRD_LOC); }
From source file:de.symeda.sormas.ui.dashboard.contacts.ContactsDashboardStatisticsComponent.java
License:Open Source License
@Override protected void addFourthComponent() { fourthComponent = new DashboardStatisticsSubComponent(); // Header//from ww w .j a v a 2s . c om fourthComponent.addHeader(I18nProperties.getString(Strings.headingVisits), null, true); // Content fourthComponent.addMainContent(); unavailableVisits = new DashboardStatisticsGraphicalGrowthElement( I18nProperties.getCaption(Captions.dashboardUnavailable), CssStyles.SVG_FILL_MINOR); fourthComponent.addComponentToContent(unavailableVisits); uncooperativeVisits = new DashboardStatisticsGraphicalGrowthElement( I18nProperties.getCaption(Captions.dashboardUncooperative), CssStyles.SVG_FILL_IMPORTANT); fourthComponent.addComponentToContent(uncooperativeVisits); cooperativeVisits = new DashboardStatisticsGraphicalGrowthElement( I18nProperties.getCaption(Captions.dashboardCooperative), CssStyles.SVG_FILL_POSITIVE); fourthComponent.addComponentToContent(cooperativeVisits); Label separator = new Label("<hr/>", ContentMode.HTML); CssStyles.style(separator, CssStyles.VSPACE_TOP_3, CssStyles.VSPACE_3); fourthComponent.addComponentToContent(separator); missedVisits = new DashboardStatisticsGraphicalGrowthElement( I18nProperties.getCaption(Captions.dashboardMissed), CssStyles.SVG_FILL_CRITICAL); fourthComponent.addComponentToContent(missedVisits); subComponentsLayout.addComponent(fourthComponent, FOURTH_LOC); }
From source file:de.symeda.sormas.ui.dashboard.DashboardFilterLayout.java
License:Open Source License
private void createDateFilters() { HorizontalLayout dateFilterLayout = new HorizontalLayout(); dateFilterLayout.addStyleName(CssStyles.LAYOUT_MINIMAL); dateFilterLayout.setSpacing(true);//from w w w. ja v a 2 s . com addComponent(dateFilterLayout); Date now = new Date(); // Date filters Button todayButton = new Button(I18nProperties.getCaption(Captions.dashboardToday)); initializeDateFilterButton(todayButton); todayButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfDay(now), DateHelper.getEndOfDay(now)); dashboardView.refreshDashboard(); }); Button yesterdayButton = new Button(I18nProperties.getCaption(Captions.dashboardYesterday)); initializeDateFilterButton(yesterdayButton); yesterdayButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfDay(DateHelper.subtractDays(now, 1)), DateHelper.getEndOfDay(DateHelper.subtractDays(now, 1))); dashboardView.refreshDashboard(); }); Button thisWeekButton = new Button(I18nProperties.getCaption(Captions.dashboardThisWeek)); initializeDateFilterButton(thisWeekButton); thisWeekButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfWeek(now), DateHelper.getEndOfWeek(now)); dashboardView.refreshDashboard(); }); CssStyles.style(thisWeekButton, CssStyles.BUTTON_FILTER_DARK); CssStyles.removeStyles(thisWeekButton, CssStyles.BUTTON_FILTER_LIGHT); Button lastWeekButton = new Button(I18nProperties.getCaption(Captions.dashboardLastWeek)); initializeDateFilterButton(lastWeekButton); lastWeekButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfWeek(DateHelper.subtractWeeks(now, 1)), DateHelper.getEndOfWeek(DateHelper.subtractWeeks(now, 1))); dashboardView.refreshDashboard(); }); Button thisYearButton = new Button(I18nProperties.getCaption(Captions.dashboardThisYear)); initializeDateFilterButton(thisYearButton); thisYearButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfYear(now), DateHelper.getEndOfYear(now)); dashboardView.refreshDashboard(); }); Button lastYearButton = new Button(I18nProperties.getCaption(Captions.dashboardLastYear)); initializeDateFilterButton(lastYearButton); lastYearButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfYear(DateHelper.subtractYears(now, 1)), DateHelper.getEndOfYear(DateHelper.subtractYears(now, 1))); dashboardView.refreshDashboard(); }); customButton = new PopupButton(I18nProperties.getCaption(Captions.dashboardCustom)); initializeDateFilterButton(customButton); // Custom filter HorizontalLayout customDateFilterLayout = new HorizontalLayout(); customDateFilterLayout.setSpacing(true); customDateFilterLayout.setMargin(true); // 'Apply custom filter' button Button applyButton = new Button(I18nProperties.getCaption(Captions.dashboardApplyCustomFilter)); CssStyles.style(applyButton, CssStyles.FORCE_CAPTION, ValoTheme.BUTTON_PRIMARY); // Date & Epi Week filter EpiWeekAndDateFilterComponent<NewCaseDateType> weekAndDateFilter = new EpiWeekAndDateFilterComponent<>( applyButton, true, true, I18nProperties.getString(Strings.infoCaseDate)); customDateFilterLayout.addComponent(weekAndDateFilter); dashboardDataProvider .setDateFilterOption((DateFilterOption) weekAndDateFilter.getDateFilterOptionFilter().getValue()); dashboardDataProvider.setFromDate( DateHelper.getEpiWeekStart((EpiWeek) weekAndDateFilter.getWeekFromFilter().getValue())); dashboardDataProvider .setToDate(DateHelper.getEpiWeekEnd((EpiWeek) weekAndDateFilter.getWeekToFilter().getValue())); customDateFilterLayout.addComponent(applyButton); // Apply button listener applyButton.addClickListener(e -> { DateFilterOption dateFilterOption = (DateFilterOption) weekAndDateFilter.getDateFilterOptionFilter() .getValue(); Date fromDate = null; Date toDate = null; EpiWeek fromWeek = null; EpiWeek toWeek = null; dashboardDataProvider.setDateFilterOption(dateFilterOption); if (dateFilterOption == DateFilterOption.DATE) { fromDate = weekAndDateFilter.getDateFromFilter().getValue(); dashboardDataProvider.setFromDate(fromDate); toDate = weekAndDateFilter.getDateToFilter().getValue(); dashboardDataProvider.setToDate(toDate); } else { fromWeek = (EpiWeek) weekAndDateFilter.getWeekFromFilter().getValue(); dashboardDataProvider.setFromDate(DateHelper.getEpiWeekStart(fromWeek)); toWeek = (EpiWeek) weekAndDateFilter.getWeekToFilter().getValue(); dashboardDataProvider.setToDate(DateHelper.getEpiWeekEnd(toWeek)); } if ((fromDate != null && toDate != null) || (fromWeek != null && toWeek != null)) { changeDateFilterButtonsStyles(customButton); dashboardView.refreshDashboard(); if (dateFilterOption == DateFilterOption.DATE) { customButton.setCaption(DateHelper.formatLocalShortDate(fromDate) + " - " + DateHelper.formatLocalShortDate(toDate)); } else { customButton.setCaption(fromWeek.toShortString() + " - " + toWeek.toShortString()); } } else { if (dateFilterOption == DateFilterOption.DATE) { new Notification(I18nProperties.getString(Strings.headingMissingDateFilter), I18nProperties.getString(Strings.messageMissingDateFilter), Type.ERROR_MESSAGE, false) .show(Page.getCurrent()); } else { new Notification(I18nProperties.getString(Strings.headingMissingEpiWeekFilter), I18nProperties.getString(Strings.messageMissingEpiWeekFilter), Type.ERROR_MESSAGE, false).show(Page.getCurrent()); } } }); customButton.setContent(customDateFilterLayout); dateFilterLayout.addComponents(todayButton, yesterdayButton, thisWeekButton, lastWeekButton, thisYearButton, lastYearButton, customButton); infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setSizeUndefined(); CssStyles.style(infoLabel, CssStyles.LABEL_XLARGE, CssStyles.LABEL_SECONDARY); addComponent(infoLabel); setComponentAlignment(infoLabel, Alignment.TOP_RIGHT); }