use of org.pentaho.di.ui.core.widget.ColumnsResizer in project pentaho-kettle by pentaho.
the class MetaInjectDialog method addOptionsTab.
private void addOptionsTab() {
// ////////////////////////
// START OF OPTIONS TAB ///
// ////////////////////////
wOptionsTab = new CTabItem(wTabFolder, SWT.NONE);
wOptionsTab.setText(BaseMessages.getString(PKG, "MetaInjectDialog.OptionsTab.TabTitle"));
wOptionsSComp = new ScrolledComposite(wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
wOptionsSComp.setLayout(new FillLayout());
wOptionsComp = new Composite(wOptionsSComp, SWT.NONE);
props.setLook(wOptionsComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 15;
fileLayout.marginHeight = 15;
wOptionsComp.setLayout(fileLayout);
Label wlSourceStep = new Label(wOptionsComp, SWT.RIGHT);
wlSourceStep.setText(BaseMessages.getString(PKG, "MetaInjectDialog.SourceStep.Label"));
props.setLook(wlSourceStep);
FormData fdlSourceStep = new FormData();
fdlSourceStep.left = new FormAttachment(0, 0);
fdlSourceStep.top = new FormAttachment(0, 0);
wlSourceStep.setLayoutData(fdlSourceStep);
wSourceStep = new CCombo(wOptionsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSourceStep);
wSourceStep.addModifyListener(lsMod);
FormData fdSourceStep = new FormData();
fdSourceStep.width = 300;
fdSourceStep.left = new FormAttachment(0, 0);
fdSourceStep.top = new FormAttachment(wlSourceStep, 5);
wSourceStep.setLayoutData(fdSourceStep);
wSourceStep.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
setActive();
}
});
final int fieldRows = metaInjectMeta.getSourceOutputFields().size();
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "MetaInjectDialog.ColumnInfo.Fieldname"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "MetaInjectDialog.ColumnInfo.Type"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getAllValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "MetaInjectDialog.ColumnInfo.Length"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "MetaInjectDialog.ColumnInfo.Precision"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
wSourceFields = new TableView(transMeta, wOptionsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, fieldRows, false, lsMod, props, false);
FormData fdFields = new FormData();
fdFields.height = 150;
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wSourceStep, 10);
fdFields.right = new FormAttachment(100, 0);
wSourceFields.setLayoutData(fdFields);
wSourceFields.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 25, 25, 25, 25));
Label wlTargetFile = new Label(wOptionsComp, SWT.RIGHT);
wlTargetFile.setText(BaseMessages.getString(PKG, "MetaInjectDialog.TargetFile.Label"));
props.setLook(wlTargetFile);
FormData fdlTargetFile = new FormData();
fdlTargetFile.left = new FormAttachment(0, 0);
fdlTargetFile.top = new FormAttachment(wSourceFields, 10);
wlTargetFile.setLayoutData(fdlTargetFile);
wTargetFile = new TextVar(transMeta, wOptionsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTargetFile);
wTargetFile.addModifyListener(lsMod);
FormData fdTargetFile = new FormData();
fdTargetFile.width = 300;
fdTargetFile.left = new FormAttachment(0, 0);
fdTargetFile.top = new FormAttachment(wlTargetFile, 5);
wTargetFile.setLayoutData(fdTargetFile);
wlStreamingSourceStep = new Label(wOptionsComp, SWT.RIGHT);
wlStreamingSourceStep.setText(BaseMessages.getString(PKG, "MetaInjectDialog.StreamingSourceStep.Label"));
props.setLook(wlStreamingSourceStep);
FormData fdlStreamingSourceStep = new FormData();
fdlStreamingSourceStep.left = new FormAttachment(0, 0);
fdlStreamingSourceStep.top = new FormAttachment(wTargetFile, 10);
wlStreamingSourceStep.setLayoutData(fdlStreamingSourceStep);
wStreamingSourceStep = new CCombo(wOptionsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wStreamingSourceStep);
FormData fdStreamingSourceStep = new FormData();
fdStreamingSourceStep.width = 300;
fdStreamingSourceStep.left = new FormAttachment(0, 0);
fdStreamingSourceStep.top = new FormAttachment(wlStreamingSourceStep, 5);
wStreamingSourceStep.setLayoutData(fdStreamingSourceStep);
wStreamingSourceStep.setItems(transMeta.getStepNames());
wStreamingSourceStep.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
setActive();
}
});
wlStreamingTargetStep = new Label(wOptionsComp, SWT.RIGHT);
wlStreamingTargetStep.setText(BaseMessages.getString(PKG, "MetaInjectDialog.StreamingTargetStep.Label"));
props.setLook(wlStreamingTargetStep);
FormData fdlStreamingTargetStep = new FormData();
fdlStreamingTargetStep.left = new FormAttachment(0, 0);
fdlStreamingTargetStep.top = new FormAttachment(wStreamingSourceStep, 10);
wlStreamingTargetStep.setLayoutData(fdlStreamingTargetStep);
wStreamingTargetStep = new CCombo(wOptionsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wStreamingTargetStep);
FormData fdStreamingTargetStep = new FormData();
fdStreamingTargetStep.width = 300;
fdStreamingTargetStep.left = new FormAttachment(0, 0);
fdStreamingTargetStep.top = new FormAttachment(wlStreamingTargetStep, 5);
wStreamingTargetStep.setLayoutData(fdStreamingTargetStep);
wNoExecution = new Button(wOptionsComp, SWT.CHECK);
wNoExecution.setText(BaseMessages.getString(PKG, "MetaInjectDialog.NoExecution.Label"));
props.setLook(wNoExecution);
FormData fdNoExecution = new FormData();
fdNoExecution.width = 250;
fdNoExecution.left = new FormAttachment(0, 0);
fdNoExecution.top = new FormAttachment(wStreamingTargetStep, 10);
wNoExecution.setLayoutData(fdNoExecution);
FormData fdOptionsComp = new FormData();
fdOptionsComp.left = new FormAttachment(0, 0);
fdOptionsComp.top = new FormAttachment(0, 0);
fdOptionsComp.right = new FormAttachment(100, 0);
fdOptionsComp.bottom = new FormAttachment(100, 0);
wOptionsComp.setLayoutData(fdOptionsComp);
wOptionsComp.pack();
Rectangle bounds = wOptionsComp.getBounds();
wOptionsSComp.setContent(wOptionsComp);
wOptionsSComp.setExpandHorizontal(true);
wOptionsSComp.setExpandVertical(true);
wOptionsSComp.setMinWidth(bounds.width);
wOptionsSComp.setMinHeight(bounds.height);
wOptionsTab.setControl(wOptionsSComp);
// ///////////////////////////////////////////////////////////
// / END OF OPTIONS TAB
// ///////////////////////////////////////////////////////////
}
use of org.pentaho.di.ui.core.widget.ColumnsResizer in project pentaho-kettle by pentaho.
the class JobExecutorDialog method addParametersTab.
private void addParametersTab() {
CTabItem wParametersTab = new CTabItem(wTabFolder, SWT.NONE);
wParametersTab.setText(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.Title"));
wParametersTab.setToolTipText(BaseMessages.getString(PKG, "JobExecutorDialog.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, "JobExecutorDialog.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(jobExecutorMeta.getParameters().isInheritingAllVariables());
wGetParameters.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// null : reload file
getParametersFromJob(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, "JobExecutorDialog.Parameters.column.Variable"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.column.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false), new ColumnInfo(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.column.Input"), ColumnInfo.COLUMN_TYPE_TEXT, false, false) };
parameterColumns[1].setUsingVariables(true);
JobExecutorParameters parameters = jobExecutorMeta.getParameters();
wJobExecutorParameters = new TableView(transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns, parameters.getVariable().length, lsMod, props);
props.setLook(wJobExecutorParameters);
FormData fdJobExecutors = new FormData();
fdJobExecutors.left = new FormAttachment(0, 0);
fdJobExecutors.right = new FormAttachment(100, 0);
fdJobExecutors.top = new FormAttachment(0, 0);
fdJobExecutors.bottom = new FormAttachment(wGetParameters, -10);
wJobExecutorParameters.setLayoutData(fdJobExecutors);
wJobExecutorParameters.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 33, 33, 33));
for (int i = 0; i < parameters.getVariable().length; i++) {
TableItem tableItem = wJobExecutorParameters.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], ""));
}
wJobExecutorParameters.setRowNums();
wJobExecutorParameters.optWidth(true);
// Add a checkbox: inherit all variables...
//
wInheritAll = new Button(wParametersComposite, SWT.CHECK);
wInheritAll.setText(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.InheritAll"));
props.setLook(wInheritAll);
FormData fdInheritAll = new FormData();
fdInheritAll.left = new FormAttachment(0, 0);
fdInheritAll.top = new FormAttachment(wJobExecutorParameters, 15);
wInheritAll.setLayoutData(fdInheritAll);
wInheritAll.setSelection(jobExecutorMeta.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);
}
use of org.pentaho.di.ui.core.widget.ColumnsResizer in project pentaho-kettle by pentaho.
the class MappingDialog method addParametersTab.
private void addParametersTab(final MappingParameters parameters) {
CTabItem wParametersTab = new CTabItem(wTabFolder, SWT.NONE);
wParametersTab.setText(BaseMessages.getString(PKG, "MappingDialog.Parameters.Title"));
wParametersTab.setToolTipText(BaseMessages.getString(PKG, "MappingDialog.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 checkbox: inherit all variables...
//
Button wInheritAll = new Button(wParametersComposite, SWT.CHECK);
wInheritAll.setText(BaseMessages.getString(PKG, "MappingDialog.Parameters.InheritAll"));
props.setLook(wInheritAll);
FormData fdInheritAll = new FormData();
fdInheritAll.bottom = new FormAttachment(100, 0);
fdInheritAll.left = new FormAttachment(0, 0);
fdInheritAll.right = new FormAttachment(100, -30);
wInheritAll.setLayoutData(fdInheritAll);
wInheritAll.setSelection(parameters.isInheritingAllVariables());
// Now add a tableview with the 2 columns to specify: input and output
// fields for the source and target steps.
//
ColumnInfo[] colinfo = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "MappingDialog.Parameters.column.Variable"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "MappingDialog.Parameters.column.ValueOrField"), ColumnInfo.COLUMN_TYPE_TEXT, false, false) };
colinfo[1].setUsingVariables(true);
final TableView wMappingParameters = new TableView(transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, parameters.getVariable().length, lsMod, props);
props.setLook(wMappingParameters);
FormData fdMappings = new FormData();
fdMappings.left = new FormAttachment(0, 0);
fdMappings.right = new FormAttachment(100, 0);
fdMappings.top = new FormAttachment(0, 0);
fdMappings.bottom = new FormAttachment(wInheritAll, -10);
wMappingParameters.setLayoutData(fdMappings);
wMappingParameters.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 50, 50));
for (int i = 0; i < parameters.getVariable().length; i++) {
TableItem tableItem = wMappingParameters.table.getItem(i);
tableItem.setText(1, Const.NVL(parameters.getVariable()[i], ""));
tableItem.setText(2, Const.NVL(parameters.getInputField()[i], ""));
}
wMappingParameters.setRowNums();
wMappingParameters.optWidth(true);
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);
parameterChanges = new MappingParametersTab(wMappingParameters, wInheritAll, parameters);
}
Aggregations