List of usage examples for com.vaadin.v7.ui TextField clear
@Override
public void clear()
From source file:de.symeda.sormas.ui.caze.CaseCreateForm.java
License:Open Source License
private void updateFacilityFields(ComboBox cbFacility, TextField tfFacilityDetails) { if (cbFacility.getValue() != null) { boolean otherHealthFacility = ((FacilityReferenceDto) cbFacility.getValue()).getUuid() .equals(FacilityDto.OTHER_FACILITY_UUID); boolean noneHealthFacility = ((FacilityReferenceDto) cbFacility.getValue()).getUuid() .equals(FacilityDto.NONE_FACILITY_UUID); boolean visibleAndRequired = otherHealthFacility || noneHealthFacility; tfFacilityDetails.setVisible(visibleAndRequired); tfFacilityDetails.setRequired(visibleAndRequired); if (otherHealthFacility) { tfFacilityDetails.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.HEALTH_FACILITY_DETAILS)); }//from w ww .j a v a2s . co m if (noneHealthFacility) { tfFacilityDetails.setCaption( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, NONE_HEALTH_FACILITY_DETAILS)); } if (!visibleAndRequired) { tfFacilityDetails.clear(); } } else { tfFacilityDetails.setVisible(false); tfFacilityDetails.setRequired(false); tfFacilityDetails.clear(); } }
From source file:de.symeda.sormas.ui.caze.CaseCreateForm.java
License:Open Source License
private void updatePointOfEntryFields(ComboBox cbPointOfEntry, TextField tfPointOfEntryDetails) { if (cbPointOfEntry.getValue() != null) { boolean isOtherPointOfEntry = ((PointOfEntryReferenceDto) cbPointOfEntry.getValue()) .isOtherPointOfEntry();//from w ww.j a v a 2 s .c om setVisible(isOtherPointOfEntry, CaseDataDto.POINT_OF_ENTRY_DETAILS); setRequired(isOtherPointOfEntry, CaseDataDto.POINT_OF_ENTRY_DETAILS); if (!isOtherPointOfEntry) { tfPointOfEntryDetails.clear(); } } else { tfPointOfEntryDetails.setVisible(false); tfPointOfEntryDetails.setRequired(false); tfPointOfEntryDetails.clear(); } }
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);//w ww . j a v a 2 s.co m }); 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.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 ww. jav a 2 s . c o m*/ 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
private void updateFacilityDetailsVisibility(TextField detailsField, FacilityReferenceDto facility) { if (facility == null) { detailsField.setVisible(false);/*from w w w.j a va 2 s .c o m*/ detailsField.clear(); return; } boolean otherHealthFacility = facility.getUuid().equals(FacilityDto.OTHER_FACILITY_UUID); boolean noneHealthFacility = facility.getUuid().equals(FacilityDto.NONE_FACILITY_UUID); boolean visibleAndRequired = otherHealthFacility || noneHealthFacility; detailsField.setVisible(visibleAndRequired); if (otherHealthFacility) { detailsField.setCaption( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.HEALTH_FACILITY_DETAILS)); } if (noneHealthFacility) { detailsField.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.NONE_HEALTH_FACILITY_DETAILS)); } if (!visibleAndRequired) { detailsField.clear(); } }
From source file:de.symeda.sormas.ui.samples.SampleCreateForm.java
License:Open Source License
@Override protected void addFields() { // addField(SampleDto.SAMPLE_CODE, TextField.class); addField(SampleDto.LAB_SAMPLE_ID, TextField.class); DateTimeField sampleDateField = addField(SampleDto.SAMPLE_DATE_TIME, DateTimeField.class); addField(SampleDto.SAMPLE_MATERIAL, ComboBox.class); addField(SampleDto.SAMPLE_MATERIAL_TEXT, TextField.class); ComboBox sampleSource = addField(SampleDto.SAMPLE_SOURCE, ComboBox.class); DateField shipmentDate = addDateField(SampleDto.SHIPMENT_DATE, DateField.class, 7); addField(SampleDto.SHIPMENT_DETAILS, TextField.class); DateField receivedDate = addField(SampleDto.RECEIVED_DATE, DateField.class); ComboBox lab = addField(SampleDto.LAB, ComboBox.class); lab.addItems(FacadeProvider.getFacilityFacade().getAllLaboratories(true)); TextField labDetails = addField(SampleDto.LAB_DETAILS, TextField.class); labDetails.setVisible(false);//w w w .j a v a 2 s . c o m addField(SampleDto.SPECIMEN_CONDITION, ComboBox.class); addField(SampleDto.NO_TEST_POSSIBLE_REASON, TextField.class); addField(SampleDto.COMMENT, TextArea.class).setRows(2); CheckBox shipped = addField(SampleDto.SHIPPED, CheckBox.class); CheckBox received = addField(SampleDto.RECEIVED, CheckBox.class); initializeRequestedTests(); // Validators sampleDateField.addValidator(new DateComparisonValidator(sampleDateField, shipmentDate, true, false, I18nProperties.getValidationError(Validations.beforeDate, sampleDateField.getCaption(), shipmentDate.getCaption()))); sampleDateField.addValidator(new DateComparisonValidator(sampleDateField, receivedDate, true, false, I18nProperties.getValidationError(Validations.beforeDate, sampleDateField.getCaption(), receivedDate.getCaption()))); shipmentDate.addValidator(new DateComparisonValidator(shipmentDate, sampleDateField, false, false, I18nProperties.getValidationError(Validations.afterDate, shipmentDate.getCaption(), sampleDateField.getCaption()))); shipmentDate.addValidator(new DateComparisonValidator(shipmentDate, receivedDate, true, false, I18nProperties.getValidationError(Validations.beforeDate, shipmentDate.getCaption(), receivedDate.getCaption()))); receivedDate.addValidator(new DateComparisonValidator(receivedDate, sampleDateField, false, false, I18nProperties.getValidationError(Validations.afterDate, receivedDate.getCaption(), sampleDateField.getCaption()))); receivedDate.addValidator(new DateComparisonValidator(receivedDate, shipmentDate, false, false, I18nProperties.getValidationError(Validations.afterDate, receivedDate.getCaption(), shipmentDate.getCaption()))); FieldHelper.setVisibleWhen(getFieldGroup(), SampleDto.SAMPLE_MATERIAL_TEXT, SampleDto.SAMPLE_MATERIAL, Arrays.asList(SampleMaterial.OTHER), true); FieldHelper.setVisibleWhen(getFieldGroup(), SampleDto.NO_TEST_POSSIBLE_REASON, SampleDto.SPECIMEN_CONDITION, Arrays.asList(SpecimenCondition.NOT_ADEQUATE), true); FieldHelper.setRequiredWhen(getFieldGroup(), SampleDto.SAMPLE_MATERIAL, Arrays.asList(SampleDto.SAMPLE_MATERIAL_TEXT), Arrays.asList(SampleMaterial.OTHER)); FieldHelper.setRequiredWhen(getFieldGroup(), SampleDto.SPECIMEN_CONDITION, Arrays.asList(SampleDto.NO_TEST_POSSIBLE_REASON), Arrays.asList(SpecimenCondition.NOT_ADEQUATE)); setRequired(true, SampleDto.SAMPLE_DATE_TIME, SampleDto.SAMPLE_MATERIAL, SampleDto.LAB); addValueChangeListener(e -> { CaseDataDto caze = FacadeProvider.getCaseFacade() .getCaseDataByUuid(getValue().getAssociatedCase().getUuid()); if (caze.getDisease() != Disease.NEW_INFLUENCA) { sampleSource.setVisible(false); } FieldHelper.setEnabledWhen(getFieldGroup(), shipped, Arrays.asList(true), Arrays.asList(SampleDto.SHIPMENT_DATE, SampleDto.SHIPMENT_DETAILS), true); FieldHelper.setRequiredWhen(getFieldGroup(), shipped, Arrays.asList(SampleDto.SHIPMENT_DATE), Arrays.asList(true)); FieldHelper.setRequiredWhen(getFieldGroup(), received, Arrays.asList(SampleDto.RECEIVED_DATE, SampleDto.SPECIMEN_CONDITION), Arrays.asList(true)); FieldHelper.setEnabledWhen(getFieldGroup(), received, Arrays.asList(true), Arrays.asList(SampleDto.RECEIVED_DATE, SampleDto.LAB_SAMPLE_ID, SampleDto.SPECIMEN_CONDITION, SampleDto.NO_TEST_POSSIBLE_REASON), true); }); shipped.addValueChangeListener(event -> { if ((boolean) event.getProperty().getValue() == true) { if (shipmentDate.getValue() == null) { shipmentDate.setValue(new Date()); } } }); received.addValueChangeListener(event -> { if ((boolean) event.getProperty().getValue() == true) { if (receivedDate.getValue() == null) { receivedDate.setValue(new Date()); } } }); lab.addValueChangeListener(e -> { if (e.getProperty().getValue() != null && ((FacilityReferenceDto) e.getProperty().getValue()).getUuid() .equals(FacilityDto.OTHER_LABORATORY_UUID)) { labDetails.setVisible(true); labDetails.setRequired(true); } else { labDetails.setVisible(false); labDetails.setRequired(false); labDetails.clear(); } }); }
From source file:de.symeda.sormas.ui.samples.SampleEditForm.java
License:Open Source License
@Override protected void addFields() { addField(SampleDto.LAB_SAMPLE_ID, TextField.class); DateTimeField sampleDateField = addField(SampleDto.SAMPLE_DATE_TIME, DateTimeField.class); sampleDateField.setInvalidCommitted(false); addField(SampleDto.SAMPLE_MATERIAL, ComboBox.class); addField(SampleDto.SAMPLE_MATERIAL_TEXT, TextField.class); ComboBox sampleSource = addField(SampleDto.SAMPLE_SOURCE, ComboBox.class); DateField shipmentDate = addDateField(SampleDto.SHIPMENT_DATE, DateField.class, 7); addField(SampleDto.SHIPMENT_DETAILS, TextField.class); DateField receivedDate = addField(SampleDto.RECEIVED_DATE, DateField.class); ComboBox lab = addField(SampleDto.LAB, ComboBox.class); lab.addItems(FacadeProvider.getFacilityFacade().getAllLaboratories(true)); TextField labDetails = addField(SampleDto.LAB_DETAILS, TextField.class); labDetails.setVisible(false);/*w w w . j ava 2 s.c om*/ addField(SampleDto.SPECIMEN_CONDITION, ComboBox.class); addField(SampleDto.NO_TEST_POSSIBLE_REASON, TextField.class); addField(SampleDto.COMMENT, TextArea.class).setRows(2); CheckBox shipped = addField(SampleDto.SHIPPED, CheckBox.class); CheckBox received = addField(SampleDto.RECEIVED, CheckBox.class); ComboBox pathogenTestResultField = addField(SampleDto.PATHOGEN_TEST_RESULT, ComboBox.class); initializeRequestedTests(); // Validators sampleDateField.addValidator(new DateComparisonValidator(sampleDateField, shipmentDate, true, false, I18nProperties.getValidationError(Validations.beforeDate, sampleDateField.getCaption(), shipmentDate.getCaption()))); sampleDateField.addValidator(new DateComparisonValidator(sampleDateField, receivedDate, true, false, I18nProperties.getValidationError(Validations.beforeDate, sampleDateField.getCaption(), receivedDate.getCaption()))); shipmentDate.addValidator(new DateComparisonValidator(shipmentDate, sampleDateField, false, false, I18nProperties.getValidationError(Validations.afterDate, shipmentDate.getCaption(), sampleDateField.getCaption()))); shipmentDate.addValidator(new DateComparisonValidator(shipmentDate, receivedDate, true, false, I18nProperties.getValidationError(Validations.beforeDate, shipmentDate.getCaption(), receivedDate.getCaption()))); receivedDate.addValidator(new DateComparisonValidator(receivedDate, sampleDateField, false, false, I18nProperties.getValidationError(Validations.afterDate, receivedDate.getCaption(), sampleDateField.getCaption()))); receivedDate.addValidator(new DateComparisonValidator(receivedDate, shipmentDate, false, false, I18nProperties.getValidationError(Validations.afterDate, receivedDate.getCaption(), shipmentDate.getCaption()))); FieldHelper.setVisibleWhen(getFieldGroup(), SampleDto.SAMPLE_MATERIAL_TEXT, SampleDto.SAMPLE_MATERIAL, Arrays.asList(SampleMaterial.OTHER), true); FieldHelper.setVisibleWhen(getFieldGroup(), SampleDto.NO_TEST_POSSIBLE_REASON, SampleDto.SPECIMEN_CONDITION, Arrays.asList(SpecimenCondition.NOT_ADEQUATE), true); FieldHelper.setRequiredWhen(getFieldGroup(), SampleDto.SAMPLE_MATERIAL, Arrays.asList(SampleDto.SAMPLE_MATERIAL_TEXT), Arrays.asList(SampleMaterial.OTHER)); FieldHelper.setRequiredWhen(getFieldGroup(), SampleDto.SPECIMEN_CONDITION, Arrays.asList(SampleDto.NO_TEST_POSSIBLE_REASON), Arrays.asList(SpecimenCondition.NOT_ADEQUATE)); addValueChangeListener(e -> { CaseDataDto caze = FacadeProvider.getCaseFacade() .getCaseDataByUuid(getValue().getAssociatedCase().getUuid()); FieldHelper.setRequiredWhen(getFieldGroup(), received, Arrays.asList(SampleDto.RECEIVED_DATE, SampleDto.SPECIMEN_CONDITION), Arrays.asList(true)); FieldHelper.setEnabledWhen(getFieldGroup(), received, Arrays.asList(true), Arrays.asList(SampleDto.RECEIVED_DATE, SampleDto.LAB_SAMPLE_ID, SampleDto.SPECIMEN_CONDITION, SampleDto.NO_TEST_POSSIBLE_REASON), true); if (caze.getDisease() != Disease.NEW_INFLUENCA) { sampleSource.setVisible(false); } if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_EDIT_NOT_OWNED) || UserProvider.getCurrent().getUuid().equals(getValue().getReportingUser().getUuid())) { FieldHelper.setEnabledWhen(getFieldGroup(), shipped, Arrays.asList(true), Arrays.asList(SampleDto.SHIPMENT_DATE, SampleDto.SHIPMENT_DETAILS), true); FieldHelper.setRequiredWhen(getFieldGroup(), shipped, Arrays.asList(SampleDto.SHIPMENT_DATE), Arrays.asList(true)); setRequired(true, SampleDto.SAMPLE_DATE_TIME, SampleDto.SAMPLE_MATERIAL, SampleDto.LAB); } else { getField(SampleDto.SAMPLE_DATE_TIME).setEnabled(false); getField(SampleDto.SAMPLE_MATERIAL).setEnabled(false); getField(SampleDto.SAMPLE_MATERIAL_TEXT).setEnabled(false); getField(SampleDto.LAB).setEnabled(false); getField(SampleDto.SHIPPED).setEnabled(false); getField(SampleDto.SHIPMENT_DATE).setEnabled(false); getField(SampleDto.SHIPMENT_DETAILS).setEnabled(false); getField(SampleDto.SAMPLE_SOURCE).setEnabled(false); } shipped.addValueChangeListener(event -> { if ((boolean) event.getProperty().getValue() == true) { if (shipmentDate.getValue() == null) { shipmentDate.setValue(new Date()); } } }); received.addValueChangeListener(event -> { if ((boolean) event.getProperty().getValue() == true) { if (receivedDate.getValue() == null) { receivedDate.setValue(new Date()); } } }); // Initialize referral and report information VerticalLayout reportInfoLayout = new VerticalLayout(); String reportInfoText = I18nProperties.getString(Strings.reportedOn) + " " + DateHelper.formatLocalDateTime(getValue().getReportDateTime()) + " " + I18nProperties.getString(Strings.by) + " " + getValue().getReportingUser().toString(); Label reportInfoLabel = new Label(reportInfoText); reportInfoLabel.setEnabled(false); reportInfoLayout.addComponent(reportInfoLabel); SampleReferenceDto referredFromRef = FacadeProvider.getSampleFacade() .getReferredFrom(getValue().getUuid()); if (referredFromRef != null) { SampleDto referredFrom = FacadeProvider.getSampleFacade() .getSampleByUuid(referredFromRef.getUuid()); Button referredButton = new Button(I18nProperties.getCaption(Captions.sampleReferredFrom) + " " + referredFrom.getLab().toString()); referredButton.addStyleName(ValoTheme.BUTTON_LINK); referredButton.addStyleName(CssStyles.VSPACE_NONE); referredButton.addClickListener( s -> ControllerProvider.getSampleController().navigateToData(referredFrom.getUuid())); reportInfoLayout.addComponent(referredButton); } getContent().addComponent(reportInfoLayout, REPORT_INFORMATION_LOC); if (FacadeProvider.getPathogenTestFacade().hasPathogenTest(getValue().toReference())) { pathogenTestResultField.setRequired(true); } else { pathogenTestResultField.setEnabled(false); } }); lab.addValueChangeListener(event -> { if (event.getProperty().getValue() != null && ((FacilityReferenceDto) event.getProperty().getValue()) .getUuid().equals(FacilityDto.OTHER_LABORATORY_UUID)) { labDetails.setVisible(true); labDetails.setRequired(true); } else { labDetails.setVisible(false); labDetails.setRequired(false); labDetails.clear(); } }); }