List of usage examples for com.vaadin.v7.ui ComboBox setWidth
public void setWidth(float width, Unit unit);
From source file:de.symeda.sormas.ui.configuration.infrastructure.CommunityEditForm.java
License:Open Source License
@Override protected void addFields() { addField(CommunityDto.NAME, TextField.class); ComboBox region = new ComboBox(); region.setCaption(I18nProperties.getPrefixCaption(CommunityDto.I18N_PREFIX, REGION_LOC)); region.setWidth(100, Unit.PERCENTAGE); getContent().addComponent(region, REGION_LOC); ComboBox district = addField(CommunityDto.DISTRICT, ComboBox.class); setRequired(true, CommunityDto.NAME, CommunityDto.DISTRICT); region.setRequired(true);//from w w w .j a v a 2 s . c o m region.addValueChangeListener(e -> { RegionReferenceDto regionDto = (RegionReferenceDto) e.getProperty().getValue(); FieldHelper.updateItems(district, regionDto != null ? FacadeProvider.getDistrictFacade().getAllByRegion(regionDto.getUuid()) : null); }); district.addValueChangeListener(e -> { if (e.getProperty().getValue() != null && region.getValue() == null) { DistrictDto communityDistrict = FacadeProvider.getDistrictFacade() .getDistrictByUuid(((DistrictReferenceDto) e.getProperty().getValue()).getUuid()); region.setValue(communityDistrict.getRegion()); } }); region.addItems(FacadeProvider.getRegionFacade().getAllAsReference()); // TODO: Workaround until cases and other data is properly transfered when infrastructure data changes if (!create) { region.setEnabled(false); district.setEnabled(false); } }