use of org.pentaho.di.trans.steps.transexecutor.TransExecutorParameters in project pentaho-kettle by pentaho.
the class TransExecutorDialog method addParametersTab.
private void addParametersTab() {
CTabItem wParametersTab = new CTabItem(wTabFolder, SWT.NONE);
wParametersTab.setText(BaseMessages.getString(PKG, "TransExecutorDialog.Parameters.Title"));
wParametersTab.setToolTipText(BaseMessages.getString(PKG, "TransExecutorDialog.Parameters.Tooltip"));
Composite wParametersComposite = new Composite(wTabFolder, SWT.NONE);
props.setLook(wParametersComposite);
FormLayout parameterTabLayout = new FormLayout();
parameterTabLayout.marginWidth = 15;
parameterTabLayout.marginHeight = 15;
wParametersComposite.setLayout(parameterTabLayout);
// Add a button: get parameters
//
wGetParameters = new Button(wParametersComposite, SWT.PUSH);
wGetParameters.setText(BaseMessages.getString(PKG, "TransExecutorDialog.Parameters.GetParameters"));
props.setLook(wGetParameters);
FormData fdGetParameters = new FormData();
fdGetParameters.bottom = new FormAttachment(100, 0);
fdGetParameters.right = new FormAttachment(100, 0);
wGetParameters.setLayoutData(fdGetParameters);
wGetParameters.setSelection(transExecutorMeta.getParameters().isInheritingAllVariables());
wGetParameters.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// null = force reload of data on disk
getParametersFromTrans(null);
}
});
// Now add a table view with the 3 columns to specify: variable name, input field & optional static input
//
parameterColumns = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "TransExecutorDialog.Parameters.column.Variable"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "TransExecutorDialog.Parameters.column.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false), new ColumnInfo(BaseMessages.getString(PKG, "TransExecutorDialog.Parameters.column.Input"), ColumnInfo.COLUMN_TYPE_TEXT, false, false) };
parameterColumns[1].setUsingVariables(true);
TransExecutorParameters parameters = transExecutorMeta.getParameters();
wTransExecutorParameters = new TableView(transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns, parameters.getVariable().length, false, lsMod, props, false);
props.setLook(wTransExecutorParameters);
FormData fdTransExecutors = new FormData();
fdTransExecutors.left = new FormAttachment(0, 0);
fdTransExecutors.right = new FormAttachment(100, 0);
fdTransExecutors.top = new FormAttachment(0, 0);
fdTransExecutors.bottom = new FormAttachment(wGetParameters, -10);
wTransExecutorParameters.setLayoutData(fdTransExecutors);
wTransExecutorParameters.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 33, 33, 33));
for (int i = 0; i < parameters.getVariable().length; i++) {
TableItem tableItem = wTransExecutorParameters.table.getItem(i);
tableItem.setText(1, Const.NVL(parameters.getVariable()[i], ""));
tableItem.setText(2, Const.NVL(parameters.getField()[i], ""));
tableItem.setText(3, Const.NVL(parameters.getInput()[i], ""));
}
wTransExecutorParameters.setRowNums();
wTransExecutorParameters.optWidth(true);
// Add a checkbox: inherit all variables...
//
wInheritAll = new Button(wParametersComposite, SWT.CHECK);
wInheritAll.setText(BaseMessages.getString(PKG, "TransExecutorDialog.Parameters.InheritAll"));
props.setLook(wInheritAll);
FormData fdInheritAll = new FormData();
fdInheritAll.top = new FormAttachment(wTransExecutorParameters, 15);
fdInheritAll.left = new FormAttachment(0, 0);
wInheritAll.setLayoutData(fdInheritAll);
wInheritAll.setSelection(transExecutorMeta.getParameters().isInheritingAllVariables());
FormData fdParametersComposite = new FormData();
fdParametersComposite.left = new FormAttachment(0, 0);
fdParametersComposite.top = new FormAttachment(0, 0);
fdParametersComposite.right = new FormAttachment(100, 0);
fdParametersComposite.bottom = new FormAttachment(100, 0);
wParametersComposite.setLayoutData(fdParametersComposite);
wParametersComposite.layout();
wParametersTab.setControl(wParametersComposite);
}
Aggregations