use of com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater in project mdw-designer by CenturyLinkCloud.
the class AttributesTableContainer method createTableEditor.
private void createTableEditor(Composite parent) {
FormatXml fmter = new FormatXml();
MbengDocument mbengDocument = new MbengDocumentClass();
try {
fmter.load(mbengDocument, pageletTable.xmlText());
} catch (Exception ex) {
ex.printStackTrace();
}
tableEditor = new TableEditor(null, mbengDocument.getRootNode());
// label was already rendered
tableEditor.setLabel(null);
tableEditor.setModelUpdater(new TableModelUpdater() {
public Object create() {
int i = 1;
String attrName = "New Field";
while (getAttribute(attrName) != null) attrName = "New Field (" + i++ + ")";
return new AttributeVO(attrName, null);
}
@SuppressWarnings("rawtypes")
public void updateModelValue(List tableValue) {
fireDirtyStateChange(true);
}
});
tableEditor.setCellModifier(new AttributeCellModifier());
tableEditor.setContentProvider(new AttributeContentProvider());
tableEditor.setLabelProvider(new AttributeLabelProvider());
tableEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
// value changed
}
});
tableEditor.render(parent, true);
}
use of com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.TableModelUpdater 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.TableModelUpdater 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.TableModelUpdater 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);
}
Aggregations