Search in sources :

Example 1 with DirtyStateListener

use of com.centurylink.mdw.plugin.designer.DirtyStateListener in project mdw-designer by CenturyLinkCloud.

the class ProcessInstanceFilterDialog method createVariablesTabItem.

private TabItem createVariablesTabItem(TabFolder tabFolder) {
    TabItem variablesTabItem = new TabItem(tabFolder, SWT.NULL);
    variablesTabItem.setText("Variables");
    Composite composite = new Composite(tabFolder, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    // variables table
    tableContainer = new VariableValuesTableContainer();
    tableContainer.create(composite);
    tableContainer.addDirtyStateListener(new DirtyStateListener() {

        public void dirtyStateChanged(boolean dirty) {
            filter.getVariableValues().clear();
            if (variableValues != null) {
                for (VariableValue variableValue : variableValues) filter.getVariableValues().put(variableValue.getName(), variableValue.getValue());
            }
        }
    });
    variablesTabItem.setControl(composite);
    variableValues = new ArrayList<>();
    tableContainer.setInput(variableValues);
    return variablesTabItem;
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) DirtyStateListener(com.centurylink.mdw.plugin.designer.DirtyStateListener) Composite(org.eclipse.swt.widgets.Composite) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) GridData(org.eclipse.swt.layout.GridData) VariableValuesTableContainer(com.centurylink.mdw.plugin.variables.VariableValuesTableContainer)

Example 2 with DirtyStateListener

use of com.centurylink.mdw.plugin.designer.DirtyStateListener in project mdw-designer by CenturyLinkCloud.

the class BamEventComposer method createBamDataTable.

private void createBamDataTable() {
    if (attributesTableContainer != null) {
        if (dataTableDirtyStateListener != null)
            attributesTableContainer.removeDirtyStateListener(dataTableDirtyStateListener);
        attributesTableContainer.dispose();
    }
    // attributes
    TableT bamTable = null;
    if (bamPagelet != null) {
        try {
            bamTable = getBamPageletTable();
        } catch (BamPageletValidationException ex) {
            PluginMessages.uiError(ex, "BAM Pagelet");
        }
    }
    String label;
    if (bamTable != null && (bamTable.getNAME() != null || bamTable.getLABEL() != null)) {
        label = bamTable.getLABEL() == null ? bamTable.getNAME() : bamTable.getLABEL();
        bamTable.setLABEL(label);
        for (DropdownT dropdown : bamTable.getDROPDOWNList()) {
            if ("Variables".equalsIgnoreCase(dropdown.getSOURCE())) {
                WorkflowProcess processVersion = getProcess();
                if (processVersion != null) {
                    List<String> varNames = processVersion.getNonDocRefVariableNames();
                    // add process variable values
                    for (String var : varNames) {
                        OptionT option = dropdown.addNewOPTION();
                        option.setVALUE("#{" + var + "}");
                        option.setStringValue(var);
                    }
                }
            }
        }
    }
    attributesTableContainer = createAttributesTable(getWidth(), LAYOUT_COLS, bamTable);
    dataTableDirtyStateListener = new DirtyStateListener() {

        public void dirtyStateChanged(boolean dirty) {
            if (bamMessage != null) {
                bamMessage.setAttributes(attributesTableContainer.getAttributes());
                Event event = new Event();
                event.widget = attributesTableContainer.tableEditor.getTable();
                event.data = attributesTableContainer.getAttributes();
                fireModify(new ModifyEvent(event));
            }
        }
    };
    attributesTableContainer.addDirtyStateListener(dataTableDirtyStateListener);
    this.layout(true);
}
Also used : OptionT(noNamespace.OptionT) DirtyStateListener(com.centurylink.mdw.plugin.designer.DirtyStateListener) ModifyEvent(org.eclipse.swt.events.ModifyEvent) DropdownT(noNamespace.DropdownT) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableT(noNamespace.TableT) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 3 with DirtyStateListener

use of com.centurylink.mdw.plugin.designer.DirtyStateListener in project mdw-designer by CenturyLinkCloud.

the class ProcessSection method setSelection.

public void setSelection(WorkflowElement selection) {
    if (process != null)
        process.removeElementChangeListener(this);
    process = (WorkflowProcess) selection;
    process.addElementChangeListener(this);
    idPropertyEditor.setElement(process);
    idPropertyEditor.setValue(process.getIdLabel());
    namePropertyEditor.setElement(process);
    namePropertyEditor.setValue(process.getName());
    descriptionPropertyEditor.setElement(process);
    descriptionPropertyEditor.setValue(process.getDescription());
    descriptionPropertyEditor.setEditable(!process.isReadOnly());
    createDatePropertyEditor.setElement(process);
    createDatePropertyEditor.setValue(process.getCreateDate());
    // avoid triggering dirty state change when reloading combo
    List<DirtyStateListener> dsListeners = new ArrayList<DirtyStateListener>();
    dsListeners.addAll(process.getDirtyStateListeners());
    for (DirtyStateListener dsListener : dsListeners) process.removeDirtyStateListener(dsListener);
    List<String> options = new ArrayList<String>();
    options.add("");
    if (process.isInRuleSet())
        options.addAll(getDesignerDataModel().getWorkgroupNames());
    // re-enable dirty state firing
    for (DirtyStateListener dsListener : dsListeners) process.addDirtyStateListener(dsListener);
    definitionLinkEditor.setElement(process);
    if (process.hasInstanceInfo())
        definitionLinkEditor.setLabel("Open Process Definition");
    else if (process.isInRuleSet())
        definitionLinkEditor.setLabel("View Definition XML");
    definitionLinkEditor.setVisible(process.hasInstanceInfo() || process.isInRuleSet());
}
Also used : DirtyStateListener(com.centurylink.mdw.plugin.designer.DirtyStateListener) ArrayList(java.util.ArrayList)

Aggregations

DirtyStateListener (com.centurylink.mdw.plugin.designer.DirtyStateListener)3 VariableValue (com.centurylink.mdw.plugin.designer.model.VariableValue)1 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)1 VariableValuesTableContainer (com.centurylink.mdw.plugin.variables.VariableValuesTableContainer)1 ArrayList (java.util.ArrayList)1 DropdownT (noNamespace.DropdownT)1 OptionT (noNamespace.OptionT)1 TableT (noNamespace.TableT)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Event (org.eclipse.swt.widgets.Event)1 TabItem (org.eclipse.swt.widgets.TabItem)1