List of usage examples for com.vaadin.v7.ui ComboBox setNullSelectionAllowed
public void setNullSelectionAllowed(boolean nullSelectionAllowed)
From source file:de.symeda.sormas.ui.caze.CaseCreateForm.java
License:Open Source License
@Override protected void addFields() { addField(CaseDataDto.REPORT_DATE, DateField.class); addDiseaseField(CaseDataDto.DISEASE, false); addField(CaseDataDto.DISEASE_DETAILS, TextField.class); OptionGroup plagueType = addField(CaseDataDto.PLAGUE_TYPE, OptionGroup.class); addField(CaseDataDto.DENGUE_FEVER_TYPE, OptionGroup.class); addCustomField(FIRST_NAME, String.class, TextField.class); addCustomField(LAST_NAME, String.class, TextField.class); ComboBox region = addField(CaseDataDto.REGION, ComboBox.class); ComboBox district = addField(CaseDataDto.DISTRICT, ComboBox.class); ComboBox community = addField(CaseDataDto.COMMUNITY, ComboBox.class); community.setNullSelectionAllowed(true); ComboBox facility = addField(CaseDataDto.HEALTH_FACILITY, ComboBox.class); facility.setImmediate(true);//from w w w .j a va 2 s. c om TextField facilityDetails = addField(CaseDataDto.HEALTH_FACILITY_DETAILS, TextField.class); facilityDetails.setVisible(false); ComboBox cbPointOfEntry = addField(CaseDataDto.POINT_OF_ENTRY, ComboBox.class); cbPointOfEntry.setImmediate(true); TextField tfPointOfEntryDetails = addField(CaseDataDto.POINT_OF_ENTRY_DETAILS, TextField.class); tfPointOfEntryDetails.setVisible(false); region.addValueChangeListener(e -> { RegionReferenceDto regionDto = (RegionReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(district, regionDto != null ? FacadeProvider.getDistrictFacade().getAllByRegion(regionDto.getUuid()) : null); }); district.addValueChangeListener(e -> { if (community.getValue() == null) { FieldHelper.removeItems(facility); } FieldHelper.removeItems(community); DistrictReferenceDto districtDto = (DistrictReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(community, districtDto != null ? FacadeProvider.getCommunityFacade().getAllByDistrict(districtDto.getUuid()) : null); FieldHelper.updateItems(facility, districtDto != null ? FacadeProvider.getFacilityFacade().getHealthFacilitiesByDistrict(districtDto, true) : null); FieldHelper.updateItems(cbPointOfEntry, districtDto != null ? FacadeProvider.getPointOfEntryFacade().getAllByDistrict(districtDto.getUuid(), true) : null); }); community.addValueChangeListener(e -> { FieldHelper.removeItems(facility); CommunityReferenceDto communityDto = (CommunityReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(facility, communityDto != null ? FacadeProvider.getFacilityFacade().getHealthFacilitiesByCommunity(communityDto, true) : district.getValue() != null ? FacadeProvider.getFacilityFacade() .getHealthFacilitiesByDistrict((DistrictReferenceDto) district.getValue(), true) : null); }); region.addItems(FacadeProvider.getRegionFacade().getAllAsReference()); OptionGroup ogCaseOrigin = addField(CaseDataDto.CASE_ORIGIN, OptionGroup.class); ogCaseOrigin.setRequired(true); if (UserRole.isPortHealthUser(UserProvider.getCurrent().getUserRoles())) { setVisible(false, CaseDataDto.CASE_ORIGIN, CaseDataDto.DISEASE, CaseDataDto.COMMUNITY, CaseDataDto.HEALTH_FACILITY); setVisible(true, CaseDataDto.POINT_OF_ENTRY); } else { ogCaseOrigin.addValueChangeListener(e -> { if (e.getProperty().getValue() == CaseOrigin.IN_COUNTRY) { setVisible(false, CaseDataDto.POINT_OF_ENTRY, CaseDataDto.POINT_OF_ENTRY_DETAILS); setRequired(true, CaseDataDto.HEALTH_FACILITY); setRequired(false, CaseDataDto.POINT_OF_ENTRY); updateFacilityFields(facility, facilityDetails); } else { setVisible(true, CaseDataDto.POINT_OF_ENTRY); setRequired(true, CaseDataDto.POINT_OF_ENTRY); setRequired(false, CaseDataDto.HEALTH_FACILITY); updatePointOfEntryFields(cbPointOfEntry, tfPointOfEntryDetails); } }); } setRequired(true, CaseDataDto.REPORT_DATE, FIRST_NAME, LAST_NAME, CaseDataDto.DISEASE, CaseDataDto.REGION, CaseDataDto.DISTRICT); FieldHelper.addSoftRequiredStyle(plagueType, community, facilityDetails); FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(CaseDataDto.DISEASE_DETAILS), CaseDataDto.DISEASE, Arrays.asList(Disease.OTHER), true); FieldHelper.setRequiredWhen(getFieldGroup(), CaseDataDto.DISEASE, Arrays.asList(CaseDataDto.DISEASE_DETAILS), Arrays.asList(Disease.OTHER)); FieldHelper.setRequiredWhen(getFieldGroup(), CaseDataDto.CASE_ORIGIN, Arrays.asList(CaseDataDto.HEALTH_FACILITY), Arrays.asList(CaseOrigin.IN_COUNTRY)); FieldHelper.setRequiredWhen(getFieldGroup(), CaseDataDto.CASE_ORIGIN, Arrays.asList(CaseDataDto.POINT_OF_ENTRY), Arrays.asList(CaseOrigin.POINT_OF_ENTRY)); FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(CaseDataDto.PLAGUE_TYPE), CaseDataDto.DISEASE, Arrays.asList(Disease.PLAGUE), true); FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(CaseDataDto.DENGUE_FEVER_TYPE), CaseDataDto.DISEASE, Arrays.asList(Disease.DENGUE), true); facility.addValueChangeListener(e -> { updateFacilityFields(facility, facilityDetails); }); cbPointOfEntry.addValueChangeListener(e -> { updatePointOfEntryFields(cbPointOfEntry, tfPointOfEntryDetails); }); }
From source file:de.symeda.sormas.ui.caze.CaseDataForm.java
License:Open Source License
@Override protected void addFields() { if (person == null || disease == null) { return;/* ww w .ja v a 2 s . c o m*/ } // Add fields addFields(CaseDataDto.UUID, CaseDataDto.REPORT_DATE, CaseDataDto.REPORTING_USER, CaseDataDto.DISTRICT_LEVEL_DATE, CaseDataDto.REGION_LEVEL_DATE, CaseDataDto.NATIONAL_LEVEL_DATE, CaseDataDto.CLASSIFICATION_DATE, CaseDataDto.CLASSIFICATION_USER, CaseDataDto.CLASSIFICATION_COMMENT, CaseDataDto.NOTIFYING_CLINIC, CaseDataDto.NOTIFYING_CLINIC_DETAILS, CaseDataDto.CLINICIAN_NAME, CaseDataDto.CLINICIAN_PHONE, CaseDataDto.CLINICIAN_EMAIL); // Button to automatically assign a new epid number Button assignNewEpidNumberButton = new Button( I18nProperties.getCaption(Captions.actionAssignNewEpidNumber)); CssStyles.style(assignNewEpidNumberButton, ValoTheme.BUTTON_PRIMARY, CssStyles.FORCE_CAPTION); getContent().addComponent(assignNewEpidNumberButton, ASSIGN_NEW_EPID_NUMBER_LOC); assignNewEpidNumberButton.setVisible(false); TextField epidField = addField(CaseDataDto.EPID_NUMBER, TextField.class); epidField.setInvalidCommitted(true); CssStyles.style(epidField, CssStyles.ERROR_COLOR_PRIMARY); assignNewEpidNumberButton.addClickListener(e -> { epidField.setValue(FacadeProvider.getCaseFacade().generateEpidNumber(getValue().toReference())); }); addField(CaseDataDto.CASE_CLASSIFICATION, OptionGroup.class); addField(CaseDataDto.INVESTIGATION_STATUS, OptionGroup.class); addField(CaseDataDto.OUTCOME, OptionGroup.class); addField(CaseDataDto.SEQUELAE, OptionGroup.class); addFields(CaseDataDto.INVESTIGATED_DATE, CaseDataDto.OUTCOME_DATE, CaseDataDto.SEQUELAE_DETAILS); ComboBox diseaseField = addDiseaseField(CaseDataDto.DISEASE, false); addField(CaseDataDto.DISEASE_DETAILS, TextField.class); addField(CaseDataDto.PLAGUE_TYPE, OptionGroup.class); addField(CaseDataDto.DENGUE_FEVER_TYPE, OptionGroup.class); addField(CaseDataDto.CASE_ORIGIN, TextField.class); TextField healthFacilityDetails = addField(CaseDataDto.HEALTH_FACILITY_DETAILS, TextField.class); addField(CaseDataDto.REGION, ComboBox.class); addField(CaseDataDto.DISTRICT, ComboBox.class); addField(CaseDataDto.COMMUNITY, ComboBox.class); addField(CaseDataDto.HEALTH_FACILITY, ComboBox.class); ComboBox surveillanceOfficerField = addField(CaseDataDto.SURVEILLANCE_OFFICER, ComboBox.class); surveillanceOfficerField.setNullSelectionAllowed(true); addField(CaseDataDto.POINT_OF_ENTRY, ComboBox.class); addField(CaseDataDto.POINT_OF_ENTRY_DETAILS, TextField.class); addFields(CaseDataDto.PREGNANT, CaseDataDto.VACCINATION, CaseDataDto.VACCINATION_DOSES, CaseDataDto.VACCINATION_INFO_SOURCE, CaseDataDto.SMALLPOX_VACCINATION_SCAR, CaseDataDto.SMALLPOX_VACCINATION_RECEIVED, CaseDataDto.VACCINATION_DATE); // Set initial visibilities initializeVisibilitiesAndAllowedVisibilities(disease, viewMode); // Set requirements that don't need visibility changes and read only status setRequired(true, CaseDataDto.REPORT_DATE, CaseDataDto.CASE_CLASSIFICATION, CaseDataDto.INVESTIGATION_STATUS, CaseDataDto.OUTCOME, CaseDataDto.DISEASE); setSoftRequired(true, CaseDataDto.INVESTIGATED_DATE, CaseDataDto.OUTCOME_DATE, CaseDataDto.PLAGUE_TYPE, CaseDataDto.SURVEILLANCE_OFFICER); FieldHelper.setReadOnlyWhen(getFieldGroup(), CaseDataDto.INVESTIGATED_DATE, CaseDataDto.INVESTIGATION_STATUS, Arrays.asList(InvestigationStatus.PENDING), false); setReadOnly(true, CaseDataDto.UUID, CaseDataDto.REPORTING_USER, CaseDataDto.CLASSIFICATION_USER, CaseDataDto.CLASSIFICATION_DATE, CaseDataDto.REGION, CaseDataDto.DISTRICT, CaseDataDto.COMMUNITY, CaseDataDto.HEALTH_FACILITY, CaseDataDto.HEALTH_FACILITY_DETAILS, CaseDataDto.POINT_OF_ENTRY, CaseDataDto.POINT_OF_ENTRY_DETAILS, CaseDataDto.CASE_ORIGIN); setReadOnly(!UserProvider.getCurrent().hasUserRight(UserRight.CASE_CHANGE_DISEASE), CaseDataDto.DISEASE); setReadOnly(!UserProvider.getCurrent().hasUserRight(UserRight.CASE_INVESTIGATE), CaseDataDto.INVESTIGATION_STATUS, CaseDataDto.INVESTIGATED_DATE); setReadOnly(!UserProvider.getCurrent().hasUserRight(UserRight.CASE_CLASSIFY), CaseDataDto.CASE_CLASSIFICATION, CaseDataDto.OUTCOME, CaseDataDto.OUTCOME_DATE); // Set conditional visibilities - ALWAYS call isVisibleAllowed before // dynamically setting the visibility if (isVisibleAllowed(CaseDataDto.PREGNANT)) { setVisible(person.getSex() == Sex.FEMALE, CaseDataDto.PREGNANT); } if (isVisibleAllowed(CaseDataDto.VACCINATION_DOSES)) { FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.VACCINATION_DOSES, CaseDataDto.VACCINATION, Arrays.asList(Vaccination.VACCINATED), true); } if (isVisibleAllowed(CaseDataDto.VACCINATION_INFO_SOURCE)) { FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.VACCINATION_INFO_SOURCE, CaseDataDto.VACCINATION, Arrays.asList(Vaccination.VACCINATED), true); } if (isVisibleAllowed(CaseDataDto.DISEASE_DETAILS)) { FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(CaseDataDto.DISEASE_DETAILS), CaseDataDto.DISEASE, Arrays.asList(Disease.OTHER), true); FieldHelper.setRequiredWhen(getFieldGroup(), CaseDataDto.DISEASE, Arrays.asList(CaseDataDto.DISEASE_DETAILS), Arrays.asList(Disease.OTHER)); } if (isVisibleAllowed(CaseDataDto.PLAGUE_TYPE)) { FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(CaseDataDto.PLAGUE_TYPE), CaseDataDto.DISEASE, Arrays.asList(Disease.PLAGUE), true); } if (isVisibleAllowed(CaseDataDto.SMALLPOX_VACCINATION_SCAR)) { FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.SMALLPOX_VACCINATION_SCAR, CaseDataDto.SMALLPOX_VACCINATION_RECEIVED, Arrays.asList(YesNoUnknown.YES), true); } if (isVisibleAllowed(CaseDataDto.VACCINATION_DATE)) { FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.VACCINATION_DATE, CaseDataDto.SMALLPOX_VACCINATION_RECEIVED, Arrays.asList(YesNoUnknown.YES), true); FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.VACCINATION_DATE, CaseDataDto.VACCINATION, Arrays.asList(Vaccination.VACCINATED), true); } if (isVisibleAllowed(CaseDataDto.OUTCOME_DATE)) { FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.OUTCOME_DATE, CaseDataDto.OUTCOME, Arrays.asList(CaseOutcome.DECEASED, CaseOutcome.RECOVERED, CaseOutcome.UNKNOWN), true); } if (isVisibleAllowed(CaseDataDto.SEQUELAE)) { FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.SEQUELAE, CaseDataDto.OUTCOME, Arrays.asList(CaseOutcome.RECOVERED, CaseOutcome.UNKNOWN), true); } if (isVisibleAllowed(CaseDataDto.SEQUELAE_DETAILS)) { FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.SEQUELAE_DETAILS, CaseDataDto.SEQUELAE, Arrays.asList(YesNoUnknown.YES), true); } if (isVisibleAllowed(CaseDataDto.NOTIFYING_CLINIC_DETAILS)) { FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.NOTIFYING_CLINIC_DETAILS, CaseDataDto.NOTIFYING_CLINIC, Arrays.asList(HospitalWardType.OTHER), true); } setVisible(UserProvider.getCurrent().hasUserRight(UserRight.CASE_MANAGEMENT_ACCESS), CaseDataDto.CLINICIAN_NAME, CaseDataDto.CLINICIAN_PHONE, CaseDataDto.CLINICIAN_EMAIL); // Other initializations if (disease == Disease.MONKEYPOX) { Image smallpoxVaccinationScarImg = new Image(null, new ThemeResource("img/smallpox-vaccination-scar.jpg")); CssStyles.style(smallpoxVaccinationScarImg, CssStyles.VSPACE_3); getContent().addComponent(smallpoxVaccinationScarImg, SMALLPOX_VACCINATION_SCAR_IMG); // Set up initial image visibility getContent().getComponent(SMALLPOX_VACCINATION_SCAR_IMG).setVisible(getFieldGroup() .getField(CaseDataDto.SMALLPOX_VACCINATION_RECEIVED).getValue() == YesNoUnknown.YES); // Set up image visibility listener getFieldGroup().getField(CaseDataDto.SMALLPOX_VACCINATION_RECEIVED).addValueChangeListener(e -> { getContent().getComponent(SMALLPOX_VACCINATION_SCAR_IMG) .setVisible(e.getProperty().getValue() == YesNoUnknown.YES); }); } List<String> medicalInformationFields = Arrays.asList(CaseDataDto.PREGNANT, CaseDataDto.VACCINATION, CaseDataDto.SMALLPOX_VACCINATION_RECEIVED); for (String medicalInformationField : medicalInformationFields) { if (getFieldGroup().getField(medicalInformationField).isVisible()) { Label medicalInformationCaptionLabel = new Label( I18nProperties.getString(Strings.headingMedicalInformation)); medicalInformationCaptionLabel.addStyleName(CssStyles.H3); getContent().addComponent(medicalInformationCaptionLabel, MEDICAL_INFORMATION_LOC); break; } } Label paperFormDatesLabel = new Label(I18nProperties.getString(Strings.headingPaperFormDates)); paperFormDatesLabel.addStyleName(CssStyles.H3); getContent().addComponent(paperFormDatesLabel, PAPER_FORM_DATES_LOC); // Automatic case classification rules button - invisible for other diseases if (disease != Disease.OTHER) { Button classificationRulesButton = new Button(I18nProperties.getCaption(Captions.info), VaadinIcons.INFO_CIRCLE); CssStyles.style(classificationRulesButton, ValoTheme.BUTTON_PRIMARY, CssStyles.FORCE_CAPTION); classificationRulesButton.addClickListener(e -> { ControllerProvider.getCaseController().openClassificationRulesPopup(getValue()); }); getContent().addComponent(classificationRulesButton, CLASSIFICATION_RULES_LOC); } addValueChangeListener(e -> { diseaseField.addValueChangeListener(new DiseaseChangeListener(diseaseField, getValue().getDisease())); // Replace classification user if case has been automatically classified if (getValue().getClassificationDate() != null && getValue().getClassificationUser() == null) { getField(CaseDataDto.CLASSIFICATION_USER).setVisible(false); Label classifiedBySystemLabel = new Label(I18nProperties.getCaption(Captions.system)); classifiedBySystemLabel.setCaption( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.CLASSIFIED_BY)); getContent().addComponent(classifiedBySystemLabel, CLASSIFIED_BY_SYSTEM_LOC); } setEpidNumberError(epidField, assignNewEpidNumberButton, getValue().getEpidNumber()); epidField.addValueChangeListener(f -> { setEpidNumberError(epidField, assignNewEpidNumberButton, (String) f.getProperty().getValue()); }); // Set health facility details visibility and caption if (getValue().getHealthFacility() != null) { boolean otherHealthFacility = getValue().getHealthFacility().getUuid() .equals(FacilityDto.OTHER_FACILITY_UUID); boolean noneHealthFacility = getValue().getHealthFacility().getUuid() .equals(FacilityDto.NONE_FACILITY_UUID); boolean detailsVisible = otherHealthFacility || noneHealthFacility; if (isVisibleAllowed(healthFacilityDetails)) { healthFacilityDetails.setVisible(detailsVisible); } if (otherHealthFacility) { healthFacilityDetails.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.HEALTH_FACILITY_DETAILS)); } if (noneHealthFacility) { healthFacilityDetails.setCaption( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, NONE_HEALTH_FACILITY_DETAILS)); } } else { setVisible(false, CaseDataDto.CLINICIAN_NAME, CaseDataDto.CLINICIAN_PHONE, CaseDataDto.CLINICIAN_EMAIL); } // Set health facility/point of entry visibility based on case origin if (getValue().getCaseOrigin() == CaseOrigin.POINT_OF_ENTRY) { setVisible(true, CaseDataDto.POINT_OF_ENTRY); setVisible(getValue().getPointOfEntry().isOtherPointOfEntry(), CaseDataDto.POINT_OF_ENTRY_DETAILS); if (getValue().getHealthFacility() == null) { setVisible(false, CaseDataDto.COMMUNITY, CaseDataDto.HEALTH_FACILITY, CaseDataDto.HEALTH_FACILITY_DETAILS); } } else { setVisible(false, CaseDataDto.POINT_OF_ENTRY, CaseDataDto.POINT_OF_ENTRY_DETAILS); } // Hide case origin from port health users if (UserRole.isPortHealthUser(UserProvider.getCurrent().getUserRoles())) { setVisible(false, CaseDataDto.CASE_ORIGIN); } }); }
From source file:de.symeda.sormas.ui.caze.CaseFacilityChangeForm.java
License:Open Source License
@Override protected void addFields() { ComboBox region = addField(CaseDataDto.REGION, ComboBox.class); ComboBox district = addField(CaseDataDto.DISTRICT, ComboBox.class); ComboBox community = addField(CaseDataDto.COMMUNITY, ComboBox.class); community.setNullSelectionAllowed(true); ComboBox facility = addField(CaseDataDto.HEALTH_FACILITY, ComboBox.class); ComboBox officer = addField(CaseDataDto.SURVEILLANCE_OFFICER, ComboBox.class); TextField facilityDetails = addField(CaseDataDto.HEALTH_FACILITY_DETAILS, TextField.class); region.addValueChangeListener(e -> { RegionReferenceDto regionDto = (RegionReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(district, regionDto != null ? FacadeProvider.getDistrictFacade().getAllByRegion(regionDto.getUuid()) : null);//from w w w . j av a 2 s .com }); district.addValueChangeListener(e -> { if (community.getValue() == null) { FieldHelper.removeItems(facility); } FieldHelper.removeItems(community); DistrictReferenceDto districtDto = (DistrictReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(community, districtDto != null ? FacadeProvider.getCommunityFacade().getAllByDistrict(districtDto.getUuid()) : null); FieldHelper.updateItems(facility, districtDto != null ? FacadeProvider.getFacilityFacade().getHealthFacilitiesByDistrict(districtDto, true) : null); List<UserReferenceDto> assignableSurveillanceOfficers = FacadeProvider.getUserFacade() .getUserRefsByDistrict(districtDto, false, UserRole.SURVEILLANCE_OFFICER); FieldHelper.updateItems(officer, assignableSurveillanceOfficers); if (assignableSurveillanceOfficers.size() == 1) { officer.setValue(assignableSurveillanceOfficers.get(0)); } else { officer.setValue(null); } }); community.addValueChangeListener(e -> { FieldHelper.removeItems(facility); CommunityReferenceDto communityDto = (CommunityReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(facility, communityDto != null ? FacadeProvider.getFacilityFacade().getHealthFacilitiesByCommunity(communityDto, true) : district.getValue() != null ? FacadeProvider.getFacilityFacade() .getHealthFacilitiesByDistrict((DistrictReferenceDto) district.getValue(), true) : null); }); facility.addValueChangeListener(e -> { if (e.getProperty().getValue() != null) { boolean otherHealthFacility = ((FacilityReferenceDto) e.getProperty().getValue()).getUuid() .equals(FacilityDto.OTHER_FACILITY_UUID); boolean noneHealthFacility = ((FacilityReferenceDto) e.getProperty().getValue()).getUuid() .equals(FacilityDto.NONE_FACILITY_UUID); boolean visibleAndRequired = otherHealthFacility || noneHealthFacility; facilityDetails.setVisible(visibleAndRequired); facilityDetails.setRequired(visibleAndRequired); if (otherHealthFacility) { facilityDetails.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.HEALTH_FACILITY_DETAILS)); } if (noneHealthFacility) { facilityDetails.setCaption( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, NONE_HEALTH_FACILITY_DETAILS)); } if (!visibleAndRequired) { facilityDetails.clear(); } } else { facilityDetails.setVisible(false); facilityDetails.setRequired(false); facilityDetails.clear(); } }); region.addItems(FacadeProvider.getRegionFacade().getAllAsReference()); FieldHelper.addSoftRequiredStyle(community, facilityDetails, officer); setRequired(true, CaseDataDto.REGION, CaseDataDto.DISTRICT, CaseDataDto.HEALTH_FACILITY); officer.setNullSelectionAllowed(true); }
From source file:de.symeda.sormas.ui.contact.ContactCreateForm.java
License:Open Source License
@Override protected void addFields() { TextField firstName = addCustomField(FIRST_NAME, String.class, TextField.class); TextField lastName = addCustomField(LAST_NAME, String.class, TextField.class); ComboBox caze = addField(ContactDto.CAZE, ComboBox.class); caze.addItems(/*from w w w. ja v a 2s.c o m*/ FacadeProvider.getCaseFacade().getSelectableCases(UserProvider.getCurrent().getUserReference())); DateField lastContactDate = addField(ContactDto.LAST_CONTACT_DATE, DateField.class); OptionGroup contactProximity = addField(ContactDto.CONTACT_PROXIMITY, OptionGroup.class); contactProximity.removeStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL); addField(ContactDto.DESCRIPTION, TextArea.class).setRows(2); ComboBox relationToCase = addField(ContactDto.RELATION_TO_CASE, ComboBox.class); CssStyles.style(CssStyles.SOFT_REQUIRED, firstName, lastName, caze, lastContactDate, contactProximity, relationToCase); ComboBox contactOfficerField = addField(ContactDto.CONTACT_OFFICER, ComboBox.class); contactOfficerField.setNullSelectionAllowed(true); setRequired(true, ContactDto.CAZE, FIRST_NAME, LAST_NAME); addValueChangeListener(e -> { updateLastContactDateValidator(); // set assignable officers ContactDto contactDto = getValue(); if (contactDto != null) { CaseDataDto caseDto = FacadeProvider.getCaseFacade() .getCaseDataByUuid(contactDto.getCaze().getUuid()); contactOfficerField.addItems(FacadeProvider.getUserFacade() .getUserRefsByDistrict(caseDto.getDistrict(), false, UserRole.CONTACT_OFFICER)); } }); }
From source file:de.symeda.sormas.ui.contact.ContactDataForm.java
License:Open Source License
@Override protected void addFields() { addField(ContactDto.CONTACT_CLASSIFICATION, OptionGroup.class); addField(ContactDto.CONTACT_STATUS, OptionGroup.class); addField(ContactDto.UUID, TextField.class); addField(ContactDto.REPORTING_USER, ComboBox.class); DateField lastContactDate = addField(ContactDto.LAST_CONTACT_DATE, DateField.class); addField(ContactDto.REPORT_DATE_TIME, DateField.class); OptionGroup contactProximity = addField(ContactDto.CONTACT_PROXIMITY, OptionGroup.class); contactProximity.removeStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL); ComboBox relationToCase = addField(ContactDto.RELATION_TO_CASE, ComboBox.class); addField(ContactDto.DESCRIPTION, TextArea.class).setRows(3); addField(ContactDto.FOLLOW_UP_STATUS, ComboBox.class); addField(ContactDto.FOLLOW_UP_COMMENT, TextArea.class).setRows(1); addDateField(ContactDto.FOLLOW_UP_UNTIL, DateField.class, -1); ComboBox contactOfficerField = addField(ContactDto.CONTACT_OFFICER, ComboBox.class); contactOfficerField.setNullSelectionAllowed(true); setReadOnly(true, ContactDto.UUID, ContactDto.REPORTING_USER, ContactDto.REPORT_DATE_TIME, ContactDto.CONTACT_STATUS, ContactDto.FOLLOW_UP_STATUS, ContactDto.FOLLOW_UP_UNTIL); FieldHelper.setRequiredWhen(getFieldGroup(), ContactDto.FOLLOW_UP_STATUS, Arrays.asList(ContactDto.FOLLOW_UP_COMMENT), Arrays.asList(FollowUpStatus.CANCELED, FollowUpStatus.LOST)); addValueChangeListener(e -> {//from w w w. java 2 s . c o m if (getValue() != null) { CaseDataDto caseDto = FacadeProvider.getCaseFacade() .getCaseDataByUuid(getValue().getCaze().getUuid()); updateLastContactDateValidator(); updateDiseaseConfiguration(caseDto.getDisease()); updateFollowUpStatusComponents(); contactOfficerField.addItems(FacadeProvider.getUserFacade() .getUserRefsByDistrict(caseDto.getDistrict(), false, UserRole.CONTACT_OFFICER)); getContent().removeComponent(TO_CASE_BTN_LOC); if (getValue().getResultingCase() != null) { // link to case Link linkToData = ControllerProvider.getCaseController().createLinkToData( getValue().getResultingCase().getUuid(), I18nProperties.getCaption(Captions.contactOpenContactCase)); getContent().addComponent(linkToData, TO_CASE_BTN_LOC); } else if (getValue().getContactClassification() == ContactClassification.CONFIRMED) { // only when confirmed if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_CONVERT)) { Button toCaseButton = new Button( I18nProperties.getCaption(Captions.contactCreateContactCase)); toCaseButton.addStyleName(ValoTheme.BUTTON_LINK); toCaseButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { PersonReferenceDto personRef = getValue().getPerson(); CaseReferenceDto caseRef = getValue().getCaze(); CaseDataDto caze = FacadeProvider.getCaseFacade() .getCaseDataByUuid(caseRef.getUuid()); ControllerProvider.getCaseController().create(personRef, caze.getDisease(), getValue()); } }); getContent().addComponent(toCaseButton, TO_CASE_BTN_LOC); } } } }); setRequired(true, ContactDto.CONTACT_CLASSIFICATION, ContactDto.CONTACT_STATUS); FieldHelper.addSoftRequiredStyle(lastContactDate, contactProximity, relationToCase); }
From source file:de.symeda.sormas.ui.events.EventDataForm.java
License:Open Source License
@Override protected void addFields() { if (isCreateForm == null) { return;//from w w w . ja v a 2s . c o m } addField(EventDto.UUID, TextField.class); addDiseaseField(EventDto.DISEASE, false); addField(EventDto.DISEASE_DETAILS, TextField.class); DateField eventDate = addField(EventDto.EVENT_DATE, DateField.class); addField(EventDto.EVENT_STATUS, OptionGroup.class); addField(EventDto.EVENT_DESC, TextArea.class).setRows(2); addField(EventDto.EVENT_LOCATION, LocationEditForm.class).setCaption(null); LocationEditForm locationForm = (LocationEditForm) getFieldGroup().getField(EventDto.EVENT_LOCATION); if (isCreateForm) { locationForm.hideValidationUntilNextCommit(); } ComboBox districtField = (ComboBox) locationForm.getFieldGroup().getField(LocationDto.DISTRICT); ComboBox surveillanceOfficerField = addField(EventDto.SURVEILLANCE_OFFICER, ComboBox.class); surveillanceOfficerField.setNullSelectionAllowed(true); ComboBox typeOfPlace = addField(EventDto.TYPE_OF_PLACE, ComboBox.class); typeOfPlace.setNullSelectionAllowed(true); addField(EventDto.TYPE_OF_PLACE_TEXT, TextField.class); addField(EventDto.REPORT_DATE_TIME, DateTimeField.class); addField(EventDto.REPORTING_USER, ComboBox.class); TextField srcFirstName = addField(EventDto.SRC_FIRST_NAME, TextField.class); TextField srcLastName = addField(EventDto.SRC_LAST_NAME, TextField.class); TextField srcTelNo = addField(EventDto.SRC_TEL_NO, TextField.class); addField(EventDto.SRC_EMAIL, TextField.class); setReadOnly(true, EventDto.UUID, EventDto.REPORT_DATE_TIME, EventDto.REPORTING_USER); FieldHelper.setVisibleWhen(getFieldGroup(), EventDto.TYPE_OF_PLACE_TEXT, EventDto.TYPE_OF_PLACE, Arrays.asList(TypeOfPlace.OTHER), true); FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(EventDto.DISEASE_DETAILS), EventDto.DISEASE, Arrays.asList(Disease.OTHER), true); FieldHelper.setRequiredWhen(getFieldGroup(), EventDto.DISEASE, Arrays.asList(EventDto.DISEASE_DETAILS), Arrays.asList(Disease.OTHER)); setRequired(true, EventDto.EVENT_STATUS, EventDto.UUID, EventDto.EVENT_DESC, EventDto.REPORT_DATE_TIME, EventDto.REPORTING_USER); setTypeOfPlaceTextRequirement(); locationForm.setFieldsRequirement(true, LocationDto.REGION, LocationDto.DISTRICT); districtField.addValueChangeListener(e -> { List<UserReferenceDto> assignableSurveillanceOfficers = FacadeProvider.getUserFacade() .getUserRefsByDistrict((DistrictReferenceDto) districtField.getValue(), false, UserRole.SURVEILLANCE_OFFICER); FieldHelper.updateItems(surveillanceOfficerField, assignableSurveillanceOfficers); }); FieldHelper.addSoftRequiredStyle(eventDate, typeOfPlace, surveillanceOfficerField, srcFirstName, srcLastName, srcTelNo); }
From source file:de.symeda.sormas.ui.hospitalization.PreviousHospitalizationEditForm.java
License:Open Source License
@Override protected void addFields() { DateField admissionDate = addField(PreviousHospitalizationDto.ADMISSION_DATE, DateField.class); DateField dischargeDate = addField(PreviousHospitalizationDto.DISCHARGE_DATE, DateField.class); addField(PreviousHospitalizationDto.ISOLATED, OptionGroup.class); addField(PreviousHospitalizationDto.DESCRIPTION, TextArea.class).setRows(2); ComboBox facilityRegion = addField(PreviousHospitalizationDto.REGION, ComboBox.class); ComboBox facilityDistrict = addField(PreviousHospitalizationDto.DISTRICT, ComboBox.class); ComboBox facilityCommunity = addField(PreviousHospitalizationDto.COMMUNITY, ComboBox.class); facilityCommunity.setNullSelectionAllowed(true); ComboBox healthFacility = addField(PreviousHospitalizationDto.HEALTH_FACILITY, ComboBox.class); TextField healthFacilityDetails = addField(CaseDataDto.HEALTH_FACILITY_DETAILS, TextField.class); healthFacilityDetails.setVisible(false); healthFacility.setImmediate(true);/*from w w w .ja va 2 s .com*/ facilityRegion.addValueChangeListener(e -> { RegionReferenceDto regionDto = (RegionReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(facilityDistrict, regionDto != null ? FacadeProvider.getDistrictFacade().getAllByRegion(regionDto.getUuid()) : null); }); facilityDistrict.addValueChangeListener(e -> { if (facilityCommunity.getValue() == null) { FieldHelper.removeItems(healthFacility); } FieldHelper.removeItems(facilityCommunity); DistrictReferenceDto districtDto = (DistrictReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(facilityCommunity, districtDto != null ? FacadeProvider.getCommunityFacade().getAllByDistrict(districtDto.getUuid()) : null); FieldHelper.updateItems(healthFacility, districtDto != null ? FacadeProvider.getFacilityFacade().getHealthFacilitiesByDistrict(districtDto, true) : null); }); facilityCommunity.addValueChangeListener(e -> { FieldHelper.removeItems(healthFacility); CommunityReferenceDto communityDto = (CommunityReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(healthFacility, communityDto != null ? FacadeProvider.getFacilityFacade().getHealthFacilitiesByCommunity(communityDto, true) : facilityDistrict.getValue() != null ? FacadeProvider.getFacilityFacade() .getHealthFacilitiesByDistrict((DistrictReferenceDto) facilityDistrict.getValue(), true) : null); }); facilityRegion.addItems(FacadeProvider.getRegionFacade().getAllAsReference()); healthFacility.addValueChangeListener(e -> { if (e.getProperty().getValue() != null) { boolean otherHealthFacility = ((FacilityReferenceDto) e.getProperty().getValue()).getUuid() .equals(FacilityDto.OTHER_FACILITY_UUID); boolean noneHealthFacility = ((FacilityReferenceDto) e.getProperty().getValue()).getUuid() .equals(FacilityDto.NONE_FACILITY_UUID); boolean visibleAndRequired = otherHealthFacility || noneHealthFacility; healthFacilityDetails.setVisible(visibleAndRequired); healthFacilityDetails.setRequired(visibleAndRequired); if (otherHealthFacility) { healthFacilityDetails.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.HEALTH_FACILITY_DETAILS)); } if (noneHealthFacility) { healthFacilityDetails.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.NONE_HEALTH_FACILITY_DETAILS)); } if (!visibleAndRequired) { healthFacilityDetails.clear(); } } else { healthFacilityDetails.setVisible(false); healthFacilityDetails.setRequired(false); healthFacilityDetails.clear(); } }); // Validations admissionDate.addValidator(new DateComparisonValidator(admissionDate, dischargeDate, true, false, I18nProperties.getValidationError(Validations.beforeDate, admissionDate.getCaption(), dischargeDate.getCaption()))); dischargeDate.addValidator(new DateComparisonValidator(dischargeDate, admissionDate, false, false, I18nProperties.getValidationError(Validations.afterDate, dischargeDate.getCaption(), admissionDate.getCaption()))); FieldHelper.addSoftRequiredStyle(admissionDate, dischargeDate, facilityCommunity, healthFacilityDetails); setRequired(true, PreviousHospitalizationDto.REGION, PreviousHospitalizationDto.DISTRICT, PreviousHospitalizationDto.HEALTH_FACILITY); }
From source file:de.symeda.sormas.ui.person.PersonEditForm.java
License:Open Source License
@Override protected void addFields() { if (!initialized) { // vars have to be set first return;/*from w w w. j a v a 2 s .c o m*/ } addField(PersonDto.FIRST_NAME, TextField.class); addField(PersonDto.LAST_NAME, TextField.class); ComboBox sex = addField(PersonDto.SEX, ComboBox.class); addField(PersonDto.NICKNAME, TextField.class); addField(PersonDto.MOTHERS_MAIDEN_NAME, TextField.class); addFields(PersonDto.MOTHERS_NAME, PersonDto.FATHERS_NAME); ComboBox presentCondition = addField(PersonDto.PRESENT_CONDITION, ComboBox.class); birthDateDay = addField(PersonDto.BIRTH_DATE_DD, ComboBox.class); // @TODO: Done for nullselection Bug, fixed in Vaadin 7.7.3 birthDateDay.setNullSelectionAllowed(true); ComboBox birthDateMonth = addField(PersonDto.BIRTH_DATE_MM, ComboBox.class); // @TODO: Done for nullselection Bug, fixed in Vaadin 7.7.3 birthDateMonth.setNullSelectionAllowed(true); birthDateMonth.addItems(DateHelper.getMonthsInYear()); birthDateMonth.setPageLength(12); setItemCaptionsForMonths(birthDateMonth); ComboBox birthDateYear = addField(PersonDto.BIRTH_DATE_YYYY, ComboBox.class); birthDateYear.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.BIRTH_DATE)); // @TODO: Done for nullselection Bug, fixed in Vaadin 7.7.3 birthDateYear.setNullSelectionAllowed(true); birthDateYear.addItems(DateHelper.getYearsToNow()); birthDateYear.setItemCaptionMode(ItemCaptionMode.ID_TOSTRING); DateField deathDate = addField(PersonDto.DEATH_DATE, DateField.class); TextField approximateAgeField = addField(PersonDto.APPROXIMATE_AGE, TextField.class); ComboBox approximateAgeTypeField = addField(PersonDto.APPROXIMATE_AGE_TYPE, ComboBox.class); addField(PersonDto.APPROXIMATE_AGE_REFERENCE_DATE, DateField.class); TextField tfGestationAgeAtBirth = addField(PersonDto.GESTATION_AGE_AT_BIRTH, TextField.class); tfGestationAgeAtBirth.setConversionError(I18nProperties.getValidationError(Validations.onlyNumbersAllowed, tfGestationAgeAtBirth.getCaption())); TextField tfBirthWeight = addField(PersonDto.BIRTH_WEIGHT, TextField.class); tfBirthWeight.setConversionError( I18nProperties.getValidationError(Validations.onlyNumbersAllowed, tfBirthWeight.getCaption())); AbstractSelect deathPlaceType = addField(PersonDto.DEATH_PLACE_TYPE, ComboBox.class); deathPlaceType.setNullSelectionAllowed(true); TextField deathPlaceDesc = addField(PersonDto.DEATH_PLACE_DESCRIPTION, TextField.class); DateField burialDate = addField(PersonDto.BURIAL_DATE, DateField.class); TextField burialPlaceDesc = addField(PersonDto.BURIAL_PLACE_DESCRIPTION, TextField.class); ComboBox burialConductor = addField(PersonDto.BURIAL_CONDUCTOR, ComboBox.class); addField(PersonDto.ADDRESS, LocationEditForm.class).setCaption(null); addField(PersonDto.PHONE, TextField.class); addField(PersonDto.PHONE_OWNER, TextField.class); addFields(PersonDto.OCCUPATION_TYPE, PersonDto.OCCUPATION_DETAILS, PersonDto.EDUCATION_TYPE, PersonDto.EDUCATION_DETAILS); ComboBox cbPlaceOfBirthRegion = addField(PersonDto.PLACE_OF_BIRTH_REGION, ComboBox.class); ComboBox cbPlaceOfBirthDistrict = addField(PersonDto.PLACE_OF_BIRTH_DISTRICT, ComboBox.class); ComboBox cbPlaceOfBirthCommunity = addField(PersonDto.PLACE_OF_BIRTH_COMMUNITY, ComboBox.class); ComboBox cbPlaceOfBirthFacility = addField(PersonDto.PLACE_OF_BIRTH_FACILITY, ComboBox.class); TextField tfPlaceOfBirthFacilityDetails = addField(PersonDto.PLACE_OF_BIRTH_FACILITY_DETAILS, TextField.class); causeOfDeathField = addField(PersonDto.CAUSE_OF_DEATH, ComboBox.class); causeOfDeathDiseaseField = addDiseaseField(PersonDto.CAUSE_OF_DEATH_DISEASE, true); causeOfDeathDetailsField = addField(PersonDto.CAUSE_OF_DEATH_DETAILS, TextField.class); ComboBox facilityRegion = addField(PersonDto.OCCUPATION_REGION, ComboBox.class); facilityRegion.setImmediate(true); facilityRegion.setNullSelectionAllowed(true); ComboBox facilityDistrict = addField(PersonDto.OCCUPATION_DISTRICT, ComboBox.class); facilityDistrict.setImmediate(true); facilityDistrict.setNullSelectionAllowed(true); ComboBox facilityCommunity = addField(PersonDto.OCCUPATION_COMMUNITY, ComboBox.class); facilityCommunity.setImmediate(true); facilityCommunity.setNullSelectionAllowed(true); occupationFacility = addField(PersonDto.OCCUPATION_FACILITY, ComboBox.class); occupationFacility.setImmediate(true); occupationFacility.setNullSelectionAllowed(true); occupationFacilityDetails = addField(PersonDto.OCCUPATION_FACILITY_DETAILS, TextField.class); // Set requirements that don't need visibility changes and read only status setReadOnly(true, PersonDto.APPROXIMATE_AGE_REFERENCE_DATE); setRequired(true, PersonDto.FIRST_NAME, PersonDto.LAST_NAME); setVisible(false, PersonDto.OCCUPATION_DETAILS, PersonDto.OCCUPATION_FACILITY, PersonDto.OCCUPATION_FACILITY_DETAILS, PersonDto.OCCUPATION_REGION, PersonDto.OCCUPATION_DISTRICT, PersonDto.OCCUPATION_COMMUNITY, PersonDto.DEATH_DATE, PersonDto.DEATH_PLACE_TYPE, PersonDto.DEATH_PLACE_DESCRIPTION, PersonDto.BURIAL_DATE, PersonDto.BURIAL_PLACE_DESCRIPTION, PersonDto.BURIAL_CONDUCTOR, PersonDto.CAUSE_OF_DEATH, PersonDto.CAUSE_OF_DEATH_DETAILS, PersonDto.CAUSE_OF_DEATH_DISEASE); FieldHelper.setVisibleWhen(getFieldGroup(), PersonDto.EDUCATION_DETAILS, PersonDto.EDUCATION_TYPE, Arrays.asList(EducationType.OTHER), true); FieldHelper.addSoftRequiredStyle(presentCondition, sex, deathDate, deathPlaceDesc, deathPlaceType, causeOfDeathField, causeOfDeathDiseaseField, causeOfDeathDetailsField, burialDate, burialPlaceDesc, burialConductor); // Set initial visibilities initializeVisibilitiesAndAllowedVisibilities(disease, viewMode); if (!getField(PersonDto.OCCUPATION_TYPE).isVisible() && !getField(PersonDto.EDUCATION_TYPE).isVisible()) occupationHeader.setVisible(false); if (!getField(PersonDto.ADDRESS).isVisible()) addressHeader.setVisible(false); // Add listeners FieldHelper.setRequiredWhenNotNull(getFieldGroup(), PersonDto.APPROXIMATE_AGE, PersonDto.APPROXIMATE_AGE_TYPE); addFieldListeners(PersonDto.APPROXIMATE_AGE, e -> { @SuppressWarnings("unchecked") Field<ApproximateAgeType> ageTypeField = (Field<ApproximateAgeType>) getField( PersonDto.APPROXIMATE_AGE_TYPE); if (e.getProperty().getValue() == null) { ageTypeField.clear(); } else { if (ageTypeField.isEmpty()) { ageTypeField.setValue(ApproximateAgeType.YEARS); } } }); addFieldListeners(PersonDto.BIRTH_DATE_DD, e -> { updateApproximateAge(); updateReadyOnlyApproximateAge(); }); addFieldListeners(PersonDto.BIRTH_DATE_MM, e -> { updateApproximateAge(); updateReadyOnlyApproximateAge(); }); addFieldListeners(PersonDto.BIRTH_DATE_YYYY, e -> { updateApproximateAge(); updateReadyOnlyApproximateAge(); }); addFieldListeners(PersonDto.DEATH_DATE, e -> updateApproximateAge()); addFieldListeners(PersonDto.OCCUPATION_TYPE, e -> { updateOccupationFieldCaptions(); toogleOccupationMetaFields(); }); addListenersToInfrastructureFields(cbPlaceOfBirthRegion, cbPlaceOfBirthDistrict, cbPlaceOfBirthCommunity, cbPlaceOfBirthFacility, tfPlaceOfBirthFacilityDetails); addListenersToInfrastructureFields(facilityRegion, facilityDistrict, facilityCommunity, occupationFacility, occupationFacilityDetails); cbPlaceOfBirthRegion.addItems(FacadeProvider.getRegionFacade().getAllAsReference()); facilityRegion.addItems(FacadeProvider.getRegionFacade().getAllAsReference()); addFieldListeners(PersonDto.PRESENT_CONDITION, e -> toogleDeathAndBurialFields()); causeOfDeathField.addValueChangeListener(e -> { toggleCauseOfDeathFields( presentCondition.getValue() != PresentCondition.ALIVE && presentCondition.getValue() != null); }); causeOfDeathDiseaseField.addValueChangeListener(e -> { toggleCauseOfDeathFields( presentCondition.getValue() != PresentCondition.ALIVE && presentCondition.getValue() != null); }); addValueChangeListener(e -> { fillDeathAndBurialFields(deathPlaceType, deathPlaceDesc, burialPlaceDesc); }); deathDate.addValidator(new DateComparisonValidator(deathDate, this::calcBirthDateValue, false, false, I18nProperties.getValidationError(Validations.afterDate, deathDate.getCaption(), birthDateYear.getCaption()))); burialDate.addValidator(new DateComparisonValidator(burialDate, deathDate, false, false, I18nProperties .getValidationError(Validations.afterDate, burialDate.getCaption(), deathDate.getCaption()))); // Update the list of days according to the selected month and year birthDateYear.addValueChangeListener(e -> { updateListOfDays((Integer) e.getProperty().getValue(), (Integer) birthDateMonth.getValue()); }); birthDateMonth.addValueChangeListener(e -> { updateListOfDays((Integer) birthDateYear.getValue(), (Integer) e.getProperty().getValue()); }); }