List of usage examples for com.vaadin.ui CheckBoxGroup setItems
@Override public default void setItems(Collection<T> items)
From source file:org.jpos.qi.eeuser.ConsumersView.java
License:Open Source License
protected Component buildAndBindCustomComponent(String propertyId) { if ("roles".equalsIgnoreCase(propertyId)) { CheckBoxGroup<Role> checkBoxGroup = new CheckBoxGroup<>(QIUtils.getCaptionFromId(propertyId)); checkBoxGroup.setItems(((ConsumersHelper) getHelper()).getRoles()); checkBoxGroup.setItemCaptionGenerator(role -> StringUtils.capitalize(role.getName())); formatField(propertyId, checkBoxGroup).bind(propertyId); return checkBoxGroup; }//from w w w . ja v a 2 s. com if ("user".equalsIgnoreCase(propertyId)) { ComboBox<User> box = createUserBox(); formatField(propertyId, box).bind(propertyId); box.setEnabled(false); box.setValue(this.selectedUser); return box; } if ("startdate".equalsIgnoreCase(propertyId) || "endDate".equalsIgnoreCase(propertyId)) { return buildAndBindDateField(propertyId); } return null; }
From source file:org.jpos.qi.eeuser.RolesView.java
License:Open Source License
@Override protected Component buildAndBindCustomComponent(String propertyId) { List<Validator> validators = getValidators(propertyId); if ("permissions".equals(propertyId)) { CheckBoxGroup<Permission> f = new CheckBoxGroup("Permissions"); List<SysConfig> sysconfigs = ((RolesHelper) getHelper()).getPermissions(); List<Permission> allPermissions = new ArrayList<>(); //convert SysConfigs to Permissions for (SysConfig sys : sysconfigs) { Permission p = Permission.valueOf(sys.getId().substring(5)); allPermissions.add(p);/*from ww w . j av a 2 s .c om*/ } f.setItems(allPermissions); f.setItemCaptionGenerator((ItemCaptionGenerator<Permission>) item -> sysconfigs .get(allPermissions.indexOf(item)).getId().substring(5) + " : " + //remove "perm." prefix sysconfigs.get(allPermissions.indexOf(item)).getValue()); Binder.BindingBuilder builder = getBinder().forField(f); validators.forEach(builder::withValidator); builder.bind(propertyId); return f; } return null; }
From source file:org.jpos.qi.eeuser.UsersView.java
License:Open Source License
protected Component buildAndBindCustomComponent(String propertyId) { if ("roles".equals(propertyId)) { CheckBoxGroup g = new CheckBoxGroup(StringUtils.capitalize(getCaptionFromId(propertyId))); g.setItems(((UsersHelper) getHelper()).getRoles()); g.setItemCaptionGenerator((ItemCaptionGenerator<Role>) item -> StringUtils.capitalize(item.getName())); List<Validator> v = getValidators(propertyId); Binder.BindingBuilder builder = getBinder().forField(g); for (Validator val : v) { builder.withValidator(val); }/* w w w. j av a 2 s .com*/ builder.bind(propertyId); return g; } return null; }