use of com.centurylink.mdw.plugin.designer.dialogs.VariableValueDialog in project mdw-designer by CenturyLinkCloud.
the class VariableInstancesSection method openDialog.
private void openDialog(VariableInstanceInfo variableInstanceInfo) {
Integer processStatus = process.getProcessInstance().getStatusCode();
VariableTypeVO varType = getType(variableInstanceInfo);
boolean readOnly = WorkStatus.STATUS_COMPLETED.equals(processStatus) || WorkStatus.STATUS_CANCELLED.equals(processStatus);
if (varType.isJavaObjectType()) {
try {
// update based on object instance or from server
varType = getDesignerProxy().getVariableInfo(variableInstanceInfo);
if (!varType.isUpdateable())
readOnly = true;
} catch (Exception ex) {
PluginMessages.log(ex);
}
}
try {
String varValue = getDesignerProxy().getVariableValue(getShell(), variableInstanceInfo, true);
VariableValueDialog variableValueDialog = new VariableValueDialog(getShell(), variableInstanceInfo, varType, varValue, readOnly);
if (variableValueDialog.open() == Dialog.OK) {
DesignerProxy designerProxy = process.getProject().getDesignerProxy();
designerProxy.updateVariableValue(process, variableInstanceInfo, variableValueDialog.getVariableValue().getValue());
List<VariableInstanceInfo> variables = process.getProcessInstance().getVariables();
List<VariableInstanceInfo> uninitializedVariables = getTheUninitializedVariables();
variables.addAll(uninitializedVariables);
tableEditor.setValue(variables);
}
} catch (Exception ex) {
PluginMessages.uiMessage(ex, "Retrieve Variable", process.getProject(), PluginMessages.VALIDATION_MESSAGE);
return;
}
}
use of com.centurylink.mdw.plugin.designer.dialogs.VariableValueDialog in project mdw-designer by CenturyLinkCloud.
the class VariableValuesTableContainer method createTable.
private void createTable(Composite parent) {
int style = SWT.SINGLE | 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 = 2;
gridData.verticalIndent = 3;
gridData.verticalAlignment = SWT.FILL;
gridData.heightHint = 150;
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);
}
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 - 5);
cumulative += tableColumns[i].getWidth();
}
}
});
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
VariableValue varVal = (VariableValue) e.item.getData();
String originalValue = varVal.getValue();
VariableValueDialog varValDlg = new VariableValueDialog(getShell(), varVal);
varValDlg.setHelpAvailable(false);
if (varValDlg.open() == Dialog.OK && !originalValue.equals(varVal.getValue())) {
varVal.setValue(varValDlg.getVariableValue().getValue());
tableViewer.update(varVal, null);
fireDirtyStateChange(true);
} else {
varVal.setValue(originalValue);
}
}
});
}
Aggregations