use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class TransitionSection method drawWidgets.
public void drawWidgets(Composite composite, WorkflowElement selection) {
transition = (Transition) selection;
// id text field
idPropertyEditor = new PropertyEditor(transition, PropertyEditor.TYPE_TEXT);
idPropertyEditor.setLabel("ID");
idPropertyEditor.setWidth(150);
idPropertyEditor.setReadOnly(true);
idPropertyEditor.render(composite);
// result code text field
resultCodePropertyEditor = new PropertyEditor(transition, PropertyEditor.TYPE_TEXT);
resultCodePropertyEditor.setLabel("Result");
resultCodePropertyEditor.setWidth(190);
resultCodePropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
transition.setCompletionCode((String) newValue);
}
});
resultCodePropertyEditor.render(composite);
// event type combo
eventTypePropertyEditor = new PropertyEditor(transition, PropertyEditor.TYPE_COMBO);
eventTypePropertyEditor.setLabel("Event Type");
eventTypePropertyEditor.setWidth(175);
eventTypePropertyEditor.setReadOnly(true);
eventTypePropertyEditor.setValueOptions(Transition.getEventTypes());
eventTypePropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
transition.setEventType((String) newValue);
}
});
eventTypePropertyEditor.render(composite);
// retry count text field
retryCountPropertyEditor = new PropertyEditor(transition, PropertyEditor.TYPE_TEXT);
retryCountPropertyEditor.setLabel("Retry Count");
retryCountPropertyEditor.setWidth(150);
retryCountPropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
String value = (String) newValue;
transition.setRetryCount(value.length() == 0 ? 0 : Integer.parseInt(value));
}
});
retryCountPropertyEditor.render(composite);
// transition delay text field
delayPropertyEditor = new PropertyEditor(transition, PropertyEditor.TYPE_TIMER);
delayPropertyEditor.setLabel("Delay");
delayPropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
TimeInterval.TimerValue timerValue = (TimeInterval.TimerValue) newValue;
if (timerValue.getUnits().equals(TimeInterval.Units.Seconds))
transition.setDelay(timerValue.getInterval() + "s");
else if (timerValue.getUnits().equals(TimeInterval.Units.Minutes))
transition.setDelay(timerValue.getInterval().equals("0") ? null : timerValue.getInterval());
else if (timerValue.getUnits().equals(TimeInterval.Units.Hours))
transition.setDelay(timerValue.getInterval() + "h");
}
});
delayPropertyEditor.render(composite);
// link style combo
stylePropertyEditor = new PropertyEditor(transition, PropertyEditor.TYPE_IMAGE_COMBO);
stylePropertyEditor.setLabel("Style");
stylePropertyEditor.setWidth(72);
List<String> listStyles = Transition.getLinkStyles();
List<Image> listStyleImages = Transition.getLinkStyleImages();
if (transition.getProject().checkRequiredVersion(6)) {
listStyles.remove(1);
listStyleImages.remove(1);
}
stylePropertyEditor.setValueOptions(listStyles);
stylePropertyEditor.setImageOptions(listStyleImages);
stylePropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
String newStyle = (String) newValue;
transition.setStyle(newStyle);
// logic copied from LinkAttrDialog
if (newStyle.equals(Link.CURVE))
controlPointsPropertyEditor.setMaxValue(4);
else if (newStyle.equals(Link.STRAIGHT))
controlPointsPropertyEditor.setMaxValue(8);
else
// Link.ELBOW, Link.ELBOWH, Link.ELBOWV
controlPointsPropertyEditor.setMaxValue(8);
}
});
stylePropertyEditor.render(composite);
// control points spinner
controlPointsPropertyEditor = new PropertyEditor(transition, PropertyEditor.TYPE_SPINNER);
controlPointsPropertyEditor.setLabel("Control Points");
controlPointsPropertyEditor.setWidth(50);
controlPointsPropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
transition.setControlPoints(Integer.parseInt((String) newValue));
}
});
controlPointsPropertyEditor.render(composite);
controlPointsPropertyEditor.setMinValue(2);
controlPointsPropertyEditor.setMaxValue(8);
}
use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class WorkflowAssetCustomSection method drawWidgets.
public void drawWidgets(Composite composite, WorkflowElement selection) {
workflowAsset = (WorkflowAsset) selection;
// attr definition text area
customAttrsPropEditor = new PropertyEditor(workflowAsset, PropertyEditor.TYPE_TEXT);
customAttrsPropEditor.setLabel("Custom Attr Definition\n(Pagelet Syntax)");
customAttrsPropEditor.setMultiLine(true);
customAttrsPropEditor.setWidth(475);
customAttrsPropEditor.setHeight(80);
customAttrsPropEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
String def = newValue == null || ((String) newValue).length() == 0 ? null : (String) newValue;
if (customAttribute == null)
customAttribute = new CustomAttributeVO("RULE_SET", workflowAsset.getLanguage());
customAttribute.setDefinition(def);
}
});
customAttrsPropEditor.render(composite);
// roles picklist
rolesPropertyEditor = new PropertyEditor(workflowAsset, PropertyEditor.TYPE_PICKLIST);
rolesPropertyEditor.setValueConverter(new ListConverter());
rolesPropertyEditor.setLabel("Custom Attr Edit Roles:Unselected~Permitted");
PluginDataAccess dataAccess = workflowAsset.getProject().getDataAccess();
rolesPropertyEditor.setValueOptions(dataAccess.getRoleNames(false));
rolesPropertyEditor.addValueChangeListener(new ValueChangeListener() {
@SuppressWarnings("unchecked")
public void propertyValueChanged(Object newValue) {
if (customAttribute == null)
customAttribute = new CustomAttributeVO("RULE_SET", workflowAsset.getLanguage());
if (newValue == null)
customAttribute.setRoles(null);
else
customAttribute.setRoles((List<String>) newValue);
}
});
rolesPropertyEditor.render(composite);
rolesPropertyEditor.setValue("");
// save button
savePropertyEditor = new PropertyEditor(workflowAsset, PropertyEditor.TYPE_BUTTON);
savePropertyEditor.setLabel("Save");
savePropertyEditor.setComment("Save Custom Attrs:");
savePropertyEditor.setWidth(65);
savePropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
saveCustomAttribute();
}
});
savePropertyEditor.render(composite);
// help link
helpLinkPropertyEditor = new PropertyEditor(workflowAsset, PropertyEditor.TYPE_LINK);
helpLinkPropertyEditor.setLabel("Custom Attributes Help");
helpLinkPropertyEditor.render(composite);
}
use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class WorkflowAssetSection method drawWidgets.
public void drawWidgets(Composite composite, WorkflowElement selection) {
workflowAsset = (WorkflowAsset) selection;
// id text field
idPropertyEditor = new PropertyEditor(workflowAsset, PropertyEditor.TYPE_TEXT);
idPropertyEditor.setLabel("ID");
idPropertyEditor.setWidth(150);
idPropertyEditor.setReadOnly(true);
idPropertyEditor.render(composite);
// name text field
namePropertyEditor = new PropertyEditor(workflowAsset, PropertyEditor.TYPE_TEXT);
namePropertyEditor.setLabel("Name");
namePropertyEditor.setWidth(415);
namePropertyEditor.setReadOnly(true);
namePropertyEditor.render(composite);
// language text field
languagePropertyEditor = new PropertyEditor(workflowAsset, PropertyEditor.TYPE_TEXT);
languagePropertyEditor.setLabel("Type");
languagePropertyEditor.setWidth(200);
languagePropertyEditor.setReadOnly(true);
languagePropertyEditor.render(composite);
// link
linkPropertyEditor = new PropertyEditor(workflowAsset, PropertyEditor.TYPE_LINK);
linkPropertyEditor.setLabel("Open " + workflowAsset.getTitle());
linkPropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
openWorkflowAsset();
}
});
linkPropertyEditor.render(composite);
// version comment text field
versionCommentPropertyEditor = new PropertyEditor(workflowAsset, PropertyEditor.TYPE_TEXT);
versionCommentPropertyEditor.setLabel("Version Comment");
versionCommentPropertyEditor.setMultiLine(true);
versionCommentPropertyEditor.setHeight(75);
versionCommentPropertyEditor.setReadOnly(true);
versionCommentPropertyEditor.render(composite);
}
use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class SimulationSection method drawWidgets.
public void drawWidgets(Composite composite, WorkflowElement selection) {
activity = (Activity) selection;
if (responseListTableEditor == null)
responseListTableEditor = new TableEditor(activity, TableEditor.TYPE_TABLE);
if (columnSpecs == null)
columnSpecs = createColumnSpecs();
responseListTableEditor.setColumnSpecs(columnSpecs);
if (contentProvider == null)
contentProvider = new SimulationContentProvider();
if (labelProvider == null)
labelProvider = new SimulationLabelProvider();
if (cellModifier == null)
cellModifier = new SimulationCellModifier();
if (modelUpdater == null)
modelUpdater = new SimulationModelUpdater();
// simulation radio button
simPropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_RADIO);
simPropertyEditor.setLabel("Simulation Mode");
simPropertyEditor.setWidth(85);
ArrayList<String> simOpts = new ArrayList<String>();
simOpts.add("On");
simOpts.add("Off");
simPropertyEditor.setValueOptions(simOpts);
simPropertyEditor.setDefaultValue("Off");
simPropertyEditor.setFireDirtyStateChange(false);
simPropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
activity.setAttribute(WorkAttributeConstant.SIMULATION_STUB_MODE, (String) newValue);
setDirty(true);
}
});
simPropertyEditor.render(composite);
// response table
responseListTableEditor.setWidth(500);
responseListTableEditor.setHeight(100);
responseListTableEditor.setFillWidth(true);
responseListTableEditor.setReadOnly(false);
responseListTableEditor.setFireDirtyStateChange(false);
responseListTableEditor.setContentProvider(contentProvider);
responseListTableEditor.setLabelProvider(labelProvider);
responseListTableEditor.setModelUpdater(modelUpdater);
responseListTableEditor.setCellModifier(cellModifier);
responseListTableEditor.setLabel("Responses");
responseListTableEditor.render(composite);
responseListTableEditor.getTable().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
SimulationResponseVO response = (SimulationResponseVO) e.item.getData();
String responseString = response == null ? null : response.getResponse();
ValueDisplayDialog dlg = new ValueDisplayDialog(getShell(), responseString);
dlg.open();
}
});
// save button
createSaveButton();
// help link
// spacer
new Label(composite, SWT.NONE);
helpPropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_LINK);
helpPropertyEditor.setLabel("Simulation Mode Help");
helpPropertyEditor.render(composite);
helpPropertyEditor.setValue("/MDWHub/doc/todo.html");
}
use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class AssetDrivenActivityCustomSection method determineCustomAttr.
private CustomAttributeVO determineCustomAttr(Activity activity) {
PropertyEditorList propEditorList = new PropertyEditorList(activity);
for (PropertyEditor propertyEditor : propEditorList) {
if (propertyEditor instanceof WorkflowAssetEditor) {
WorkflowAssetEditor assetEditor = (WorkflowAssetEditor) propertyEditor;
propertyEditor.setValue(activity);
AssetLocator locator = new AssetLocator(assetEditor.getElement(), assetEditor.getLocatorType());
WorkflowAsset asset = (WorkflowAsset) locator.assetFromAttr(activity.getAttribute(assetEditor.getAttributeName()));
if (asset != null) {
// language definitively determined by selected asset
return activity.getProject().getDataAccess().getAssetCustomAttribute(asset.getLanguage());
} else {
// guess language based on presence of custom attributes
for (String language : assetEditor.getAssetTypes()) {
CustomAttributeVO customAttr = activity.getProject().getDataAccess().getAssetCustomAttribute(language);
if (customAttr != null && !StringHelper.isEmpty(customAttr.getDefinition()))
return customAttr;
}
}
}
}
return null;
}
Aggregations