Search in sources :

Example 16 with ColumnSpec

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

the class TransitionInstanceSection method createColumnSpecs.

private List<ColumnSpec> createColumnSpecs() {
    List<ColumnSpec> columnSpecs = new ArrayList<ColumnSpec>();
    ColumnSpec instanceIdColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Instance ID", "instanceId");
    instanceIdColSpec.width = 100;
    columnSpecs.add(instanceIdColSpec);
    ColumnSpec statusColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Status", "status");
    statusColSpec.width = 100;
    columnSpecs.add(statusColSpec);
    ColumnSpec startDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Start", "startDate");
    startDateColSpec.width = 150;
    columnSpecs.add(startDateColSpec);
    ColumnSpec endDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "End", "endDate");
    endDateColSpec.width = 150;
    columnSpecs.add(endDateColSpec);
    return columnSpecs;
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) ArrayList(java.util.ArrayList)

Example 17 with ColumnSpec

use of com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec 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 18 with ColumnSpec

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

the class VariableValuesTableContainer method createColumnSpecs.

private void createColumnSpecs() {
    columnSpecs = new ArrayList<>();
    ColumnSpec inputVarColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Variable", "variable");
    inputVarColSpec.width = 150;
    inputVarColSpec.readOnly = true;
    columnSpecs.add(inputVarColSpec);
    ColumnSpec varTypeColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Type", "type");
    varTypeColSpec.width = 150;
    varTypeColSpec.readOnly = true;
    columnSpecs.add(varTypeColSpec);
    ColumnSpec valueColSpec = new ColumnSpec(PropertyEditor.TYPE_DIALOG, "Value", "value");
    valueColSpec.width = 200;
    columnSpecs.add(valueColSpec);
    columnProps = new String[columnSpecs.size()];
    for (int i = 0; i < columnSpecs.size(); i++) {
        columnProps[i] = columnSpecs.get(i).property;
    }
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec)

Example 19 with ColumnSpec

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

the class VariableValuesTableContainer method createTable.

private void createTable(Composite parent) {
    int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION;
    table = new Table(parent, style);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 2;
    gridData.verticalIndent = 3;
    gridData.verticalAlignment = SWT.FILL;
    gridData.heightHint = 150;
    table.setLayoutData(gridData);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    for (int i = 0; i < columnSpecs.size(); i++) {
        ColumnSpec colSpec = columnSpecs.get(i);
        int styles = SWT.LEFT;
        if (colSpec.readOnly)
            style = style | SWT.READ_ONLY;
        TableColumn column = new TableColumn(table, styles, i);
        column.setText(colSpec.label);
        column.setWidth(colSpec.width);
        column.setResizable(colSpec.resizable);
    }
    table.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            int tableWidth = table.getBounds().width;
            int cumulative = 0;
            TableColumn[] tableColumns = table.getColumns();
            for (int i = 0; i < tableColumns.length; i++) {
                if (i == tableColumns.length - 1)
                    tableColumns[i].setWidth(tableWidth - cumulative - 5);
                cumulative += tableColumns[i].getWidth();
            }
        }
    });
    table.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            VariableValue varVal = (VariableValue) e.item.getData();
            String originalValue = varVal.getValue();
            VariableValueDialog varValDlg = new VariableValueDialog(getShell(), varVal);
            varValDlg.setHelpAvailable(false);
            if (varValDlg.open() == Dialog.OK && !originalValue.equals(varVal.getValue())) {
                varVal.setValue(varValDlg.getVariableValue().getValue());
                tableViewer.update(varVal, null);
                fireDirtyStateChange(true);
            } else {
                varVal.setValue(originalValue);
            }
        }
    });
}
Also used : Table(org.eclipse.swt.widgets.Table) ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) ControlAdapter(org.eclipse.swt.events.ControlAdapter) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableColumn(org.eclipse.swt.widgets.TableColumn) VariableValueDialog(com.centurylink.mdw.plugin.designer.dialogs.VariableValueDialog) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 20 with ColumnSpec

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

the class VariableValuesTableContainer method createTableViewer.

private void createTableViewer() {
    tableViewer = new TableViewer(table);
    tableViewer.setUseHashlookup(true);
    tableViewer.setColumnProperties(columnProps);
    CellEditor[] editors = new CellEditor[columnSpecs.size()];
    for (int i = 0; i < columnSpecs.size(); i++) {
        ColumnSpec colSpec = columnSpecs.get(i);
        CellEditor cellEditor = null;
        if (colSpec.type.equals(PropertyEditor.TYPE_TEXT)) {
            cellEditor = new TextCellEditor(table);
        } else if (colSpec.type.equals(PropertyEditor.TYPE_DIALOG)) {
            cellEditor = new VariableCellEditor(table);
        }
        editors[i] = cellEditor;
    }
    tableViewer.setCellEditors(editors);
    tableViewer.setCellModifier(new VariableCellModifier());
    tableViewer.setLabelProvider(new VariablesLabelProvider());
    tableViewer.setContentProvider(new VariablesContentProvider());
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) DialogCellEditor(org.eclipse.jface.viewers.DialogCellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer)

Aggregations

ColumnSpec (com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec)36 ArrayList (java.util.ArrayList)22 TableEditor (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 GridData (org.eclipse.swt.layout.GridData)6 CellEditor (org.eclipse.jface.viewers.CellEditor)5 Table (org.eclipse.swt.widgets.Table)5 TableColumn (org.eclipse.swt.widgets.TableColumn)5 List (java.util.List)4 TableViewer (org.eclipse.jface.viewers.TableViewer)4 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 Event (org.eclipse.swt.widgets.Event)4 Listener (org.eclipse.swt.widgets.Listener)4 DefaultRowImpl (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl)3 TableModelUpdater (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater)3 ValueChangeListener (com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener)3 ControlAdapter (org.eclipse.swt.events.ControlAdapter)3 ControlEvent (org.eclipse.swt.events.ControlEvent)3 ElementChangeEvent (com.centurylink.mdw.plugin.designer.model.ElementChangeEvent)2