Search in sources :

Example 6 with DefaultRowImpl

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

the class ExtensionModulesTable method setSelectedModules.

public void setSelectedModules(List<ExtensionModule> list) {
    this.selectedModules = list;
    List<DefaultRowImpl> tableRows = new ArrayList<DefaultRowImpl>();
    for (ExtensionModule module : WorkflowProjectManager.getInstance().getAvailableExtensions(workflowProject)) {
        String[] rowData = new String[3];
        if (selectedModules.contains(module))
            rowData[0] = "true";
        else
            rowData[0] = "false";
        rowData[1] = module.getName();
        rowData[2] = module.getDescription();
        DefaultRowImpl row = tableEditor.new DefaultRowImpl(rowData);
        tableRows.add(row);
    }
    tableEditor.setValue(tableRows);
}
Also used : DefaultRowImpl(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl) ArrayList(java.util.ArrayList)

Example 7 with DefaultRowImpl

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

the class ImportProjectSelectPage method createSelectButtonControls.

private void createSelectButtonControls(Composite parent, int ncol) {
    Composite buttonComposite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = 5;
    buttonComposite.setLayout(layout);
    GridData gd = new GridData(SWT.END, SWT.TOP, true, false);
    gd.horizontalSpan = ncol;
    buttonComposite.setLayoutData(gd);
    Button selectAllButton = new Button(buttonComposite, SWT.PUSH);
    selectAllButton.setText("Select All");
    gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 75;
    selectAllButton.setLayoutData(gd);
    selectAllButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            for (Object rowObj : projectTableEditor.getTableValue()) {
                DefaultRowImpl row = (DefaultRowImpl) rowObj;
                row.setColumnValue(0, "true");
            }
            setProjectsToImport(getProjectList());
            projectTableEditor.getTableViewer().update(projectTableEditor.getTableValue(), null);
            handleFieldChanged();
        }
    });
    Button deselectAllButton = new Button(buttonComposite, SWT.PUSH);
    deselectAllButton.setText("Deselect All");
    gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 70;
    deselectAllButton.setLayoutData(gd);
    deselectAllButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            for (Object rowObj : projectTableEditor.getTableValue()) {
                DefaultRowImpl row = (DefaultRowImpl) rowObj;
                row.setColumnValue(0, "false");
            }
            setProjectsToImport(new ArrayList<WorkflowProject>());
            projectTableEditor.getTableViewer().update(projectTableEditor.getTableValue(), null);
            handleFieldChanged();
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) DefaultRowImpl(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayList(java.util.ArrayList)

Example 8 with DefaultRowImpl

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

Example 9 with DefaultRowImpl

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

the class ImportProjectSelectPage method initialize.

/**
 * Populate the table based on the imported data.
 */
public void initialize() {
    List<DefaultRowImpl> tableRows = new ArrayList<>();
    List<WorkflowProject> projectsToImport = new ArrayList<>();
    for (WorkflowProject workflowProject : getProjectList()) {
        IProject existing = MdwPlugin.getWorkspaceRoot().getProject(workflowProject.getName());
        String[] rowData = new String[3];
        rowData[0] = "true";
        rowData[1] = workflowProject.getName();
        rowData[2] = "";
        if (existing != null && existing.exists()) {
            rowData[0] = "false";
            if (existing.isOpen())
                rowData[2] = "Already exists in workspace";
            else
                rowData[2] = "Closed project exists in workspace";
        } else if (workflowProject.getMdwDataSource().getJdbcUrl() == null) {
            rowData[0] = "false";
            rowData[2] = "Missing JDBC URL";
        } else {
            projectsToImport.add(workflowProject);
        }
        DefaultRowImpl row = projectTableEditor.new DefaultRowImpl(rowData);
        tableRows.add(row);
    }
    projectTableEditor.setValue(tableRows);
    setProjectsToImport(projectsToImport);
    handleFieldChanged();
}
Also used : DefaultRowImpl(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl) ArrayList(java.util.ArrayList) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IProject(org.eclipse.core.resources.IProject)

Aggregations

DefaultRowImpl (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl)9 ArrayList (java.util.ArrayList)8 TableEditor (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)4 ColumnSpec (com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec)3 TableModelUpdater (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater)3 List (java.util.List)3 GridData (org.eclipse.swt.layout.GridData)3 Action (com.centurylink.mdw.model.value.user.UserActionVO.Action)2 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2 Composite (org.eclipse.swt.widgets.Composite)2 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)1 PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)1 IProject (org.eclipse.core.resources.IProject)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1