Search in sources :

Example 1 with ValueDisplayDialog

use of com.centurylink.mdw.plugin.designer.dialogs.ValueDisplayDialog in project mdw-designer by CenturyLinkCloud.

the class SimulationSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    activity = (Activity) selection;
    if (responseListTableEditor == null)
        responseListTableEditor = new TableEditor(activity, TableEditor.TYPE_TABLE);
    if (columnSpecs == null)
        columnSpecs = createColumnSpecs();
    responseListTableEditor.setColumnSpecs(columnSpecs);
    if (contentProvider == null)
        contentProvider = new SimulationContentProvider();
    if (labelProvider == null)
        labelProvider = new SimulationLabelProvider();
    if (cellModifier == null)
        cellModifier = new SimulationCellModifier();
    if (modelUpdater == null)
        modelUpdater = new SimulationModelUpdater();
    // simulation radio button
    simPropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_RADIO);
    simPropertyEditor.setLabel("Simulation Mode");
    simPropertyEditor.setWidth(85);
    ArrayList<String> simOpts = new ArrayList<String>();
    simOpts.add("On");
    simOpts.add("Off");
    simPropertyEditor.setValueOptions(simOpts);
    simPropertyEditor.setDefaultValue("Off");
    simPropertyEditor.setFireDirtyStateChange(false);
    simPropertyEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            activity.setAttribute(WorkAttributeConstant.SIMULATION_STUB_MODE, (String) newValue);
            setDirty(true);
        }
    });
    simPropertyEditor.render(composite);
    // response table
    responseListTableEditor.setWidth(500);
    responseListTableEditor.setHeight(100);
    responseListTableEditor.setFillWidth(true);
    responseListTableEditor.setReadOnly(false);
    responseListTableEditor.setFireDirtyStateChange(false);
    responseListTableEditor.setContentProvider(contentProvider);
    responseListTableEditor.setLabelProvider(labelProvider);
    responseListTableEditor.setModelUpdater(modelUpdater);
    responseListTableEditor.setCellModifier(cellModifier);
    responseListTableEditor.setLabel("Responses");
    responseListTableEditor.render(composite);
    responseListTableEditor.getTable().addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            SimulationResponseVO response = (SimulationResponseVO) e.item.getData();
            String responseString = response == null ? null : response.getResponse();
            ValueDisplayDialog dlg = new ValueDisplayDialog(getShell(), responseString);
            dlg.open();
        }
    });
    // save button
    createSaveButton();
    // help link
    // spacer
    new Label(composite, SWT.NONE);
    helpPropertyEditor = new PropertyEditor(activity, PropertyEditor.TYPE_LINK);
    helpPropertyEditor.setLabel("Simulation Mode Help");
    helpPropertyEditor.render(composite);
    helpPropertyEditor.setValue("/MDWHub/doc/todo.html");
}
Also used : ValueDisplayDialog(com.centurylink.mdw.plugin.designer.dialogs.ValueDisplayDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ArrayList(java.util.ArrayList) Label(org.eclipse.swt.widgets.Label) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)

Aggregations

ValueDisplayDialog (com.centurylink.mdw.plugin.designer.dialogs.ValueDisplayDialog)1 PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)1 TableEditor (com.centurylink.mdw.plugin.designer.properties.editor.TableEditor)1 ValueChangeListener (com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener)1 ArrayList (java.util.ArrayList)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Label (org.eclipse.swt.widgets.Label)1