Search in sources :

Example 16 with TableEditor

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

the class VariablesSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    process = (WorkflowProcess) selection;
    tableEditor = new TableEditor(process, TableEditor.TYPE_TABLE);
    if (columnSpecs == null)
        columnSpecs = createColumnSpecs();
    tableEditor.setColumnSpecs(columnSpecs);
    if (contentProvider == null)
        contentProvider = new VariableContentProvider();
    tableEditor.setContentProvider(contentProvider);
    if (labelProvider == null)
        labelProvider = new VariableLabelProvider();
    tableEditor.setLabelProvider(labelProvider);
    if (cellModifier == null)
        cellModifier = new VariableCellModifier();
    tableEditor.setCellModifier(cellModifier);
    if (modelUpdater == null)
        modelUpdater = new VariableModelUpdater();
    tableEditor.setModelUpdater(modelUpdater);
    tableEditor.render(composite);
    // variables help link
    variablesHelpPropertyEditor = new PropertyEditor(process, PropertyEditor.TYPE_LINK);
    variablesHelpPropertyEditor.setLabel("Process Variables Help");
    variablesHelpPropertyEditor.render(composite);
}
Also used : PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Example 17 with TableEditor

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

the class AttributesSection method drawWidgets.

@Override
public void drawWidgets(Composite composite, WorkflowElement selection) {
    this.element = selection;
    tableEditor = new TableEditor(element, TableEditor.TYPE_TABLE);
    List<ColumnSpec> columnSpecs = new ArrayList<>();
    columnSpecs.add(new ColumnSpec(PropertyEditor.TYPE_TEXT, "Attribute Name", "name"));
    columnSpecs.add(new ColumnSpec(PropertyEditor.TYPE_TEXT, "Value", "value"));
    tableEditor.setColumnSpecs(columnSpecs);
    tableEditor.setReadOnly(true);
    tableEditor.setContentProvider(new AttributeContentProvider());
    tableEditor.setLabelProvider(new AttributeLabelProvider());
    tableEditor.render(composite);
    tableEditor.getTable().addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            AttributeVO attributeVO = (AttributeVO) e.item.getData();
            AttributeDialog dialog = new AttributeDialog(getShell(), attributeVO);
            dialog.open();
        }
    });
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ArrayList(java.util.ArrayList) SelectionEvent(org.eclipse.swt.events.SelectionEvent) AttributeDialog(com.centurylink.mdw.plugin.designer.dialogs.AttributeDialog) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Example 18 with TableEditor

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

the class ImportProjectSelectPage method createProjectListControls.

private void createProjectListControls(Composite parent, int ncol) {
    projectTableEditor = new TableEditor(null, TableEditor.TYPE_TABLE);
    // colspecs
    List<ColumnSpec> projectColSpecs = new ArrayList<>();
    ColumnSpec selectionColSpec = new ColumnSpec(PropertyEditor.TYPE_CHECKBOX, "Import/Overwrite", "import");
    selectionColSpec.width = 100;
    projectColSpecs.add(selectionColSpec);
    ColumnSpec projectColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Project", "project");
    projectColSpec.width = 250;
    projectColSpec.readOnly = true;
    projectColSpecs.add(projectColSpec);
    ColumnSpec noteColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Note", "note");
    noteColSpec.readOnly = true;
    noteColSpec.width = 150;
    projectColSpecs.add(noteColSpec);
    projectTableEditor.setColumnSpecs(projectColSpecs);
    projectTableEditor.setFillWidth(true);
    projectTableEditor.setModelUpdater(new TableModelUpdater() {

        public Object create() {
            return null;
        }

        @SuppressWarnings("rawtypes")
        public void updateModelValue(List tableValue) {
            List<WorkflowProject> selectedProjects = new ArrayList<>();
            for (WorkflowProject workflowProject : getProjectList()) {
                for (Object rowObj : tableValue) {
                    DefaultRowImpl row = (DefaultRowImpl) rowObj;
                    if (workflowProject.getName().equals(row.getColumnValue(1)) && ((Boolean) row.getColumnValue(0)).booleanValue())
                        selectedProjects.add(workflowProject);
                }
            }
            setProjectsToImport(selectedProjects);
            handleFieldChanged();
        }
    });
    projectTableEditor.render(parent, false);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = ncol;
    projectTableEditor.getTable().setLayoutData(gd);
}
Also used : DefaultRowImpl(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl) ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) TableModelUpdater(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater) ArrayList(java.util.ArrayList) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor) GridData(org.eclipse.swt.layout.GridData) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

TableEditor (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)18 ArrayList (java.util.ArrayList)10 ColumnSpec (com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec)9 ValueChangeListener (com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)5 Event (org.eclipse.swt.widgets.Event)5 Listener (org.eclipse.swt.widgets.Listener)5 DefaultRowImpl (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl)4 List (java.util.List)4 TableModelUpdater (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater)3 ElementChangeEvent (com.centurylink.mdw.plugin.designer.model.ElementChangeEvent)2 ElementChangeListener (com.centurylink.mdw.plugin.designer.model.ElementChangeListener)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 GridData (org.eclipse.swt.layout.GridData)2 Button (org.eclipse.swt.widgets.Button)2 Composite (org.eclipse.swt.widgets.Composite)2 Label (org.eclipse.swt.widgets.Label)2 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)1 TaskInstanceVO (com.centurylink.mdw.model.value.task.TaskInstanceVO)1