use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.
the class SapFunctionBrowser method open.
public SAPFunction open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
props.setLook(shell);
shell.setImage(GUIResource.getInstance().getImageSpoon());
int middle = Const.MIDDLE_PCT;
int margin = Const.MARGIN;
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SapFunctionBrowser.Title"));
// Function
//
wlFunction = new Label(shell, SWT.RIGHT);
wlFunction.setText(BaseMessages.getString(PKG, "SapInputDialog.Function.Label"));
props.setLook(wlFunction);
FormData fdlFunction = new FormData();
fdlFunction.left = new FormAttachment(0, 0);
fdlFunction.right = new FormAttachment(middle, -margin);
fdlFunction.top = new FormAttachment(0, 0);
wlFunction.setLayoutData(fdlFunction);
wbFunction = new Button(shell, SWT.PUSH);
props.setLook(wbFunction);
wbFunction.setText(BaseMessages.getString(PKG, "SapInputDialog.FindFunctionButton.Label"));
FormData fdbFunction = new FormData();
fdbFunction.right = new FormAttachment(100, 0);
fdbFunction.top = new FormAttachment(0, 0);
wbFunction.setLayoutData(fdbFunction);
wbFunction.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
searchString = wFunction.getText();
getData();
}
});
wFunction = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFunction);
FormData fdFunction = new FormData();
fdFunction.left = new FormAttachment(middle, 0);
fdFunction.right = new FormAttachment(wbFunction, -margin);
fdFunction.top = new FormAttachment(0, margin);
wFunction.setLayoutData(fdFunction);
Control lastControl = wFunction;
// The buttons at the bottom of the dialog
//
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wOK.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
ok();
}
});
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wCancel.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
cancel();
}
});
// Position the buttons...
//
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, Const.MARGIN, null);
// The search results...
//
ColumnInfo[] columns = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "SapFunctionBrowser.ResultView.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "SapFunctionBrowser.ResultView.Groupname.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "SapFunctionBrowser.ResultView.Application.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "SapFunctionBrowser.ResultView.Description.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
wResult = new TableView(space, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columns, 0, null, props);
wResult.setSortable(true);
FormData fdResults = new FormData();
fdResults.left = new FormAttachment(0, 0);
fdResults.top = new FormAttachment(lastControl, margin);
fdResults.right = new FormAttachment(100, 0);
fdResults.bottom = new FormAttachment(wOK, -3 * margin);
wResult.setLayoutData(fdResults);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
// Set the shell size, based upon previous time...
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return function;
}
use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.
the class SapInputDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
if (!SAPLibraryTester.isJCoLibAvailable()) {
int style = SWT.ICON_ERROR;
MessageBox messageBox = new MessageBox(shell, style);
messageBox.setMessage(BaseMessages.getString(PKG, "SapInputDialog.JCoLibNotFound"));
messageBox.open();
// dispose();
// return stepname;
}
if (!SAPLibraryTester.isJCoImplAvailable()) {
int style = SWT.ICON_ERROR;
MessageBox messageBox = new MessageBox(shell, style);
messageBox.setMessage(BaseMessages.getString(PKG, "SapInputDialog.JCoImplNotFound"));
messageBox.open();
// dispose();
// return stepname;
}
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
ModifyListener lsConnectionMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
backupChanged = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SapInputDialog.shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "SapInputDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
Control lastControl = wStepname;
// Connection line
//
wConnection = addConnectionLine(shell, lastControl, middle, margin);
List<String> items = new ArrayList<String>();
for (DatabaseMeta dbMeta : transMeta.getDatabases()) {
if (dbMeta.getDatabaseInterface() instanceof SAPR3DatabaseMeta) {
items.add(dbMeta.getName());
}
}
wConnection.setItems(items.toArray(new String[items.size()]));
if (input.getDatabaseMeta() == null && transMeta.nrDatabases() == 1) {
wConnection.select(0);
}
wConnection.addModifyListener(lsConnectionMod);
lastControl = wConnection;
// Function
//
wlFunction = new Label(shell, SWT.RIGHT);
wlFunction.setText(BaseMessages.getString(PKG, "SapInputDialog.Function.Label"));
props.setLook(wlFunction);
FormData fdlFunction = new FormData();
fdlFunction.left = new FormAttachment(0, 0);
fdlFunction.right = new FormAttachment(middle, -margin);
fdlFunction.top = new FormAttachment(lastControl, margin);
wlFunction.setLayoutData(fdlFunction);
wbFunction = new Button(shell, SWT.PUSH);
props.setLook(wbFunction);
wbFunction.setText(BaseMessages.getString(PKG, "SapInputDialog.FindFunctionButton.Label"));
FormData fdbFunction = new FormData();
fdbFunction.right = new FormAttachment(100, 0);
fdbFunction.top = new FormAttachment(lastControl, margin);
wbFunction.setLayoutData(fdbFunction);
wbFunction.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getFunction();
}
});
wFunction = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFunction);
wFunction.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
function = new SAPFunction(((Text) e.widget).getText());
input.setChanged();
}
});
FormData fdFunction = new FormData();
fdFunction.left = new FormAttachment(middle, 0);
fdFunction.right = new FormAttachment(wbFunction, -margin);
fdFunction.top = new FormAttachment(lastControl, margin);
wFunction.setLayoutData(fdFunction);
lastControl = wFunction;
// The parameter input fields...
//
wlInput = new Label(shell, SWT.NONE);
wlInput.setText(BaseMessages.getString(PKG, "SapInputDialog.Input.Label"));
props.setLook(wlInput);
FormData fdlInput = new FormData();
fdlInput.left = new FormAttachment(0, 0);
fdlInput.top = new FormAttachment(lastControl, margin);
wlInput.setLayoutData(fdlInput);
ColumnInfo[] ciKey = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.SAPType"), ColumnInfo.COLUMN_TYPE_CCOMBO, SapType.getDescriptions()), new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.TableOrStruct"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.SAPParameterName"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.TargetType"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMeta.getTypes()) };
inputFieldColumns.add(ciKey[0]);
wInput = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciKey, input.getParameters().size(), lsMod, props);
FormData fdInput = new FormData();
fdInput.left = new FormAttachment(0, 0);
fdInput.top = new FormAttachment(wlInput, margin);
fdInput.right = new FormAttachment(100, 0);
fdInput.bottom = new FormAttachment(40, 0);
wInput.setLayoutData(fdInput);
lastControl = wInput;
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
// wPreview = new Button(shell, SWT.PUSH);
// wPreview.setText(BaseMessages.getString(PKG, "System.Button.Preview"));
wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "SapInputDialog.GetFields.Button"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wAbout = new Button(shell, SWT.PUSH);
wAbout.setText(BaseMessages.getString(PKG, "SapInputDialog.About.Button"));
// Preview not possible without inputRowSets in BaseStep.getRow()
// setButtonPositions(new Button[] { wOK, wPreview, wAbout , wGet, wCancel}, margin, null);
setButtonPositions(new Button[] { wOK, wAbout, wGet, wCancel }, margin, null);
// The output fields...
//
wlOutput = new Label(shell, SWT.NONE);
wlOutput.setText(BaseMessages.getString(PKG, "SapInputDialog.Output.Label"));
props.setLook(wlOutput);
FormData fdlOutput = new FormData();
fdlOutput.left = new FormAttachment(0, 0);
fdlOutput.top = new FormAttachment(wInput, margin);
wlOutput.setLayoutData(fdlOutput);
ColumnInfo[] ciReturn = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.SAPField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false), new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.SAPType"), ColumnInfo.COLUMN_TYPE_CCOMBO, SapType.getDescriptions(), false), new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.TableOrStruct"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.NewName"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SapInputDialog.ColumnInfo.TargetType"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMeta.getTypes()) };
outputFieldColumns.add(ciReturn[0]);
wOutput = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, input.getOutputFields().size(), lsMod, props);
FormData fdOutput = new FormData();
fdOutput.left = new FormAttachment(0, 0);
fdOutput.top = new FormAttachment(wlOutput, margin);
fdOutput.right = new FormAttachment(100, 0);
fdOutput.bottom = new FormAttachment(wOK, -8 * margin);
wOutput.setLayoutData(fdOutput);
lastControl = wOutput;
this.wAscLink = new Link(this.shell, SWT.NONE);
FormData fdAscLink = new FormData();
fdAscLink.left = new FormAttachment(0, 0);
fdAscLink.top = new FormAttachment(wOutput, margin);
wAscLink.setLayoutData(fdAscLink);
this.wAscLink.setText(BaseMessages.getString(PKG, "SapInputDialog.Provided.Info"));
lastControl = wAscLink;
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsPreview = new Listener() {
public void handleEvent(Event e) {
preview();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
Listener lsAbout = new Listener() {
public void handleEvent(Event e) {
about();
}
};
wOK.addListener(SWT.Selection, lsOK);
// wPreview.addListener(SWT.Selection, lsPreview);
wGet.addListener(SWT.Selection, lsGet);
wCancel.addListener(SWT.Selection, lsCancel);
this.wAbout.addListener(SWT.Selection, lsAbout);
this.wAscLink.addListener(SWT.Selection, new Listener() {
public void handleEvent(final Event event) {
Program.launch(event.text);
}
});
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wFunction.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
// Set the shell size, based upon previous time...
setSize();
input.setChanged(backupChanged);
setComboValues();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.
the class SapInputDialog method setComboValues.
private void setComboValues() {
Runnable fieldLoader = new Runnable() {
public void run() {
try {
prevFields = transMeta.getPrevStepFields(stepname);
} catch (KettleException e) {
prevFields = new RowMeta();
String msg = BaseMessages.getString(PKG, "SapInputDialog.DoMapping.UnableToFindInput");
logError(msg);
}
String[] prevStepFieldNames = prevFields.getFieldNames();
Arrays.sort(prevStepFieldNames);
for (int i = 0; i < inputFieldColumns.size(); i++) {
ColumnInfo colInfo = outputFieldColumns.get(i);
colInfo.setComboValues(prevStepFieldNames);
}
}
};
new Thread(fieldLoader).start();
}
use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.
the class StarModelerPerspective method addSharedDimensionsGroupToDomainTab.
private Control addSharedDimensionsGroupToDomainTab(final StarDomain starDomain, final XulTabAndPanel tabAndPanel, Composite parentComposite, Control lastControl) {
PropsUI props = PropsUI.getInstance();
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Add a group for the logical stars
//
final Group dimsGroup = new Group(parentComposite, SWT.SHADOW_NONE);
props.setLook(dimsGroup);
dimsGroup.setText(BaseMessages.getString(PKG, "StarModelerPerspective.SharedDimensions.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginLeft = 10;
groupLayout.marginRight = 10;
groupLayout.marginTop = 10;
groupLayout.marginBottom = 10;
groupLayout.spacing = margin;
dimsGroup.setLayout(groupLayout);
FormData fdDimsGroup = new FormData();
fdDimsGroup.top = new FormAttachment(lastControl, margin);
fdDimsGroup.left = new FormAttachment(0, 0);
fdDimsGroup.right = new FormAttachment(100, 0);
dimsGroup.setLayoutData(fdDimsGroup);
// Then we'll add a table view for the shared dimensions
//
Label dimensionsLabel = new Label(dimsGroup, SWT.RIGHT);
props.setLook(dimensionsLabel);
dimensionsLabel.setText(BaseMessages.getString(PKG, "StarModelerPerspective.ListOfSharedDimensions.Label"));
FormData fdDimensionsLabel = new FormData();
fdDimensionsLabel.left = new FormAttachment(0, 0);
fdDimensionsLabel.right = new FormAttachment(middle, 0);
fdDimensionsLabel.top = new FormAttachment(lastControl, margin);
dimensionsLabel.setLayoutData(fdDimensionsLabel);
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "StarModelerPerspective.DimensionName.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "StarModelerPerspective.DimensionDescription.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
final TableView dimensionsList = new TableView(new Variables(), dimsGroup, SWT.BORDER, colinf, 1, null, props);
dimensionsList.setReadonly(true);
dimensionsList.table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
if (dimensionsList.getSelectionIndex() < 0)
return;
TableItem item = dimensionsList.table.getSelection()[0];
String name = item.getText(1);
if (editModel(dimsGroup.getShell(), starDomain, defaultLocale, name)) {
refreshDimensionsList(starDomain, dimensionsList);
}
}
});
refreshDimensionsList(starDomain, dimensionsList);
FormData fdDimensionsList = new FormData();
fdDimensionsList.top = new FormAttachment(lastControl, margin);
fdDimensionsList.bottom = new FormAttachment(lastControl, 250);
fdDimensionsList.left = new FormAttachment(middle, margin);
fdDimensionsList.right = new FormAttachment(100, 0);
dimensionsList.setLayoutData(fdDimensionsList);
lastControl = dimensionsList;
// A few buttons to edit the list
//
Button newDimensionButton = new Button(dimsGroup, SWT.PUSH);
newDimensionButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.NewSharedDimension"));
FormData fdNewModelButton = new FormData();
fdNewModelButton.top = new FormAttachment(lastControl, margin);
fdNewModelButton.left = new FormAttachment(middle, margin);
newDimensionButton.setLayoutData(fdNewModelButton);
newDimensionButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (newSharedDimension(dimsGroup.getShell(), starDomain)) {
refreshDimensionsList(starDomain, dimensionsList);
}
}
});
Button editDimensionButton = new Button(dimsGroup, SWT.PUSH);
editDimensionButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.EditDimension"));
FormData fdEditModelButton = new FormData();
fdEditModelButton.top = new FormAttachment(lastControl, margin);
fdEditModelButton.left = new FormAttachment(newDimensionButton, margin);
editDimensionButton.setLayoutData(fdEditModelButton);
editDimensionButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (dimensionsList.getSelectionIndex() < 0)
return;
TableItem item = dimensionsList.table.getSelection()[0];
String name = item.getText(1);
if (editSharedDimension(dimsGroup.getShell(), starDomain, defaultLocale, name)) {
refreshDimensionsList(starDomain, dimensionsList);
}
}
});
Button delDimensionButton = new Button(dimsGroup, SWT.PUSH);
delDimensionButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.DeleteDimension"));
FormData fdDelDimensionButton = new FormData();
fdDelDimensionButton.top = new FormAttachment(lastControl, margin);
fdDelDimensionButton.left = new FormAttachment(editDimensionButton, margin);
delDimensionButton.setLayoutData(fdDelDimensionButton);
delDimensionButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (dimensionsList.getSelectionIndex() < 0)
return;
TableItem item = dimensionsList.table.getSelection()[0];
String name = item.getText(1);
if (deleteSharedDimension(dimsGroup.getShell(), starDomain, defaultLocale, name)) {
refreshDimensionsList(starDomain, dimensionsList);
}
}
});
Button testDimensionButton = new Button(dimsGroup, SWT.PUSH);
testDimensionButton.setText("TEST PUR");
FormData fdtestDimensionButton = new FormData();
fdtestDimensionButton.top = new FormAttachment(lastControl, margin);
fdtestDimensionButton.left = new FormAttachment(delDimensionButton, margin);
testDimensionButton.setLayoutData(fdtestDimensionButton);
testDimensionButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
testMetaStore();
}
});
return dimsGroup;
}
use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.
the class JobEntryBaseDialog method createElements.
protected void createElements() {
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
getJobEntry().setChanged();
}
};
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 15;
formLayout.marginHeight = 15;
shell.setLayout(formLayout);
Label wicon = new Label(shell, SWT.RIGHT);
wicon.setImage(getImage());
FormData fdlicon = new FormData();
fdlicon.top = new FormAttachment(0, 0);
fdlicon.right = new FormAttachment(100, 0);
wicon.setLayoutData(fdlicon);
props.setLook(wicon);
wlName = new Label(shell, SWT.LEFT);
props.setLook(wlName);
wlName.setText(BaseMessages.getString(PKG, "JobTrans.JobStep.Label"));
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.top = new FormAttachment(0, 0);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
fdName = new FormData();
fdName.width = 250;
fdName.top = new FormAttachment(wlName, 5);
fdName.left = new FormAttachment(0, 0);
wName.setLayoutData(fdName);
Label spacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
FormData fdSpacer = new FormData();
fdSpacer.left = new FormAttachment(0, 0);
fdSpacer.top = new FormAttachment(wName, 15);
fdSpacer.right = new FormAttachment(100, 0);
spacer.setLayoutData(fdSpacer);
wlPath = new Label(shell, SWT.LEFT);
props.setLook(wlPath);
FormData fdlTransformation = new FormData();
fdlTransformation.left = new FormAttachment(0, 0);
fdlTransformation.top = new FormAttachment(spacer, 20);
fdlTransformation.right = new FormAttachment(50, 0);
wlPath.setLayoutData(fdlTransformation);
wPath = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPath);
FormData fdTransformation = new FormData();
fdTransformation.left = new FormAttachment(0, 0);
fdTransformation.top = new FormAttachment(wlPath, 5);
fdTransformation.right = new FormAttachment(50, 0);
wPath.setLayoutData(fdTransformation);
wbBrowse = new Button(shell, SWT.PUSH);
props.setLook(wbBrowse);
wbBrowse.setText(BaseMessages.getString(PKG, "JobTrans.Browse.Label"));
FormData fdBrowse = new FormData();
fdBrowse.left = new FormAttachment(wPath, 5);
fdBrowse.top = new FormAttachment(wlPath, Const.isOSX() ? 0 : 5);
wbBrowse.setLayoutData(fdBrowse);
CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// Options Tab Start
CTabItem wOptionsTab = new CTabItem(wTabFolder, SWT.NONE);
wOptionsTab.setText(BaseMessages.getString(PKG, "JobTrans.Options.Group.Label"));
wOptions = new Composite(wTabFolder, SWT.SHADOW_NONE);
props.setLook(wOptions);
FormLayout specLayout = new FormLayout();
specLayout.marginWidth = 15;
specLayout.marginHeight = 15;
wOptions.setLayout(specLayout);
gExecution = new Group(wOptions, SWT.SHADOW_ETCHED_IN);
props.setLook(gExecution);
gExecution.setText(BaseMessages.getString(PKG, "JobTrans.Execution.Group.Label"));
FormLayout gExecutionLayout = new FormLayout();
gExecutionLayout.marginWidth = 15;
gExecutionLayout.marginHeight = 15;
gExecution.setLayout(gExecutionLayout);
fdgExecution = new FormData();
fdgExecution.top = new FormAttachment(0, 10);
fdgExecution.left = new FormAttachment(0, 0);
fdgExecution.right = new FormAttachment(100, 0);
gExecution.setLayoutData(fdgExecution);
wEveryRow = new Button(gExecution, SWT.CHECK);
props.setLook(wEveryRow);
wEveryRow.setText(BaseMessages.getString(PKG, "JobTrans.ExecForEveryInputRow.Label"));
FormData fdbExecute = new FormData();
fdbExecute.left = new FormAttachment(0, 0);
fdbExecute.top = new FormAttachment(0, 0);
wEveryRow.setLayoutData(fdbExecute);
wOptionsTab.setControl(wOptions);
FormData fdOptions = new FormData();
fdOptions.left = new FormAttachment(0, 0);
fdOptions.top = new FormAttachment(0, 0);
fdOptions.right = new FormAttachment(100, 0);
fdOptions.bottom = new FormAttachment(100, 0);
wOptions.setLayoutData(fdOptions);
// Options Tab End
// Logging Tab Start
CTabItem wLoggingTab = new CTabItem(wTabFolder, SWT.NONE);
wLoggingTab.setText(BaseMessages.getString(PKG, "JobTrans.LogSettings.Group.Label"));
Composite wLogging = new Composite(wTabFolder, SWT.SHADOW_NONE);
props.setLook(wLogging);
FormLayout loggingLayout = new FormLayout();
loggingLayout.marginWidth = 15;
loggingLayout.marginHeight = 15;
wLogging.setLayout(loggingLayout);
wSetLogfile = new Button(wLogging, SWT.CHECK);
props.setLook(wSetLogfile);
wSetLogfile.setText(BaseMessages.getString(PKG, "JobTrans.Specify.Logfile.Label"));
FormData fdSpecifyLogFile = new FormData();
fdSpecifyLogFile.left = new FormAttachment(0, 0);
fdSpecifyLogFile.top = new FormAttachment(0, 0);
wSetLogfile.setLayoutData(fdSpecifyLogFile);
gLogFile = new Group(wLogging, SWT.SHADOW_ETCHED_IN);
props.setLook(gLogFile);
gLogFile.setText(BaseMessages.getString(PKG, "JobTrans.Logfile.Group.Label"));
FormLayout gLogFileLayout = new FormLayout();
gLogFileLayout.marginWidth = 15;
gLogFileLayout.marginHeight = 15;
gLogFile.setLayout(gLogFileLayout);
FormData fdgLogFile = new FormData();
fdgLogFile.top = new FormAttachment(wSetLogfile, 10);
fdgLogFile.left = new FormAttachment(0, 0);
fdgLogFile.right = new FormAttachment(100, 0);
gLogFile.setLayoutData(fdgLogFile);
wlLogfile = new Label(gLogFile, SWT.LEFT);
props.setLook(wlLogfile);
wlLogfile.setText(BaseMessages.getString(PKG, "JobTrans.NameOfLogfile.Label"));
FormData fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.top = new FormAttachment(0, 0);
wlLogfile.setLayoutData(fdlName);
wLogfile = new TextVar(jobMeta, gLogFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLogfile);
FormData fdName = new FormData();
fdName.width = 250;
fdName.left = new FormAttachment(0, 0);
fdName.top = new FormAttachment(wlLogfile, 5);
wLogfile.setLayoutData(fdName);
wbLogFilename = new Button(gLogFile, SWT.PUSH | SWT.CENTER);
props.setLook(wbLogFilename);
wbLogFilename.setText(BaseMessages.getString(PKG, "JobTrans.Browse.Label"));
fdbLogFilename = new FormData();
fdbLogFilename.top = new FormAttachment(wlLogfile, Const.isOSX() ? 0 : 5);
fdbLogFilename.left = new FormAttachment(wLogfile, 5);
wbLogFilename.setLayoutData(fdbLogFilename);
wlLogext = new Label(gLogFile, SWT.LEFT);
props.setLook(wlLogext);
wlLogext.setText(BaseMessages.getString(PKG, "JobTrans.LogfileExtension.Label"));
FormData fdlExtension = new FormData();
fdlExtension.left = new FormAttachment(0, 0);
fdlExtension.top = new FormAttachment(wLogfile, 10);
wlLogext.setLayoutData(fdlExtension);
wLogext = new TextVar(jobMeta, gLogFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLogext);
FormData fdExtension = new FormData();
fdExtension.width = 250;
fdExtension.left = new FormAttachment(0, 0);
fdExtension.top = new FormAttachment(wlLogext, 5);
wLogext.setLayoutData(fdExtension);
wlLoglevel = new Label(gLogFile, SWT.LEFT);
props.setLook(wlLoglevel);
wlLoglevel.setText(BaseMessages.getString(PKG, "JobTrans.Loglevel.Label"));
FormData fdlLogLevel = new FormData();
fdlLogLevel.left = new FormAttachment(0, 0);
fdlLogLevel.top = new FormAttachment(wLogext, 10);
wlLoglevel.setLayoutData(fdlLogLevel);
wLoglevel = new CCombo(gLogFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wLoglevel.setItems(LogLevel.getLogLevelDescriptions());
props.setLook(wLoglevel);
FormData fdLogLevel = new FormData();
fdLogLevel.width = 250;
fdLogLevel.left = new FormAttachment(0, 0);
fdLogLevel.top = new FormAttachment(wlLoglevel, 5);
wLoglevel.setLayoutData(fdLogLevel);
wAppendLogfile = new Button(gLogFile, SWT.CHECK);
props.setLook(wAppendLogfile);
wAppendLogfile.setText(BaseMessages.getString(PKG, "JobTrans.Append.Logfile.Label"));
FormData fdLogFile = new FormData();
fdLogFile.left = new FormAttachment(0, 0);
fdLogFile.top = new FormAttachment(wLoglevel, 10);
wAppendLogfile.setLayoutData(fdLogFile);
wCreateParentFolder = new Button(gLogFile, SWT.CHECK);
props.setLook(wCreateParentFolder);
wCreateParentFolder.setText(BaseMessages.getString(PKG, "JobTrans.Logfile.CreateParentFolder.Label"));
FormData fdCreateParent = new FormData();
fdCreateParent.left = new FormAttachment(0, 0);
fdCreateParent.top = new FormAttachment(wAppendLogfile, 10);
wCreateParentFolder.setLayoutData(fdCreateParent);
wAddDate = new Button(gLogFile, SWT.CHECK);
props.setLook(wAddDate);
wAddDate.setText(BaseMessages.getString(PKG, "JobTrans.Logfile.IncludeDate.Label"));
FormData fdIncludeDate = new FormData();
fdIncludeDate.left = new FormAttachment(0, 0);
fdIncludeDate.top = new FormAttachment(wCreateParentFolder, 10);
wAddDate.setLayoutData(fdIncludeDate);
wAddTime = new Button(gLogFile, SWT.CHECK);
props.setLook(wAddTime);
wAddTime.setText(BaseMessages.getString(PKG, "JobTrans.Logfile.IncludeTime.Label"));
FormData fdIncludeTime = new FormData();
fdIncludeTime.left = new FormAttachment(0, 0);
fdIncludeTime.top = new FormAttachment(wAddDate, 10);
wAddTime.setLayoutData(fdIncludeTime);
wSetLogfile.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent selectionEvent) {
setActive();
}
});
wLoggingTab.setControl(wLogging);
FormData fdLogging = new FormData();
fdLogging.left = new FormAttachment(0, 0);
fdLogging.top = new FormAttachment(0, 0);
fdLogging.right = new FormAttachment(100, 0);
fdLogging.bottom = new FormAttachment(100, 0);
wOptions.setLayoutData(fdLogging);
// Logging Tab End
CTabItem wArgumentTab = new CTabItem(wTabFolder, SWT.NONE);
wArgumentTab.setText(BaseMessages.getString(PKG, "JobTrans.Fields.Arguments.Label"));
FormLayout fieldLayout = new FormLayout();
fieldLayout.marginWidth = 15;
fieldLayout.marginHeight = 15;
Composite wFieldComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFieldComp);
wFieldComp.setLayout(fieldLayout);
wPrevious = new Button(wFieldComp, SWT.CHECK);
props.setLook(wPrevious);
wPrevious.setSelection(getArgFromPrev());
wPrevious.setText(BaseMessages.getString(PKG, "JobTrans.Previous.Label"));
FormData fdCopyResults = new FormData();
fdCopyResults.top = new FormAttachment(0, 0);
fdCopyResults.left = new FormAttachment(0, 0);
wPrevious.setLayoutData(fdCopyResults);
wPrevious.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
wFields.setEnabled(!getArgFromPrev());
}
});
final int FieldsCols = 1;
int rows = getArguments() == null ? 1 : (getArguments().length == 0 ? 0 : getArguments().length);
final int FieldsRows = rows;
ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "JobTrans.Arguments.Argument.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[0].setUsingVariables(true);
wFields = new TableView(jobMeta, wFieldComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.NO_SCROLL | SWT.V_SCROLL, colinf, FieldsRows, false, lsMod, props, false);
FormData fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wPrevious, 15);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(100, 0);
wFields.setLayoutData(fdFields);
wFields.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 100));
FormData fdFieldsComp = new FormData();
fdFieldsComp.left = new FormAttachment(0, 0);
fdFieldsComp.top = new FormAttachment(0, 0);
fdFieldsComp.right = new FormAttachment(100, 0);
fdFieldsComp.bottom = new FormAttachment(100, 0);
wFieldComp.setLayoutData(fdFieldsComp);
wFieldComp.layout();
wArgumentTab.setControl(wFieldComp);
CTabItem wParametersTab = new CTabItem(wTabFolder, SWT.NONE);
wParametersTab.setText(BaseMessages.getString(PKG, "JobTrans.Fields.Parameters.Label"));
fieldLayout = new FormLayout();
fieldLayout.marginWidth = 15;
fieldLayout.marginHeight = 15;
Composite wParameterComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wParameterComp);
wParameterComp.setLayout(fieldLayout);
wPrevToParams = new Button(wParameterComp, SWT.CHECK);
props.setLook(wPrevToParams);
wPrevToParams.setText(BaseMessages.getString(PKG, "JobTrans.PrevToParams.Label"));
FormData fdCopyResultsParams = new FormData();
fdCopyResultsParams.left = new FormAttachment(0, 0);
fdCopyResultsParams.top = new FormAttachment(0, 0);
wPrevToParams.setLayoutData(fdCopyResultsParams);
wPrevToParams.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getJobEntry().setChanged();
}
});
wPassParams = new Button(wParameterComp, SWT.CHECK);
props.setLook(wPassParams);
FormData fdPassParams = new FormData();
fdPassParams.left = new FormAttachment(0, 0);
fdPassParams.top = new FormAttachment(wPrevToParams, 10);
wPassParams.setLayoutData(fdPassParams);
wbGetParams = new Button(wParameterComp, SWT.PUSH);
wbGetParams.setText(BaseMessages.getString(PKG, "JobTrans.GetParameters.Button.Label"));
FormData fdGetParams = new FormData();
fdGetParams.bottom = new FormAttachment(100, 0);
fdGetParams.right = new FormAttachment(100, 0);
wbGetParams.setLayoutData(fdGetParams);
final int parameterRows = getParamters() != null ? getParamters().length : 0;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobTrans.Parameters.Parameter.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobTrans.Parameters.ColumnName.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobTrans.Parameters.Value.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinf[2].setUsingVariables(true);
wParameters = new TableView(jobMeta, wParameterComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, parameterRows, false, lsMod, props, false);
props.setLook(wParameters);
FormData fdParameters = new FormData();
fdParameters.left = new FormAttachment(0, 0);
fdParameters.top = new FormAttachment(wPassParams, 10);
fdParameters.right = new FormAttachment(100);
fdParameters.bottom = new FormAttachment(wbGetParams, -10);
wParameters.setLayoutData(fdParameters);
wParameters.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 33, 33, 33));
FormData fdParametersComp = new FormData();
fdParametersComp.left = new FormAttachment(0, 0);
fdParametersComp.top = new FormAttachment(0, 0);
fdParametersComp.right = new FormAttachment(100, 0);
fdParametersComp.bottom = new FormAttachment(100, 0);
wParameterComp.setLayoutData(fdParametersComp);
wParameterComp.layout();
wParametersTab.setControl(wParameterComp);
wTabFolder.setSelection(0);
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
FormData fdCancel = new FormData();
fdCancel.right = new FormAttachment(100, 0);
fdCancel.bottom = new FormAttachment(100, 0);
wCancel.setLayoutData(fdCancel);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
FormData fdOk = new FormData();
fdOk.right = new FormAttachment(wCancel, -5);
fdOk.bottom = new FormAttachment(100, 0);
wOK.setLayoutData(fdOk);
Label hSpacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
FormData fdhSpacer = new FormData();
fdhSpacer.left = new FormAttachment(0, 0);
fdhSpacer.bottom = new FormAttachment(wCancel, -15);
fdhSpacer.right = new FormAttachment(100, 0);
hSpacer.setLayoutData(fdhSpacer);
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wPath, 20);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(hSpacer, -15);
wTabFolder.setLayoutData(fdTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wPath.addSelectionListener(lsDef);
}
Aggregations