Search in sources :

Example 1 with SymptomsContext

use of de.symeda.sormas.api.symptoms.SymptomsContext in project SORMAS-Project by hzi-braunschweig.

the class SymptomsForm method addFields.

@Override
protected void addFields() {
    if (disease == null || symptomsContext == null) {
        // workaround to stop initialization until disease is set
        return;
    }
    // Add fields
    Label clinicalMeasurementsHeadingLabel = createLabel(I18nProperties.getString(Strings.headingClinicalMeasurements), H3, CLINICAL_MEASUREMENTS_HEADING_LOC);
    Label signsAndSymptomsHeadingLabel = createLabel(I18nProperties.getString(Strings.headingSignsAndSymptoms), H3, SIGNS_AND_SYMPTOMS_HEADING_LOC);
    final Label generalSymptomsHeadingLabel = createLabel(SymptomGroup.GENERAL.toString(), H4, GENERAL_SIGNS_AND_SYMPTOMS_HEADING_LOC);
    final Label respiratorySymptomsHeadingLabel = createLabel(SymptomGroup.RESPIRATORY.toString(), H4, RESPIRATORY_SIGNS_AND_SYMPTOMS_HEADING_LOC);
    final Label cardiovascularSymptomsHeadingLabel = createLabel(SymptomGroup.CARDIOVASCULAR.toString(), H4, CARDIOVASCULAR_SIGNS_AND_SYMPTOMS_HEADING_LOC);
    final Label gastrointestinalSymptomsHeadingLabel = createLabel(SymptomGroup.GASTROINTESTINAL.toString(), H4, GASTROINTESTINAL_SIGNS_AND_SYMPTOMS_HEADING_LOC);
    final Label urinarySymptomsHeadingLabel = createLabel(SymptomGroup.URINARY.toString(), H4, URINARY_SIGNS_AND_SYMPTOMS_HEADING_LOC);
    final Label nervousSystemSymptomsHeadingLabel = createLabel(SymptomGroup.NERVOUS_SYSTEM.toString(), H4, NERVOUS_SYSTEM_SIGNS_AND_SYMPTOMS_HEADING_LOC);
    final Label skinSymptomsHeadingLabel = createLabel(SymptomGroup.SKIN.toString(), H4, SKIN_SIGNS_AND_SYMPTOMS_HEADING_LOC);
    final Label otherSymptomsHeadingLabel = createLabel(SymptomGroup.OTHER.toString(), H4, OTHER_SIGNS_AND_SYMPTOMS_HEADING_LOC);
    DateField onsetDateField = addField(ONSET_DATE, DateField.class);
    ComboBox onsetSymptom = addField(ONSET_SYMPTOM, ComboBox.class);
    if (symptomsContext == SymptomsContext.CASE) {
        // If the symptom onset date is after the hospital admission date, show a warning but don't prevent the user from saving
        onsetDateField.addValueChangeListener(event -> {
            if (caze.getHospitalization().getAdmissionDate() != null && DateTimeComparator.getDateOnlyInstance().compare(caze.getHospitalization().getAdmissionDate(), onsetDateField.getValue()) < 0) {
                onsetDateField.setComponentError(new ErrorMessage() {

                    @Override
                    public ErrorLevel getErrorLevel() {
                        return ErrorLevel.INFO;
                    }

                    @Override
                    public String getFormattedHtmlMessage() {
                        return I18nProperties.getValidationError(Validations.beforeDateSoft, onsetDateField.getCaption(), I18nProperties.getPrefixCaption(HospitalizationDto.I18N_PREFIX, HospitalizationDto.ADMISSION_DATE));
                    }
                });
            } else if (onsetDateField.isValid()) {
                onsetDateField.setComponentError(null);
            }
        });
    }
    ComboBox temperature = addField(TEMPERATURE, ComboBox.class);
    temperature.setImmediate(true);
    for (Float temperatureValue : SymptomsHelper.getTemperatureValues()) {
        temperature.addItem(temperatureValue);
        temperature.setItemCaption(temperatureValue, SymptomsHelper.getTemperatureString(temperatureValue));
    }
    if (symptomsContext == SymptomsContext.CASE) {
        temperature.setCaption(I18nProperties.getCaption(Captions.symptomsMaxTemperature));
    }
    addField(TEMPERATURE_SOURCE);
    ComboBox bloodPressureSystolic = addField(BLOOD_PRESSURE_SYSTOLIC, ComboBox.class);
    bloodPressureSystolic.addItems(SymptomsHelper.getBloodPressureValues());
    ComboBox bloodPressureDiastolic = addField(BLOOD_PRESSURE_DIASTOLIC, ComboBox.class);
    bloodPressureDiastolic.addItems(SymptomsHelper.getBloodPressureValues());
    ComboBox heartRate = addField(HEART_RATE, ComboBox.class);
    heartRate.addItems(SymptomsHelper.getHeartRateValues());
    ComboBox respiratoryRate = addField(RESPIRATORY_RATE, ComboBox.class);
    respiratoryRate.addItems(SymptomsHelper.getRespiratoryRateValues());
    ComboBox weight = addField(WEIGHT, ComboBox.class);
    for (Integer weightValue : SymptomsHelper.getWeightValues()) {
        weight.addItem(weightValue);
        weight.setItemCaption(weightValue, SymptomsHelper.getDecimalString(weightValue));
    }
    ComboBox height = addField(HEIGHT, ComboBox.class);
    height.addItems(SymptomsHelper.getHeightValues());
    ComboBox midUpperArmCircumference = addField(MID_UPPER_ARM_CIRCUMFERENCE, ComboBox.class);
    for (Integer circumferenceValue : SymptomsHelper.getMidUpperArmCircumferenceValues()) {
        midUpperArmCircumference.addItem(circumferenceValue);
        midUpperArmCircumference.setItemCaption(circumferenceValue, SymptomsHelper.getDecimalString(circumferenceValue));
    }
    ComboBox glasgowComaScale = addField(GLASGOW_COMA_SCALE, ComboBox.class);
    glasgowComaScale.addItems(SymptomsHelper.getGlasgowComaScaleValues());
    addFields(VOMITING, DIARRHEA, BLOOD_IN_STOOL, NAUSEA, ABDOMINAL_PAIN, HEADACHE, MUSCLE_PAIN, FATIGUE_WEAKNESS, SKIN_RASH, NECK_STIFFNESS, SORE_THROAT, COUGH, COUGH_WITH_SPUTUM, COUGH_WITH_HEAMOPTYSIS, RUNNY_NOSE, DIFFICULTY_BREATHING, CHEST_PAIN, CONJUNCTIVITIS, EYE_PAIN_LIGHT_SENSITIVE, KOPLIKS_SPOTS, THROBOCYTOPENIA, OTITIS_MEDIA, HEARINGLOSS, DEHYDRATION, ANOREXIA_APPETITE_LOSS, REFUSAL_FEEDOR_DRINK, JOINT_PAIN, HICCUPS, BACKACHE, EYES_BLEEDING, JAUNDICE, DARK_URINE, STOMACH_BLEEDING, RAPID_BREATHING, SWOLLEN_GLANDS, UNEXPLAINED_BLEEDING, GUMS_BLEEDING, INJECTION_SITE_BLEEDING, NOSE_BLEEDING, BLOODY_BLACK_STOOL, RED_BLOOD_VOMIT, DIGESTED_BLOOD_VOMIT, COUGHING_BLOOD, BLEEDING_VAGINA, SKIN_BRUISING, BLOOD_URINE, OTHER_HEMORRHAGIC_SYMPTOMS, OTHER_HEMORRHAGIC_SYMPTOMS_TEXT, OTHER_NON_HEMORRHAGIC_SYMPTOMS, OTHER_NON_HEMORRHAGIC_SYMPTOMS_TEXT, LESIONS, LESIONS_THAT_ITCH, LESIONS_SAME_STATE, LESIONS_SAME_SIZE, LESIONS_DEEP_PROFOUND, LESIONS_FACE, LESIONS_LEGS, LESIONS_SOLES_FEET, LESIONS_PALMS_HANDS, LESIONS_THORAX, LESIONS_ARMS, LESIONS_GENITALS, LESIONS_ALL_OVER_BODY, LYMPHADENOPATHY, LYMPHADENOPATHY_AXILLARY, LYMPHADENOPATHY_CERVICAL, LYMPHADENOPATHY_INGUINAL, CHILLS_SWEATS, BEDRIDDEN, ORAL_ULCERS, PAINFUL_LYMPHADENITIS, BLACKENING_DEATH_OF_TISSUE, BUBOES_GROIN_ARMPIT_NECK, BULGING_FONTANELLE, PHARYNGEAL_ERYTHEMA, PHARYNGEAL_EXUDATE, OEDEMA_FACE_NECK, OEDEMA_LOWER_EXTREMITY, LOSS_SKIN_TURGOR, PALPABLE_LIVER, PALPABLE_SPLEEN, MALAISE, SUNKEN_EYES_FONTANELLE, SIDE_PAIN, FLUID_IN_LUNG_CAVITY, TREMOR, BILATERAL_CATARACTS, UNILATERAL_CATARACTS, CONGENITAL_GLAUCOMA, CONGENITAL_HEART_DISEASE, PIGMENTARY_RETINOPATHY, RADIOLUCENT_BONE_DISEASE, SPLENOMEGALY, MICROCEPHALY, MENINGOENCEPHALITIS, PURPURIC_RASH, DEVELOPMENTAL_DELAY, CONGENITAL_HEART_DISEASE_TYPE, CONGENITAL_HEART_DISEASE_DETAILS, JAUNDICE_WITHIN_24_HOURS_OF_BIRTH, PATIENT_ILL_LOCATION, HYDROPHOBIA, OPISTHOTONUS, ANXIETY_STATES, DELIRIUM, UPROARIOUSNESS, PARASTHESIA_AROUND_WOUND, EXCESS_SALIVATION, INSOMNIA, PARALYSIS, EXCITATION, DYSPHAGIA, AEROPHOBIA, HYPERACTIVITY, PARESIS, AGITATION, ASCENDING_FLACCID_PARALYSIS, ERRATIC_BEHAVIOUR, COMA, CONVULSION, FLUID_IN_LUNG_CAVITY_AUSCULTATION, FLUID_IN_LUNG_CAVITY_XRAY, ABNORMAL_LUNG_XRAY_FINDINGS, CONJUNCTIVAL_INJECTION, ACUTE_RESPIRATORY_DISTRESS_SYNDROME, PNEUMONIA_CLINICAL_OR_RADIOLOGIC, LOSS_OF_TASTE, LOSS_OF_SMELL, WHEEZING, SKIN_ULCERS, INABILITY_TO_WALK, IN_DRAWING_OF_CHEST_WALL, FEELING_ILL, SHIVERING, RESPIRATORY_DISEASE_VENTILATION, FAST_HEART_RATE, OXYGEN_SATURATION_LOWER_94, FEVERISHFEELING, WEAKNESS, FATIGUE, COUGH_WITHOUT_SPUTUM, BREATHLESSNESS, CHEST_PRESSURE, BLUE_LIPS, BLOOD_CIRCULATION_PROBLEMS, PALPITATIONS, DIZZINESS_STANDING_UP, HIGH_OR_LOW_BLOOD_PRESSURE, URINARY_RETENTION, FEVER);
    addField(SYMPTOMS_COMMENTS, TextField.class).setDescription(I18nProperties.getPrefixDescription(I18N_PREFIX, SYMPTOMS_COMMENTS, "") + "\n" + I18nProperties.getDescription(Descriptions.descGdpr));
    addField(LESIONS_ONSET_DATE, DateField.class);
    // complications
    addFields(ALTERED_CONSCIOUSNESS, CONFUSED_DISORIENTED, OTHER_COMPLICATIONS, OTHER_COMPLICATIONS_TEXT, HEMORRHAGIC_SYNDROME, HYPERGLYCEMIA, HYPOGLYCEMIA, MENINGEAL_SIGNS, SEIZURES, SEPSIS, SHOCK);
    monkeypoxImageFieldIds = Arrays.asList(LESIONS_RESEMBLE_IMG1, LESIONS_RESEMBLE_IMG2, LESIONS_RESEMBLE_IMG3, LESIONS_RESEMBLE_IMG4);
    for (String propertyId : monkeypoxImageFieldIds) {
        @SuppressWarnings("rawtypes") Field monkeypoxImageField = addField(propertyId);
        CssStyles.style(monkeypoxImageField, VSPACE_NONE);
    }
    // Set initial visibilities
    initializeVisibilitiesAndAllowedVisibilities();
    initializeAccessAndAllowedAccesses();
    if (symptomsContext != SymptomsContext.CLINICAL_VISIT) {
        setVisible(false, BLOOD_PRESSURE_SYSTOLIC, BLOOD_PRESSURE_DIASTOLIC, HEART_RATE, RESPIRATORY_RATE, WEIGHT, HEIGHT, MID_UPPER_ARM_CIRCUMFERENCE, GLASGOW_COMA_SCALE);
    } else {
        setVisible(false, ONSET_SYMPTOM, ONSET_DATE);
    }
    // Initialize lists
    conditionalBleedingSymptomFieldIds = Arrays.asList(GUMS_BLEEDING, INJECTION_SITE_BLEEDING, NOSE_BLEEDING, BLOODY_BLACK_STOOL, RED_BLOOD_VOMIT, DIGESTED_BLOOD_VOMIT, EYES_BLEEDING, COUGHING_BLOOD, BLEEDING_VAGINA, SKIN_BRUISING, STOMACH_BLEEDING, BLOOD_URINE, OTHER_HEMORRHAGIC_SYMPTOMS);
    lesionsFieldIds = Arrays.asList(LESIONS_SAME_STATE, LESIONS_SAME_SIZE, LESIONS_DEEP_PROFOUND, LESIONS_THAT_ITCH);
    lesionsLocationFieldIds = Arrays.asList(LESIONS_FACE, LESIONS_LEGS, LESIONS_SOLES_FEET, LESIONS_PALMS_HANDS, LESIONS_THORAX, LESIONS_ARMS, LESIONS_GENITALS, LESIONS_ALL_OVER_BODY);
    unconditionalSymptomFieldIds = Arrays.asList(FEVER, ABNORMAL_LUNG_XRAY_FINDINGS, CONJUNCTIVAL_INJECTION, ACUTE_RESPIRATORY_DISTRESS_SYNDROME, PNEUMONIA_CLINICAL_OR_RADIOLOGIC, VOMITING, DIARRHEA, BLOOD_IN_STOOL, NAUSEA, ABDOMINAL_PAIN, HEADACHE, MUSCLE_PAIN, FATIGUE_WEAKNESS, SKIN_RASH, NECK_STIFFNESS, SORE_THROAT, COUGH, COUGH_WITH_SPUTUM, COUGH_WITH_HEAMOPTYSIS, RUNNY_NOSE, DIFFICULTY_BREATHING, CHEST_PAIN, CONJUNCTIVITIS, EYE_PAIN_LIGHT_SENSITIVE, KOPLIKS_SPOTS, THROBOCYTOPENIA, OTITIS_MEDIA, HEARINGLOSS, DEHYDRATION, ANOREXIA_APPETITE_LOSS, REFUSAL_FEEDOR_DRINK, JOINT_PAIN, HICCUPS, BACKACHE, JAUNDICE, DARK_URINE, RAPID_BREATHING, SWOLLEN_GLANDS, UNEXPLAINED_BLEEDING, OTHER_NON_HEMORRHAGIC_SYMPTOMS, LESIONS, LYMPHADENOPATHY, LYMPHADENOPATHY_AXILLARY, LYMPHADENOPATHY_CERVICAL, LYMPHADENOPATHY_INGUINAL, CHILLS_SWEATS, BEDRIDDEN, ORAL_ULCERS, PAINFUL_LYMPHADENITIS, BLACKENING_DEATH_OF_TISSUE, BUBOES_GROIN_ARMPIT_NECK, BULGING_FONTANELLE, PHARYNGEAL_ERYTHEMA, PHARYNGEAL_EXUDATE, OEDEMA_FACE_NECK, OEDEMA_LOWER_EXTREMITY, LOSS_SKIN_TURGOR, PALPABLE_LIVER, PALPABLE_SPLEEN, MALAISE, SUNKEN_EYES_FONTANELLE, SIDE_PAIN, FLUID_IN_LUNG_CAVITY, FLUID_IN_LUNG_CAVITY_AUSCULTATION, FLUID_IN_LUNG_CAVITY_XRAY, TREMOR, BILATERAL_CATARACTS, UNILATERAL_CATARACTS, CONGENITAL_GLAUCOMA, CONGENITAL_HEART_DISEASE, RADIOLUCENT_BONE_DISEASE, SPLENOMEGALY, MICROCEPHALY, MENINGOENCEPHALITIS, DEVELOPMENTAL_DELAY, PURPURIC_RASH, PIGMENTARY_RETINOPATHY, CONVULSION, AEROPHOBIA, AGITATION, ANXIETY_STATES, ASCENDING_FLACCID_PARALYSIS, COMA, DELIRIUM, DYSPHAGIA, ERRATIC_BEHAVIOUR, EXCESS_SALIVATION, EXCITATION, HYDROPHOBIA, HYPERACTIVITY, INSOMNIA, OPISTHOTONUS, PARALYSIS, PARASTHESIA_AROUND_WOUND, PARESIS, UPROARIOUSNESS, LOSS_OF_TASTE, LOSS_OF_SMELL, WHEEZING, SKIN_ULCERS, INABILITY_TO_WALK, IN_DRAWING_OF_CHEST_WALL, OTHER_COMPLICATIONS, FEELING_ILL, SHIVERING, RESPIRATORY_DISEASE_VENTILATION, FAST_HEART_RATE, OXYGEN_SATURATION_LOWER_94, FEVERISHFEELING, WEAKNESS, FATIGUE, COUGH_WITHOUT_SPUTUM, BREATHLESSNESS, CHEST_PRESSURE, BLUE_LIPS, BLOOD_CIRCULATION_PROBLEMS, PALPITATIONS, DIZZINESS_STANDING_UP, HIGH_OR_LOW_BLOOD_PRESSURE, URINARY_RETENTION, // complications
    ALTERED_CONSCIOUSNESS, CONFUSED_DISORIENTED, HEMORRHAGIC_SYNDROME, HYPERGLYCEMIA, HYPOGLYCEMIA, MENINGEAL_SIGNS, SEIZURES, SEPSIS, SHOCK);
    // Set visibilities
    NullableOptionGroup feverField = (NullableOptionGroup) getFieldGroup().getField(FEVER);
    feverField.setImmediate(true);
    FieldHelper.setVisibleWhen(getFieldGroup(), conditionalBleedingSymptomFieldIds, UNEXPLAINED_BLEEDING, Arrays.asList(SymptomState.YES), true);
    FieldHelper.setVisibleWhen(getFieldGroup(), OTHER_HEMORRHAGIC_SYMPTOMS_TEXT, OTHER_HEMORRHAGIC_SYMPTOMS, Arrays.asList(SymptomState.YES), true);
    FieldHelper.setVisibleWhen(getFieldGroup(), OTHER_NON_HEMORRHAGIC_SYMPTOMS_TEXT, OTHER_NON_HEMORRHAGIC_SYMPTOMS, Arrays.asList(SymptomState.YES), true);
    FieldHelper.setVisibleWhen(getFieldGroup(), OTHER_COMPLICATIONS_TEXT, OTHER_COMPLICATIONS, Arrays.asList(SymptomState.YES), true);
    FieldHelper.setVisibleWhen(getFieldGroup(), lesionsFieldIds, LESIONS, Arrays.asList(SymptomState.YES), true);
    FieldHelper.setVisibleWhen(getFieldGroup(), lesionsLocationFieldIds, LESIONS, Arrays.asList(SymptomState.YES), true);
    FieldHelper.setVisibleWhen(getFieldGroup(), LESIONS_ONSET_DATE, LESIONS, Arrays.asList(SymptomState.YES), true);
    FieldHelper.setVisibleWhen(getFieldGroup(), CONGENITAL_HEART_DISEASE_TYPE, CONGENITAL_HEART_DISEASE, Arrays.asList(SymptomState.YES), true);
    FieldHelper.setVisibleWhen(getFieldGroup(), CONGENITAL_HEART_DISEASE_DETAILS, CONGENITAL_HEART_DISEASE_TYPE, Arrays.asList(CongenitalHeartDiseaseType.OTHER), true);
    if (isVisibleAllowed(getFieldGroup().getField(JAUNDICE_WITHIN_24_HOURS_OF_BIRTH))) {
        FieldHelper.setVisibleWhen(getFieldGroup(), JAUNDICE_WITHIN_24_HOURS_OF_BIRTH, JAUNDICE, Arrays.asList(SymptomState.YES), true);
    }
    FieldHelper.addSoftRequiredStyle(getField(LESIONS_ONSET_DATE));
    boolean isInfant = person != null && person.getApproximateAge() != null && ((person.getApproximateAge() <= 12 && person.getApproximateAgeType() == ApproximateAgeType.MONTHS) || person.getApproximateAge() <= 1);
    if (!isInfant) {
        getFieldGroup().getField(BULGING_FONTANELLE).setVisible(false);
    }
    // Handle visibility of lesions locations caption
    Label lesionsLocationsCaption = new Label(I18nProperties.getCaption(Captions.symptomsLesionsLocations));
    CssStyles.style(lesionsLocationsCaption, VSPACE_3);
    getContent().addComponent(lesionsLocationsCaption, LESIONS_LOCATIONS_LOC);
    getContent().getComponent(LESIONS_LOCATIONS_LOC).setVisible(FieldHelper.getNullableSourceFieldValue(getFieldGroup().getField(LESIONS)) == SymptomState.YES);
    getFieldGroup().getField(LESIONS).addValueChangeListener(e -> {
        getContent().getComponent(LESIONS_LOCATIONS_LOC).setVisible(FieldHelper.getNullableSourceFieldValue((Field) e.getProperty()) == SymptomState.YES);
    });
    // Symptoms hint text
    Label symptomsHint = new Label(I18nProperties.getString(symptomsContext == SymptomsContext.CASE ? Strings.messageSymptomsHint : Strings.messageSymptomsVisitHint), ContentMode.HTML);
    symptomsHint.setWidth(100, Unit.PERCENTAGE);
    getContent().addComponent(symptomsHint, SYMPTOMS_HINT_LOC);
    if (disease == Disease.MONKEYPOX) {
        setUpMonkeypoxVisibilities();
    }
    if (symptomsContext != SymptomsContext.CASE) {
        getFieldGroup().getField(PATIENT_ILL_LOCATION).setVisible(false);
    }
    symptomGroupMap.forEach((location, strings) -> {
        final Component groupLabel = getContent().getComponent(location);
        final Optional<String> groupHasVisibleSymptom = strings.stream().filter(s -> getFieldGroup().getField(s).isVisible()).findAny();
        if (!groupHasVisibleSymptom.isPresent()) {
            groupLabel.setVisible(false);
        }
    });
    if (isEditableAllowed(OTHER_HEMORRHAGIC_SYMPTOMS_TEXT)) {
        FieldHelper.setRequiredWhen(getFieldGroup(), getFieldGroup().getField(OTHER_HEMORRHAGIC_SYMPTOMS), Arrays.asList(OTHER_HEMORRHAGIC_SYMPTOMS_TEXT), Arrays.asList(SymptomState.YES), disease);
    }
    if (isEditableAllowed(OTHER_NON_HEMORRHAGIC_SYMPTOMS_TEXT)) {
        FieldHelper.setRequiredWhen(getFieldGroup(), getFieldGroup().getField(OTHER_NON_HEMORRHAGIC_SYMPTOMS), Arrays.asList(OTHER_NON_HEMORRHAGIC_SYMPTOMS_TEXT), Arrays.asList(SymptomState.YES), disease);
    }
    if (isEditableAllowed(OTHER_COMPLICATIONS_TEXT)) {
        FieldHelper.setRequiredWhen(getFieldGroup(), getFieldGroup().getField(OTHER_COMPLICATIONS), Arrays.asList(OTHER_COMPLICATIONS_TEXT), Arrays.asList(SymptomState.YES), disease);
    }
    FieldHelper.setRequiredWhen(getFieldGroup(), getFieldGroup().getField(LESIONS), lesionsFieldIds, Arrays.asList(SymptomState.YES), disease);
    FieldHelper.setRequiredWhen(getFieldGroup(), getFieldGroup().getField(LESIONS), monkeypoxImageFieldIds, Arrays.asList(SymptomState.YES), disease);
    addListenerForOnsetFields(onsetSymptom, onsetDateField);
    Button clearAllButton = ButtonHelper.createButton(Captions.actionClearAll, event -> {
        for (Object symptomId : unconditionalSymptomFieldIds) {
            getFieldGroup().getField(symptomId).setValue(null);
        }
        for (Object symptomId : conditionalBleedingSymptomFieldIds) {
            getFieldGroup().getField(symptomId).setValue(null);
        }
        for (Object symptomId : lesionsFieldIds) {
            getFieldGroup().getField(symptomId).setValue(null);
        }
        for (Object symptomId : lesionsLocationFieldIds) {
            getFieldGroup().getField(symptomId).setValue(null);
        }
        for (Object symptomId : monkeypoxImageFieldIds) {
            getFieldGroup().getField(symptomId).setValue(null);
        }
    }, ValoTheme.BUTTON_LINK);
    Button setEmptyToNoButton = createButtonSetClearedToSymptomState(Captions.symptomsSetClearedToNo, SymptomState.NO);
    Button setEmptyToUnknownButton = createButtonSetClearedToSymptomState(Captions.symptomsSetClearedToUnknown, SymptomState.UNKNOWN);
    // Complications heading - not displayed for Rubella (dirty, should be made generic)
    Label complicationsHeading = new Label(I18nProperties.getString(Strings.headingComplications));
    CssStyles.style(complicationsHeading, CssStyles.H3);
    if (disease != Disease.CONGENITAL_RUBELLA && !isConfiguredServer("de")) {
        getContent().addComponent(complicationsHeading, COMPLICATIONS_HEADING);
    }
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.addComponent(clearAllButton);
    buttonsLayout.addComponent(setEmptyToNoButton);
    buttonsLayout.addComponent(setEmptyToUnknownButton);
    buttonsLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    buttonsLayout.setMargin(new MarginInfo(true, false, true, true));
    getContent().addComponent(buttonsLayout, BUTTONS_LOC);
    if (feverField.isVisible()) {
        temperature.addValueChangeListener(e -> {
            toggleFeverComponentError(feverField, temperature);
        });
        feverField.addValueChangeListener(e -> {
            toggleFeverComponentError(feverField, temperature);
        });
    }
}
Also used : NullableOptionGroup(de.symeda.sormas.ui.utils.NullableOptionGroup) ThemeResource(com.vaadin.server.ThemeResource) AbstractEditForm(de.symeda.sormas.ui.utils.AbstractEditForm) H3(de.symeda.sormas.ui.utils.CssStyles.H3) Arrays(java.util.Arrays) ApproximateAgeType(de.symeda.sormas.api.person.ApproximateAgeType) H4(de.symeda.sormas.ui.utils.CssStyles.H4) ConversionException(com.vaadin.v7.data.util.converter.Converter.ConversionException) AbstractField(com.vaadin.v7.ui.AbstractField) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) VisitStatus(de.symeda.sormas.api.visit.VisitStatus) Alignment(com.vaadin.ui.Alignment) PersonDto(de.symeda.sormas.api.person.PersonDto) CssStyles(de.symeda.sormas.ui.utils.CssStyles) Map(java.util.Map) VSPACE_3(de.symeda.sormas.ui.utils.CssStyles.VSPACE_3) LayoutUtil.fluidRow(de.symeda.sormas.ui.utils.LayoutUtil.fluidRow) ValoTheme(com.vaadin.ui.themes.ValoTheme) ViewMode(de.symeda.sormas.ui.utils.ViewMode) Predicate(java.util.function.Predicate) ComboBox(com.vaadin.v7.ui.ComboBox) Set(java.util.Set) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) Field(com.vaadin.v7.ui.Field) FieldHelper(de.symeda.sormas.ui.utils.FieldHelper) Collectors(java.util.stream.Collectors) MarginInfo(com.vaadin.shared.ui.MarginInfo) DateTimeComparator(org.joda.time.DateTimeComparator) LayoutUtil.locsCss(de.symeda.sormas.ui.utils.LayoutUtil.locsCss) List(java.util.List) Stream(java.util.stream.Stream) Optional(java.util.Optional) TextField(com.vaadin.v7.ui.TextField) Descriptions(de.symeda.sormas.api.i18n.Descriptions) UiFieldAccessCheckers(de.symeda.sormas.api.utils.fieldaccess.UiFieldAccessCheckers) LayoutUtil.fluidRowLocsCss(de.symeda.sormas.ui.utils.LayoutUtil.fluidRowLocsCss) LayoutUtil.fluidRowCss(de.symeda.sormas.ui.utils.LayoutUtil.fluidRowCss) FacadeProvider(de.symeda.sormas.api.FacadeProvider) OutbreakFieldVisibilityChecker(de.symeda.sormas.ui.utils.OutbreakFieldVisibilityChecker) HashMap(java.util.HashMap) ErrorLevel(com.vaadin.shared.ui.ErrorLevel) SymptomsContext(de.symeda.sormas.api.symptoms.SymptomsContext) ArrayList(java.util.ArrayList) SymptomGrouping(de.symeda.sormas.api.utils.SymptomGrouping) LayoutUtil.loc(de.symeda.sormas.ui.utils.LayoutUtil.loc) Image(com.vaadin.ui.Image) SymptomState(de.symeda.sormas.api.symptoms.SymptomState) LayoutUtil.locCss(de.symeda.sormas.ui.utils.LayoutUtil.locCss) Label(com.vaadin.ui.Label) SymptomsDto(de.symeda.sormas.api.symptoms.SymptomsDto) NullableOptionGroup(de.symeda.sormas.ui.utils.NullableOptionGroup) LayoutUtil.fluidRowLocs(de.symeda.sormas.ui.utils.LayoutUtil.fluidRowLocs) DateField(com.vaadin.v7.ui.DateField) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ContentMode(com.vaadin.shared.ui.ContentMode) Validations(de.symeda.sormas.api.i18n.Validations) VSPACE_NONE(de.symeda.sormas.ui.utils.CssStyles.VSPACE_NONE) SymptomGroup(de.symeda.sormas.api.utils.SymptomGroup) ErrorMessage(com.vaadin.server.ErrorMessage) SymptomsHelper(de.symeda.sormas.api.symptoms.SymptomsHelper) Captions(de.symeda.sormas.api.i18n.Captions) FieldGroup(com.vaadin.v7.data.fieldgroup.FieldGroup) Button(com.vaadin.ui.Button) Disease(de.symeda.sormas.api.Disease) HorizontalLayout(com.vaadin.ui.HorizontalLayout) LayoutUtil.fluidColumn(de.symeda.sormas.ui.utils.LayoutUtil.fluidColumn) HospitalizationDto(de.symeda.sormas.api.hospitalization.HospitalizationDto) CongenitalHeartDiseaseType(de.symeda.sormas.api.symptoms.CongenitalHeartDiseaseType) FieldVisibilityCheckers(de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers) Comparator(java.util.Comparator) Strings(de.symeda.sormas.api.i18n.Strings) Component(com.vaadin.ui.Component) ComboBox(com.vaadin.v7.ui.ComboBox) Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout) AbstractField(com.vaadin.v7.ui.AbstractField) Field(com.vaadin.v7.ui.Field) TextField(com.vaadin.v7.ui.TextField) DateField(com.vaadin.v7.ui.DateField) Button(com.vaadin.ui.Button) MarginInfo(com.vaadin.shared.ui.MarginInfo) ErrorLevel(com.vaadin.shared.ui.ErrorLevel) TextField(com.vaadin.v7.ui.TextField) DateField(com.vaadin.v7.ui.DateField) ErrorMessage(com.vaadin.server.ErrorMessage) Component(com.vaadin.ui.Component)

Aggregations

ErrorMessage (com.vaadin.server.ErrorMessage)1 ThemeResource (com.vaadin.server.ThemeResource)1 ContentMode (com.vaadin.shared.ui.ContentMode)1 ErrorLevel (com.vaadin.shared.ui.ErrorLevel)1 MarginInfo (com.vaadin.shared.ui.MarginInfo)1 Alignment (com.vaadin.ui.Alignment)1 Button (com.vaadin.ui.Button)1 Component (com.vaadin.ui.Component)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Image (com.vaadin.ui.Image)1 Label (com.vaadin.ui.Label)1 ValoTheme (com.vaadin.ui.themes.ValoTheme)1 FieldGroup (com.vaadin.v7.data.fieldgroup.FieldGroup)1 ConversionException (com.vaadin.v7.data.util.converter.Converter.ConversionException)1 AbstractField (com.vaadin.v7.ui.AbstractField)1 ComboBox (com.vaadin.v7.ui.ComboBox)1 DateField (com.vaadin.v7.ui.DateField)1 Field (com.vaadin.v7.ui.Field)1 TextField (com.vaadin.v7.ui.TextField)1 Disease (de.symeda.sormas.api.Disease)1