Search in sources :

Example 6 with ValueChangeListener

use of com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener in project mdw-designer by CenturyLinkCloud.

the class ProcessVersionsSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    process = (WorkflowProcess) selection;
    tableEditor = new TableEditor(process, TableEditor.TYPE_TABLE);
    List<ColumnSpec> columnSpecs = new ArrayList<ColumnSpec>();
    ColumnSpec packageColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Package", "package");
    packageColSpec.width = 160;
    columnSpecs.add(packageColSpec);
    ColumnSpec versionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Version", "version");
    versionColSpec.width = 60;
    columnSpecs.add(versionColSpec);
    ColumnSpec idColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "ID", "id");
    idColSpec.width = 65;
    columnSpecs.add(idColSpec);
    ColumnSpec createDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Created", "createDate");
    createDateColSpec.width = 110;
    columnSpecs.add(createDateColSpec);
    ColumnSpec userColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "User", "user");
    userColSpec.width = 75;
    columnSpecs.add(userColSpec);
    ColumnSpec commentsColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Comments", "comments");
    commentsColSpec.width = 200;
    columnSpecs.add(commentsColSpec);
    ColumnSpec lockedToColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Locked To", "lockedTo");
    lockedToColSpec.width = 75;
    columnSpecs.add(lockedToColSpec);
    ColumnSpec modDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Last Modified", "modDate");
    modDateColSpec.width = 110;
    columnSpecs.add(modDateColSpec);
    tableEditor.setColumnSpecs(columnSpecs);
    tableEditor.setReadOnly(true);
    tableEditor.setContentProvider(new ProcessVersionContentProvider());
    tableEditor.setLabelProvider(new ProcessVersionLabelProvider());
    tableEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            openProcess((WorkflowProcess) newValue);
        }
    });
    tableEditor.render(composite);
    // right-click menu
    tableEditor.getTable().addListener(SWT.MenuDetect, new Listener() {

        public void handleEvent(Event event) {
            tableEditor.getTable().setMenu(createContextMenu(tableEditor.getTable().getShell()));
        }
    });
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) Listener(org.eclipse.swt.widgets.Listener) ElementChangeListener(com.centurylink.mdw.plugin.designer.model.ElementChangeListener) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) ArrayList(java.util.ArrayList) Event(org.eclipse.swt.widgets.Event) ElementChangeEvent(com.centurylink.mdw.plugin.designer.model.ElementChangeEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 7 with ValueChangeListener

use of com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener 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);
}
Also used : ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) TimeInterval(com.centurylink.mdw.plugin.designer.properties.editor.TimeInterval) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor) Image(org.eclipse.swt.graphics.Image)

Example 8 with ValueChangeListener

use of com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener 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);
}
Also used : ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) CustomAttributeVO(com.centurylink.mdw.model.value.attribute.CustomAttributeVO) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor) ListConverter(com.centurylink.mdw.plugin.designer.properties.convert.ListConverter) PluginDataAccess(com.centurylink.mdw.plugin.designer.PluginDataAccess)

Example 9 with ValueChangeListener

use of com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener 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);
}
Also used : ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)

Example 10 with ValueChangeListener

use of com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener 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");
}
Also used : ValueDisplayDialog(com.centurylink.mdw.plugin.designer.dialogs.ValueDisplayDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ArrayList(java.util.ArrayList) Label(org.eclipse.swt.widgets.Label) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)

Aggregations

ValueChangeListener (com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener)44 PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)36 TableEditor (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)9 ArrayList (java.util.ArrayList)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 ArtifactEditor (com.centurylink.mdw.plugin.designer.properties.editor.ArtifactEditor)5 Event (org.eclipse.swt.widgets.Event)5 Label (org.eclipse.swt.widgets.Label)5 Listener (org.eclipse.swt.widgets.Listener)5 DateConverter (com.centurylink.mdw.plugin.designer.properties.convert.DateConverter)4 ColumnSpec (com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec)3 PropertyEditorList (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditorList)3 FontData (org.eclipse.swt.graphics.FontData)3 CustomAttributeVO (com.centurylink.mdw.model.value.attribute.CustomAttributeVO)2 ElementChangeEvent (com.centurylink.mdw.plugin.designer.model.ElementChangeEvent)2 ElementChangeListener (com.centurylink.mdw.plugin.designer.model.ElementChangeListener)2 EmbeddedSubProcess (com.centurylink.mdw.plugin.designer.model.EmbeddedSubProcess)2 TimeInterval (com.centurylink.mdw.plugin.designer.properties.editor.TimeInterval)2 WorkflowAssetEditor (com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor)2 MarkdownRenderer (com.centurylink.mdw.designer.utils.MarkdownRenderer)1