List of usage examples for com.vaadin.ui ComboBox ComboBox
public ComboBox(String caption, Collection<T> options)
From source file:pl.exsio.ca.module.terrain.evidence.NotificationsDataTable.java
License:Open Source License
private ComboBox getEventField(EntityItem<? extends TerrainNotification> item) { JPAContainer<? extends pl.exsio.ca.model.Event> events = JPAContainerFactory.make( this.caEntities.getEventClass(), this.caEntityProviders.getEventEntityProvider().getEntityManager()); events.setEntityProvider(this.caEntityProviders.getEventEntityProvider()); events.sort(new Object[] { "startDate" }, new boolean[] { false }); ComboBox event = new ComboBox(t("event"), events); event.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); event.setItemCaptionPropertyId("name"); event.setPropertyDataSource(item.getItemProperty("event")); event.setConverter(new SingleSelectConverter(event)); return event; }
From source file:pl.exsio.ca.module.terrain.evidence.NotificationsDataTable.java
License:Open Source License
private ComboBox getAssignmentField(EntityItem<? extends TerrainNotification> item) throws Property.ReadOnlyException, UnsupportedFilterException { JPAContainer<? extends TerrainAssignment> assignments = JPAContainerFactory.make( this.caEntities.getTerrainAssignmentClass(), this.caEntityProviders.getTerrainAssignmentEntityProvider().getEntityManager()); assignments.setEntityProvider(this.caEntityProviders.getTerrainAssignmentEntityProvider()); assignments.addContainerFilter(eq("terrain", this.terrain)); ComboBox assignment = new ComboBox(t("assignment"), assignments); assignment.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); assignment.setItemCaptionPropertyId("caption"); assignment.setPropertyDataSource(item.getItemProperty("assignment")); assignment.setConverter(new SingleSelectConverter(assignment)); if (item.getItemProperty("assignment").getValue() == null) { TerrainAssignment activeAssignment = this.caRepositories.getTerrainAssignmentRepository() .findActive(this.terrain); if (activeAssignment instanceof TerrainAssignment) { assignment.setValue(activeAssignment.getId()); }//w w w. j a va 2 s . c o m } assignment.setNullSelectionAllowed(false); assignment.addValidator(new NullValidator(t("invalid_assignment"), false)); return assignment; }
From source file:pl.exsio.ca.module.terrain.evidence.QuickNotifyWindow.java
License:Open Source License
private ComboBox getEventField() { JPAContainer<? extends pl.exsio.ca.model.Event> events = JPAContainerFactory.make( this.caEntities.getEventClass(), this.caEntityProviders.getEventEntityProvider().getEntityManager()); events.setEntityProvider(this.caEntityProviders.getEventEntityProvider()); events.sort(new Object[] { "startDate" }, new boolean[] { false }); ComboBox event = new ComboBox("", events); event.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); event.setItemCaptionPropertyId("name"); event.setConverter(new SingleSelectConverter(event)); return event; }
From source file:pl.exsio.ca.module.terrain.evidence.TerrainDataTable.java
License:Open Source License
private ComboBox getGroupsCombo() throws UnsupportedFilterException { JPAContainer<ServiceGroup> groupsContainer = JPAContainerFactory.make( this.caEntities.getServiceGroupClass(), this.caEntityProviders.getServiceGroupEntityProvider().getEntityManager()); groupsContainer.setEntityProvider(this.caEntityProviders.getServiceGroupEntityProvider()); groupsContainer.addContainerFilter(eq("archival", false)); final ComboBox groups = new ComboBox(t("pick_group"), groupsContainer); groups.setConverter(new SingleSelectConverter<ServiceGroup>(groups)); groups.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); groups.setItemCaptionPropertyId("caption"); return groups; }
From source file:pl.exsio.ca.module.terrain.report.impl.AbstractReportImpl.java
License:Open Source License
protected ComboBox getGroupsCombo() throws UnsupportedFilterException { JPAContainer<ServiceGroup> groupsContainer = JPAContainerFactory.make( this.caEntities.getServiceGroupClass(), this.caEntityProviders.getServiceGroupEntityProvider().getEntityManager()); groupsContainer.setEntityProvider(this.caEntityProviders.getServiceGroupEntityProvider()); groupsContainer.addContainerFilter(eq("archival", false)); final ComboBox groups = new ComboBox(t("group"), groupsContainer); groups.setConverter(new SingleSelectConverter<ServiceGroup>(groups)); groups.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); groups.setItemCaptionPropertyId("caption"); return groups; }
From source file:pl.exsio.ca.module.terrain.report.impl.EventReportImpl.java
License:Open Source License
private ComboBox getEventsCombo() { JPAContainer<pl.exsio.ca.model.Event> container = JPAContainerFactory.make(this.caEntities.getEventClass(), this.caEntityProviders.getEventEntityProvider().getEntityManager()); container.setEntityProvider(this.caEntityProviders.getEventEntityProvider()); container.sort(new Object[] { "startDate" }, new boolean[] { false }); final ComboBox picker = new ComboBox(t("pick"), container); picker.setNullSelectionAllowed(false); picker.setConverter(new SingleSelectConverter<pl.exsio.ca.model.Event>(picker)); if (!picker.getItemIds().isEmpty()) { picker.select(picker.getItemIds().toArray()[0]); }/*from w ww . j a va 2s . com*/ picker.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); picker.setItemCaptionPropertyId("name"); return picker; }
From source file:pl.exsio.frameset.vaadin.ui.support.component.data.form.SecurityPermissionsForm.java
License:Open Source License
@Override protected void doInit() { this.setMargin(true); final JPAContainer<? extends Role> roles = JPAContainerFactory.make(this.getRoleClass(), this.entityProvider.getEntityManager()); ComboBox roleSelect = new ComboBox(t("core.security.management.roles"), roles); roleSelect.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); roleSelect.setItemCaptionPropertyId("label"); this.addComponent(roleSelect); final FormLayout permissionsLayout = new FormLayout(); this.addComponent(permissionsLayout); final Map<String, Permission> permissionsMap = this.permissionMapProvider.getPermissionMap(); this.handleRoleSelectionChange(roleSelect, permissionsLayout, roles, permissionsMap); }