use of com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec in project mdw-designer by CenturyLinkCloud.
the class TestSuiteLaunchTab method createTable.
protected void createTable(Composite parent) {
int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION;
testCasesTable = new Table(parent, style);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 2;
gridData.verticalIndent = 3;
testCasesTable.setLayoutData(gridData);
testCasesTable.setLinesVisible(true);
testCasesTable.setHeaderVisible(true);
for (int i = 0; i < testCasesColumnSpecs.size(); i++) {
ColumnSpec colSpec = testCasesColumnSpecs.get(i);
int styles = SWT.LEFT;
if (colSpec.readOnly)
style = style | SWT.READ_ONLY;
TableColumn column = new TableColumn(testCasesTable, styles, i);
column.setText(colSpec.label);
column.setWidth(colSpec.width);
column.setResizable(colSpec.resizable);
}
}
use of com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec in project mdw-designer by CenturyLinkCloud.
the class ListView method createTable.
private void createTable(Composite parent) {
int style = SWT.MULTI | 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 = 10;
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);
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.UP;
}
tableViewer.getTable().setSortDirection(direction);
// TODO handle column sort
refreshTable();
}
});
}
// double-click
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
handleOpen(e.item.getData());
}
});
// right-click menu
table.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
table.setMenu(createContextMenu(table.getShell()));
}
});
// auto-adjust column width
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 - 25);
cumulative += tableColumns[i].getWidth();
}
}
});
}
use of com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec in project mdw-designer by CenturyLinkCloud.
the class VariableInstancesSection method createColumnSpecs.
private List<ColumnSpec> createColumnSpecs() {
List<ColumnSpec> columnSpecs = new ArrayList<ColumnSpec>();
ColumnSpec nameColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Variable Name", "name");
nameColSpec.width = 150;
columnSpecs.add(nameColSpec);
ColumnSpec instanceIdColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Instance ID", "instId");
instanceIdColSpec.width = 80;
columnSpecs.add(instanceIdColSpec);
ColumnSpec valueColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Value", "value");
valueColSpec.width = 300;
columnSpecs.add(valueColSpec);
ColumnSpec typeColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Type", "type");
typeColSpec.width = 200;
columnSpecs.add(typeColSpec);
return columnSpecs;
}
use of com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec in project mdw-designer by CenturyLinkCloud.
the class SubProcessMappingSection method createColumnSpecs.
private List<ColumnSpec> createColumnSpecs() {
List<ColumnSpec> columnSpecs = new ArrayList<>();
ColumnSpec variableColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "SubProcess Variable", "variable");
variableColSpec.width = 175;
variableColSpec.readOnly = true;
columnSpecs.add(variableColSpec);
ColumnSpec typeColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Type", "type");
typeColSpec.width = 200;
typeColSpec.readOnly = true;
columnSpecs.add(typeColSpec);
ColumnSpec varModeColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Mode", "mode");
varModeColSpec.width = 125;
varModeColSpec.readOnly = true;
columnSpecs.add(varModeColSpec);
ColumnSpec expressionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Binding Expression", "expression");
expressionColSpec.width = 175;
columnSpecs.add(expressionColSpec);
return columnSpecs;
}
use of com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec in project mdw-designer by CenturyLinkCloud.
the class SubProcessMappingSection method populateVariableBindingsTable.
private void populateVariableBindingsTable() {
mappingEditor.disposeWidget();
mappingEditor.setOwningProcess(subProcess);
inputOutputVariables = getInputOutputVariables();
List<ColumnSpec> columnSpecs = createColumnSpecs();
mappingEditor.setColumnSpecs(columnSpecs);
mappingEditor.render(composite, false);
if (subProcess != null) {
Map<String, String> map = StringHelper.parseMap(activity.getAttribute("variables"));
// clear inapplicable bindings
List<String> inapplicableVars = new ArrayList<>();
for (String varName : map.keySet()) {
boolean found = false;
for (VariableVO inputVar : subProcess.getInputOutputVariables()) {
if (inputVar.getName().equals(varName)) {
found = true;
break;
}
}
if (!found)
inapplicableVars.add(varName);
}
for (String inapplicableVar : inapplicableVars) map.remove(inapplicableVar);
if (!inapplicableVars.isEmpty()) {
String newAttrVal = StringHelper.formatMap(map);
activity.setAttribute("variables", newAttrVal);
activity.fireAttributeValueChanged("variables", newAttrVal);
}
List<VariableBinding> variableBindings = getVariableBindings(map);
mappingEditor.setValue(variableBindings);
}
composite.layout(true);
}
Aggregations