use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class JobEntryEvalFilesMetricsDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// SETTINGS grouping?
// ////////////////////////
// START OF SETTINGS GROUP
//
wSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSettings);
wSettings.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Settings.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wSettings.setLayout(groupLayout);
// SourceFiles
wlSourceFiles = new Label(wSettings, SWT.RIGHT);
wlSourceFiles.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.SourceFiles.Label"));
props.setLook(wlSourceFiles);
fdlSourceFiles = new FormData();
fdlSourceFiles.left = new FormAttachment(0, 0);
fdlSourceFiles.right = new FormAttachment(middle, -margin);
fdlSourceFiles.top = new FormAttachment(wName, margin);
wlSourceFiles.setLayoutData(fdlSourceFiles);
wSourceFiles = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSourceFiles.setItems(JobEntryEvalFilesMetrics.SourceFilesDesc);
// +1: starts at -1
wSourceFiles.select(0);
props.setLook(wSourceFiles);
fdSourceFiles = new FormData();
fdSourceFiles.left = new FormAttachment(middle, 0);
fdSourceFiles.top = new FormAttachment(wName, margin);
fdSourceFiles.right = new FormAttachment(100, 0);
wSourceFiles.setLayoutData(fdSourceFiles);
wSourceFiles.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
RefreshSourceFiles();
}
});
// ResultFilenamesWildcard
wlResultFilenamesWildcard = new Label(wSettings, SWT.RIGHT);
wlResultFilenamesWildcard.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFilenamesWildcard.Label"));
props.setLook(wlResultFilenamesWildcard);
fdlResultFilenamesWildcard = new FormData();
fdlResultFilenamesWildcard.left = new FormAttachment(0, 0);
fdlResultFilenamesWildcard.top = new FormAttachment(wSourceFiles, margin);
fdlResultFilenamesWildcard.right = new FormAttachment(middle, -margin);
wlResultFilenamesWildcard.setLayoutData(fdlResultFilenamesWildcard);
wResultFilenamesWildcard = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wResultFilenamesWildcard.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFilenamesWildcard.Tooltip"));
props.setLook(wResultFilenamesWildcard);
wResultFilenamesWildcard.addModifyListener(lsMod);
fdResultFilenamesWildcard = new FormData();
fdResultFilenamesWildcard.left = new FormAttachment(middle, 0);
fdResultFilenamesWildcard.top = new FormAttachment(wSourceFiles, margin);
fdResultFilenamesWildcard.right = new FormAttachment(100, -margin);
wResultFilenamesWildcard.setLayoutData(fdResultFilenamesWildcard);
// ResultFieldFile
wlResultFieldFile = new Label(wSettings, SWT.RIGHT);
wlResultFieldFile.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFieldFile.Label"));
props.setLook(wlResultFieldFile);
fdlResultFieldFile = new FormData();
fdlResultFieldFile.left = new FormAttachment(0, 0);
fdlResultFieldFile.top = new FormAttachment(wResultFilenamesWildcard, margin);
fdlResultFieldFile.right = new FormAttachment(middle, -margin);
wlResultFieldFile.setLayoutData(fdlResultFieldFile);
wResultFieldFile = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wResultFieldFile.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFieldFile.Tooltip"));
props.setLook(wResultFieldFile);
wResultFieldFile.addModifyListener(lsMod);
fdResultFieldFile = new FormData();
fdResultFieldFile.left = new FormAttachment(middle, 0);
fdResultFieldFile.top = new FormAttachment(wResultFilenamesWildcard, margin);
fdResultFieldFile.right = new FormAttachment(100, -margin);
wResultFieldFile.setLayoutData(fdResultFieldFile);
// ResultFieldWildcard
wlResultFieldWildcard = new Label(wSettings, SWT.RIGHT);
wlResultFieldWildcard.setText(BaseMessages.getString(PKG, "JobEvalWildcardsMetrics.ResultFieldWildcard.Label"));
props.setLook(wlResultFieldWildcard);
fdlResultFieldWildcard = new FormData();
fdlResultFieldWildcard.left = new FormAttachment(0, 0);
fdlResultFieldWildcard.top = new FormAttachment(wResultFieldFile, margin);
fdlResultFieldWildcard.right = new FormAttachment(middle, -margin);
wlResultFieldWildcard.setLayoutData(fdlResultFieldWildcard);
wResultFieldWildcard = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wResultFieldWildcard.setToolTipText(BaseMessages.getString(PKG, "JobEvalWildcardsMetrics.ResultFieldWildcard.Tooltip"));
props.setLook(wResultFieldWildcard);
wResultFieldWildcard.addModifyListener(lsMod);
fdResultFieldWildcard = new FormData();
fdResultFieldWildcard.left = new FormAttachment(middle, 0);
fdResultFieldWildcard.top = new FormAttachment(wResultFieldFile, margin);
fdResultFieldWildcard.right = new FormAttachment(100, -margin);
wResultFieldWildcard.setLayoutData(fdResultFieldWildcard);
// ResultFieldIncludeSubFolders
wlResultFieldIncludeSubFolders = new Label(wSettings, SWT.RIGHT);
wlResultFieldIncludeSubFolders.setText(BaseMessages.getString(PKG, "JobEvalIncludeSubFolderssMetrics.ResultFieldIncludeSubFolders.Label"));
props.setLook(wlResultFieldIncludeSubFolders);
fdlResultFieldIncludeSubFolders = new FormData();
fdlResultFieldIncludeSubFolders.left = new FormAttachment(0, 0);
fdlResultFieldIncludeSubFolders.top = new FormAttachment(wResultFieldWildcard, margin);
fdlResultFieldIncludeSubFolders.right = new FormAttachment(middle, -margin);
wlResultFieldIncludeSubFolders.setLayoutData(fdlResultFieldIncludeSubFolders);
wResultFieldIncludeSubFolders = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wResultFieldIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "JobEvalIncludeSubFolderssMetrics.ResultFieldIncludeSubFolders.Tooltip"));
props.setLook(wResultFieldIncludeSubFolders);
wResultFieldIncludeSubFolders.addModifyListener(lsMod);
fdResultFieldIncludeSubFolders = new FormData();
fdResultFieldIncludeSubFolders.left = new FormAttachment(middle, 0);
fdResultFieldIncludeSubFolders.top = new FormAttachment(wResultFieldWildcard, margin);
fdResultFieldIncludeSubFolders.right = new FormAttachment(100, -margin);
wResultFieldIncludeSubFolders.setLayoutData(fdResultFieldIncludeSubFolders);
// EvaluationType
wlEvaluationType = new Label(wSettings, SWT.RIGHT);
wlEvaluationType.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.EvaluationType.Label"));
props.setLook(wlEvaluationType);
fdlEvaluationType = new FormData();
fdlEvaluationType.left = new FormAttachment(0, 0);
fdlEvaluationType.right = new FormAttachment(middle, -margin);
fdlEvaluationType.top = new FormAttachment(wResultFieldIncludeSubFolders, margin);
wlEvaluationType.setLayoutData(fdlEvaluationType);
wEvaluationType = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wEvaluationType.setItems(JobEntryEvalFilesMetrics.EvaluationTypeDesc);
// +1: starts at -1
wEvaluationType.select(0);
props.setLook(wEvaluationType);
fdEvaluationType = new FormData();
fdEvaluationType.left = new FormAttachment(middle, 0);
fdEvaluationType.top = new FormAttachment(wResultFieldIncludeSubFolders, margin);
fdEvaluationType.right = new FormAttachment(100, 0);
wEvaluationType.setLayoutData(fdEvaluationType);
wEvaluationType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
RefreshSize();
jobEntry.setChanged();
}
});
fdSettings = new FormData();
fdSettings.left = new FormAttachment(0, margin);
fdSettings.top = new FormAttachment(wName, margin);
fdSettings.right = new FormAttachment(100, -margin);
wSettings.setLayoutData(fdSettings);
// ///////////////////////////////////////////////////////////
// / END OF SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// SourceFileFolder line
wlSourceFileFolder = new Label(wGeneralComp, SWT.RIGHT);
wlSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.SourceFileFolder.Label"));
props.setLook(wlSourceFileFolder);
fdlSourceFileFolder = new FormData();
fdlSourceFileFolder.left = new FormAttachment(0, 0);
fdlSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin);
fdlSourceFileFolder.right = new FormAttachment(middle, -margin);
wlSourceFileFolder.setLayoutData(fdlSourceFileFolder);
// Browse Source folders button ...
wbSourceDirectory = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbSourceDirectory);
wbSourceDirectory.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.BrowseFolders.Label"));
fdbSourceDirectory = new FormData();
fdbSourceDirectory.right = new FormAttachment(100, 0);
fdbSourceDirectory.top = new FormAttachment(wSettings, margin);
wbSourceDirectory.setLayoutData(fdbSourceDirectory);
wbSourceDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wSourceFileFolder.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wSourceFileFolder.setText(dir);
}
}
});
// Browse Source files button ...
wbSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbSourceFileFolder);
wbSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.BrowseFiles.Label"));
fdbSourceFileFolder = new FormData();
fdbSourceFileFolder.right = new FormAttachment(wbSourceDirectory, -margin);
fdbSourceFileFolder.top = new FormAttachment(wSettings, margin);
wbSourceFileFolder.setLayoutData(fdbSourceFileFolder);
// Browse Destination file add button ...
wbaSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbaSourceFileFolder);
wbaSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameAdd.Button"));
fdbaSourceFileFolder = new FormData();
fdbaSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -margin);
fdbaSourceFileFolder.top = new FormAttachment(wSettings, margin);
wbaSourceFileFolder.setLayoutData(fdbaSourceFileFolder);
wSourceFileFolder = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wSourceFileFolder.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.SourceFileFolder.Tooltip"));
props.setLook(wSourceFileFolder);
wSourceFileFolder.addModifyListener(lsMod);
fdSourceFileFolder = new FormData();
fdSourceFileFolder.left = new FormAttachment(middle, 0);
fdSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin);
fdSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -55);
wSourceFileFolder.setLayoutData(fdSourceFileFolder);
// Whenever something changes, set the tooltip to the expanded version:
wSourceFileFolder.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wSourceFileFolder.setToolTipText(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
}
});
wbSourceFileFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*" });
if (wSourceFileFolder.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wSourceFileFolder.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// Buttons to the right of the screen...
wbdSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbdSourceFileFolder);
wbdSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameDelete.Button"));
wbdSourceFileFolder.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameDelete.Tooltip"));
fdbdSourceFileFolder = new FormData();
fdbdSourceFileFolder.right = new FormAttachment(100, 0);
fdbdSourceFileFolder.top = new FormAttachment(wSourceFileFolder, 40);
wbdSourceFileFolder.setLayoutData(fdbdSourceFileFolder);
wbeSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbeSourceFileFolder);
wbeSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameEdit.Button"));
fdbeSourceFileFolder = new FormData();
fdbeSourceFileFolder.right = new FormAttachment(100, 0);
fdbeSourceFileFolder.left = new FormAttachment(wbdSourceFileFolder, 0, SWT.LEFT);
fdbeSourceFileFolder.top = new FormAttachment(wbdSourceFileFolder, margin);
wbeSourceFileFolder.setLayoutData(fdbeSourceFileFolder);
// Wildcard
wlWildcard = new Label(wGeneralComp, SWT.RIGHT);
wlWildcard.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Wildcard.Label"));
props.setLook(wlWildcard);
fdlWildcard = new FormData();
fdlWildcard.left = new FormAttachment(0, 0);
fdlWildcard.top = new FormAttachment(wSourceFileFolder, margin);
fdlWildcard.right = new FormAttachment(middle, -margin);
wlWildcard.setLayoutData(fdlWildcard);
wWildcard = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wWildcard.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(middle, 0);
fdWildcard.top = new FormAttachment(wSourceFileFolder, margin);
fdWildcard.right = new FormAttachment(wbSourceFileFolder, -55);
wWildcard.setLayoutData(fdWildcard);
wlFields = new Label(wGeneralComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.right = new FormAttachment(middle, -margin);
fdlFields.top = new FormAttachment(wWildcard, margin);
wlFields.setLayoutData(fdlFields);
int rows = jobEntry.getSourceFileFolder() == null ? 1 : (jobEntry.getSourceFileFolder().length == 0 ? 0 : jobEntry.getSourceFileFolder().length);
final int FieldsRows = rows;
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.SourceFileFolder.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.Wildcard.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.IncludeSubDirs.Label"), ColumnInfo.COLUMN_TYPE_CCOMBO, JobEntryEvalFilesMetrics.IncludeSubFoldersDesc) };
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.SourceFileFolder.Tooltip"));
colinf[1].setUsingVariables(true);
colinf[1].setToolTip(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.Wildcard.Tooltip"));
wFields = new TableView(jobMeta, wGeneralComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(wbeSourceFileFolder, -margin);
fdFields.bottom = new FormAttachment(100, -margin);
wFields.setLayoutData(fdFields);
// RefreshArgFromPrevious();
// Add the file to the list of files...
SelectionAdapter selA = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
wFields.add(new String[] { wSourceFileFolder.getText(), wWildcard.getText() });
wSourceFileFolder.setText("");
wWildcard.setText("");
wFields.removeEmptyRows();
wFields.setRowNums();
wFields.optWidth(true);
}
};
wbaSourceFileFolder.addSelectionListener(selA);
wSourceFileFolder.addSelectionListener(selA);
// Delete files from the list of files...
wbdSourceFileFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
int[] idx = wFields.getSelectionIndices();
wFields.remove(idx);
wFields.removeEmptyRows();
wFields.setRowNums();
}
});
// Edit the selected file & remove from the list...
wbeSourceFileFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
int idx = wFields.getSelectionIndex();
if (idx >= 0) {
String[] string = wFields.getItem(idx);
wSourceFileFolder.setText(string[0]);
wWildcard.setText(string[1]);
wFields.remove(idx);
}
wFields.removeEmptyRows();
wFields.setRowNums();
}
});
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////////////////
// START OF ADVANCED TAB ///
// ///////////////////////////////////
wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
wAdvancedTab.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Tab.Advanced.Label"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wAdvancedComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wAdvancedComp);
wAdvancedComp.setLayout(contentLayout);
// SuccessOngrouping?
// ////////////////////////
// START OF SUCCESS ON GROUP///
// /
wSuccessOn = new Group(wAdvancedComp, SWT.SHADOW_NONE);
props.setLook(wSuccessOn);
wSuccessOn.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.SuccessOn.Group.Label"));
FormLayout successongroupLayout = new FormLayout();
successongroupLayout.marginWidth = 10;
successongroupLayout.marginHeight = 10;
wSuccessOn.setLayout(successongroupLayout);
// Scale
wlScale = new Label(wSuccessOn, SWT.RIGHT);
wlScale.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.Scale.Label"));
props.setLook(wlScale);
fdlScale = new FormData();
fdlScale.left = new FormAttachment(0, 0);
fdlScale.right = new FormAttachment(middle, -margin);
fdlScale.top = new FormAttachment(0, margin);
wlScale.setLayoutData(fdlScale);
wScale = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wScale.setItems(JobEntryEvalFilesMetrics.scaleDesc);
// +1: starts at -1
wScale.select(0);
props.setLook(wScale);
fdScale = new FormData();
fdScale.left = new FormAttachment(middle, 0);
fdScale.top = new FormAttachment(0, margin);
fdScale.right = new FormAttachment(100, 0);
wScale.setLayoutData(fdScale);
wScale.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Success number Condition
wlSuccessNumberCondition = new Label(wSuccessOn, SWT.RIGHT);
wlSuccessNumberCondition.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.SuccessCondition.Label"));
props.setLook(wlSuccessNumberCondition);
fdlSuccessNumberCondition = new FormData();
fdlSuccessNumberCondition.left = new FormAttachment(0, 0);
fdlSuccessNumberCondition.right = new FormAttachment(middle, -margin);
fdlSuccessNumberCondition.top = new FormAttachment(wScale, margin);
wlSuccessNumberCondition.setLayoutData(fdlSuccessNumberCondition);
wSuccessNumberCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSuccessNumberCondition.setItems(JobEntrySimpleEval.successNumberConditionDesc);
// +1: starts at -1
wSuccessNumberCondition.select(0);
props.setLook(wSuccessNumberCondition);
fdSuccessNumberCondition = new FormData();
fdSuccessNumberCondition.left = new FormAttachment(middle, 0);
fdSuccessNumberCondition.top = new FormAttachment(wScale, margin);
fdSuccessNumberCondition.right = new FormAttachment(100, 0);
wSuccessNumberCondition.setLayoutData(fdSuccessNumberCondition);
wSuccessNumberCondition.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refresh();
jobEntry.setChanged();
}
});
// Compare with value
wlCompareValue = new Label(wSuccessOn, SWT.RIGHT);
wlCompareValue.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.CompareValue.Label"));
props.setLook(wlCompareValue);
fdlCompareValue = new FormData();
fdlCompareValue.left = new FormAttachment(0, 0);
fdlCompareValue.top = new FormAttachment(wSuccessNumberCondition, margin);
fdlCompareValue.right = new FormAttachment(middle, -margin);
wlCompareValue.setLayoutData(fdlCompareValue);
wCompareValue = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.CompareValue.Tooltip"));
props.setLook(wCompareValue);
wCompareValue.addModifyListener(lsMod);
fdCompareValue = new FormData();
fdCompareValue.left = new FormAttachment(middle, 0);
fdCompareValue.top = new FormAttachment(wSuccessNumberCondition, margin);
fdCompareValue.right = new FormAttachment(100, -margin);
wCompareValue.setLayoutData(fdCompareValue);
// Min value
wlMinValue = new Label(wSuccessOn, SWT.RIGHT);
wlMinValue.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.MinValue.Label"));
props.setLook(wlMinValue);
fdlMinValue = new FormData();
fdlMinValue.left = new FormAttachment(0, 0);
fdlMinValue.top = new FormAttachment(wSuccessNumberCondition, margin);
fdlMinValue.right = new FormAttachment(middle, -margin);
wlMinValue.setLayoutData(fdlMinValue);
wMinValue = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.MinValue.Tooltip"));
props.setLook(wMinValue);
wMinValue.addModifyListener(lsMod);
fdMinValue = new FormData();
fdMinValue.left = new FormAttachment(middle, 0);
fdMinValue.top = new FormAttachment(wSuccessNumberCondition, margin);
fdMinValue.right = new FormAttachment(100, -margin);
wMinValue.setLayoutData(fdMinValue);
// Maximum value
wlMaxValue = new Label(wSuccessOn, SWT.RIGHT);
wlMaxValue.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.MaxValue.Label"));
props.setLook(wlMaxValue);
fdlMaxValue = new FormData();
fdlMaxValue.left = new FormAttachment(0, 0);
fdlMaxValue.top = new FormAttachment(wMinValue, margin);
fdlMaxValue.right = new FormAttachment(middle, -margin);
wlMaxValue.setLayoutData(fdlMaxValue);
wMaxValue = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.MaxValue.Tooltip"));
props.setLook(wMaxValue);
wMaxValue.addModifyListener(lsMod);
fdMaxValue = new FormData();
fdMaxValue.left = new FormAttachment(middle, 0);
fdMaxValue.top = new FormAttachment(wMinValue, margin);
fdMaxValue.right = new FormAttachment(100, -margin);
wMaxValue.setLayoutData(fdMaxValue);
fdSuccessOn = new FormData();
fdSuccessOn.left = new FormAttachment(0, margin);
fdSuccessOn.top = new FormAttachment(0, margin);
fdSuccessOn.right = new FormAttachment(100, -margin);
wSuccessOn.setLayoutData(fdSuccessOn);
// ///////////////////////////////////////////////////////////
// / END OF Success ON GROUP
// ///////////////////////////////////////////////////////////
fdAdvancedComp = new FormData();
fdAdvancedComp.left = new FormAttachment(0, 0);
fdAdvancedComp.top = new FormAttachment(0, 0);
fdAdvancedComp.right = new FormAttachment(100, 0);
fdAdvancedComp.bottom = new FormAttachment(100, 0);
wAdvancedComp.setLayoutData(wAdvancedComp);
wAdvancedComp.layout();
wAdvancedTab.setControl(wAdvancedComp);
// ///////////////////////////////////////////////////////////
// / END OF ADVANCED TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wSourceFileFolder.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
refresh();
RefreshSize();
RefreshSourceFiles();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class JobEntryExportRepositoryDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobExportRepository.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Repositoryname line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobExportRepository.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobExportRepository.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF Repository Infos GROUP///
// /
wRepositoryInfos = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wRepositoryInfos);
wRepositoryInfos.setText(BaseMessages.getString(PKG, "JobExportRepository.RepositoryInfos.Group.Label"));
FormLayout RepositoryInfosgroupLayout = new FormLayout();
RepositoryInfosgroupLayout.marginWidth = 10;
RepositoryInfosgroupLayout.marginHeight = 10;
wRepositoryInfos.setLayout(RepositoryInfosgroupLayout);
// Repositoryname line
wlRepositoryname = new Label(wRepositoryInfos, SWT.RIGHT);
wlRepositoryname.setText(BaseMessages.getString(PKG, "JobExportRepository.Repositoryname.Label"));
props.setLook(wlRepositoryname);
fdlRepositoryname = new FormData();
fdlRepositoryname.left = new FormAttachment(0, margin);
fdlRepositoryname.top = new FormAttachment(wName, margin);
fdlRepositoryname.right = new FormAttachment(middle, -margin);
wlRepositoryname.setLayoutData(fdlRepositoryname);
wbRepositoryname = new Button(wRepositoryInfos, SWT.PUSH | SWT.CENTER);
props.setLook(wbRepositoryname);
wbRepositoryname.setText(BaseMessages.getString(PKG, "JobExportRepository.ListRepositories.Label"));
wbRepositoryname.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.ListRepositories.Tooltip"));
fdbRepositoryname = new FormData();
fdbRepositoryname.right = new FormAttachment(100, 0);
fdbRepositoryname.top = new FormAttachment(wName, 0);
wbRepositoryname.setLayoutData(fdbRepositoryname);
wbRepositoryname.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getListRepositories();
}
});
wRepositoryname = new TextVar(jobMeta, wRepositoryInfos, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wRepositoryname);
wRepositoryname.addModifyListener(lsMod);
fdRepositoryname = new FormData();
fdRepositoryname.left = new FormAttachment(middle, margin);
fdRepositoryname.top = new FormAttachment(wName, margin);
fdRepositoryname.right = new FormAttachment(wbRepositoryname, -margin);
wRepositoryname.setLayoutData(fdRepositoryname);
// Whenever something changes, set the tooltip to the expanded version:
wRepositoryname.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wRepositoryname.setToolTipText(jobMeta.environmentSubstitute(wRepositoryname.getText()));
}
});
// UserName line
wUserName = new LabelTextVar(jobMeta, wRepositoryInfos, BaseMessages.getString(PKG, "JobExportRepository.User.Label"), BaseMessages.getString(PKG, "JobExportRepository.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wRepositoryname, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(jobMeta, wRepositoryInfos, BaseMessages.getString(PKG, "JobExportRepository.Password.Label"), BaseMessages.getString(PKG, "JobExportRepository.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Test connection button
wTest = new Button(wRepositoryInfos, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobExportRepository.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wPassword, 2 * margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdRepositoryInfos = new FormData();
fdRepositoryInfos.left = new FormAttachment(0, margin);
fdRepositoryInfos.top = new FormAttachment(wName, margin);
fdRepositoryInfos.right = new FormAttachment(100, -margin);
wRepositoryInfos.setLayoutData(fdRepositoryInfos);
// ///////////////////////////////////////////////////////////
// / END OF Repository Infos GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Settings GROUP///
// //////////////////////////////
wSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSettings);
wSettings.setText(BaseMessages.getString(PKG, "JobExportRepository.Settings.Group.Label"));
FormLayout SettingsgroupLayout = new FormLayout();
SettingsgroupLayout.marginWidth = 10;
SettingsgroupLayout.marginHeight = 10;
wSettings.setLayout(SettingsgroupLayout);
wlExportType = new Label(wSettings, SWT.RIGHT);
wlExportType.setText(BaseMessages.getString(PKG, "JobExportRepository.ExportType.Label"));
props.setLook(wlExportType);
fdlExportType = new FormData();
fdlExportType.left = new FormAttachment(0, 0);
fdlExportType.right = new FormAttachment(middle, 0);
fdlExportType.top = new FormAttachment(wRepositoryInfos, margin);
wlExportType.setLayoutData(fdlExportType);
wExportType = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wExportType.add(BaseMessages.getString(PKG, "JobExportRepository.Export_All.Label"));
wExportType.add(BaseMessages.getString(PKG, "JobExportRepository.Export_Jobs.Label"));
wExportType.add(BaseMessages.getString(PKG, "JobExportRepository.Export_Trans.Label"));
wExportType.add(BaseMessages.getString(PKG, "JobExportRepository.Export_By_Folder.Label"));
wExportType.add(BaseMessages.getString(PKG, "JobExportRepository.Export_One_Folder.Label"));
// +1: starts at -1
wExportType.select(0);
props.setLook(wExportType);
fdExportType = new FormData();
fdExportType.left = new FormAttachment(middle, margin);
fdExportType.top = new FormAttachment(wTargetFilename, margin);
fdExportType.right = new FormAttachment(100, 0);
wExportType.setLayoutData(fdExportType);
wExportType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeOneFolder();
}
});
// Foldername line
wlFoldername = new Label(wSettings, SWT.RIGHT);
wlFoldername.setText(BaseMessages.getString(PKG, "JobExportRepository.Foldername.Label"));
props.setLook(wlFoldername);
fdlFoldername = new FormData();
fdlFoldername.left = new FormAttachment(0, margin);
fdlFoldername.top = new FormAttachment(wExportType, margin);
fdlFoldername.right = new FormAttachment(middle, -margin);
wlFoldername.setLayoutData(fdlFoldername);
wbFoldername = new Button(wSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbFoldername);
// wbFoldername.setText(BaseMessages.getString(PKG, "JobExportRepository.ListFolders.Label"));
wbFoldername.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.ListFolders.Tooltip"));
wbFoldername.setImage(GUIResource.getInstance().getImageBol());
fdbFoldername = new FormData();
fdbFoldername.right = new FormAttachment(100, 0);
fdbFoldername.top = new FormAttachment(wExportType, 0);
wbFoldername.setLayoutData(fdbFoldername);
wbFoldername.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
displaydirectoryList();
}
});
wFoldername = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFoldername);
wFoldername.addModifyListener(lsMod);
fdFoldername = new FormData();
fdFoldername.left = new FormAttachment(middle, margin);
fdFoldername.top = new FormAttachment(wExportType, margin);
fdFoldername.right = new FormAttachment(wbFoldername, -margin);
wFoldername.setLayoutData(fdFoldername);
// Whenever something changes, set the tooltip to the expanded version:
wFoldername.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFoldername.setToolTipText(jobMeta.environmentSubstitute(wFoldername.getText()));
}
});
// export each directory to a new folder?
wlNewFolder = new Label(wSettings, SWT.RIGHT);
wlNewFolder.setText(BaseMessages.getString(PKG, "JobExportRepository.NewFolder.Label"));
props.setLook(wlNewFolder);
fdlNewFolder = new FormData();
fdlNewFolder.left = new FormAttachment(0, 0);
fdlNewFolder.top = new FormAttachment(wFoldername, margin);
fdlNewFolder.right = new FormAttachment(middle, -margin);
wlNewFolder.setLayoutData(fdlNewFolder);
wNewFolder = new Button(wSettings, SWT.CHECK);
props.setLook(wNewFolder);
wNewFolder.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.NewFolder.Tooltip"));
fdNewFolder = new FormData();
fdNewFolder.left = new FormAttachment(middle, margin);
fdNewFolder.top = new FormAttachment(wFoldername, margin);
fdNewFolder.right = new FormAttachment(100, 0);
wNewFolder.setLayoutData(fdNewFolder);
wNewFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
fdSettings = new FormData();
fdSettings.left = new FormAttachment(0, margin);
fdSettings.top = new FormAttachment(wRepositoryInfos, margin);
fdSettings.right = new FormAttachment(100, -margin);
wSettings.setLayoutData(fdSettings);
// ///////////////////////////////////////////////////////////
// / END OF Settings GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Target Filename GROUP///
// //////////////////////////////
wTarget = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wTarget);
wTarget.setText(BaseMessages.getString(PKG, "JobExportRepository.Target.Group.Label"));
FormLayout TargetgroupLayout = new FormLayout();
TargetgroupLayout.marginWidth = 10;
TargetgroupLayout.marginHeight = 10;
wTarget.setLayout(TargetgroupLayout);
// Target filename line
wlTargetFilename = new Label(wTarget, SWT.RIGHT);
wlTargetFilename.setText(BaseMessages.getString(PKG, "JobExportRepository.TargetFilename.Label"));
props.setLook(wlTargetFilename);
fdlTargetFilename = new FormData();
fdlTargetFilename.left = new FormAttachment(0, 0);
fdlTargetFilename.top = new FormAttachment(wSettings, margin);
fdlTargetFilename.right = new FormAttachment(middle, -margin);
wlTargetFilename.setLayoutData(fdlTargetFilename);
// Browse Source folders button ...
wbTargetFilename = new Button(wTarget, SWT.PUSH | SWT.CENTER);
props.setLook(wbTargetFilename);
wbTargetFilename.setText(BaseMessages.getString(PKG, "JobExportRepository.BrowseFolders.Label"));
fdbTargetFilename = new FormData();
fdbTargetFilename.right = new FormAttachment(100, 0);
fdbTargetFilename.top = new FormAttachment(wSettings, margin);
wbTargetFilename.setLayoutData(fdbTargetFilename);
wbTargetFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wTargetFilename.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wTargetFilename.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wTargetFilename.setText(dir);
}
}
});
// Browse Source files button ...
wbTargetFoldername = new Button(wTarget, SWT.PUSH | SWT.CENTER);
props.setLook(wbTargetFoldername);
wbTargetFoldername.setText(BaseMessages.getString(PKG, "JobExportRepository.BrowseFiles.Label"));
fdbTargetFoldername = new FormData();
fdbTargetFoldername.right = new FormAttachment(wbTargetFilename, -margin);
fdbTargetFoldername.top = new FormAttachment(wSettings, margin);
wbTargetFoldername.setLayoutData(fdbTargetFoldername);
wbTargetFoldername.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFilterExtensions(new String[] { "*.xml", ".*" });
if (wTargetFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wTargetFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wTargetFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// Target filename line
wTargetFilename = new TextVar(jobMeta, wTarget, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTargetFilename);
wTargetFilename.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.TargetFilename.Tooltip"));
wTargetFilename.addModifyListener(lsMod);
fdTargetFilename = new FormData();
fdTargetFilename.left = new FormAttachment(middle, margin);
fdTargetFilename.top = new FormAttachment(wSettings, margin);
fdTargetFilename.right = new FormAttachment(wbTargetFoldername, -margin);
wTargetFilename.setLayoutData(fdTargetFilename);
// create folder or parent folder?
wlcreateFolder = new Label(wTarget, SWT.RIGHT);
wlcreateFolder.setText(BaseMessages.getString(PKG, "JobExportRepository.createFolder.Label"));
props.setLook(wlcreateFolder);
fdlcreateFolder = new FormData();
fdlcreateFolder.left = new FormAttachment(0, 0);
fdlcreateFolder.top = new FormAttachment(wTargetFilename, margin);
fdlcreateFolder.right = new FormAttachment(middle, -margin);
wlcreateFolder.setLayoutData(fdlcreateFolder);
wcreateFolder = new Button(wTarget, SWT.CHECK);
props.setLook(wcreateFolder);
wcreateFolder.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.createFolder.Tooltip"));
fdcreateFolder = new FormData();
fdcreateFolder.left = new FormAttachment(middle, margin);
fdcreateFolder.top = new FormAttachment(wTargetFilename, margin);
fdcreateFolder.right = new FormAttachment(100, 0);
wcreateFolder.setLayoutData(fdcreateFolder);
wcreateFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Create multi-part file?
wlAddDate = new Label(wTarget, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "JobExportRepository.AddDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wcreateFolder, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(wTarget, SWT.CHECK);
props.setLook(wAddDate);
wAddDate.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.AddDate.Tooltip"));
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, margin);
fdAddDate.top = new FormAttachment(wcreateFolder, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Create multi-part file?
wlAddTime = new Label(wTarget, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "JobExportRepository.AddTime.Label"));
props.setLook(wlAddTime);
fdlAddTime = new FormData();
fdlAddTime.left = new FormAttachment(0, 0);
fdlAddTime.top = new FormAttachment(wAddDate, margin);
fdlAddTime.right = new FormAttachment(middle, -margin);
wlAddTime.setLayoutData(fdlAddTime);
wAddTime = new Button(wTarget, SWT.CHECK);
props.setLook(wAddTime);
wAddTime.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.AddTime.Tooltip"));
fdAddTime = new FormData();
fdAddTime.left = new FormAttachment(middle, margin);
fdAddTime.top = new FormAttachment(wAddDate, margin);
fdAddTime.right = new FormAttachment(100, 0);
wAddTime.setLayoutData(fdAddTime);
wAddTime.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Specify date time format?
wlSpecifyFormat = new Label(wTarget, SWT.RIGHT);
wlSpecifyFormat.setText(BaseMessages.getString(PKG, "JobExportRepository.SpecifyFormat.Label"));
props.setLook(wlSpecifyFormat);
fdlSpecifyFormat = new FormData();
fdlSpecifyFormat.left = new FormAttachment(0, 0);
fdlSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdlSpecifyFormat.right = new FormAttachment(middle, -margin);
wlSpecifyFormat.setLayoutData(fdlSpecifyFormat);
wSpecifyFormat = new Button(wTarget, SWT.CHECK);
props.setLook(wSpecifyFormat);
wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.SpecifyFormat.Tooltip"));
fdSpecifyFormat = new FormData();
fdSpecifyFormat.left = new FormAttachment(middle, margin);
fdSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdSpecifyFormat.right = new FormAttachment(100, 0);
wSpecifyFormat.setLayoutData(fdSpecifyFormat);
wSpecifyFormat.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
setDateTimeFormat();
}
});
// DateTimeFormat
wlDateTimeFormat = new Label(wTarget, SWT.RIGHT);
wlDateTimeFormat.setText(BaseMessages.getString(PKG, "JobExportRepository.DateTimeFormat.Label"));
props.setLook(wlDateTimeFormat);
fdlDateTimeFormat = new FormData();
fdlDateTimeFormat.left = new FormAttachment(0, 0);
fdlDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdlDateTimeFormat.right = new FormAttachment(middle, -margin);
wlDateTimeFormat.setLayoutData(fdlDateTimeFormat);
wDateTimeFormat = new CCombo(wTarget, SWT.BORDER | SWT.READ_ONLY);
wDateTimeFormat.setEditable(true);
props.setLook(wDateTimeFormat);
wDateTimeFormat.addModifyListener(lsMod);
fdDateTimeFormat = new FormData();
fdDateTimeFormat.left = new FormAttachment(middle, margin);
fdDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdDateTimeFormat.right = new FormAttachment(100, 0);
wDateTimeFormat.setLayoutData(fdDateTimeFormat);
// Prepare a list of possible DateTimeFormats...
String[] dats = Const.getDateFormats();
for (int x = 0; x < dats.length; x++) {
wDateTimeFormat.add(dats[x]);
}
// If File Exists
wlIfFileExists = new Label(wTarget, SWT.RIGHT);
wlIfFileExists.setText(BaseMessages.getString(PKG, "JobExportRepository.IfFileExists.Label"));
props.setLook(wlIfFileExists);
fdlIfFileExists = new FormData();
fdlIfFileExists.left = new FormAttachment(0, 0);
fdlIfFileExists.right = new FormAttachment(middle, 0);
fdlIfFileExists.top = new FormAttachment(wDateTimeFormat, margin);
wlIfFileExists.setLayoutData(fdlIfFileExists);
wIfFileExists = new CCombo(wTarget, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wIfFileExists.add(BaseMessages.getString(PKG, "JobExportRepository.Do_Nothing_IfFileExists.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobExportRepository.Overwrite_File_IfFileExists.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobExportRepository.Unique_Name_IfFileExists.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobExportRepository.Fail_IfFileExists.Label"));
// +1: starts at -1
wIfFileExists.select(0);
props.setLook(wIfFileExists);
fdIfFileExists = new FormData();
fdIfFileExists.left = new FormAttachment(middle, margin);
fdIfFileExists.top = new FormAttachment(wDateTimeFormat, margin);
fdIfFileExists.right = new FormAttachment(100, 0);
wIfFileExists.setLayoutData(fdIfFileExists);
// Add file to result
wlAddFileToResult = new Label(wTarget, SWT.RIGHT);
wlAddFileToResult.setText(BaseMessages.getString(PKG, "JobExportRepository.AddFileToResult.Label"));
props.setLook(wlAddFileToResult);
fdlAddFileToResult = new FormData();
fdlAddFileToResult.left = new FormAttachment(0, 0);
fdlAddFileToResult.top = new FormAttachment(wIfFileExists, margin);
fdlAddFileToResult.right = new FormAttachment(middle, -margin);
wlAddFileToResult.setLayoutData(fdlAddFileToResult);
wAddFileToResult = new Button(wTarget, SWT.CHECK);
props.setLook(wAddFileToResult);
wAddFileToResult.setToolTipText(BaseMessages.getString(PKG, "JobExportRepository.AddFileToResult.Tooltip"));
fdAddFileToResult = new FormData();
fdAddFileToResult.left = new FormAttachment(middle, margin);
fdAddFileToResult.top = new FormAttachment(wIfFileExists, margin);
fdAddFileToResult.right = new FormAttachment(100, 0);
wAddFileToResult.setLayoutData(fdAddFileToResult);
wAddFileToResult.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
fdTarget = new FormData();
fdTarget.left = new FormAttachment(0, margin);
fdTarget.top = new FormAttachment(wSettings, margin);
fdTarget.right = new FormAttachment(100, -margin);
wTarget.setLayoutData(fdTarget);
// ///////////////////////////////////////////////////////////
// / END OF Target GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////////////////
// START OF ADVANCED TAB ///
// ///////////////////////////////////
wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
wAdvancedTab.setText(BaseMessages.getString(PKG, "JobExportRepository.Tab.Advanced.Label"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wAdvancedComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wAdvancedComp);
wAdvancedComp.setLayout(contentLayout);
// SuccessOngrouping?
// ////////////////////////
// START OF SUCCESS ON GROUP///
// /
wSuccessOn = new Group(wAdvancedComp, SWT.SHADOW_NONE);
props.setLook(wSuccessOn);
wSuccessOn.setText(BaseMessages.getString(PKG, "JobExportRepository.SuccessOn.Group.Label"));
FormLayout successongroupLayout = new FormLayout();
successongroupLayout.marginWidth = 10;
successongroupLayout.marginHeight = 10;
wSuccessOn.setLayout(successongroupLayout);
// Success Condition
wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT);
wlSuccessCondition.setText(BaseMessages.getString(PKG, "JobExportRepository.SuccessCondition.Label"));
props.setLook(wlSuccessCondition);
fdlSuccessCondition = new FormData();
fdlSuccessCondition.left = new FormAttachment(0, 0);
fdlSuccessCondition.right = new FormAttachment(middle, 0);
fdlSuccessCondition.top = new FormAttachment(0, margin);
wlSuccessCondition.setLayoutData(fdlSuccessCondition);
wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSuccessCondition.add(BaseMessages.getString(PKG, "JobExportRepository.SuccessWhenAllWorksFine.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobExportRepository.SuccessWhenErrorsLessThan.Label"));
// +1: starts at -1
wSuccessCondition.select(0);
props.setLook(wSuccessCondition);
fdSuccessCondition = new FormData();
fdSuccessCondition.left = new FormAttachment(middle, 0);
fdSuccessCondition.top = new FormAttachment(0, margin);
fdSuccessCondition.right = new FormAttachment(100, 0);
wSuccessCondition.setLayoutData(fdSuccessCondition);
wSuccessCondition.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeSuccessCondition();
}
});
// Success when number of errors less than
wlLimit = new Label(wSuccessOn, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "JobExportRepository.Limit.Label"));
props.setLook(wlLimit);
fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.top = new FormAttachment(wSuccessCondition, margin);
fdlLimit.right = new FormAttachment(middle, -margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobExportRepository.NrLimit.Tooltip"));
props.setLook(wLimit);
wLimit.addModifyListener(lsMod);
fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.top = new FormAttachment(wSuccessCondition, margin);
fdLimit.right = new FormAttachment(100, -margin);
wLimit.setLayoutData(fdLimit);
fdSuccessOn = new FormData();
fdSuccessOn.left = new FormAttachment(0, margin);
fdSuccessOn.top = new FormAttachment(0, margin);
fdSuccessOn.right = new FormAttachment(100, -margin);
wSuccessOn.setLayoutData(fdSuccessOn);
// ///////////////////////////////////////////////////////////
// / END OF Success ON GROUP
// ///////////////////////////////////////////////////////////
fdAdvancedComp = new FormData();
fdAdvancedComp.left = new FormAttachment(0, 0);
fdAdvancedComp.top = new FormAttachment(0, 0);
fdAdvancedComp.right = new FormAttachment(100, 0);
fdAdvancedComp.bottom = new FormAttachment(100, 0);
wAdvancedComp.setLayoutData(wAdvancedComp);
wAdvancedComp.layout();
wAdvancedTab.setControl(wAdvancedComp);
// ///////////////////////////////////////////////////////////
// / END OF ADVANCED TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
repConnect(true);
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wRepositoryname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activeOneFolder();
setDateTimeFormat();
activeSuccessCondition();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class JobEntryFTPDeleteDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
pwdFolder = null;
ftpclient = null;
ftpsclient = null;
sftpclient = null;
conn = null;
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobFTPDelete.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobFTPDelete.Name.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobFTPDelete.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobFTPDelete.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// Protocol
wlProtocol = new Label(wServerSettings, SWT.RIGHT);
wlProtocol.setText(BaseMessages.getString(PKG, "JobFTPDelete.Protocol.Label"));
props.setLook(wlProtocol);
fdlProtocol = new FormData();
fdlProtocol.left = new FormAttachment(0, 0);
fdlProtocol.top = new FormAttachment(wName, margin);
fdlProtocol.right = new FormAttachment(middle, 0);
wlProtocol.setLayoutData(fdlProtocol);
wProtocol = new Combo(wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProtocol.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.Protocol.Tooltip"));
wProtocol.add(JobEntryFTPDelete.PROTOCOL_FTP);
wProtocol.add(JobEntryFTPDelete.PROTOCOL_FTPS);
wProtocol.add(JobEntryFTPDelete.PROTOCOL_SFTP);
wProtocol.add(JobEntryFTPDelete.PROTOCOL_SSH);
props.setLook(wProtocol);
fdProtocol = new FormData();
fdProtocol.left = new FormAttachment(middle, margin);
fdProtocol.top = new FormAttachment(wName, margin);
fdProtocol.right = new FormAttachment(100, 0);
wProtocol.setLayoutData(fdProtocol);
wProtocol.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeFTPProtocol();
jobEntry.setChanged();
}
});
// ServerName line
wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.Server.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wProtocol, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Proxy port line
wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.Port.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(wServerName, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// UserName line
wUserName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.User.Label"), BaseMessages.getString(PKG, "JobFTPDelete.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.Password.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
wlConnectionType = new Label(wServerSettings, SWT.RIGHT);
wlConnectionType.setText(BaseMessages.getString(PKG, "JobFTPDelete.ConnectionType.Label"));
props.setLook(wlConnectionType);
fdlConnectionType = new FormData();
fdlConnectionType.left = new FormAttachment(0, 0);
fdlConnectionType.right = new FormAttachment(middle, 0);
fdlConnectionType.top = new FormAttachment(wPassword, 2 * margin);
wlConnectionType.setLayoutData(fdlConnectionType);
wConnectionType = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wConnectionType.setItems(FTPSConnection.connection_type_Desc);
props.setLook(wConnectionType);
fdConnectionType = new FormData();
fdConnectionType.left = new FormAttachment(middle, margin);
fdConnectionType.top = new FormAttachment(wPassword, 2 * margin);
fdConnectionType.right = new FormAttachment(100, 0);
wConnectionType.setLayoutData(fdConnectionType);
wConnectionType.addModifyListener(lsMod);
// Use proxy...
wluseProxy = new Label(wServerSettings, SWT.RIGHT);
wluseProxy.setText(BaseMessages.getString(PKG, "JobFTPDelete.useProxy.Label"));
props.setLook(wluseProxy);
fdluseProxy = new FormData();
fdluseProxy.left = new FormAttachment(0, 0);
fdluseProxy.top = new FormAttachment(wConnectionType, margin);
fdluseProxy.right = new FormAttachment(middle, 0);
wluseProxy.setLayoutData(fdluseProxy);
wuseProxy = new Button(wServerSettings, SWT.CHECK);
props.setLook(wuseProxy);
wuseProxy.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.useProxy.Tooltip"));
fduseProxy = new FormData();
fduseProxy.left = new FormAttachment(middle, margin);
fduseProxy.top = new FormAttachment(wConnectionType, margin);
fduseProxy.right = new FormAttachment(100, 0);
wuseProxy.setLayoutData(fduseProxy);
wuseProxy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeProxy();
jobEntry.setChanged();
}
});
// Proxy host line
wProxyHost = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.ProxyHost.Label"), BaseMessages.getString(PKG, "JobFTPDelete.ProxyHost.Tooltip"));
props.setLook(wProxyHost);
wProxyHost.addModifyListener(lsMod);
fdProxyHost = new FormData();
fdProxyHost.left = new FormAttachment(0, 0);
fdProxyHost.top = new FormAttachment(wuseProxy, margin);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// Proxy port line
wProxyPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.ProxyPort.Label"), BaseMessages.getString(PKG, "JobFTPDelete.ProxyPort.Tooltip"));
props.setLook(wProxyPort);
wProxyPort.addModifyListener(lsMod);
fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(0, 0);
fdProxyPort.top = new FormAttachment(wProxyHost, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
// Proxy username line
wProxyUsername = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTPDelete.ProxyUsername.Tooltip"));
props.setLook(wProxyUsername);
wProxyUsername.addModifyListener(lsMod);
fdProxyUsername = new FormData();
fdProxyUsername.left = new FormAttachment(0, 0);
fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
fdProxyUsername.right = new FormAttachment(100, 0);
wProxyUsername.setLayoutData(fdProxyUsername);
// Proxy password line
wProxyPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTPDelete.ProxyPassword.Tooltip"), true);
props.setLook(wProxyPassword);
wProxyPassword.addModifyListener(lsMod);
fdProxyPasswd = new FormData();
fdProxyPasswd.left = new FormAttachment(0, 0);
fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
fdProxyPasswd.right = new FormAttachment(100, 0);
wProxyPassword.setLayoutData(fdProxyPasswd);
// usePublicKey
wlusePublicKey = new Label(wServerSettings, SWT.RIGHT);
wlusePublicKey.setText(BaseMessages.getString(PKG, "JobFTPDelete.usePublicKeyFiles.Label"));
props.setLook(wlusePublicKey);
fdlusePublicKey = new FormData();
fdlusePublicKey.left = new FormAttachment(0, 0);
fdlusePublicKey.top = new FormAttachment(wProxyPassword, margin);
fdlusePublicKey.right = new FormAttachment(middle, 0);
wlusePublicKey.setLayoutData(fdlusePublicKey);
wusePublicKey = new Button(wServerSettings, SWT.CHECK);
wusePublicKey.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.usePublicKeyFiles.Tooltip"));
props.setLook(wusePublicKey);
fdusePublicKey = new FormData();
fdusePublicKey.left = new FormAttachment(middle, margin);
fdusePublicKey.top = new FormAttachment(wProxyPassword, margin);
fdusePublicKey.right = new FormAttachment(100, 0);
wusePublicKey.setLayoutData(fdusePublicKey);
wusePublicKey.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeUsePublicKey();
jobEntry.setChanged();
}
});
// Key File
wlKeyFilename = new Label(wServerSettings, SWT.RIGHT);
wlKeyFilename.setText(BaseMessages.getString(PKG, "JobFTPDelete.KeyFilename.Label"));
props.setLook(wlKeyFilename);
fdlKeyFilename = new FormData();
fdlKeyFilename.left = new FormAttachment(0, 0);
fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdlKeyFilename.right = new FormAttachment(middle, -margin);
wlKeyFilename.setLayoutData(fdlKeyFilename);
wbKeyFilename = new Button(wServerSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbKeyFilename);
wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbKeyFilename = new FormData();
fdbKeyFilename.right = new FormAttachment(100, 0);
fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
// fdbKeyFilename.height = 22;
wbKeyFilename.setLayoutData(fdbKeyFilename);
wKeyFilename = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.KeyFilename.Tooltip"));
props.setLook(wKeyFilename);
wKeyFilename.addModifyListener(lsMod);
fdKeyFilename = new FormData();
fdKeyFilename.left = new FormAttachment(middle, margin);
fdKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
wKeyFilename.setLayoutData(fdKeyFilename);
// Whenever something changes, set the tooltip to the expanded version:
wKeyFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wKeyFilename.setToolTipText(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
});
wbKeyFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.pem", "*" });
if (wKeyFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// keyfilePass line
wkeyfilePass = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.keyfilePass.Label"), BaseMessages.getString(PKG, "JobFTPDelete.keyfilePass.Tooltip"), true);
props.setLook(wkeyfilePass);
wkeyfilePass.addModifyListener(lsMod);
fdkeyfilePass = new FormData();
fdkeyfilePass.left = new FormAttachment(0, 0);
fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
fdkeyfilePass.right = new FormAttachment(100, 0);
wkeyfilePass.setLayoutData(fdkeyfilePass);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobFTPDelete.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wkeyfilePass, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wName, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Advanced TAB ///
// ////////////////////////
wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "JobFTPDelete.Tab.Files.Label"));
wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout AdvancedLayout = new FormLayout();
AdvancedLayout.marginWidth = 3;
AdvancedLayout.marginHeight = 3;
wFilesComp.setLayout(AdvancedLayout);
// ////////////////////////
// START OF Advanced SETTINGS GROUP///
// /
wAdvancedSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedSettings);
wAdvancedSettings.setText(BaseMessages.getString(PKG, "JobFTPDelete.AdvancedSettings.Group.Label"));
FormLayout AdvancedSettingsgroupLayout = new FormLayout();
AdvancedSettingsgroupLayout.marginWidth = 10;
AdvancedSettingsgroupLayout.marginHeight = 10;
wAdvancedSettings.setLayout(AdvancedSettingsgroupLayout);
// Timeout line
wTimeout = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobFTPDelete.Timeout.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.addModifyListener(lsMod);
fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(0, 0);
fdTimeout.top = new FormAttachment(wActive, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// active connection?
wlActive = new Label(wAdvancedSettings, SWT.RIGHT);
wlActive.setText(BaseMessages.getString(PKG, "JobFTPDelete.ActiveConns.Label"));
props.setLook(wlActive);
fdlActive = new FormData();
fdlActive.left = new FormAttachment(0, 0);
fdlActive.top = new FormAttachment(wTimeout, margin);
fdlActive.right = new FormAttachment(middle, 0);
wlActive.setLayoutData(fdlActive);
wActive = new Button(wAdvancedSettings, SWT.CHECK);
wActive.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.ActiveConns.Tooltip"));
props.setLook(wActive);
fdActive = new FormData();
fdActive.left = new FormAttachment(middle, margin);
fdActive.top = new FormAttachment(wTimeout, margin);
fdActive.right = new FormAttachment(100, 0);
wActive.setLayoutData(fdActive);
fdAdvancedSettings = new FormData();
fdAdvancedSettings.left = new FormAttachment(0, margin);
fdAdvancedSettings.top = new FormAttachment(0, margin);
fdAdvancedSettings.right = new FormAttachment(100, -margin);
wAdvancedSettings.setLayoutData(fdAdvancedSettings);
// ///////////////////////////////////////////////////////////
// / END OF Advanced SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Remote SETTINGS GROUP///
// /
wRemoteSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wRemoteSettings);
wRemoteSettings.setText(BaseMessages.getString(PKG, "JobFTPDelete.RemoteSettings.Group.Label"));
FormLayout RemoteSettinsgroupLayout = new FormLayout();
RemoteSettinsgroupLayout.marginWidth = 10;
RemoteSettinsgroupLayout.marginHeight = 10;
wRemoteSettings.setLayout(RemoteSettinsgroupLayout);
// Get arguments from previous result...
wlgetPrevious = new Label(wRemoteSettings, SWT.RIGHT);
wlgetPrevious.setText(BaseMessages.getString(PKG, "JobFTPDelete.getPrevious.Label"));
props.setLook(wlgetPrevious);
fdlgetPrevious = new FormData();
fdlgetPrevious.left = new FormAttachment(0, 0);
fdlgetPrevious.top = new FormAttachment(wAdvancedSettings, margin);
fdlgetPrevious.right = new FormAttachment(middle, 0);
wlgetPrevious.setLayoutData(fdlgetPrevious);
wgetPrevious = new Button(wRemoteSettings, SWT.CHECK);
props.setLook(wgetPrevious);
wgetPrevious.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.getPrevious.Tooltip"));
fdgetPrevious = new FormData();
fdgetPrevious.left = new FormAttachment(middle, margin);
fdgetPrevious.top = new FormAttachment(wAdvancedSettings, margin);
fdgetPrevious.right = new FormAttachment(100, 0);
wgetPrevious.setLayoutData(fdgetPrevious);
wgetPrevious.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeCopyFromPrevious();
jobEntry.setChanged();
}
});
// FTP directory
wlFtpDirectory = new Label(wRemoteSettings, SWT.RIGHT);
wlFtpDirectory.setText(BaseMessages.getString(PKG, "JobFTPDelete.RemoteDir.Label"));
props.setLook(wlFtpDirectory);
fdlFtpDirectory = new FormData();
fdlFtpDirectory.left = new FormAttachment(0, 0);
fdlFtpDirectory.top = new FormAttachment(wgetPrevious, margin);
fdlFtpDirectory.right = new FormAttachment(middle, 0);
wlFtpDirectory.setLayoutData(fdlFtpDirectory);
// Test remote folder button ...
wbTestChangeFolderExists = new Button(wRemoteSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestChangeFolderExists);
wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobFTPDelete.TestFolderExists.Label"));
fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(wgetPrevious, margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
wFtpDirectory = new TextVar(jobMeta, wRemoteSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPDelete.RemoteDir.Tooltip"));
props.setLook(wFtpDirectory);
wFtpDirectory.addModifyListener(lsMod);
fdFtpDirectory = new FormData();
fdFtpDirectory.left = new FormAttachment(middle, margin);
fdFtpDirectory.top = new FormAttachment(wgetPrevious, margin);
fdFtpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wFtpDirectory.setLayoutData(fdFtpDirectory);
// Wildcard line
wWildcard = new LabelTextVar(jobMeta, wRemoteSettings, BaseMessages.getString(PKG, "JobFTPDelete.Wildcard.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(0, 0);
fdWildcard.top = new FormAttachment(wFtpDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
fdRemoteSettings = new FormData();
fdRemoteSettings.left = new FormAttachment(0, margin);
fdRemoteSettings.top = new FormAttachment(wAdvancedSettings, margin);
fdRemoteSettings.right = new FormAttachment(100, -margin);
wRemoteSettings.setLayoutData(fdRemoteSettings);
// ///////////////////////////////////////////////////////////
// / END OF Remote SETTINGSGROUP
// ///////////////////////////////////////////////////////////
// SuccessOngrouping?
// ////////////////////////
// START OF SUCCESS ON GROUP///
// /
wSuccessOn = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wSuccessOn);
wSuccessOn.setText(BaseMessages.getString(PKG, "JobFTPDelete.SuccessOn.Group.Label"));
FormLayout successongroupLayout = new FormLayout();
successongroupLayout.marginWidth = 10;
successongroupLayout.marginHeight = 10;
wSuccessOn.setLayout(successongroupLayout);
// Success Condition
wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT);
wlSuccessCondition.setText(BaseMessages.getString(PKG, "JobFTPDelete.SuccessCondition.Label") + " ");
props.setLook(wlSuccessCondition);
fdlSuccessCondition = new FormData();
fdlSuccessCondition.left = new FormAttachment(0, 0);
fdlSuccessCondition.right = new FormAttachment(middle, 0);
fdlSuccessCondition.top = new FormAttachment(wRemoteSettings, margin);
wlSuccessCondition.setLayoutData(fdlSuccessCondition);
wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTPDelete.SuccessWhenAllWorksFine.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTPDelete.SuccessWhenAtLeat.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTPDelete.SuccessWhenNrErrorsLessThan.Label"));
// +1: starts at -1
wSuccessCondition.select(0);
props.setLook(wSuccessCondition);
fdSuccessCondition = new FormData();
fdSuccessCondition.left = new FormAttachment(middle, 0);
fdSuccessCondition.top = new FormAttachment(wRemoteSettings, margin);
fdSuccessCondition.right = new FormAttachment(100, 0);
wSuccessCondition.setLayoutData(fdSuccessCondition);
wSuccessCondition.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeSuccessCondition();
}
});
// Success when number of errors less than
wlNrErrorsLessThan = new Label(wSuccessOn, SWT.RIGHT);
wlNrErrorsLessThan.setText(BaseMessages.getString(PKG, "JobFTPDelete.NrBadFormedLessThan.Label") + " ");
props.setLook(wlNrErrorsLessThan);
fdlNrErrorsLessThan = new FormData();
fdlNrErrorsLessThan.left = new FormAttachment(0, 0);
fdlNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
fdlNrErrorsLessThan.right = new FormAttachment(middle, -margin);
wlNrErrorsLessThan.setLayoutData(fdlNrErrorsLessThan);
wNrErrorsLessThan = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPDelete.NrBadFormedLessThan.Tooltip"));
props.setLook(wNrErrorsLessThan);
wNrErrorsLessThan.addModifyListener(lsMod);
fdNrErrorsLessThan = new FormData();
fdNrErrorsLessThan.left = new FormAttachment(middle, 0);
fdNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
fdNrErrorsLessThan.right = new FormAttachment(100, -margin);
wNrErrorsLessThan.setLayoutData(fdNrErrorsLessThan);
fdSuccessOn = new FormData();
fdSuccessOn.left = new FormAttachment(0, margin);
fdSuccessOn.top = new FormAttachment(wRemoteSettings, margin);
fdSuccessOn.right = new FormAttachment(100, -margin);
wSuccessOn.setLayoutData(fdSuccessOn);
// ///////////////////////////////////////////////////////////
// / END OF Success ON GROUP
// ///////////////////////////////////////////////////////////
fdFilesComp = new FormData();
fdFilesComp.left = new FormAttachment(0, 0);
fdFilesComp.top = new FormAttachment(0, 0);
fdFilesComp.right = new FormAttachment(100, 0);
fdFilesComp.bottom = new FormAttachment(100, 0);
wFilesComp.setLayoutData(fdFilesComp);
wFilesComp.layout();
wFilesTab.setControl(wFilesComp);
props.setLook(wFilesComp);
// ///////////////////////////////////////////////////////////
// / END OF Advanced TAB
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// Start of Socks Proxy Tab
// ///////////////////////////////////////////////////////////
wSocksProxyTab = new CTabItem(wTabFolder, SWT.NONE);
wSocksProxyTab.setText(BaseMessages.getString(PKG, "JobFTPDelete.Tab.Socks.Label"));
wSocksProxyComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSocksProxyComp);
FormLayout SoxProxyLayout = new FormLayout();
SoxProxyLayout.marginWidth = 3;
SoxProxyLayout.marginHeight = 3;
wSocksProxyComp.setLayout(SoxProxyLayout);
// ////////////////////////////////////////////////////////
// Start of Proxy Group
// ////////////////////////////////////////////////////////
wSocksProxy = new Group(wSocksProxyComp, SWT.SHADOW_NONE);
props.setLook(wSocksProxy);
wSocksProxy.setText(BaseMessages.getString(PKG, "JobFTPDelete.SocksProxy.Group.Label"));
FormLayout SocksProxyGroupLayout = new FormLayout();
SocksProxyGroupLayout.marginWidth = 10;
SocksProxyGroupLayout.marginHeight = 10;
wSocksProxy.setLayout(SocksProxyGroupLayout);
// host line
wSocksProxyHost = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyHost.Label"), BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyHost.Tooltip"));
props.setLook(wSocksProxyHost);
wSocksProxyHost.addModifyListener(lsMod);
fdSocksProxyHost = new FormData();
fdSocksProxyHost.left = new FormAttachment(0, 0);
fdSocksProxyHost.top = new FormAttachment(wName, margin);
fdSocksProxyHost.right = new FormAttachment(100, margin);
wSocksProxyHost.setLayoutData(fdSocksProxyHost);
// port line
wSocksProxyPort = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPort.Label"), BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPort.Tooltip"));
props.setLook(wSocksProxyPort);
wSocksProxyPort.addModifyListener(lsMod);
fdSocksProxyPort = new FormData();
fdSocksProxyPort.left = new FormAttachment(0, 0);
fdSocksProxyPort.top = new FormAttachment(wSocksProxyHost, margin);
fdSocksProxyPort.right = new FormAttachment(100, margin);
wSocksProxyPort.setLayoutData(fdSocksProxyPort);
// username line
wSocksProxyUsername = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPassword.Tooltip"));
props.setLook(wSocksProxyUsername);
wSocksProxyUsername.addModifyListener(lsMod);
fdSocksProxyUsername = new FormData();
fdSocksProxyUsername.left = new FormAttachment(0, 0);
fdSocksProxyUsername.top = new FormAttachment(wSocksProxyPort, margin);
fdSocksProxyUsername.right = new FormAttachment(100, margin);
wSocksProxyUsername.setLayoutData(fdSocksProxyUsername);
// password line
wSocksProxyPassword = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPassword.Tooltip"), true);
props.setLook(wSocksProxyPort);
wSocksProxyPassword.addModifyListener(lsMod);
fdSocksProxyPassword = new FormData();
fdSocksProxyPassword.left = new FormAttachment(0, 0);
fdSocksProxyPassword.top = new FormAttachment(wSocksProxyUsername, margin);
fdSocksProxyPassword.right = new FormAttachment(100, margin);
wSocksProxyPassword.setLayoutData(fdSocksProxyPassword);
// ///////////////////////////////////////////////////////////////
// End of socks proxy group
// ///////////////////////////////////////////////////////////////
fdSocksProxyComp = new FormData();
fdSocksProxyComp.left = new FormAttachment(0, margin);
fdSocksProxyComp.top = new FormAttachment(0, margin);
fdSocksProxyComp.right = new FormAttachment(100, -margin);
wSocksProxy.setLayoutData(fdSocksProxyComp);
wSocksProxyComp.layout();
wSocksProxyTab.setControl(wSocksProxyComp);
props.setLook(wSocksProxyComp);
// ////////////////////////////////////////////////////////
// End of Socks Proxy Tab
// ////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsCheckFolder = new Listener() {
public void handleEvent(Event e) {
checkFTPFolder();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckFolder);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wWildcard.addSelectionListener(lsDef);
wTimeout.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activeSuccessCondition();
activeUsePublicKey();
activeProxy();
activeFTPProtocol();
activeCopyFromPrevious();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobFTPDeleteDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class SalesforceInputDialog method open.
@Override
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);
ModifyListener lsMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
SelectionListener checkBoxModifyListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -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);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF FILE TAB ///
// ////////////////////////
wFileTab = new CTabItem(wTabFolder, SWT.NONE);
wFileTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.File.Tab"));
wFileComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFileComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wFileComp.setLayout(fileLayout);
// ////////////////////////
// START CONNECTION GROUP
wConnectionGroup = new Group(wFileComp, SWT.SHADOW_ETCHED_IN);
wConnectionGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ConnectionGroup.Label"));
FormLayout fconnLayout = new FormLayout();
fconnLayout.marginWidth = 3;
fconnLayout.marginHeight = 3;
wConnectionGroup.setLayout(fconnLayout);
props.setLook(wConnectionGroup);
// Webservice URL
wURL = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.URL.Tooltip"));
props.setLook(wURL);
wURL.addModifyListener(lsMod);
fdURL = new FormData();
fdURL.left = new FormAttachment(0, 0);
fdURL.top = new FormAttachment(0, margin);
fdURL.right = new FormAttachment(100, 0);
wURL.setLayoutData(fdURL);
// UserName line
wUserName = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wURL, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Test Salesforce connection button
wTest = new Button(wConnectionGroup, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wPassword, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
FormData fdConnectionGroup = new FormData();
fdConnectionGroup.left = new FormAttachment(0, 0);
fdConnectionGroup.right = new FormAttachment(100, 0);
fdConnectionGroup.top = new FormAttachment(0, margin);
wConnectionGroup.setLayoutData(fdConnectionGroup);
// END CONNECTION GROUP
// ////////////////////////
// ////////////////////////
// START SETTINGS GROUP
wSettingsGroup = new Group(wFileComp, SWT.SHADOW_ETCHED_IN);
wSettingsGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.HttpAuthGroup.Label"));
FormLayout fsettingsLayout = new FormLayout();
fsettingsLayout.marginWidth = 3;
fsettingsLayout.marginHeight = 3;
wSettingsGroup.setLayout(fsettingsLayout);
props.setLook(wSettingsGroup);
wlspecifyQuery = new Label(wSettingsGroup, SWT.RIGHT);
wlspecifyQuery.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.specifyQuery.Label"));
props.setLook(wlspecifyQuery);
fdlspecifyQuery = new FormData();
fdlspecifyQuery.left = new FormAttachment(0, 0);
fdlspecifyQuery.top = new FormAttachment(wConnectionGroup, 2 * margin);
fdlspecifyQuery.right = new FormAttachment(middle, -margin);
wlspecifyQuery.setLayoutData(fdlspecifyQuery);
wspecifyQuery = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wspecifyQuery);
wspecifyQuery.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.specifyQuery.Tooltip"));
fdspecifyQuery = new FormData();
fdspecifyQuery.left = new FormAttachment(middle, 0);
fdspecifyQuery.top = new FormAttachment(wConnectionGroup, 2 * margin);
wspecifyQuery.setLayoutData(fdspecifyQuery);
wspecifyQuery.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableQuery();
input.setChanged();
}
});
// Module
wlModule = new Label(wSettingsGroup, SWT.RIGHT);
wlModule.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Module.Label"));
props.setLook(wlModule);
fdlModule = new FormData();
fdlModule.left = new FormAttachment(0, 0);
fdlModule.top = new FormAttachment(wspecifyQuery, margin);
fdlModule.right = new FormAttachment(middle, -margin);
wlModule.setLayoutData(fdlModule);
wModule = new ComboVar(transMeta, wSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
wModule.setEditable(true);
props.setLook(wModule);
wModule.addModifyListener(lsMod);
fdModule = new FormData();
fdModule.left = new FormAttachment(middle, margin);
fdModule.top = new FormAttachment(wspecifyQuery, margin);
fdModule.right = new FormAttachment(100, -margin);
wModule.setLayoutData(fdModule);
wModule.addFocusListener(new FocusListener() {
@Override
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
getModulesListError = false;
}
@Override
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
// check if the URL and login credentials passed and not just had error
if (Utils.isEmpty(wURL.getText()) || Utils.isEmpty(wUserName.getText()) || Utils.isEmpty(wPassword.getText()) || (getModulesListError)) {
return;
}
getModulesList();
}
});
wlPosition = new Label(wSettingsGroup, SWT.NONE);
props.setLook(wlPosition);
fdlPosition = new FormData();
fdlPosition.left = new FormAttachment(middle, 0);
fdlPosition.right = new FormAttachment(100, 0);
fdlPosition.bottom = new FormAttachment(100, -margin);
wlPosition.setLayoutData(fdlPosition);
// condition
wlCondition = new Label(wSettingsGroup, SWT.RIGHT);
wlCondition.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Condition.Label"));
props.setLook(wlCondition);
FormData fdlCondition = new FormData();
fdlCondition.left = new FormAttachment(0, -margin);
fdlCondition.top = new FormAttachment(wModule, margin);
fdlCondition.right = new FormAttachment(middle, -margin);
wlCondition.setLayoutData(fdlCondition);
wCondition = new StyledTextComp(transMeta, wSettingsGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
wCondition.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.Condition.Tooltip"));
props.setLook(wCondition, Props.WIDGET_STYLE_FIXED);
wCondition.addModifyListener(lsMod);
fdCondition = new FormData();
fdCondition.left = new FormAttachment(middle, margin);
fdCondition.top = new FormAttachment(wModule, margin);
fdCondition.right = new FormAttachment(100, -2 * margin);
fdCondition.bottom = new FormAttachment(wlPosition, -margin);
wCondition.setLayoutData(fdCondition);
wCondition.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
setQueryToolTip();
setPosition();
}
});
wCondition.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setPosition();
}
@Override
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wCondition.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setPosition();
}
@Override
public void focusLost(FocusEvent e) {
setPosition();
}
});
wCondition.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
@Override
public void mouseDown(MouseEvent e) {
setPosition();
}
@Override
public void mouseUp(MouseEvent e) {
setPosition();
}
});
// Text Higlighting
wCondition.addLineStyleListener(new SOQLValuesHighlight());
// Query
wlQuery = new Label(wSettingsGroup, SWT.RIGHT);
wlQuery.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Query.Label"));
props.setLook(wlQuery);
fdlQuery = new FormData();
fdlQuery.left = new FormAttachment(0, -margin);
fdlQuery.top = new FormAttachment(wspecifyQuery, margin);
fdlQuery.right = new FormAttachment(middle, -margin);
wlQuery.setLayoutData(fdlQuery);
wQuery = new StyledTextComp(transMeta, wSettingsGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wQuery, Props.WIDGET_STYLE_FIXED);
wQuery.addModifyListener(lsMod);
fdQuery = new FormData();
fdQuery.left = new FormAttachment(middle, 0);
fdQuery.top = new FormAttachment(wspecifyQuery, margin);
fdQuery.right = new FormAttachment(100, -2 * margin);
fdQuery.bottom = new FormAttachment(wlPosition, -margin);
wQuery.setLayoutData(fdQuery);
wQuery.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
setQueryToolTip();
}
});
wQuery.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setPosition();
}
@Override
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wQuery.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setPosition();
}
@Override
public void focusLost(FocusEvent e) {
setPosition();
}
});
wQuery.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
@Override
public void mouseDown(MouseEvent e) {
setPosition();
}
@Override
public void mouseUp(MouseEvent e) {
setPosition();
}
});
// Text Higlighting
wQuery.addLineStyleListener(new SOQLValuesHighlight());
FormData fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, 0);
fdSettingsGroup.right = new FormAttachment(100, 0);
fdSettingsGroup.bottom = new FormAttachment(100, 0);
fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// END SETTINGS GROUP
// ////////////////////////
fdFileComp = new FormData();
fdFileComp.left = new FormAttachment(0, 0);
fdFileComp.top = new FormAttachment(0, 0);
fdFileComp.right = new FormAttachment(100, 0);
fdFileComp.bottom = new FormAttachment(100, 0);
wFileComp.setLayoutData(fdFileComp);
wFileComp.layout();
wFileTab.setControl(wFileComp);
// ///////////////////////////////////////////////////////////
// / END OF FILE TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Content.Tab"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// ///////////////////////////////
// START OF Advanced GROUP //
// ///////////////////////////////
wAdvancedGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedGroup);
wAdvancedGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.AdvancedGroup.Label"));
FormLayout advancedgroupLayout = new FormLayout();
advancedgroupLayout.marginWidth = 10;
advancedgroupLayout.marginHeight = 10;
wAdvancedGroup.setLayout(advancedgroupLayout);
// RecordsFilter
wlRecordsFilter = new Label(wAdvancedGroup, SWT.RIGHT);
wlRecordsFilter.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.RecordsFilter.Label"));
props.setLook(wlRecordsFilter);
fdlRecordsFilter = new FormData();
fdlRecordsFilter.left = new FormAttachment(0, 0);
fdlRecordsFilter.right = new FormAttachment(middle, -margin);
fdlRecordsFilter.top = new FormAttachment(0, 2 * margin);
wlRecordsFilter.setLayoutData(fdlRecordsFilter);
wRecordsFilter = new CCombo(wAdvancedGroup, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wRecordsFilter);
wRecordsFilter.addModifyListener(lsMod);
fdRecordsFilter = new FormData();
fdRecordsFilter.left = new FormAttachment(middle, 0);
fdRecordsFilter.top = new FormAttachment(0, 2 * margin);
fdRecordsFilter.right = new FormAttachment(100, -margin);
wRecordsFilter.setLayoutData(fdRecordsFilter);
wRecordsFilter.setItems(SalesforceConnectionUtils.recordsFilterDesc);
wRecordsFilter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateRecordsFilter();
}
});
// Query All?
wlQueryAll = new Label(wAdvancedGroup, SWT.RIGHT);
wlQueryAll.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.QueryAll.Label"));
props.setLook(wlQueryAll);
FormData fdlQueryAll = new FormData();
fdlQueryAll.left = new FormAttachment(0, 0);
fdlQueryAll.top = new FormAttachment(wRecordsFilter, margin);
fdlQueryAll.right = new FormAttachment(middle, -margin);
wlQueryAll.setLayoutData(fdlQueryAll);
wQueryAll = new Button(wAdvancedGroup, SWT.CHECK);
wQueryAll.addSelectionListener(checkBoxModifyListener);
props.setLook(wQueryAll);
wQueryAll.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.QueryAll.Tooltip"));
FormData fdQueryAll = new FormData();
fdQueryAll.left = new FormAttachment(middle, 0);
fdQueryAll.top = new FormAttachment(wRecordsFilter, margin);
wQueryAll.setLayoutData(fdQueryAll);
wQueryAll.addSelectionListener(new ComponentSelectionListener(input));
open = new Button(wAdvancedGroup, SWT.PUSH);
open.setImage(GUIResource.getInstance().getImageCalendar());
open.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.OpenCalendar"));
FormData fdlButton = new FormData();
fdlButton.top = new FormAttachment(wQueryAll, margin);
fdlButton.right = new FormAttachment(100, 0);
open.setLayoutData(fdlButton);
open.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
dialog.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.SelectDate"));
dialog.setImage(GUIResource.getInstance().getImageSpoon());
dialog.setLayout(new GridLayout(3, false));
final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
final DateTime time = new DateTime(dialog, SWT.TIME | SWT.TIME);
new Label(dialog, SWT.NONE);
new Label(dialog, SWT.NONE);
Button ok = new Button(dialog, SWT.PUSH);
ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
ok.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wReadFrom.setText(calendar.getYear() + "-" + ((calendar.getMonth() + 1) < 10 ? "0" + (calendar.getMonth() + 1) : (calendar.getMonth() + 1)) + "-" + (calendar.getDay() < 10 ? "0" + calendar.getDay() : calendar.getDay()) + " " + (time.getHours() < 10 ? "0" + time.getHours() : time.getHours()) + ":" + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()) + ":" + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()));
dialog.close();
}
});
dialog.setDefaultButton(ok);
dialog.pack();
dialog.open();
}
});
wlReadFrom = new Label(wAdvancedGroup, SWT.RIGHT);
wlReadFrom.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadFrom.Label"));
props.setLook(wlReadFrom);
fdlReadFrom = new FormData();
fdlReadFrom.left = new FormAttachment(0, 0);
fdlReadFrom.top = new FormAttachment(wQueryAll, margin);
fdlReadFrom.right = new FormAttachment(middle, -margin);
wlReadFrom.setLayoutData(fdlReadFrom);
wReadFrom = new TextVar(transMeta, wAdvancedGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadFrom.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadFrom.Tooltip"));
props.setLook(wReadFrom);
wReadFrom.addModifyListener(lsMod);
fdReadFrom = new FormData();
fdReadFrom.left = new FormAttachment(middle, 0);
fdReadFrom.top = new FormAttachment(wQueryAll, margin);
fdReadFrom.right = new FormAttachment(open, -margin);
wReadFrom.setLayoutData(fdReadFrom);
opento = new Button(wAdvancedGroup, SWT.PUSH);
opento.setImage(GUIResource.getInstance().getImageCalendar());
opento.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.OpenCalendar"));
FormData fdlButtonto = new FormData();
fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
fdlButtonto.right = new FormAttachment(100, 0);
opento.setLayoutData(fdlButtonto);
opento.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
dialogto.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.SelectDate"));
dialogto.setImage(GUIResource.getInstance().getImageSpoon());
dialogto.setLayout(new GridLayout(3, false));
final DateTime calendarto = new DateTime(dialogto, SWT.CALENDAR | SWT.BORDER);
final DateTime timeto = new DateTime(dialogto, SWT.TIME | SWT.TIME);
new Label(dialogto, SWT.NONE);
new Label(dialogto, SWT.NONE);
Button okto = new Button(dialogto, SWT.PUSH);
okto.setText(BaseMessages.getString(PKG, "System.Button.OK"));
okto.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
okto.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wReadTo.setText(calendarto.getYear() + "-" + ((calendarto.getMonth() + 1) < 10 ? "0" + (calendarto.getMonth() + 1) : (calendarto.getMonth() + 1)) + "-" + (calendarto.getDay() < 10 ? "0" + calendarto.getDay() : calendarto.getDay()) + " " + (timeto.getHours() < 10 ? "0" + timeto.getHours() : timeto.getHours()) + ":" + (timeto.getMinutes() < 10 ? "0" + timeto.getMinutes() : timeto.getMinutes()) + ":" + (timeto.getSeconds() < 10 ? "0" + timeto.getSeconds() : timeto.getSeconds()));
dialogto.close();
}
});
dialogto.setDefaultButton(okto);
dialogto.pack();
dialogto.open();
}
});
wlReadTo = new Label(wAdvancedGroup, SWT.RIGHT);
wlReadTo.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadTo.Label"));
props.setLook(wlReadTo);
fdlReadTo = new FormData();
fdlReadTo.left = new FormAttachment(0, 0);
fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdlReadTo.right = new FormAttachment(middle, -margin);
wlReadTo.setLayoutData(fdlReadTo);
wReadTo = new TextVar(transMeta, wAdvancedGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadTo.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadTo.Tooltip"));
props.setLook(wReadTo);
wReadTo.addModifyListener(lsMod);
fdReadTo = new FormData();
fdReadTo.left = new FormAttachment(middle, 0);
fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdReadTo.right = new FormAttachment(opento, -margin);
wReadTo.setLayoutData(fdReadTo);
fdAdvancedGroup = new FormData();
fdAdvancedGroup.left = new FormAttachment(0, margin);
fdAdvancedGroup.top = new FormAttachment(0, 2 * margin);
fdAdvancedGroup.right = new FormAttachment(100, -margin);
wAdvancedGroup.setLayoutData(fdAdvancedGroup);
// ///////////////////////////////////////////////////////////
// / END OF Advanced GROUP
// ///////////////////////////////////////////////////////////
// ///////////////////////////////
// START OF Additional Fields GROUP //
// ///////////////////////////////
wAdditionalFields = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wAdditionalFields);
wAdditionalFields.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.wAdditionalFields.Label"));
FormLayout AdditionalFieldsgroupLayout = new FormLayout();
AdditionalFieldsgroupLayout.marginWidth = 10;
AdditionalFieldsgroupLayout.marginHeight = 10;
wAdditionalFields.setLayout(AdditionalFieldsgroupLayout);
// Add Salesforce URL in the output stream ?
wlInclURL = new Label(wAdditionalFields, SWT.RIGHT);
wlInclURL.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURL.Label"));
props.setLook(wlInclURL);
fdlInclURL = new FormData();
fdlInclURL.left = new FormAttachment(0, 0);
fdlInclURL.top = new FormAttachment(wAdvancedGroup, margin);
fdlInclURL.right = new FormAttachment(middle, -margin);
wlInclURL.setLayoutData(fdlInclURL);
wInclURL = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclURL);
wInclURL.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURL.Tooltip"));
fdInclURL = new FormData();
fdInclURL.left = new FormAttachment(middle, 0);
fdInclURL.top = new FormAttachment(wAdvancedGroup, margin);
wInclURL.setLayoutData(fdInclURL);
wInclURL.addSelectionListener(checkBoxModifyListener);
wInclURL.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclTargetURL();
input.setChanged();
}
});
wlInclURLField = new Label(wAdditionalFields, SWT.LEFT);
wlInclURLField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURLField.Label"));
props.setLook(wlInclURLField);
fdlInclURLField = new FormData();
fdlInclURLField.left = new FormAttachment(wInclURL, margin);
fdlInclURLField.top = new FormAttachment(wAdvancedGroup, margin);
wlInclURLField.setLayoutData(fdlInclURLField);
wInclURLField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wlInclURLField);
wInclURLField.addModifyListener(lsMod);
fdInclURLField = new FormData();
fdInclURLField.left = new FormAttachment(wlInclURLField, margin);
fdInclURLField.top = new FormAttachment(wAdvancedGroup, margin);
fdInclURLField.right = new FormAttachment(100, 0);
wInclURLField.setLayoutData(fdInclURLField);
// Add module in the output stream ?
wlInclModule = new Label(wAdditionalFields, SWT.RIGHT);
wlInclModule.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModule.Label"));
props.setLook(wlInclModule);
fdlInclModule = new FormData();
fdlInclModule.left = new FormAttachment(0, 0);
fdlInclModule.top = new FormAttachment(wInclURLField, margin);
fdlInclModule.right = new FormAttachment(middle, -margin);
wlInclModule.setLayoutData(fdlInclModule);
wInclModule = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclModule);
wInclModule.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModule.Tooltip"));
fdModule = new FormData();
fdModule.left = new FormAttachment(middle, 0);
fdModule.top = new FormAttachment(wInclURLField, margin);
wInclModule.setLayoutData(fdModule);
wInclModule.addSelectionListener(checkBoxModifyListener);
wInclModule.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclModule();
input.setChanged();
}
});
wlInclModuleField = new Label(wAdditionalFields, SWT.RIGHT);
wlInclModuleField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModuleField.Label"));
props.setLook(wlInclModuleField);
fdlInclModuleField = new FormData();
fdlInclModuleField.left = new FormAttachment(wInclModule, margin);
fdlInclModuleField.top = new FormAttachment(wInclURLField, margin);
wlInclModuleField.setLayoutData(fdlInclModuleField);
wInclModuleField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclModuleField);
wInclModuleField.addModifyListener(lsMod);
fdInclModuleField = new FormData();
fdInclModuleField.left = new FormAttachment(wlInclModuleField, margin);
fdInclModuleField.top = new FormAttachment(wInclURLField, margin);
fdInclModuleField.right = new FormAttachment(100, 0);
wInclModuleField.setLayoutData(fdInclModuleField);
// Add SQL in the output stream ?
wlInclSQL = new Label(wAdditionalFields, SWT.RIGHT);
wlInclSQL.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQL.Label"));
props.setLook(wlInclSQL);
fdlInclSQL = new FormData();
fdlInclSQL.left = new FormAttachment(0, 0);
fdlInclSQL.top = new FormAttachment(wInclModuleField, margin);
fdlInclSQL.right = new FormAttachment(middle, -margin);
wlInclSQL.setLayoutData(fdlInclSQL);
wInclSQL = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclSQL);
wInclSQL.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQL.Tooltip"));
fdInclSQL = new FormData();
fdInclSQL.left = new FormAttachment(middle, 0);
fdInclSQL.top = new FormAttachment(wInclModuleField, margin);
wInclSQL.setLayoutData(fdInclSQL);
wInclSQL.addSelectionListener(checkBoxModifyListener);
wInclSQL.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclSQL();
input.setChanged();
}
});
wlInclSQLField = new Label(wAdditionalFields, SWT.LEFT);
wlInclSQLField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQLField.Label"));
props.setLook(wlInclSQLField);
fdlInclSQLField = new FormData();
fdlInclSQLField.left = new FormAttachment(wInclSQL, margin);
fdlInclSQLField.top = new FormAttachment(wInclModuleField, margin);
wlInclSQLField.setLayoutData(fdlInclSQLField);
wInclSQLField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wlInclSQLField);
wInclSQLField.addModifyListener(lsMod);
fdInclSQLField = new FormData();
fdInclSQLField.left = new FormAttachment(wlInclSQLField, margin);
fdInclSQLField.top = new FormAttachment(wInclModuleField, margin);
fdInclSQLField.right = new FormAttachment(100, 0);
wInclSQLField.setLayoutData(fdInclSQLField);
// Add Timestamp in the output stream ?
wlInclTimestamp = new Label(wAdditionalFields, SWT.RIGHT);
wlInclTimestamp.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestamp.Label"));
props.setLook(wlInclTimestamp);
fdlInclTimestamp = new FormData();
fdlInclTimestamp.left = new FormAttachment(0, 0);
fdlInclTimestamp.top = new FormAttachment(wInclSQLField, margin);
fdlInclTimestamp.right = new FormAttachment(middle, -margin);
wlInclTimestamp.setLayoutData(fdlInclTimestamp);
wInclTimestamp = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclTimestamp);
wInclTimestamp.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestamp.Tooltip"));
fdInclTimestamp = new FormData();
fdInclTimestamp.left = new FormAttachment(middle, 0);
fdInclTimestamp.top = new FormAttachment(wInclSQLField, margin);
wInclTimestamp.setLayoutData(fdInclTimestamp);
wInclTimestamp.addSelectionListener(checkBoxModifyListener);
wInclTimestamp.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclTimestamp();
input.setChanged();
}
});
wlInclTimestampField = new Label(wAdditionalFields, SWT.LEFT);
wlInclTimestampField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestampField.Label"));
props.setLook(wlInclTimestampField);
fdlInclTimestampField = new FormData();
fdlInclTimestampField.left = new FormAttachment(wInclTimestamp, margin);
fdlInclTimestampField.top = new FormAttachment(wInclSQLField, margin);
wlInclTimestampField.setLayoutData(fdlInclTimestampField);
wInclTimestampField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wlInclTimestampField);
wInclTimestampField.addModifyListener(lsMod);
fdInclTimestampField = new FormData();
fdInclTimestampField.left = new FormAttachment(wlInclTimestampField, margin);
fdInclTimestampField.top = new FormAttachment(wInclSQLField, margin);
fdInclTimestampField.right = new FormAttachment(100, 0);
wInclTimestampField.setLayoutData(fdInclTimestampField);
// Include Rownum in output stream?
wlInclRownum = new Label(wAdditionalFields, SWT.RIGHT);
wlInclRownum.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownum.Label"));
props.setLook(wlInclRownum);
FormData fdlInclRownum = new FormData();
fdlInclRownum.left = new FormAttachment(0, 0);
fdlInclRownum.top = new FormAttachment(wInclTimestampField, margin);
fdlInclRownum.right = new FormAttachment(middle, -margin);
wlInclRownum.setLayoutData(fdlInclRownum);
wInclRownum = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclRownum);
wInclRownum.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownum.Tooltip"));
FormData fdRownum = new FormData();
fdRownum.left = new FormAttachment(middle, 0);
fdRownum.top = new FormAttachment(wInclTimestampField, margin);
wInclRownum.setLayoutData(fdRownum);
wInclRownum.addSelectionListener(checkBoxModifyListener);
wInclRownum.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclRownum();
input.setChanged();
}
});
wlInclRownumField = new Label(wAdditionalFields, SWT.RIGHT);
wlInclRownumField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownumField.Label"));
props.setLook(wlInclRownumField);
fdlInclRownumField = new FormData();
fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
fdlInclRownumField.top = new FormAttachment(wInclTimestampField, margin);
wlInclRownumField.setLayoutData(fdlInclRownumField);
wInclRownumField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclRownumField);
wInclRownumField.addModifyListener(lsMod);
FormData fdInclRownumField = new FormData();
fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
fdInclRownumField.top = new FormAttachment(wInclTimestampField, margin);
fdInclRownumField.right = new FormAttachment(100, 0);
wInclRownumField.setLayoutData(fdInclRownumField);
// Include DeletionDate in output stream?
wlInclDeletionDate = new Label(wAdditionalFields, SWT.RIGHT);
wlInclDeletionDate.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDate.Label"));
props.setLook(wlInclDeletionDate);
fdlInclDeletionDate = new FormData();
fdlInclDeletionDate.left = new FormAttachment(0, 0);
fdlInclDeletionDate.top = new FormAttachment(wInclRownumField, margin);
fdlInclDeletionDate.right = new FormAttachment(middle, -margin);
wlInclDeletionDate.setLayoutData(fdlInclDeletionDate);
wInclDeletionDate = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclDeletionDate);
wInclDeletionDate.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDate.Tooltip"));
fdDeletionDate = new FormData();
fdDeletionDate.left = new FormAttachment(middle, 0);
fdDeletionDate.top = new FormAttachment(wInclRownumField, margin);
wInclDeletionDate.setLayoutData(fdDeletionDate);
wInclDeletionDate.addSelectionListener(checkBoxModifyListener);
wInclDeletionDate.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclDeletionDate();
input.setChanged();
}
});
wlInclDeletionDateField = new Label(wAdditionalFields, SWT.RIGHT);
wlInclDeletionDateField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDateField.Label"));
props.setLook(wlInclDeletionDateField);
fdlInclDeletionDateField = new FormData();
fdlInclDeletionDateField.left = new FormAttachment(wInclDeletionDate, margin);
fdlInclDeletionDateField.top = new FormAttachment(wInclRownumField, margin);
wlInclDeletionDateField.setLayoutData(fdlInclDeletionDateField);
wInclDeletionDateField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclDeletionDateField);
wInclDeletionDateField.addModifyListener(lsMod);
fdInclDeletionDateField = new FormData();
fdInclDeletionDateField.left = new FormAttachment(wlInclDeletionDateField, margin);
fdInclDeletionDateField.top = new FormAttachment(wInclRownumField, margin);
fdInclDeletionDateField.right = new FormAttachment(100, 0);
wInclDeletionDateField.setLayoutData(fdInclDeletionDateField);
fdAdditionalFields = new FormData();
fdAdditionalFields.left = new FormAttachment(0, margin);
fdAdditionalFields.top = new FormAttachment(wAdvancedGroup, margin);
fdAdditionalFields.right = new FormAttachment(100, -margin);
wAdditionalFields.setLayoutData(fdAdditionalFields);
// ///////////////////////////////////////////////////////////
// / END OF Additional Fields GROUP
// ///////////////////////////////////////////////////////////
// Timeout
wlTimeOut = new Label(wContentComp, SWT.RIGHT);
wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.TimeOut.Label"));
props.setLook(wlTimeOut);
fdlTimeOut = new FormData();
fdlTimeOut.left = new FormAttachment(0, 0);
fdlTimeOut.top = new FormAttachment(wAdditionalFields, 2 * margin);
fdlTimeOut.right = new FormAttachment(middle, -margin);
wlTimeOut.setLayoutData(fdlTimeOut);
wTimeOut = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTimeOut);
wTimeOut.addModifyListener(lsMod);
fdTimeOut = new FormData();
fdTimeOut.left = new FormAttachment(middle, 0);
fdTimeOut.top = new FormAttachment(wAdditionalFields, 2 * margin);
fdTimeOut.right = new FormAttachment(100, 0);
wTimeOut.setLayoutData(fdTimeOut);
// Use compression?
wlUseCompression = new Label(wContentComp, SWT.RIGHT);
wlUseCompression.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.UseCompression.Label"));
props.setLook(wlUseCompression);
FormData fdlUseCompression = new FormData();
fdlUseCompression.left = new FormAttachment(0, 0);
fdlUseCompression.top = new FormAttachment(wTimeOut, margin);
fdlUseCompression.right = new FormAttachment(middle, -margin);
wlUseCompression.setLayoutData(fdlUseCompression);
wUseCompression = new Button(wContentComp, SWT.CHECK);
wUseCompression.addSelectionListener(checkBoxModifyListener);
props.setLook(wUseCompression);
wUseCompression.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.UseCompression.Tooltip"));
FormData fdUseCompression = new FormData();
fdUseCompression.left = new FormAttachment(middle, 0);
fdUseCompression.top = new FormAttachment(wTimeOut, margin);
wUseCompression.setLayoutData(fdUseCompression);
wUseCompression.addSelectionListener(new ComponentSelectionListener(input));
// Limit rows
wlLimit = new Label(wContentComp, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Limit.Label"));
props.setLook(wlLimit);
fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.top = new FormAttachment(wUseCompression, margin);
fdlLimit.right = new FormAttachment(middle, -margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLimit);
wLimit.addModifyListener(lsMod);
fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.top = new FormAttachment(wUseCompression, margin);
fdLimit.right = new FormAttachment(100, 0);
wLimit.setLayoutData(fdLimit);
fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(fdContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
// Fields tab...
//
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Fields.Tab"));
FormLayout fieldsLayout = new FormLayout();
fieldsLayout.marginWidth = Const.FORM_MARGIN;
fieldsLayout.marginHeight = Const.FORM_MARGIN;
wFieldsComp = new Composite(wTabFolder, SWT.NONE);
wFieldsComp.setLayout(fieldsLayout);
props.setLook(wFieldsComp);
wGet = new Button(wFieldsComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.GetFields.Button"));
fdGet = new FormData();
fdGet.left = new FormAttachment(50, 0);
fdGet.bottom = new FormAttachment(100, 0);
wGet.setLayoutData(fdGet);
final int FieldsRows = input.getInputFields().length;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Field.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.IsIdLookup.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Type.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Format.Column"), ColumnInfo.COLUMN_TYPE_FORMAT, 3), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Length.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Precision.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Currency.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Decimal.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Group.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.TrimType.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, SalesforceInputField.trimTypeDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Repeat.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true) };
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Name.Column.Tooltip"));
colinf[1].setUsingVariables(true);
colinf[1].setToolTip(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Field.Column.Tooltip"));
colinf[2].setReadOnly(true);
wFields = new TableView(transMeta, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(wGet, -margin);
wFields.setLayoutData(fdFields);
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);
wFieldsComp.setLayoutData(fdFieldsComp);
wFieldsComp.layout();
wFieldsTab.setControl(wFieldsComp);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
// 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, "SalesforceInputDialog.Button.PreviewRows"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
@Override
public void handleEvent(Event e) {
test();
}
};
lsGet = new Listener() {
@Override
public void handleEvent(Event e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
get();
shell.setCursor(null);
busy.dispose();
input.setChanged();
}
};
lsPreview = new Listener() {
@Override
public void handleEvent(Event e) {
preview();
}
};
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wTest.addListener(SWT.Selection, lsTest);
wPreview.addListener(SWT.Selection, lsPreview);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wLimit.addSelectionListener(lsDef);
wInclModuleField.addSelectionListener(lsDef);
wInclURLField.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData(input);
setEnableInclTargetURL();
setEnableInclSQL();
setEnableInclTimestamp();
setEnableInclModule();
setEnableInclRownum();
setEnableInclDeletionDate();
setEnableQuery();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class SalesforceInsertDialog method open.
@Override
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);
ModifyListener lsMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
ModifyListener lsTableMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
input.setChanged();
setModuleFieldCombo();
}
};
SelectionAdapter lsSelection = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setModuleFieldCombo();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -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);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF FILE TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.General.Tab"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ///////////////////////////////
// START OF Connection GROUP //
// ///////////////////////////////
wConnectionGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wConnectionGroup);
wConnectionGroup.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.ConnectionGroup.Label"));
FormLayout connectionGroupLayout = new FormLayout();
connectionGroupLayout.marginWidth = 10;
connectionGroupLayout.marginHeight = 10;
wConnectionGroup.setLayout(connectionGroupLayout);
// Webservice URL
wURL = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInsertDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceInsertDialog.URL.Tooltip"));
props.setLook(wURL);
wURL.addModifyListener(lsMod);
fdURL = new FormData();
fdURL.left = new FormAttachment(0, 0);
fdURL.top = new FormAttachment(wStepname, margin);
fdURL.right = new FormAttachment(100, 0);
wURL.setLayoutData(fdURL);
// UserName line
wUserName = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInsertDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceInsertDialog.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wURL, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInsertDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceInsertDialog.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Test Salesforce connection button
wTest = new Button(wConnectionGroup, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "SalesforceInsertDialog.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wPassword, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdConnectionGroup = new FormData();
fdConnectionGroup.left = new FormAttachment(0, margin);
fdConnectionGroup.top = new FormAttachment(wStepname, margin);
fdConnectionGroup.right = new FormAttachment(100, -margin);
wConnectionGroup.setLayoutData(fdConnectionGroup);
// ///////////////////////////////
// END OF Connection GROUP //
// ///////////////////////////////
// ///////////////////////////////
// START OF Settings GROUP //
// ///////////////////////////////
wSettingsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSettingsGroup);
wSettingsGroup.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.SettingsGroup.Label"));
FormLayout settingGroupLayout = new FormLayout();
settingGroupLayout.marginWidth = 10;
settingGroupLayout.marginHeight = 10;
wSettingsGroup.setLayout(settingGroupLayout);
// Timeout
wlTimeOut = new Label(wSettingsGroup, SWT.RIGHT);
wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.TimeOut.Label"));
props.setLook(wlTimeOut);
fdlTimeOut = new FormData();
fdlTimeOut.left = new FormAttachment(0, 0);
fdlTimeOut.top = new FormAttachment(wSettingsGroup, margin);
fdlTimeOut.right = new FormAttachment(middle, -margin);
wlTimeOut.setLayoutData(fdlTimeOut);
wTimeOut = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTimeOut);
wTimeOut.addModifyListener(lsMod);
fdTimeOut = new FormData();
fdTimeOut.left = new FormAttachment(middle, 0);
fdTimeOut.top = new FormAttachment(wSettingsGroup, margin);
fdTimeOut.right = new FormAttachment(100, 0);
wTimeOut.setLayoutData(fdTimeOut);
// Use compression?
wlUseCompression = new Label(wSettingsGroup, SWT.RIGHT);
wlUseCompression.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.UseCompression.Label"));
props.setLook(wlUseCompression);
fdlUseCompression = new FormData();
fdlUseCompression.left = new FormAttachment(0, 0);
fdlUseCompression.top = new FormAttachment(wTimeOut, margin);
fdlUseCompression.right = new FormAttachment(middle, -margin);
wlUseCompression.setLayoutData(fdlUseCompression);
wUseCompression = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wUseCompression);
wUseCompression.setToolTipText(BaseMessages.getString(PKG, "SalesforceInsertDialog.UseCompression.Tooltip"));
fdUseCompression = new FormData();
fdUseCompression.left = new FormAttachment(middle, 0);
fdUseCompression.top = new FormAttachment(wTimeOut, margin);
wUseCompression.setLayoutData(fdUseCompression);
wUseCompression.addSelectionListener(new ComponentSelectionListener(input));
// Rollback all changes on error?
wlRollbackAllChangesOnError = new Label(wSettingsGroup, SWT.RIGHT);
wlRollbackAllChangesOnError.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.RollbackAllChangesOnError.Label"));
props.setLook(wlRollbackAllChangesOnError);
fdlRollbackAllChangesOnError = new FormData();
fdlRollbackAllChangesOnError.left = new FormAttachment(0, 0);
fdlRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
fdlRollbackAllChangesOnError.right = new FormAttachment(middle, -margin);
wlRollbackAllChangesOnError.setLayoutData(fdlRollbackAllChangesOnError);
wRollbackAllChangesOnError = new Button(wSettingsGroup, SWT.CHECK);
wRollbackAllChangesOnError.addSelectionListener(new ComponentSelectionListener(input));
props.setLook(wRollbackAllChangesOnError);
wRollbackAllChangesOnError.setToolTipText(BaseMessages.getString(PKG, "SalesforceInsertDialog.RollbackAllChangesOnError.Tooltip"));
fdRollbackAllChangesOnError = new FormData();
fdRollbackAllChangesOnError.left = new FormAttachment(middle, 0);
fdRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
wRollbackAllChangesOnError.setLayoutData(fdRollbackAllChangesOnError);
// BatchSize value
wlBatchSize = new Label(wSettingsGroup, SWT.RIGHT);
wlBatchSize.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.Limit.Label"));
props.setLook(wlBatchSize);
fdlBatchSize = new FormData();
fdlBatchSize.left = new FormAttachment(0, 0);
fdlBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
fdlBatchSize.right = new FormAttachment(middle, -margin);
wlBatchSize.setLayoutData(fdlBatchSize);
wBatchSize = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBatchSize);
wBatchSize.addModifyListener(lsMod);
fdBatchSize = new FormData();
fdBatchSize.left = new FormAttachment(middle, 0);
fdBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
fdBatchSize.right = new FormAttachment(100, 0);
wBatchSize.setLayoutData(fdBatchSize);
// Module
wlModule = new Label(wSettingsGroup, SWT.RIGHT);
wlModule.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.Module.Label"));
props.setLook(wlModule);
fdlModule = new FormData();
fdlModule.left = new FormAttachment(0, 0);
fdlModule.top = new FormAttachment(wBatchSize, margin);
fdlModule.right = new FormAttachment(middle, -margin);
wlModule.setLayoutData(fdlModule);
wModule = new ComboVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wModule.setEditable(true);
props.setLook(wModule);
wModule.addModifyListener(lsTableMod);
wModule.addSelectionListener(lsSelection);
fdModule = new FormData();
fdModule.left = new FormAttachment(middle, 0);
fdModule.top = new FormAttachment(wBatchSize, margin);
fdModule.right = new FormAttachment(100, -margin);
wModule.setLayoutData(fdModule);
wModule.addFocusListener(new FocusListener() {
@Override
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
getModulesListError = false;
}
@Override
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
// check if the URL and login credentials passed and not just had error
if (Utils.isEmpty(wURL.getText()) || Utils.isEmpty(wUserName.getText()) || Utils.isEmpty(wPassword.getText()) || (getModulesListError)) {
return;
}
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
getModulesList();
shell.setCursor(null);
busy.dispose();
}
});
fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, margin);
fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin);
fdSettingsGroup.right = new FormAttachment(100, -margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// ///////////////////////////////
// END OF Settings GROUP //
// ///////////////////////////////
// ///////////////////////////////
// START OF OutFields GROUP //
// ///////////////////////////////
wOutFieldsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wOutFieldsGroup);
wOutFieldsGroup.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.OutFieldsGroup.Label"));
FormLayout OutFieldsGroupLayout = new FormLayout();
OutFieldsGroupLayout.marginWidth = 10;
OutFieldsGroupLayout.marginHeight = 10;
wOutFieldsGroup.setLayout(OutFieldsGroupLayout);
// SalesforceIDFieldName
wlSalesforceIDFieldName = new Label(wOutFieldsGroup, SWT.RIGHT);
wlSalesforceIDFieldName.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.SalesforceIDFieldName.Label"));
props.setLook(wlSalesforceIDFieldName);
fdlSalesforceIDFieldName = new FormData();
fdlSalesforceIDFieldName.left = new FormAttachment(0, 0);
fdlSalesforceIDFieldName.top = new FormAttachment(wSettingsGroup, margin);
fdlSalesforceIDFieldName.right = new FormAttachment(middle, -margin);
wlSalesforceIDFieldName.setLayoutData(fdlSalesforceIDFieldName);
wSalesforceIDFieldName = new TextVar(transMeta, wOutFieldsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSalesforceIDFieldName);
wSalesforceIDFieldName.setToolTipText(BaseMessages.getString(PKG, "SalesforceInsertDialog.SalesforceIDFieldName.Tooltip"));
wSalesforceIDFieldName.addModifyListener(lsMod);
fdSalesforceIDFieldName = new FormData();
fdSalesforceIDFieldName.left = new FormAttachment(middle, 0);
fdSalesforceIDFieldName.top = new FormAttachment(wSettingsGroup, margin);
fdSalesforceIDFieldName.right = new FormAttachment(100, 0);
wSalesforceIDFieldName.setLayoutData(fdSalesforceIDFieldName);
fdOutFieldsGroup = new FormData();
fdOutFieldsGroup.left = new FormAttachment(0, margin);
fdOutFieldsGroup.top = new FormAttachment(wSettingsGroup, margin);
fdOutFieldsGroup.right = new FormAttachment(100, -margin);
wOutFieldsGroup.setLayoutData(fdOutFieldsGroup);
// ///////////////////////////////
// END OF OutFields GROUP //
// ///////////////////////////////
// THE UPDATE/INSERT TABLE
wlReturn = new Label(wGeneralComp, SWT.NONE);
wlReturn.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.UpdateFields.Label"));
props.setLook(wlReturn);
fdlReturn = new FormData();
fdlReturn.left = new FormAttachment(0, 0);
fdlReturn.top = new FormAttachment(wOutFieldsGroup, margin);
wlReturn.setLayoutData(fdlReturn);
int UpInsCols = 3;
int UpInsRows = (input.getUpdateLookup() != null ? input.getUpdateLookup().length : 1);
ciReturn = new ColumnInfo[UpInsCols];
ciReturn[0] = new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInsertDialog.ColumnInfo.TableField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciReturn[1] = new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInsertDialog.ColumnInfo.StreamField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciReturn[2] = new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInsertDialog.ColumnInfo.UseExternalId"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "Y", "N" });
ciReturn[2].setToolTip(BaseMessages.getString(PKG, "SalesforceInsertDialog.ColumnInfo.UseExternalId.Tooltip"));
tableFieldColumns.add(ciReturn[0]);
wReturn = new TableView(transMeta, wGeneralComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props);
wGetLU = new Button(wGeneralComp, SWT.PUSH);
wGetLU.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.GetAndUpdateFields.Label"));
fdGetLU = new FormData();
fdGetLU.top = new FormAttachment(wlReturn, margin);
fdGetLU.right = new FormAttachment(100, 0);
wGetLU.setLayoutData(fdGetLU);
wDoMapping = new Button(wGeneralComp, SWT.PUSH);
wDoMapping.setText(BaseMessages.getString(PKG, "SalesforceInsertDialog.EditMapping.Label"));
fdDoMapping = new FormData();
fdDoMapping.top = new FormAttachment(wGetLU, margin);
fdDoMapping.right = new FormAttachment(100, 0);
wDoMapping.setLayoutData(fdDoMapping);
wDoMapping.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event arg0) {
generateMappings();
}
});
fdReturn = new FormData();
fdReturn.left = new FormAttachment(0, 0);
fdReturn.top = new FormAttachment(wlReturn, margin);
fdReturn.right = new FormAttachment(wGetLU, -5 * margin);
fdReturn.bottom = new FormAttachment(100, -2 * margin);
wReturn.setLayoutData(fdReturn);
//
// Search the fields in the background
//
final Runnable runnable = new Runnable() {
@Override
public void run() {
StepMeta stepMeta = transMeta.findStep(stepname);
if (stepMeta != null) {
try {
RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
}
setComboBoxes();
// Dislay in red missing field names
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
if (!wReturn.isDisposed()) {
for (int i = 0; i < wReturn.table.getItemCount(); i++) {
TableItem it = wReturn.table.getItem(i);
if (!Utils.isEmpty(it.getText(2))) {
if (!inputFields.containsKey(it.getText(2))) {
it.setBackground(GUIResource.getInstance().getColorRed());
}
}
}
}
}
});
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wStepname, margin);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, null);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOK, -margin);
wTabFolder.setLayoutData(fdTabFolder);
// Add listeners
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
@Override
public void handleEvent(Event e) {
test();
}
};
lsGetLU = new Listener() {
@Override
public void handleEvent(Event e) {
getUpdate();
}
};
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGetLU.addListener(SWT.Selection, lsGetLU);
wTest.addListener(SWT.Selection, lsTest);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData(input);
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations