Search in sources :

Example 36 with ValueChangeListener

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

the class SubProcessInstancesSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    this.element = selection;
    tableEditor = new TableEditor(element, TableEditor.TYPE_TABLE);
    tableEditor.setReadOnly(true);
    if (columnSpecs == null)
        columnSpecs = createColumnSpecs();
    tableEditor.setColumnSpecs(columnSpecs);
    if (contentProvider == null)
        contentProvider = new SubProcessInstanceContentProvider();
    tableEditor.setContentProvider(contentProvider);
    if (labelProvider == null)
        labelProvider = new SubProcessInstanceLabelProvider();
    tableEditor.setLabelProvider(labelProvider);
    tableEditor.render(composite);
    // double-click
    tableEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            if (!(element instanceof EmbeddedSubProcess))
                openSubProcessInstance((ProcessInstanceVO) newValue);
        }
    });
    // right-click menu
    tableEditor.getTable().addListener(SWT.MenuDetect, new Listener() {

        public void handleEvent(Event event) {
            tableEditor.getTable().setMenu(element instanceof EmbeddedSubProcess ? null : createContextMenu(getShell()));
        }
    });
}
Also used : EmbeddedSubProcess(com.centurylink.mdw.plugin.designer.model.EmbeddedSubProcess) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) Listener(org.eclipse.swt.widgets.Listener) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Example 37 with ValueChangeListener

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

the class TaskInstancesSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    activity = (Activity) selection;
    tableEditor = new TableEditor(activity, TableEditor.TYPE_TABLE);
    tableEditor.setReadOnly(true);
    tableEditor.setColumnSpecs(getColumnSpecs());
    if (contentProvider == null)
        contentProvider = getContentProvider();
    tableEditor.setContentProvider(contentProvider);
    if (labelProvider == null)
        labelProvider = getLabelProvider();
    tableEditor.setLabelProvider(labelProvider);
    tableEditor.render(composite);
    // double-click
    tableEditor.addValueChangeListener(new ValueChangeListener() {

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

        public void handleEvent(Event event) {
            tableEditor.getTable().setMenu(createContextMenu(getShell()));
        }
    });
}
Also used : ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) Listener(org.eclipse.swt.widgets.Listener) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) TaskInstanceVO(com.centurylink.mdw.model.value.task.TaskInstanceVO) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Example 38 with ValueChangeListener

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

the class ActivityImplDesignSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    activityImpl = (ActivityImpl) selection;
    // base class combo
    baseClassPropertyEditor = new PropertyEditor(activityImpl, PropertyEditor.TYPE_COMBO);
    baseClassPropertyEditor.setLabel("Category");
    baseClassPropertyEditor.setReadOnly(true);
    baseClassPropertyEditor.setWidth(475);
    List<String> implementorBaseClasses = new ArrayList<String>();
    if (!activityImpl.getProject().checkRequiredVersion(5, 5)) {
        implementorBaseClasses = Arrays.asList(ActivityImpl.getOldBaseClasses());
    } else {
        for (Class<?> baseClass : ActivityImpl.getBaseClasses()) implementorBaseClasses.add(baseClass.getName());
    }
    baseClassPropertyEditor.setValueOptions(implementorBaseClasses);
    baseClassPropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            activityImpl.setBaseClassName((String) newValue);
        }
    });
    baseClassPropertyEditor.render(composite);
    // attr description text area
    attrDescriptionPropertyEditor = new PropertyEditor(activityImpl, PropertyEditor.TYPE_TEXT);
    attrDescriptionPropertyEditor.setLabel("Pagelet");
    attrDescriptionPropertyEditor.setMultiLine(true);
    attrDescriptionPropertyEditor.setWidth(475);
    attrDescriptionPropertyEditor.setHeight(150);
    attrDescriptionPropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            activityImpl.setAttrDescriptionXml((String) newValue);
        }
    });
    attrDescriptionPropertyEditor.render(composite);
}
Also used : ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) ArrayList(java.util.ArrayList) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)

Example 39 with ValueChangeListener

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

the class BamMonitoringSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    element = (WorkflowElement) selection;
    // trigger dropdown
    triggerPropertyEditor = new PropertyEditor(element, PropertyEditor.TYPE_COMBO);
    triggerPropertyEditor.setLabel("BAM Trigger");
    triggerPropertyEditor.setWidth(100);
    triggerPropertyEditor.setReadOnly(true);
    ArrayList<String> triggerOpts = new ArrayList<String>();
    triggerOpts.add("Start");
    triggerOpts.add("Finish");
    triggerPropertyEditor.setValueOptions(triggerOpts);
    triggerPropertyEditor.setFireDirtyStateChange(false);
    triggerPropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            if (newValue.equals("Start"))
                selectedTrigger = WorkAttributeConstant.BAM_START_MSGDEF;
            else if (newValue.equals("Finish"))
                selectedTrigger = WorkAttributeConstant.BAM_FINISH_MSGDEF;
            if (bamEventDefs.get(selectedTrigger) == null) {
                bamEventDefs.put(selectedTrigger, getValue(selectedTrigger));
            }
            bamMessagePropertyEditor.setValue(bamEventDefs.get(selectedTrigger));
            // otherwise
            bamMessagePropertyEditor.setEditable(isEditable());
        // reverts
        // Add/Delete
        // buttons
        // to
        // enabled
        }
    });
    triggerPropertyEditor.render(composite);
    separatorPropertyEditor = new PropertyEditor(element, PropertyEditor.TYPE_SEPARATOR);
    separatorPropertyEditor.setWidth(500);
    separatorPropertyEditor.render(composite);
    // bam message def
    bamMessagePropertyEditor = new PropertyEditor(element, PropertyEditor.TYPE_BAM_MESSAGE);
    bamMessagePropertyEditor.setLabel("BAM Message");
    bamMessagePropertyEditor.setWidth(500);
    bamMessagePropertyEditor.setFireDirtyStateChange(false);
    bamMessagePropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            BamMessageDefinition bamMessageDef = (BamMessageDefinition) newValue;
            bamEventDefs.put(selectedTrigger, bamMessageDef);
            element.setAttribute(selectedTrigger, valueConverter.toPropertyValue(bamMessageDef));
            setDirty(true);
        }
    });
    bamMessagePropertyEditor.render(composite);
    createSaveButton();
    // help link
    // spacer
    new Label(composite, SWT.NONE);
    helpPropertyEditor = new PropertyEditor(element, PropertyEditor.TYPE_LINK);
    helpPropertyEditor.setLabel("BAM Monitoring Help");
    helpPropertyEditor.render(composite);
    helpPropertyEditor.setValue("/MDWHub/doc/bam.html");
}
Also used : ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) ArrayList(java.util.ArrayList) Label(org.eclipse.swt.widgets.Label) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor) BamMessageDefinition(com.centurylink.mdw.model.value.event.BamMessageDefinition)

Example 40 with ValueChangeListener

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

the class DocumentationSection method setSelection.

public void setSelection(WorkflowElement selection) {
    element = selection;
    String attrVal = element.getAttribute(ATTR);
    if (attrVal != null && !attrVal.isEmpty()) {
        if (attrVal.length() >= 8) {
            byte[] first4 = RuleSetVO.decode(attrVal.substring(0, 8));
            if (first4[0] == 68 && first4[1] == 35 && first4[2] == 17 && first4[3] == 0)
                language = DocumentationEditorValueProvider.MS_WORD;
        }
    }
    if (artifactEditor != null) {
        artifactEditor.dispose();
        artifactEditor = null;
    }
    if (referenceIdEditor != null) {
        referenceIdEditor.dispose();
        referenceIdEditor = null;
    }
    if (sequenceIdEditor != null) {
        sequenceIdEditor.dispose();
        sequenceIdEditor = null;
    }
    if (webEditor != null) {
        webEditor.dispose();
        webEditor = null;
    }
    // artifact editor
    ArtifactEditorValueProvider valueProvider = new DocumentationEditorValueProvider(selection) {

        @Override
        public void languageChanged(String newLanguage) {
            super.languageChanged(newLanguage);
            boolean proceed = true;
            String attrVal = element.getAttribute(ATTR);
            if (attrVal != null && !attrVal.isEmpty() && !language.equals(newLanguage))
                proceed = MessageDialog.openConfirm(getShell(), "Confirm Format", "Proceed with switch to " + newLanguage + " format? (" + language + " formatted content will be lost.)");
            if (proceed) {
                language = newLanguage;
                element.setAttribute(getAttributeName(), " ");
                setSelection(element);
            } else {
                artifactEditor.setLanguage(language);
            }
        }

        @Override
        public String getLanguage() {
            return language;
        }
    };
    artifactEditor = new ArtifactEditor(selection, valueProvider, "Format");
    artifactEditor.render(composite);
    artifactEditor.setElement(selection);
    artifactEditor.setEditable(!selection.isReadOnly());
    artifactEditor.setLanguage(language);
    if (element instanceof Activity || element instanceof EmbeddedSubProcess) {
        // reference ID text field
        sequenceIdEditor = new PropertyEditor(element, PropertyEditor.TYPE_TEXT);
        sequenceIdEditor.setLabel("Sequence Number");
        sequenceIdEditor.setWidth(100);
        sequenceIdEditor.setVerticalIndent(5);
        sequenceIdEditor.render(composite);
        sequenceIdEditor.setElement(selection);
        sequenceIdEditor.setValue(element instanceof EmbeddedSubProcess ? ((EmbeddedSubProcess) element).getSequenceId() : ((Activity) element).getSequenceId());
        sequenceIdEditor.setEditable(false);
        // reference ID text field
        referenceIdEditor = new PropertyEditor(element, PropertyEditor.TYPE_TEXT);
        referenceIdEditor.setLabel("Reference ID");
        referenceIdEditor.setWidth(100);
        referenceIdEditor.setComment("Optional (select Reference ID element order when exporting)");
        referenceIdEditor.addValueChangeListener(new ValueChangeListener() {

            public void propertyValueChanged(Object newValue) {
                element.setAttribute(WorkAttributeConstant.REFERENCE_ID, (String) newValue);
            }
        });
        referenceIdEditor.render(composite);
        referenceIdEditor.setElement(selection);
        referenceIdEditor.setEditable(!selection.isReadOnly());
        referenceIdEditor.setValue(element.getAttribute(WorkAttributeConstant.REFERENCE_ID));
    }
    if (DocumentationEditorValueProvider.MARKDOWN.equals(language) && element.getProject().checkRequiredVersion(6, 0)) {
        webEditor = new PropertyEditor(element, PropertyEditor.TYPE_WEB);
        webEditor.render(composite);
        webEditor.setElement(element);
        MarkdownRenderer renderer = new MarkdownRenderer(attrVal);
        webEditor.setValue(renderer.renderHtml());
        webEditor.addValueChangeListener(new ValueChangeListener() {

            public void propertyValueChanged(Object newValue) {
                MarkdownRenderer renderer = new MarkdownRenderer(newValue == null ? null : newValue.toString());
                String html = renderer.renderHtml();
                webEditor.setValue(html);
            }
        });
    }
    composite.layout(true);
}
Also used : EmbeddedSubProcess(com.centurylink.mdw.plugin.designer.model.EmbeddedSubProcess) ArtifactEditor(com.centurylink.mdw.plugin.designer.properties.editor.ArtifactEditor) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) DocumentationEditorValueProvider(com.centurylink.mdw.plugin.designer.properties.value.DocumentationEditorValueProvider) Activity(com.centurylink.mdw.plugin.designer.model.Activity) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor) ArtifactEditorValueProvider(com.centurylink.mdw.plugin.designer.properties.value.ArtifactEditorValueProvider) MarkdownRenderer(com.centurylink.mdw.designer.utils.MarkdownRenderer)

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