Search in sources :

Example 1 with TableModelUpdater

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

the class AttributesTableContainer method createTableEditor.

private void createTableEditor(Composite parent) {
    FormatXml fmter = new FormatXml();
    MbengDocument mbengDocument = new MbengDocumentClass();
    try {
        fmter.load(mbengDocument, pageletTable.xmlText());
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    tableEditor = new TableEditor(null, mbengDocument.getRootNode());
    // label was already rendered
    tableEditor.setLabel(null);
    tableEditor.setModelUpdater(new TableModelUpdater() {

        public Object create() {
            int i = 1;
            String attrName = "New Field";
            while (getAttribute(attrName) != null) attrName = "New Field (" + i++ + ")";
            return new AttributeVO(attrName, null);
        }

        @SuppressWarnings("rawtypes")
        public void updateModelValue(List tableValue) {
            fireDirtyStateChange(true);
        }
    });
    tableEditor.setCellModifier(new AttributeCellModifier());
    tableEditor.setContentProvider(new AttributeContentProvider());
    tableEditor.setLabelProvider(new AttributeLabelProvider());
    tableEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
        // value changed
        }
    });
    tableEditor.render(parent, true);
}
Also used : AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) TableModelUpdater(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater) FormatXml(com.qwest.mbeng.FormatXml) MbengDocument(com.qwest.mbeng.MbengDocument) ArrayList(java.util.ArrayList) List(java.util.List) MbengDocumentClass(com.qwest.mbeng.MbengDocumentClass)

Example 2 with TableModelUpdater

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

the class ExtensionModulesTable method create.

public TableEditor create() {
    tableEditor = new TableEditor(null, TableEditor.TYPE_TABLE);
    // colspecs
    List<ColumnSpec> colSpecs = new ArrayList<ColumnSpec>();
    ColumnSpec selectionColSpec = new ColumnSpec(PropertyEditor.TYPE_CHECKBOX, "", "import");
    selectionColSpec.width = 80;
    colSpecs.add(selectionColSpec);
    ColumnSpec extensionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Extension", "extension");
    extensionColSpec.width = 150;
    extensionColSpec.readOnly = true;
    colSpecs.add(extensionColSpec);
    ColumnSpec descriptionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Description", "description");
    descriptionColSpec.readOnly = true;
    descriptionColSpec.width = 350;
    colSpecs.add(descriptionColSpec);
    tableEditor.setColumnSpecs(colSpecs);
    tableEditor.setFillWidth(true);
    tableEditor.setModelUpdater(new TableModelUpdater() {

        public Object create() {
            return null;
        }

        @SuppressWarnings("rawtypes")
        public void updateModelValue(List tableValue) {
            selectedModules = new ArrayList<ExtensionModule>();
            for (ExtensionModule module : WorkflowProjectManager.getInstance().getAvailableExtensions(workflowProject)) {
                for (Object rowObj : tableValue) {
                    DefaultRowImpl row = (DefaultRowImpl) rowObj;
                    if (module.getName().equals(row.getColumnValue(1))) {
                        if (((Boolean) row.getColumnValue(0)).booleanValue())
                            selectedModules.add(module);
                        else
                            selectedModules.remove(module);
                    }
                }
            }
        }
    });
    return tableEditor;
}
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) List(java.util.List) ArrayList(java.util.ArrayList) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Example 3 with TableModelUpdater

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

the class PreferencesSection method createNoticesTable.

private void createNoticesTable() {
    noticesEditor = new TableEditor(null, TableEditor.TYPE_TABLE);
    noticesEditor.setLabel("Desktop Notices");
    // colspecs
    List<ColumnSpec> colSpecs = new ArrayList<ColumnSpec>();
    ColumnSpec selectionColSpec = new ColumnSpec(PropertyEditor.TYPE_CHECKBOX, "", "selected");
    selectionColSpec.width = 50;
    colSpecs.add(selectionColSpec);
    ColumnSpec extensionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Task Outcome", "outcome");
    extensionColSpec.width = 150;
    extensionColSpec.readOnly = true;
    colSpecs.add(extensionColSpec);
    noticesEditor.setColumnSpecs(colSpecs);
    noticesEditor.setHorizontalSpan(3);
    noticesEditor.setWidth(300);
    noticesEditor.setModelUpdater(new TableModelUpdater() {

        public Object create() {
            return null;
        }

        @SuppressWarnings("rawtypes")
        public void updateModelValue(List tableValue) {
            List<String> selectedNotices = new ArrayList<String>();
            for (Action outcome : UserActionVO.NOTIFIABLE_TASK_ACTIONS) {
                for (Object rowObj : tableValue) {
                    DefaultRowImpl row = (DefaultRowImpl) rowObj;
                    if (outcome.toString().equals(row.getColumnValue(1))) {
                        if (((Boolean) row.getColumnValue(0)).booleanValue())
                            selectedNotices.add(outcome.toString());
                        else
                            selectedNotices.remove(outcome.toString());
                    }
                }
            }
            project.setNoticeChecks(selectedNotices);
        }
    });
}
Also used : Action(com.centurylink.mdw.model.value.user.UserActionVO.Action) 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) ArrayList(java.util.ArrayList) List(java.util.List) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Example 4 with TableModelUpdater

use of com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater 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

TableModelUpdater (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 ColumnSpec (com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec)3 TableEditor (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)3 DefaultRowImpl (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl)3 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)1 Action (com.centurylink.mdw.model.value.user.UserActionVO.Action)1 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)1 FormatXml (com.qwest.mbeng.FormatXml)1 MbengDocument (com.qwest.mbeng.MbengDocument)1 MbengDocumentClass (com.qwest.mbeng.MbengDocumentClass)1 GridData (org.eclipse.swt.layout.GridData)1