use of com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl 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;
}
use of com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl 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);
}
});
}
use of com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl in project mdw-designer by CenturyLinkCloud.
the class PreferencesSection method getSelectedNoticeRows.
private List<DefaultRowImpl> getSelectedNoticeRows(List<String> selectedNotices) {
List<DefaultRowImpl> tableRows = new ArrayList<DefaultRowImpl>();
for (Action outcome : UserActionVO.NOTIFIABLE_TASK_ACTIONS) {
String[] rowData = new String[2];
if (selectedNotices.contains(outcome.toString()))
rowData[0] = "true";
else
rowData[0] = "false";
rowData[1] = outcome.toString();
DefaultRowImpl row = noticesEditor.new DefaultRowImpl(rowData);
tableRows.add(row);
}
return tableRows;
}
use of com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl in project mdw-designer by CenturyLinkCloud.
the class OsgiAdapterDesignSection method getParamsTableValue.
private List<DefaultRowImpl> getParamsTableValue() {
List<DefaultRowImpl> rows = new ArrayList<DefaultRowImpl>();
String methodSig = methodDropdown.getValue();
if (methodSig != null && !methodSig.isEmpty()) {
int parenOpen = methodSig.indexOf('(');
String params = methodSig.substring(parenOpen + 1, methodSig.length() - 1);
for (String p : params.split(",")) {
p = p.trim();
int space = p.indexOf(' ');
String paramName = p.substring(space + 1);
String paramType = p.substring(0, space);
String[] colVals = new String[2];
colVals[0] = paramName + " (" + paramType + ")";
colVals[1] = "";
DefaultRowImpl row = paramsTable.new DefaultRowImpl(colVals);
rows.add(row);
}
}
return rows;
}
use of com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl in project mdw-designer by CenturyLinkCloud.
the class TaskTemplateEditor method addPage.
private void addPage(String section) {
ScrolledComposite scrolledComposite = new ScrolledComposite(getContainer(), SWT.V_SCROLL);
scrolledComposite.setLayout(new GridLayout());
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrolledComposite.setAlwaysShowScrollBars(true);
Composite composite = new Composite(scrolledComposite, SWT.NONE);
composite.setLayout(new FillLayout());
// create the grid layout
GridLayout gl = new GridLayout();
gl.numColumns = PropertyEditor.COLUMNS;
gl.marginTop = 6;
gl.marginLeft = 3;
composite.setLayout(gl);
for (PropertyEditor propertyEditor : propertyEditors) {
boolean belongs;
if (section == null)
belongs = propertyEditor.getSection() == null;
else
belongs = section.equals(propertyEditor.getSection());
if (belongs) {
if ("Notices".equals(propertyEditor.getName())) {
// special handling for notices
String attrVal = taskTemplate.getAttribute(TaskAttributeConstant.NOTICES);
if (StringHelper.isEmpty(attrVal) || attrVal.equals("$DefaultNotices"))
taskTemplate.setAttribute(TaskAttributeConstant.NOTICES, TaskVO.getDefaultNotices());
if (noticesValueChangeListener != null)
taskTemplate.removeAttributeValueChangeListener(noticesValueChangeListener);
noticesValueChangeListener = new NoticesValueChangeListener(propertyEditor);
taskTemplate.addAttributeValueChangeListener(noticesValueChangeListener);
propertyEditor.render(composite);
} else if ("Variables".equals(propertyEditor.getName())) {
// special handling for variables
TableEditor tableEditor = (TableEditor) propertyEditor;
// support for value expressions
tableEditor.setCellModifier(tableEditor.new DefaultCellModifier() {
@Override
public boolean canModify(Object element, String property) {
boolean editable = super.canModify(element, property);
if (editable && getColumnIndex(property) == 1) {
for (VariableVO var : getProcessVariables()) {
if (var.getName().equals(getValue(element, property)))
// can't edit process var rows
return false;
}
}
return editable;
}
});
tableEditor.setHorizontalSpan(4);
propertyEditor.render(composite);
tableEditor.getAddButton().setText("Expression");
GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gridData.widthHint = 80;
tableEditor.getAddButton().setLayoutData(gridData);
final Button deleteBtn = tableEditor.getDeleteButton();
tableEditor.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
if (sel.getFirstElement() instanceof DefaultRowImpl) {
DefaultRowImpl row = (DefaultRowImpl) sel.getFirstElement();
for (VariableVO var : getProcessVariables()) {
if (var.getName().equals(row.getColumnValue(1))) {
deleteBtn.setEnabled(false);
return;
}
}
deleteBtn.setEnabled(true);
} else {
deleteBtn.setEnabled(false);
}
}
});
} else {
propertyEditor.render(composite);
}
propertyEditor.setValue(taskTemplate);
if (!propertyEditor.getType().equals(PropertyEditor.TYPE_LINK)) {
propertyEditor.setEditable(!(propertyEditor.isReadOnly() || taskTemplate.isReadOnly()));
}
}
}
scrolledComposite.setContent(composite);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
String pageName = section == null ? "General" : section;
setPageText(addPage(scrolledComposite), pageName);
pages.put(pageName, scrolledComposite);
}
Aggregations