Search in sources :

Example 71 with ComboBox

use of com.vaadin.v7.ui.ComboBox in project SORMAS-Project by hzi-braunschweig.

the class ContactsFilterForm method populateContactResponsibles.

private void populateContactResponsibles(List<UserReferenceDto> items) {
    final ComboBox officerField = getField(ContactCriteria.CONTACT_OFFICER);
    officerField.removeAllItems();
    officerField.addItems(items);
}
Also used : ComboBox(com.vaadin.v7.ui.ComboBox)

Example 72 with ComboBox

use of com.vaadin.v7.ui.ComboBox in project SORMAS-Project by hzi-braunschweig.

the class CommunityEditForm method addFields.

@Override
protected void addFields() {
    addField(CommunityDto.NAME, TextField.class);
    ComboBox region = addInfrastructureField(CommunityDto.REGION);
    ComboBox district = addInfrastructureField(CommunityDto.DISTRICT);
    addField(RegionDto.EXTERNAL_ID, TextField.class);
    setRequired(true, CommunityDto.NAME, CommunityDto.REGION, CommunityDto.DISTRICT);
    region.addValueChangeListener(e -> {
        RegionReferenceDto regionDto = (RegionReferenceDto) e.getProperty().getValue();
        FieldHelper.updateItems(district, regionDto != null ? FacadeProvider.getDistrictFacade().getAllActiveByRegion(regionDto.getUuid()) : null);
    });
    district.addValueChangeListener(e -> {
        if (e.getProperty().getValue() != null && region.getValue() == null) {
            DistrictDto communityDistrict = FacadeProvider.getDistrictFacade().getByUuid(((DistrictReferenceDto) e.getProperty().getValue()).getUuid());
            region.setValue(communityDistrict.getRegion());
        }
    });
    region.addItems(FacadeProvider.getRegionFacade().getAllActiveAsReference());
    // TODO: Workaround until cases and other data is properly transfered when infrastructure data changes
    if (!create) {
        region.setEnabled(false);
        district.setEnabled(false);
    }
}
Also used : DistrictDto(de.symeda.sormas.api.infrastructure.district.DistrictDto) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) ComboBox(com.vaadin.v7.ui.ComboBox)

Example 73 with ComboBox

use of com.vaadin.v7.ui.ComboBox in project SORMAS-Project by hzi-braunschweig.

the class SubcontinentEditForm method addFields.

@Override
protected void addFields() {
    if (create == null) {
        return;
    }
    addField(SubcontinentDto.DEFAULT_NAME, TextField.class);
    addField(SubcontinentDto.EXTERNAL_ID, TextField.class);
    ComboBox continent = addInfrastructureField(SubcontinentDto.CONTINENT);
    continent.addItems(FacadeProvider.getContinentFacade().getAllActiveAsReference());
    initializeVisibilitiesAndAllowedVisibilities();
    setRequired(true, SubcontinentDto.DEFAULT_NAME, SubcontinentDto.CONTINENT);
    if (!create) {
        continent.setEnabled(false);
    }
}
Also used : ComboBox(com.vaadin.v7.ui.ComboBox)

Example 74 with ComboBox

use of com.vaadin.v7.ui.ComboBox in project SORMAS-Project by hzi-braunschweig.

the class CountryEditForm method addFields.

@Override
protected void addFields() {
    if (create == null) {
        return;
    }
    addField(CountryDto.DEFAULT_NAME, TextField.class);
    addField(CountryDto.ISO_CODE, TextField.class).setMaxLength(3);
    addField(CountryDto.EXTERNAL_ID, TextField.class);
    addField(CountryDto.UNO_CODE, TextField.class).setMaxLength(3);
    ComboBox subcontinent = addInfrastructureField(CountryDto.SUBCONTINENT);
    subcontinent.addItems(FacadeProvider.getSubcontinentFacade().getAllActiveAsReference());
    initializeVisibilitiesAndAllowedVisibilities();
    setRequired(true, CountryDto.DEFAULT_NAME, CountryDto.ISO_CODE);
    if (!create) {
        subcontinent.setEnabled(false);
    }
}
Also used : ComboBox(com.vaadin.v7.ui.ComboBox) TextField(com.vaadin.v7.ui.TextField)

Example 75 with ComboBox

use of com.vaadin.v7.ui.ComboBox in project SORMAS-Project by hzi-braunschweig.

the class RegionEditForm method addFields.

@Override
protected void addFields() {
    if (create == null) {
        return;
    }
    addField(RegionDto.NAME, TextField.class);
    addField(RegionDto.EPID_CODE, TextField.class);
    ComboBox country = addInfrastructureField(RegionDto.COUNTRY);
    ComboBox area = addInfrastructureField(RegionDto.AREA);
    addField(RegionDto.EXTERNAL_ID, TextField.class);
    // TextField growthRate = addField(RegionDto.GROWTH_RATE, TextField.class);
    // growthRate.setConverter(new StringToFloatConverter());
    // growthRate.setConversionError(I18nProperties.getValidationError(Validations.onlyDecimalNumbersAllowed, growthRate.getCaption()));
    initializeVisibilitiesAndAllowedVisibilities();
    setRequired(true, RegionDto.NAME, RegionDto.EPID_CODE);
    country.addItems(FacadeProvider.getCountryFacade().getAllActiveAsReference());
    area.addItems(FacadeProvider.getAreaFacade().getAllActiveAsReference());
    FieldHelper.setVisibleWhen(country, Collections.singletonList(area), Arrays.asList(null, FacadeProvider.getCountryFacade().getServerCountry()), true);
}
Also used : ComboBox(com.vaadin.v7.ui.ComboBox)

Aggregations

ComboBox (com.vaadin.v7.ui.ComboBox)113 TextField (com.vaadin.v7.ui.TextField)43 RegionReferenceDto (de.symeda.sormas.api.infrastructure.region.RegionReferenceDto)31 DistrictReferenceDto (de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto)28 Label (com.vaadin.ui.Label)24 Disease (de.symeda.sormas.api.Disease)24 TextArea (com.vaadin.v7.ui.TextArea)19 UserDto (de.symeda.sormas.api.user.UserDto)19 NullableOptionGroup (de.symeda.sormas.ui.utils.NullableOptionGroup)19 DateField (com.vaadin.v7.ui.DateField)18 List (java.util.List)18 CheckBox (com.vaadin.v7.ui.CheckBox)17 FacadeProvider (de.symeda.sormas.api.FacadeProvider)17 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)17 DateComparisonValidator (de.symeda.sormas.ui.utils.DateComparisonValidator)17 CommunityReferenceDto (de.symeda.sormas.api.infrastructure.community.CommunityReferenceDto)16 AbstractEditForm (de.symeda.sormas.ui.utils.AbstractEditForm)16 Field (com.vaadin.v7.ui.Field)15 FieldVisibilityCheckers (de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers)15 Captions (de.symeda.sormas.api.i18n.Captions)14