use of org.activiti.explorer.ui.process.simple.editor.listener.DeletePropertyClickListener in project Activiti by Activiti.
the class PropertyTable method addPropertyRow.
protected void addPropertyRow(Object itemId, String propertyName, String propertyType, Boolean required) {
Object newItemId = null;
if (itemId == null) {
// add at the end of list
newItemId = addItem();
} else {
newItemId = addItemAfter(itemId);
}
Item newItem = getItem(newItemId);
// name
newItem.getItemProperty(ID_PROPERTY_NAME).setValue(propertyName == null ? DEFAULT_PROPERTY_NAME : propertyName);
// type
ComboBox typeComboBox = new ComboBox("", Arrays.asList("text", "number", "date"));
typeComboBox.setNullSelectionAllowed(false);
if (propertyType == null) {
typeComboBox.setValue(typeComboBox.getItemIds().iterator().next());
} else {
typeComboBox.setValue(propertyType);
}
newItem.getItemProperty(ID_PROPERTY_TYPE).setValue(typeComboBox);
// required
CheckBox requiredCheckBox = new CheckBox();
requiredCheckBox.setValue(required == null ? false : required);
newItem.getItemProperty(ID_PROPERTY_REQUIRED).setValue(requiredCheckBox);
// actions
HorizontalLayout actionButtons = new HorizontalLayout();
Button deleteRowButton = new Button("-");
deleteRowButton.setData(newItemId);
deleteRowButton.addListener(new DeletePropertyClickListener(this));
actionButtons.addComponent(deleteRowButton);
Button addRowButton = new Button("+");
addRowButton.setData(newItemId);
addRowButton.addListener(new AddPropertyClickListener(this));
actionButtons.addComponent(addRowButton);
newItem.getItemProperty(ID_PROPERTY_ACTIONS).setValue(actionButtons);
}
Aggregations