public QueueForm(final ProcessToolContext ctx, final I18NSource source, final GenericVaadinPortlet2BpmApplication application) {
setFormFieldFactory(new DefaultFieldFactory() {
@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
Field field = super.createField(item, propertyId, uiContext);
if ("process".equalsIgnoreCase(propertyId.toString())) {
NativeSelect select = new NativeSelect();
Collection<ProcessDefinitionConfig> processes = ctx.getProcessDefinitionDAO().getActiveConfigurations();
BeanItemContainer<ProcessDefinitionConfig> ds = new BeanItemContainer<ProcessDefinitionConfig>(ProcessDefinitionConfig.class);
ds.addAll(processes);
select.setContainerDataSource(ds);
select.setItemCaptionPropertyId("description");
select.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
select.setNullSelectionAllowed(false);
select.setRequired(true);
select.setPropertyDataSource(item.getItemProperty(propertyId));
field = select;
}
else if ("name".equalsIgnoreCase(propertyId.toString())) {
TextField text = new TextField();
text.setNullRepresentation("");
text.setRequired(true);
field = text;
}
else if ("description".equalsIgnoreCase(propertyId.toString())) {
TextField text = new TextField();
text.setNullRepresentation("");
text.setRequired(true);
field = text;
}
else if ("rights".equalsIgnoreCase(propertyId.toString())) {
RightsTable rights = new RightsTable(source, application);
//rights.setHeight("150px");
rights.setRequired(true);
field = rights;
}
field.setCaption(source.getMessage("queues.add.form." + propertyId));
field.setWidth(100, Sizeable.UNITS_PERCENTAGE);
return field;
}
});
}