Search in sources :

Example 1 with ExposureType

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);
        }
    });
}
Also used : ExposureType(de.symeda.sormas.api.exposure.ExposureType) AnimalContactType(de.symeda.sormas.api.exposure.AnimalContactType) TypeOfPlace(de.symeda.sormas.api.event.TypeOfPlace) GatheringType(de.symeda.sormas.api.exposure.GatheringType) HabitationType(de.symeda.sormas.api.exposure.HabitationType) TypeOfAnimal(de.symeda.sormas.api.exposure.TypeOfAnimal) MeansOfTransport(de.symeda.sormas.api.event.MeansOfTransport) ExposureRole(de.symeda.sormas.api.exposure.ExposureRole) AnimalCondition(de.symeda.sormas.api.epidata.AnimalCondition) WorkEnvironment(de.symeda.sormas.api.exposure.WorkEnvironment) FacilityType(de.symeda.sormas.api.infrastructure.facility.FacilityType)

Example 2 with ExposureType

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();
}
Also used : ExposureType(de.symeda.sormas.api.exposure.ExposureType)

Aggregations

ExposureType (de.symeda.sormas.api.exposure.ExposureType)2 AnimalCondition (de.symeda.sormas.api.epidata.AnimalCondition)1 MeansOfTransport (de.symeda.sormas.api.event.MeansOfTransport)1 TypeOfPlace (de.symeda.sormas.api.event.TypeOfPlace)1 AnimalContactType (de.symeda.sormas.api.exposure.AnimalContactType)1 ExposureRole (de.symeda.sormas.api.exposure.ExposureRole)1 GatheringType (de.symeda.sormas.api.exposure.GatheringType)1 HabitationType (de.symeda.sormas.api.exposure.HabitationType)1 TypeOfAnimal (de.symeda.sormas.api.exposure.TypeOfAnimal)1 WorkEnvironment (de.symeda.sormas.api.exposure.WorkEnvironment)1 FacilityType (de.symeda.sormas.api.infrastructure.facility.FacilityType)1