List of usage examples for com.vaadin.ui VerticalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:de.fatalix.bookery.view.common.BookSearchLayout.java
License:Open Source License
private VerticalLayout createSearchResultLayout() { resultText = new Label(" 0 Ergebnisse gefunden"); resultText.addStyleName(ValoTheme.LABEL_BOLD); resultLayout = new HorizontalLayout(); resultLayout.setSpacing(true);/*from ww w. jav a2 s . c o m*/ resultLayout.addStyleName("wrapping"); showMore = new Button("show more", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { searchBooks(query, false); } }); showMore.setWidth(100, Unit.PERCENTAGE); showMore.addStyleName(ValoTheme.BUTTON_HUGE); showMore.addStyleName(ValoTheme.BUTTON_FRIENDLY); VerticalLayout root = new VerticalLayout(); root.addStyleName("bookery-view"); root.setSpacing(true); root.setMargin(true); root.addComponents(resultText, resultLayout, showMore); return root; }
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); root.setMargin(true);//w w w.ja v a2 s .c o m root.addComponents(bookCount, watchListLane, newBooksLane, mostLikedLane, mostLoadedLane); root.addStyleName("bookery-view"); bookCount.addStyleName(ValoTheme.LABEL_BOLD); this.setCompositionRoot(root); }
From source file:de.fatalix.lighty.web.LightyApp.java
@Override protected void init(VaadinRequest request) { setSizeFull();// w w w . j a v a 2 s. c om VerticalLayout navigatorLayout = new VerticalLayout(); navigatorLayout.setSizeFull(); navigatorLayout.setSpacing(true); Panel contentPanel = new Panel(navigatorLayout); contentPanel.setSizeFull(); contentPanel.addStyleName(LightyTheme.BACKGROUND); Navigator navigator = new Navigator(LightyApp.this, contentPanel); navigator.addProvider(viewProvider); VerticalLayout rootLayout = new VerticalLayout(); rootLayout.addComponent(new LightyHeader()); rootLayout.addComponent(new LightyNavigation()); rootLayout.addComponent(notificationBar); rootLayout.addComponent(contentPanel); rootLayout.setExpandRatio(contentPanel, 1.0f); rootLayout.setSizeFull(); setContent(rootLayout); }
From source file:de.fatalix.timeline.web.VaadinWebProjectApp.java
@Override protected void init(VaadinRequest request) { setSizeFull();/*from w ww.j ava 2 s . c o m*/ VerticalLayout navigatorLayout = new VerticalLayout(); navigatorLayout.setSizeFull(); navigatorLayout.setSpacing(true); Panel contentPanel = new Panel(navigatorLayout); contentPanel.setSizeFull(); Navigator navigator = new Navigator(VaadinWebProjectApp.this, contentPanel); navigator.addProvider(viewProvider); VerticalLayout rootLayout = new VerticalLayout(); //rootLayout.addComponent(header); rootLayout.addComponent(contentPanel); rootLayout.setExpandRatio(contentPanel, 1.0f); rootLayout.setSizeFull(); setContent(rootLayout); }
From source file:de.kaiserpfalzEdv.vaadin.about.AboutViewImpl.java
License:Apache License
private VerticalLayout createVerticalLayout(final String caption, final String description, Resource icon) { VerticalLayout result = new VerticalLayout(); result.setSizeFull();// w w w . ja v a 2s . c o m result.setSpacing(true); result.setResponsive(true); if (caption != null) result.setCaption(presenter.translate(caption)); if (description != null) result.setDescription(presenter.translate(description)); if (icon != null) result.setIcon(icon); return result; }
From source file:de.lmu.ifi.dbs.knowing.vaadin.MainApplication.java
License:Apache License
private Window getAboutDialog() { if (aboutWindow == null) { aboutWindow = new Window("About..."); aboutWindow.setModal(true);/*www.j a v a 2 s .c o m*/ aboutWindow.setWidth("400px"); VerticalLayout layout = (VerticalLayout) aboutWindow.getContent(); layout.setMargin(true); layout.setSpacing(true); layout.setStyleName("grey"); CssLayout titleLayout = new CssLayout(); H2 title = new H2("Knowing Vaadin Application"); titleLayout.addComponent(title); SmallText description = new SmallText("<br>Copyright (c) Nepomuk Seiler, LMU Database <br>" + "Licensed under Apache Software Foundation 2.0 license (ASF).<br><br>" + "This software contains modules licenced under<br>" + " the Apache Software Foundation 2.0 license (ASF) and EPL<br><br>" + "Many thanks to Kai Tdter, Chris Brind, Neil Bartlett and<br>" + " Petter Holmstrm for their OSGi and Vaadin<br>" + " related work, blogs, and bundles.<br><br>" + "The icons are from the Silk icon set by Mark James<br>" + "<a href=\"http://www.famfamfam.com/lab/icons/silk/\">http://www.famfamfam.com/lab/icons/silk/</a>"); description.setSizeUndefined(); description.setContentMode(Label.CONTENT_XHTML); titleLayout.addComponent(description); aboutWindow.addComponent(titleLayout); @SuppressWarnings("serial") Button close = new Button("Close", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { (aboutWindow.getParent()).removeWindow(aboutWindow); } }); layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); } return aboutWindow; }
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); infoLayout.setMargin(false);/*from w ww . j av a 2 s .c om*/ 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.CaseInfoLayout.java
License:Open Source License
private void updateCaseInfo() { this.removeAllComponents(); PersonDto personDto = FacadeProvider.getPersonFacade().getPersonByUuid(caseDto.getPerson().getUuid()); VerticalLayout leftColumnLayout = new VerticalLayout(); leftColumnLayout.setMargin(false);//from w w w .j av a 2s. c o m leftColumnLayout.setSpacing(true); { addDescLabel(leftColumnLayout, DataHelper.getShortUuid(caseDto.getUuid()), I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.UUID)) .setDescription(caseDto.getUuid()); addDescLabel(leftColumnLayout, caseDto.getEpidNumber(), I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.EPID_NUMBER)) .setDescription(caseDto.getEpidNumber()); if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_VIEW)) { addDescLabel(leftColumnLayout, caseDto.getPerson(), I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.PERSON)); HorizontalLayout ageSexLayout = new HorizontalLayout(); ageSexLayout.setMargin(false); ageSexLayout.setSpacing(true); addDescLabel(ageSexLayout, ApproximateAgeHelper.formatApproximateAge(personDto.getApproximateAge(), personDto.getApproximateAgeType()), I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.APPROXIMATE_AGE)); addDescLabel(ageSexLayout, personDto.getSex(), I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.SEX)); leftColumnLayout.addComponent(ageSexLayout); } if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_MANAGEMENT_ACCESS)) { addDescLabel(leftColumnLayout, caseDto.getClinicianName(), I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.CLINICIAN_NAME)); } } this.addComponent(leftColumnLayout); VerticalLayout rightColumnLayout = new VerticalLayout(); rightColumnLayout.setMargin(false); rightColumnLayout.setSpacing(true); { addDescLabel(rightColumnLayout, caseDto.getDisease() != Disease.OTHER ? caseDto.getDisease().toShortString() : DataHelper.toStringNullable(caseDto.getDiseaseDetails()), I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.DISEASE)); if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_VIEW)) { addDescLabel(rightColumnLayout, caseDto.getCaseClassification(), I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.CASE_CLASSIFICATION)); addDescLabel(rightColumnLayout, DateHelper.formatLocalShortDate(caseDto.getSymptoms().getOnsetDate()), I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX, SymptomsDto.ONSET_DATE)); } } this.addComponent(rightColumnLayout); }
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 a v a2 s.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.caze.CasesView.java
License:Open Source License
public VerticalLayout createFilterBar() { VerticalLayout filterLayout = new VerticalLayout(); filterLayout.setSpacing(false); filterLayout.setMargin(false);/* w w w. j a va 2s.co m*/ filterLayout.setWidth(100, Unit.PERCENTAGE); firstFilterRowLayout = new HorizontalLayout(); firstFilterRowLayout.setMargin(false); firstFilterRowLayout.setSpacing(true); firstFilterRowLayout.setSizeUndefined(); { if (!UserRole.isPortHealthUser(UserProvider.getCurrent().getUserRoles())) { caseOriginFilter = new ComboBox(); caseOriginFilter.setId(CaseDataDto.CASE_ORIGIN); caseOriginFilter.setWidth(140, Unit.PIXELS); caseOriginFilter.setInputPrompt( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.CASE_ORIGIN)); caseOriginFilter.addItems((Object[]) CaseOrigin.values()); caseOriginFilter.addValueChangeListener(e -> { criteria.caseOrigin(((CaseOrigin) e.getProperty().getValue())); if (UserProvider.getCurrent().hasUserRight(UserRight.PORT_HEALTH_INFO_VIEW)) { pointOfEntryFilter.setEnabled(e.getProperty().getValue() != CaseOrigin.IN_COUNTRY); portHealthCasesWithoutFacilityFilter .setEnabled(e.getProperty().getValue() != CaseOrigin.IN_COUNTRY); } navigateTo(criteria); }); firstFilterRowLayout.addComponent(caseOriginFilter); } outcomeFilter = new ComboBox(); outcomeFilter.setId(CaseDataDto.OUTCOME); outcomeFilter.setWidth(140, Unit.PIXELS); outcomeFilter .setInputPrompt(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.OUTCOME)); outcomeFilter.addItems((Object[]) CaseOutcome.values()); outcomeFilter.addValueChangeListener(e -> { criteria.outcome(((CaseOutcome) e.getProperty().getValue())); navigateTo(criteria); }); firstFilterRowLayout.addComponent(outcomeFilter); diseaseFilter = new ComboBox(); diseaseFilter.setId(CaseDataDto.DISEASE); diseaseFilter.setWidth(140, Unit.PIXELS); diseaseFilter .setInputPrompt(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.DISEASE)); diseaseFilter.addItems( FacadeProvider.getDiseaseConfigurationFacade().getAllActivePrimaryDiseases().toArray()); diseaseFilter.addValueChangeListener(e -> { criteria.disease(((Disease) e.getProperty().getValue())); navigateTo(criteria); }); firstFilterRowLayout.addComponent(diseaseFilter); classificationFilter = new ComboBox(); classificationFilter.setId(CaseDataDto.CASE_CLASSIFICATION); classificationFilter.setWidth(140, Unit.PIXELS); classificationFilter.setInputPrompt( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.CASE_CLASSIFICATION)); classificationFilter.addItems((Object[]) CaseClassification.values()); classificationFilter.addValueChangeListener(e -> { criteria.caseClassification(((CaseClassification) e.getProperty().getValue())); navigateTo(criteria); }); firstFilterRowLayout.addComponent(classificationFilter); searchField = new TextField(); searchField.setId("search"); searchField.setWidth(200, Unit.PIXELS); searchField.setNullRepresentation(""); searchField.setInputPrompt(I18nProperties.getString(Strings.promptCasesSearchField)); searchField.addTextChangeListener(e -> { criteria.nameUuidEpidNumberLike(e.getText()); grid.reload(); }); firstFilterRowLayout.addComponent(searchField); addShowMoreOrLessFiltersButtons(firstFilterRowLayout); resetButton = new Button(I18nProperties.getCaption(Captions.actionResetFilters)); resetButton.setId("reset"); resetButton.setVisible(false); resetButton.addClickListener(event -> { ViewModelProviders.of(CasesView.class).remove(CaseCriteria.class); navigateTo(null); }); firstFilterRowLayout.addComponent(resetButton); } filterLayout.addComponent(firstFilterRowLayout); secondFilterRowLayout = new HorizontalLayout(); secondFilterRowLayout.setMargin(false); secondFilterRowLayout.setSpacing(true); secondFilterRowLayout.setSizeUndefined(); { presentConditionFilter = new ComboBox(); presentConditionFilter.setWidth(140, Unit.PIXELS); presentConditionFilter.setInputPrompt( I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.PRESENT_CONDITION)); presentConditionFilter.addItems((Object[]) PresentCondition.values()); presentConditionFilter.addValueChangeListener(e -> { criteria.presentCondition(((PresentCondition) e.getProperty().getValue())); navigateTo(criteria); }); secondFilterRowLayout.addComponent(presentConditionFilter); UserDto user = UserProvider.getCurrent().getUser(); regionFilter = new ComboBox(); if (user.getRegion() == null) { regionFilter.setWidth(140, Unit.PIXELS); regionFilter.setInputPrompt( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.REGION)); regionFilter.addItems(FacadeProvider.getRegionFacade().getAllAsReference()); regionFilter.addValueChangeListener(e -> { RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue(); criteria.region(region); navigateTo(criteria); }); secondFilterRowLayout.addComponent(regionFilter); } districtFilter = new ComboBox(); districtFilter.setWidth(140, Unit.PIXELS); districtFilter .setInputPrompt(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.DISTRICT)); districtFilter.setDescription(I18nProperties.getDescription(Descriptions.descDistrictFilter)); districtFilter.addValueChangeListener(e -> { DistrictReferenceDto district = (DistrictReferenceDto) e.getProperty().getValue(); criteria.district(district); navigateTo(criteria); }); if (user.getRegion() != null && user.getDistrict() == null) { districtFilter .addItems(FacadeProvider.getDistrictFacade().getAllByRegion(user.getRegion().getUuid())); districtFilter.setEnabled(true); } else { regionFilter.addValueChangeListener(e -> { RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue(); districtFilter.removeAllItems(); if (region != null) { districtFilter .addItems(FacadeProvider.getDistrictFacade().getAllByRegion(region.getUuid())); districtFilter.setEnabled(true); } else { districtFilter.setEnabled(false); } }); districtFilter.setEnabled(false); } secondFilterRowLayout.addComponent(districtFilter); if (!UserRole.isPortHealthUser(UserProvider.getCurrent().getUserRoles())) { facilityFilter = new ComboBox(); facilityFilter.setWidth(140, Unit.PIXELS); facilityFilter.setInputPrompt( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.HEALTH_FACILITY)); facilityFilter.setDescription(I18nProperties.getDescription(Descriptions.descFacilityFilter)); facilityFilter.addValueChangeListener(e -> { criteria.healthFacility(((FacilityReferenceDto) e.getProperty().getValue())); navigateTo(criteria); }); facilityFilter.setEnabled(false); secondFilterRowLayout.addComponent(facilityFilter); } if (UserProvider.getCurrent().hasUserRight(UserRight.PORT_HEALTH_INFO_VIEW)) { pointOfEntryFilter = new ComboBox(); pointOfEntryFilter.setWidth(140, Unit.PIXELS); pointOfEntryFilter.setInputPrompt( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.POINT_OF_ENTRY)); pointOfEntryFilter .setDescription(I18nProperties.getDescription(Descriptions.descPointOfEntryFilter)); pointOfEntryFilter.addValueChangeListener(e -> { criteria.pointOfEntry(((PointOfEntryReferenceDto) e.getProperty().getValue())); navigateTo(criteria); }); secondFilterRowLayout.addComponent(pointOfEntryFilter); } districtFilter.addValueChangeListener(e -> { if (facilityFilter != null) { facilityFilter.removeAllItems(); DistrictReferenceDto district = (DistrictReferenceDto) e.getProperty().getValue(); if (district != null) { facilityFilter.addItems( FacadeProvider.getFacilityFacade().getHealthFacilitiesByDistrict(district, true)); facilityFilter.setEnabled(true); } else { facilityFilter.setEnabled(false); } } if (pointOfEntryFilter != null) { pointOfEntryFilter.removeAllItems(); DistrictReferenceDto district = (DistrictReferenceDto) e.getProperty().getValue(); if (district != null) { pointOfEntryFilter.addItems( FacadeProvider.getPointOfEntryFacade().getAllByDistrict(district.getUuid(), true)); pointOfEntryFilter.setEnabled( caseOriginFilter == null || caseOriginFilter.getValue() != CaseOrigin.IN_COUNTRY); } else { pointOfEntryFilter.setEnabled(false); } } }); officerFilter = new ComboBox(); officerFilter.setWidth(140, Unit.PIXELS); officerFilter.setInputPrompt( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.SURVEILLANCE_OFFICER)); if (user.getRegion() != null) { officerFilter.addItems(FacadeProvider.getUserFacade().getUsersByRegionAndRoles(user.getRegion(), UserRole.SURVEILLANCE_OFFICER)); } officerFilter.addValueChangeListener(e -> { criteria.surveillanceOfficer(((UserReferenceDto) e.getProperty().getValue())); navigateTo(criteria); }); secondFilterRowLayout.addComponent(officerFilter); reportedByFilter = new ComboBox(); reportedByFilter.setWidth(140, Unit.PIXELS); reportedByFilter.setInputPrompt(I18nProperties.getString(Strings.reportedBy)); reportedByFilter.addItems((Object[]) UserRole.values()); reportedByFilter.addValueChangeListener(e -> { criteria.reportingUserRole((UserRole) e.getProperty().getValue()); navigateTo(criteria); }); secondFilterRowLayout.addComponent(reportedByFilter); reportingUserFilter = new TextField(); reportingUserFilter.setWidth(200, Unit.PIXELS); reportingUserFilter.setInputPrompt( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.REPORTING_USER)); reportingUserFilter.setNullRepresentation(""); reportingUserFilter.addTextChangeListener(e -> { criteria.reportingUserLike(e.getText()); grid.reload(); }); secondFilterRowLayout.addComponent(reportingUserFilter); } filterLayout.addComponent(secondFilterRowLayout); secondFilterRowLayout.setVisible(false); thirdFilterRowLayout = new HorizontalLayout(); thirdFilterRowLayout.setMargin(false); thirdFilterRowLayout.setSpacing(true); thirdFilterRowLayout.setSizeUndefined(); CssStyles.style(thirdFilterRowLayout, CssStyles.VSPACE_3); { casesWithoutGeoCoordsFilter = new CheckBox(); CssStyles.style(casesWithoutGeoCoordsFilter, CssStyles.CHECKBOX_FILTER_INLINE); casesWithoutGeoCoordsFilter.setCaption(I18nProperties.getCaption(Captions.caseFilterWithoutGeo)); casesWithoutGeoCoordsFilter .setDescription(I18nProperties.getDescription(Descriptions.descCaseFilterWithoutGeo)); casesWithoutGeoCoordsFilter.addValueChangeListener(e -> { criteria.mustHaveNoGeoCoordinates((Boolean) e.getProperty().getValue()); navigateTo(criteria); }); thirdFilterRowLayout.addComponent(casesWithoutGeoCoordsFilter); if (UserProvider.getCurrent().hasUserRight(UserRight.PORT_HEALTH_INFO_VIEW)) { portHealthCasesWithoutFacilityFilter = new CheckBox(); CssStyles.style(portHealthCasesWithoutFacilityFilter, CssStyles.CHECKBOX_FILTER_INLINE); portHealthCasesWithoutFacilityFilter .setCaption(I18nProperties.getCaption(Captions.caseFilterPortHealthWithoutFacility)); portHealthCasesWithoutFacilityFilter.setDescription( I18nProperties.getDescription(Descriptions.descCaseFilterPortHealthWithoutFacility)); portHealthCasesWithoutFacilityFilter.addValueChangeListener(e -> { criteria.mustBePortHealthCaseWithoutFacility((Boolean) e.getProperty().getValue()); navigateTo(criteria); }); thirdFilterRowLayout.addComponent(portHealthCasesWithoutFacilityFilter); } } filterLayout.addComponent(thirdFilterRowLayout); thirdFilterRowLayout.setVisible(false); dateFilterRowLayout = new HorizontalLayout(); dateFilterRowLayout.setSpacing(true); dateFilterRowLayout.setSizeUndefined(); { Button applyButton = new Button(I18nProperties.getCaption(Captions.actionApplyDateFilter)); weekAndDateFilter = new EpiWeekAndDateFilterComponent<>(applyButton, false, false, I18nProperties.getString(Strings.infoCaseDate), NewCaseDateType.class, I18nProperties.getString(Strings.promptNewCaseDateType), NewCaseDateType.MOST_RELEVANT); weekAndDateFilter.getWeekFromFilter() .setInputPrompt(I18nProperties.getString(Strings.promptCasesEpiWeekFrom)); weekAndDateFilter.getWeekToFilter() .setInputPrompt(I18nProperties.getString(Strings.promptCasesEpiWeekTo)); weekAndDateFilter.getDateFromFilter() .setInputPrompt(I18nProperties.getString(Strings.promptCasesDateFrom)); weekAndDateFilter.getDateToFilter().setInputPrompt(I18nProperties.getString(Strings.promptDateTo)); dateFilterRowLayout.addComponent(weekAndDateFilter); dateFilterRowLayout.addComponent(applyButton); applyButton.addClickListener(e -> { DateFilterOption dateFilterOption = (DateFilterOption) weekAndDateFilter.getDateFilterOptionFilter() .getValue(); Date fromDate, toDate; if (dateFilterOption == DateFilterOption.DATE) { fromDate = DateHelper.getStartOfDay(weekAndDateFilter.getDateFromFilter().getValue()); toDate = DateHelper.getEndOfDay(weekAndDateFilter.getDateToFilter().getValue()); } else { fromDate = DateHelper .getEpiWeekStart((EpiWeek) weekAndDateFilter.getWeekFromFilter().getValue()); toDate = DateHelper.getEpiWeekEnd((EpiWeek) weekAndDateFilter.getWeekToFilter().getValue()); } if ((fromDate != null && toDate != null) || (fromDate == null && toDate == null)) { applyButton.removeStyleName(ValoTheme.BUTTON_PRIMARY); NewCaseDateType newCaseDateType = (NewCaseDateType) weekAndDateFilter.getDateTypeSelector() .getValue(); criteria.newCaseDateBetween(fromDate, toDate, newCaseDateType != null ? newCaseDateType : NewCaseDateType.MOST_RELEVANT); navigateTo(criteria); } else { if (dateFilterOption == DateFilterOption.DATE) { Notification notification = new Notification( I18nProperties.getString(Strings.headingMissingDateFilter), I18nProperties.getString(Strings.messageMissingDateFilter), Type.WARNING_MESSAGE, false); notification.setDelayMsec(-1); notification.show(Page.getCurrent()); } else { Notification notification = new Notification( I18nProperties.getString(Strings.headingMissingEpiWeekFilter), I18nProperties.getString(Strings.messageMissingEpiWeekFilter), Type.WARNING_MESSAGE, false); notification.setDelayMsec(-1); notification.show(Page.getCurrent()); } } }); } filterLayout.addComponent(dateFilterRowLayout); dateFilterRowLayout.setVisible(false); return filterLayout; }