use of com.centurylink.mdw.plugin.designer.properties.editor.MappingEditor in project mdw-designer by CenturyLinkCloud.
the class SubProcessMappingSection method drawWidgets.
@Override
public void drawWidgets(Composite composite, WorkflowElement selection) {
activity = (Activity) selection;
mappingEditor = new MappingEditor(activity);
if (labelProvider == null)
labelProvider = new MappingLabelProvider();
mappingEditor.setLabelProvider(labelProvider);
if (cellModifier == null)
cellModifier = new MappingCellModifier();
mappingEditor.setCellModifier(cellModifier);
if (modelUpdater == null)
modelUpdater = new MappingModelUpdater();
mappingEditor.setModelUpdater(modelUpdater);
// widget creation is deferred until setSelection()
}
use of com.centurylink.mdw.plugin.designer.properties.editor.MappingEditor in project mdw-designer by CenturyLinkCloud.
the class StartProcessMappingSection method drawWidgets.
public void drawWidgets(Composite composite, WorkflowElement selection) {
activity = (Activity) selection;
mappingEditor = new MappingEditor(activity);
mappingEditor.setOwningProcess(activity.getProcess());
mappingEditor.setMappedVariables(getInputVariables());
mappingEditor.setVariableColumnLabel("Input Variable");
mappingEditor.setBindingColumnLabel("Binding Expression");
mappingEditor.render(composite);
}
use of com.centurylink.mdw.plugin.designer.properties.editor.MappingEditor in project mdw-designer by CenturyLinkCloud.
the class VariableValueDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
composite.getShell().setText("Variable Value");
Label nameLabel = new Label(composite, SWT.NONE);
nameLabel.setFont(new Font(nameLabel.getDisplay(), new FontData("Tahoma", 8, SWT.BOLD)));
nameLabel.setText(variableValue.getName());
final String type = variableValue.getType() == null ? "Unknown" : variableValue.getType().getVariableType();
new Label(composite, SWT.NONE).setText("(" + type + ")");
if (type.equals("java.lang.Boolean")) {
valueEditor = new PropertyEditor(null, PropertyEditor.TYPE_CHECKBOX);
} else if (type.equals("java.util.Date")) {
valueEditor = new PropertyEditor(null, PropertyEditor.TYPE_DATE_PICKER);
valueEditor.setWidth(100);
} else if (type.equals("java.lang.Integer") || type.equals("java.lang.Long")) {
valueEditor = new PropertyEditor(null, PropertyEditor.TYPE_TEXT);
valueEditor.setWidth(250);
valueEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
String stringValue = (String) newValue;
try {
long val = type.equals("java.lang.Long") ? Long.parseLong(stringValue) : Integer.parseInt(stringValue);
variableValue.setValue(String.valueOf(val));
} catch (NumberFormatException ex) {
String oldValue = variableValue.getValue();
valueEditor.setValue(oldValue);
}
}
});
} else if (type.equals("java.net.URI")) {
valueEditor = new PropertyEditor(null, PropertyEditor.TYPE_TEXT);
valueEditor.setWidth(450);
valueEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
try {
new URI((String) newValue);
valueEditor.setLabel("");
} catch (URISyntaxException ex) {
valueEditor.setLabel(ex.getMessage());
}
}
});
} else if (type.equals("java.lang.Integer[]") || type.equals("java.lang.Long[]") || type.equals("java.lang.String[]")) {
valueEditor = new TableEditor(null, TableEditor.TYPE_TABLE);
TableEditor tableEditor = (TableEditor) valueEditor;
List<ColumnSpec> columnSpecs = new ArrayList<ColumnSpec>();
ColumnSpec valueColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, type.substring(type.lastIndexOf('.') + 1, type.length() - 2) + " Values", type);
columnSpecs.add(valueColSpec);
tableEditor.setColumnSpecs(columnSpecs);
tableEditor.setFillWidth(true);
tableEditor.setRowDelimiter(ROW_DELIMITER);
tableEditor.setModelUpdater(new CollectionModelUpdater(tableEditor));
} else if (type.equals("java.util.Map")) {
valueEditor = new MappingEditor(null);
MappingEditor mappingEditor = (MappingEditor) valueEditor;
List<ColumnSpec> columnSpecs = new ArrayList<ColumnSpec>();
ColumnSpec keyColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Key", "key");
keyColSpec.width = 150;
columnSpecs.add(keyColSpec);
ColumnSpec valColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Value", "value");
valColSpec.width = 150;
columnSpecs.add(valColSpec);
mappingEditor.setColumnSpecs(columnSpecs);
mappingEditor.setHeight(150);
mappingEditor.setFillWidth(true);
mappingEditor.setRowDelimiter(ROW_DELIMITER);
mappingEditor.setColumnDelimiter(COLUMN_DELIMITER);
mappingEditor.setContentProvider(mappingEditor.new DefaultContentProvider());
mappingEditor.setLabelProvider(((TableEditor) mappingEditor).new DefaultLabelProvider());
mappingEditor.setCellModifier(((TableEditor) mappingEditor).new DefaultCellModifier());
mappingEditor.setModelUpdater(new CollectionModelUpdater(mappingEditor));
} else {
valueEditor = new PropertyEditor(null, PropertyEditor.TYPE_TEXT);
valueEditor.setMultiLine(true);
valueEditor.setWidth(500);
valueEditor.setHeight(500);
}
valueEditor.setReadOnly(variableValue.isReadOnly());
valueEditor.render(composite);
valueEditor.setValue(variableValue.getValue());
if (!variableValue.isReadOnly()) {
valueEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
Button okButton = getButton(Dialog.OK);
if (// else not editable
okButton != null)
okButton.setEnabled(true);
}
});
}
if (isCollectionType(type))
tentativeValueForCollection = variableValue.getValue();
if (type.equals("java.lang.Boolean"))
((Button) valueEditor.getWidget()).setText("(checked = true)");
else if (type.equals("java.lang.Object"))
valueEditor.setValue(variableValue.getValue() == null ? null : variableValue.getValue().toString());
else if (type.equals("java.lang.Integer[]") || type.equals("java.lang.Long[]")) {
if (!variableValue.isReadOnly()) {
TableEditor tableEditor = (TableEditor) valueEditor;
final CellEditor cellEditor = tableEditor.getTableViewer().getCellEditors()[0];
cellEditor.setValidator(new ICellEditorValidator() {
private String oldValue = "";
public String isValid(Object value) {
String message = validateValue((String) value, variableValue.getType().getVariableType());
if (message != null)
cellEditor.setValue(oldValue);
else
oldValue = (String) value;
return null;
}
});
}
} else if (type.equals("java.util.Map")) {
if (!variableValue.isReadOnly()) {
MappingEditor mappingEditor = (MappingEditor) valueEditor;
final CellEditor valueCellEditor = mappingEditor.getTableViewer().getCellEditors()[1];
valueCellEditor.setValidator(new ICellEditorValidator() {
public String isValid(Object value) {
String message = validateValue((String) value, variableValue.getType().getVariableType());
if (message != null)
getButton(Dialog.OK).setEnabled(false);
return null;
}
});
}
}
return composite;
}
use of com.centurylink.mdw.plugin.designer.properties.editor.MappingEditor in project mdw-designer by CenturyLinkCloud.
the class BindingsSection method drawWidgets.
@Override
public void drawWidgets(Composite composite, WorkflowElement selection) {
activity = (Activity) selection;
mappingEditor = new MappingEditor(activity);
mappingEditor.setOwningProcess(activity.getProcess());
mappingEditor.setBindingColumnLabel(findBindingsNode(activity).getAttribute("LABEL"));
mappingEditor.render(composite);
}
Aggregations