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);
}
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);
}
}
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);
}
}
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);
}
}
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);
}
Aggregations