use of de.symeda.sormas.api.exposure.ExposureType in project SORMAS-Project by hzi-braunschweig.
the class ExposureDialog method initializeContentView.
@Override
protected void initializeContentView(ViewDataBinding rootBinding, ViewDataBinding buttonPanelBinding) {
contentBinding.exposureStartDate.initializeDateTimeField(getFragmentManager());
contentBinding.exposureEndDate.initializeDateTimeField(getFragmentManager());
if (data.getId() == null) {
setLiveValidationDisabled(true);
}
contentBinding.exposureExposureType.initializeSpinner(DataUtils.getEnumItems(ExposureType.class, true, fieldVisibilityCheckers));
contentBinding.exposureGatheringType.initializeSpinner(DataUtils.getEnumItems(GatheringType.class, true));
contentBinding.exposureHabitationType.initializeSpinner(DataUtils.getEnumItems(HabitationType.class, true));
contentBinding.exposureTypeOfAnimal.initializeSpinner(DataUtils.getEnumItems(TypeOfAnimal.class, true));
contentBinding.exposureAnimalCondition.initializeSpinner(DataUtils.getEnumItems(AnimalCondition.class, true));
contentBinding.exposureAnimalContactType.initializeSpinner(DataUtils.getEnumItems(AnimalContactType.class, true));
contentBinding.exposureTypeOfPlace.initializeSpinner(DataUtils.getEnumItems(TypeOfPlace.class, true, fieldVisibilityCheckers));
contentBinding.exposureMeansOfTransport.initializeSpinner(DataUtils.getEnumItems(MeansOfTransport.class, true));
contentBinding.exposureExposureRole.initializeSpinner(DataUtils.getEnumItems(ExposureRole.class, true));
contentBinding.exposureWorkEnvironment.initializeSpinner(DataUtils.getEnumItems(WorkEnvironment.class, true));
setUpHeadingVisibilities(data.getExposureType());
contentBinding.exposureExposureType.addValueChangedListener(e -> {
setUpHeadingVisibilities((ExposureType) e.getValue());
});
contentBinding.exposureMeansOfTransport.addValueChangedListener(e -> {
contentBinding.exposureConnectionNumber.setCaption(e.getValue() == MeansOfTransport.PLANE ? I18nProperties.getCaption(Captions.exposureFlightNumber) : I18nProperties.getPrefixCaption(ExposureDto.I18N_PREFIX, ExposureDto.CONNECTION_NUMBER));
});
contentBinding.exposureLocation.setOnClickListener(v -> openAddressPopup());
setFieldVisibilitiesAndAccesses(ExposureDto.class, (ViewGroup) getRootView());
contentBinding.exposureTypeOfPlace.addValueChangedListener(e -> {
if (e.getValue() != TypeOfPlace.FACILITY) {
contentBinding.exposureWorkEnvironment.setValue(null);
contentBinding.exposureWorkEnvironment.setVisibility(View.GONE);
} else {
FacilityType facilityType = data.getLocation().getFacilityType();
contentBinding.exposureWorkEnvironment.setVisibility(facilityType == null || FacilityTypeGroup.WORKING_PLACE != facilityType.getFacilityTypeGroup() ? View.GONE : View.VISIBLE);
}
});
}
use of de.symeda.sormas.api.exposure.ExposureType in project SORMAS-Project by hzi-braunschweig.
the class ExposureForm method setUpVisibilityDependencies.
private void setUpVisibilityDependencies() {
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.EXPOSURE_TYPE_DETAILS, ExposureDto.EXPOSURE_TYPE, ExposureType.OTHER, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.GATHERING_TYPE, ExposureDto.EXPOSURE_TYPE, ExposureType.GATHERING, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.HABITATION_TYPE, ExposureDto.EXPOSURE_TYPE, ExposureType.HABITATION, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.TYPE_OF_ANIMAL, ExposureDto.EXPOSURE_TYPE, ExposureType.ANIMAL_CONTACT, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.GATHERING_DETAILS, ExposureDto.GATHERING_TYPE, GatheringType.OTHER, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.HABITATION_DETAILS, ExposureDto.HABITATION_TYPE, HabitationType.OTHER, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.TYPE_OF_ANIMAL_DETAILS, ExposureDto.TYPE_OF_ANIMAL, TypeOfAnimal.OTHER, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.LARGE_ATTENDANCE_NUMBER, ExposureDto.EXPOSURE_TYPE, ExposureType.GATHERING, true);
FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(ExposureDto.PHYSICAL_CONTACT_DURING_PREPARATION, ExposureDto.PHYSICAL_CONTACT_WITH_BODY, ExposureDto.DECEASED_PERSON_NAME, ExposureDto.DECEASED_PERSON_RELATION), ExposureDto.EXPOSURE_TYPE, ExposureType.BURIAL, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.PROTECTIVE_MEASURES_DETAILS, ExposureDto.OTHER_PROTECTIVE_MEASURES, YesNoUnknown.YES, true);
FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(ExposureDto.ANIMAL_CONDITION, ExposureDto.ANIMAL_VACCINATED, ExposureDto.ANIMAL_CONTACT_TYPE), ExposureDto.EXPOSURE_TYPE, ExposureType.ANIMAL_CONTACT, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.ANIMAL_CONTACT_TYPE_DETAILS, ExposureDto.ANIMAL_CONTACT_TYPE, AnimalContactType.OTHER, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.TYPE_OF_PLACE_DETAILS, ExposureDto.TYPE_OF_PLACE, TypeOfPlace.OTHER, true);
FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(ExposureDto.MEANS_OF_TRANSPORT, ExposureDto.CONNECTION_NUMBER), ExposureDto.TYPE_OF_PLACE, TypeOfPlace.MEANS_OF_TRANSPORT, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.MEANS_OF_TRANSPORT_DETAILS, ExposureDto.MEANS_OF_TRANSPORT, MeansOfTransport.OTHER, true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.SEAT_NUMBER, ExposureDto.MEANS_OF_TRANSPORT, Arrays.asList(MeansOfTransport.PLANE, MeansOfTransport.TRAIN, MeansOfTransport.OTHER), true);
FieldHelper.setVisibleWhen(getFieldGroup(), ExposureDto.WORK_ENVIRONMENT, locationForm.getFacilityTypeGroup(), Collections.singletonList(FacilityTypeGroup.WORKING_PLACE), true);
getContent().getComponent(LOC_ANIMAL_CONTACT_DETAILS_HEADING).setVisible(false);
getContent().getComponent(LOC_BURIAL_DETAILS_HEADING).setVisible(false);
getField(ExposureDto.EXPOSURE_TYPE).addValueChangeListener(e -> {
ExposureType selectedExposureType = (ExposureType) e.getProperty().getValue();
getContent().getComponent(LOC_ANIMAL_CONTACT_DETAILS_HEADING).setVisible(selectedExposureType == ExposureType.ANIMAL_CONTACT);
getContent().getComponent(LOC_BURIAL_DETAILS_HEADING).setVisible(selectedExposureType == ExposureType.BURIAL);
});
locationForm.setFacilityFieldsVisible(getField(ExposureDto.TYPE_OF_PLACE).getValue() == TypeOfPlace.FACILITY, true);
getField(ExposureDto.TYPE_OF_PLACE).addValueChangeListener(e -> locationForm.setFacilityFieldsVisible(e.getProperty().getValue() == TypeOfPlace.FACILITY, true));
locationForm.setContinentFieldsVisibility();
}
Aggregations