Search in sources :

Example 21 with ColumnSpec

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

the class WorkflowAssetVersionsSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    workflowAsset = (WorkflowAsset) selection;
    tableEditor = new TableEditor(workflowAsset, TableEditor.TYPE_TABLE);
    List<ColumnSpec> columnSpecs = new ArrayList<ColumnSpec>();
    ColumnSpec packageColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Package", "package");
    packageColSpec.width = 160;
    columnSpecs.add(packageColSpec);
    ColumnSpec versionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Version", "version");
    versionColSpec.width = 60;
    columnSpecs.add(versionColSpec);
    ColumnSpec idColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "ID", "id");
    idColSpec.width = 65;
    columnSpecs.add(idColSpec);
    ColumnSpec createDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Created", "createDate");
    createDateColSpec.width = 110;
    columnSpecs.add(createDateColSpec);
    ColumnSpec userColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "User", "user");
    userColSpec.width = 75;
    columnSpecs.add(userColSpec);
    ColumnSpec commentsColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Comments", "comments");
    commentsColSpec.width = 200;
    columnSpecs.add(commentsColSpec);
    ColumnSpec lockedToColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Locked To", "lockedTo");
    lockedToColSpec.width = 75;
    columnSpecs.add(lockedToColSpec);
    ColumnSpec modDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Last Modified", "modDate");
    modDateColSpec.width = 110;
    columnSpecs.add(modDateColSpec);
    tableEditor.setColumnSpecs(columnSpecs);
    // tableEditor.setFillWidth(true);
    tableEditor.setReadOnly(true);
    tableEditor.setContentProvider(new AssetVersionContentProvider());
    tableEditor.setLabelProvider(new AssetVersionLabelProvider());
    tableEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            openAsset((WorkflowAsset) newValue);
        }
    });
    tableEditor.render(composite);
    // right-click menu
    tableEditor.getTable().addListener(SWT.MenuDetect, new Listener() {

        public void handleEvent(Event event) {
            tableEditor.getTable().setMenu(createContextMenu(tableEditor.getTable().getShell()));
        }
    });
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) Listener(org.eclipse.swt.widgets.Listener) ElementChangeListener(com.centurylink.mdw.plugin.designer.model.ElementChangeListener) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) ArrayList(java.util.ArrayList) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) Event(org.eclipse.swt.widgets.Event) ElementChangeEvent(com.centurylink.mdw.plugin.designer.model.ElementChangeEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Example 22 with ColumnSpec

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

the class MyTasksView method createColumnSpecs.

@Override
protected List<ColumnSpec> createColumnSpecs() {
    List<ColumnSpec> columnSpecs = new ArrayList<>();
    ColumnSpec taskInstIdColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Task ID", "taskInstanceId");
    taskInstIdColSpec.width = 100;
    columnSpecs.add(taskInstIdColSpec);
    ColumnSpec taskNameColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Name", "taskName");
    taskNameColSpec.width = 180;
    columnSpecs.add(taskNameColSpec);
    ColumnSpec masterRequestColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Master Request ID", "orderId");
    masterRequestColSpec.width = 180;
    columnSpecs.add(masterRequestColSpec);
    ColumnSpec statusColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Status", "status");
    statusColSpec.width = 100;
    columnSpecs.add(statusColSpec);
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    ColumnSpec startDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Start", "startDateAsDate");
    startDateColSpec.width = 150;
    startDateColSpec.dateFormat = df;
    columnSpecs.add(startDateColSpec);
    ColumnSpec dueDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Due", "dueDate");
    dueDateColSpec.width = 150;
    dueDateColSpec.dateFormat = df;
    columnSpecs.add(dueDateColSpec);
    return columnSpecs;
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) ArrayList(java.util.ArrayList) SimpleDateFormat(java.text.SimpleDateFormat)

Example 23 with ColumnSpec

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

the class PackageVersionsSection method drawWidgets.

@Override
public void drawWidgets(Composite composite, WorkflowElement selection) {
    workflowPackage = (WorkflowPackage) selection;
    tableEditor = new TableEditor(workflowPackage, TableEditor.TYPE_TABLE);
    List<ColumnSpec> columnSpecs = new ArrayList<>();
    ColumnSpec projectColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Project", "project");
    projectColSpec.width = 200;
    columnSpecs.add(projectColSpec);
    ColumnSpec versionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Version", "version");
    versionColSpec.width = 80;
    columnSpecs.add(versionColSpec);
    ColumnSpec tagsColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Tags", "tags");
    tagsColSpec.width = 150;
    columnSpecs.add(tagsColSpec);
    ColumnSpec idColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Package ID", "id");
    idColSpec.width = 100;
    columnSpecs.add(idColSpec);
    ColumnSpec lastModColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Last Modified", "lastModified");
    lastModColSpec.width = 120;
    columnSpecs.add(lastModColSpec);
    ColumnSpec packageColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Notes", "archived");
    packageColSpec.width = 150;
    columnSpecs.add(packageColSpec);
    tableEditor.setColumnSpecs(columnSpecs);
    tableEditor.setReadOnly(true);
    tableEditor.setContentProvider(new PackageVersionContentProvider());
    tableEditor.setLabelProvider(new PackageVersionLabelProvider());
    tableEditor.render(composite);
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) ArrayList(java.util.ArrayList) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)

Example 24 with ColumnSpec

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

the class ListViewLabelProvider method getColumnImage.

public Image getColumnImage(Object element, int columnIndex) {
    ColumnSpec colspec = columnSpecs.get(columnIndex);
    if (colspec.type.equals(TYPE_CHECKBOX)) {
        ImageDescriptor descriptor = null;
        Boolean value = (Boolean) getValue(element, columnIndex);
        if (value != null && value.booleanValue()) {
            descriptor = MdwPlugin.getImageDescriptor("icons/checked.gif");
        } else {
            descriptor = MdwPlugin.getImageDescriptor("icons/unchecked.gif");
        }
        Image image = imageCache.get(descriptor);
        if (image == null) {
            image = descriptor.createImage();
            imageCache.put(descriptor, image);
        }
        return image;
    } else {
        return null;
    }
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Image(org.eclipse.swt.graphics.Image)

Example 25 with ColumnSpec

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

the class ProcessInstanceListView method createTable.

private void createTable(Composite parent) {
    int style = SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION;
    processInstanceTable = new Table(parent, style);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 10;
    processInstanceTable.setLayoutData(gridData);
    processInstanceTable.setLinesVisible(true);
    processInstanceTable.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(processInstanceTable, styles, i);
        column.setText(colSpec.label);
        column.setWidth(colSpec.width);
        column.setResizable(colSpec.resizable);
        column.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                TableColumn sortColumn = tableViewer.getTable().getSortColumn();
                TableColumn currentColumn = (TableColumn) e.widget;
                int direction = tableViewer.getTable().getSortDirection();
                if (sortColumn == currentColumn) {
                    direction = direction == SWT.UP ? SWT.DOWN : SWT.UP;
                } else {
                    tableViewer.getTable().setSortColumn(currentColumn);
                    direction = SWT.DOWN;
                }
                tableViewer.getTable().setSortDirection(direction);
                ProcessInstanceSort sort = contentProvider.getSort();
                sort.setSort(currentColumn.getText());
                sort.setAscending(direction == SWT.UP);
                refreshTable();
            }
        });
    }
    // double-click
    processInstanceTable.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            ProcessInstanceVO processInstanceInfo = (ProcessInstanceVO) e.item.getData();
            handleOpen(processInstanceInfo);
        }
    });
    // right-click menu
    processInstanceTable.addListener(SWT.MenuDetect, new Listener() {

        public void handleEvent(Event event) {
            processInstanceTable.setMenu(createContextMenu(processInstanceTable.getShell()));
        }
    });
    // auto-adjust column width
    processInstanceTable.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            int tableWidth = processInstanceTable.getBounds().width;
            int cumulative = 0;
            TableColumn[] tableColumns = processInstanceTable.getColumns();
            for (int i = 0; i < tableColumns.length; i++) {
                if (i == tableColumns.length - 1)
                    tableColumns[i].setWidth(tableWidth - cumulative - 25);
                cumulative += tableColumns[i].getWidth();
            }
        }
    });
}
Also used : Table(org.eclipse.swt.widgets.Table) ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ProcessInstanceSort(com.centurylink.mdw.plugin.designer.model.ProcessInstanceSort) ControlAdapter(org.eclipse.swt.events.ControlAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) ControlEvent(org.eclipse.swt.events.ControlEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlEvent(org.eclipse.swt.events.ControlEvent) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

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