use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class JobEntryMoveFilesDialog 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, "JobMoveFiles.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobMoveFiles.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, "JobMoveFiles.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, "JobMoveFiles.Settings.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wSettings.setLayout(groupLayout);
wlIncludeSubfolders = new Label(wSettings, SWT.RIGHT);
wlIncludeSubfolders.setText(BaseMessages.getString(PKG, "JobMoveFiles.IncludeSubfolders.Label"));
props.setLook(wlIncludeSubfolders);
fdlIncludeSubfolders = new FormData();
fdlIncludeSubfolders.left = new FormAttachment(0, 0);
fdlIncludeSubfolders.top = new FormAttachment(wName, margin);
fdlIncludeSubfolders.right = new FormAttachment(middle, -margin);
wlIncludeSubfolders.setLayoutData(fdlIncludeSubfolders);
wIncludeSubfolders = new Button(wSettings, SWT.CHECK);
props.setLook(wIncludeSubfolders);
wIncludeSubfolders.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.IncludeSubfolders.Tooltip"));
fdIncludeSubfolders = new FormData();
fdIncludeSubfolders.left = new FormAttachment(middle, 0);
fdIncludeSubfolders.top = new FormAttachment(wName, margin);
fdIncludeSubfolders.right = new FormAttachment(100, 0);
wIncludeSubfolders.setLayoutData(fdIncludeSubfolders);
wIncludeSubfolders.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
CheckIncludeSubFolders();
}
});
// Copy empty folders
wlMoveEmptyFolders = new Label(wSettings, SWT.RIGHT);
wlMoveEmptyFolders.setText(BaseMessages.getString(PKG, "JobMoveFiles.MoveEmptyFolders.Label"));
props.setLook(wlMoveEmptyFolders);
fdlMoveEmptyFolders = new FormData();
fdlMoveEmptyFolders.left = new FormAttachment(0, 0);
fdlMoveEmptyFolders.top = new FormAttachment(wIncludeSubfolders, margin);
fdlMoveEmptyFolders.right = new FormAttachment(middle, -margin);
wlMoveEmptyFolders.setLayoutData(fdlMoveEmptyFolders);
wMoveEmptyFolders = new Button(wSettings, SWT.CHECK);
props.setLook(wMoveEmptyFolders);
wMoveEmptyFolders.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.MoveEmptyFolders.Tooltip"));
fdMoveEmptyFolders = new FormData();
fdMoveEmptyFolders.left = new FormAttachment(middle, 0);
fdMoveEmptyFolders.top = new FormAttachment(wIncludeSubfolders, margin);
fdMoveEmptyFolders.right = new FormAttachment(100, 0);
wMoveEmptyFolders.setLayoutData(fdMoveEmptyFolders);
wMoveEmptyFolders.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Simulate?
wlSimulate = new Label(wSettings, SWT.RIGHT);
wlSimulate.setText(BaseMessages.getString(PKG, "JobMoveFiles.Simulate.Label"));
props.setLook(wlSimulate);
fdlSimulate = new FormData();
fdlSimulate.left = new FormAttachment(0, 0);
fdlSimulate.top = new FormAttachment(wMoveEmptyFolders, margin);
fdlSimulate.right = new FormAttachment(middle, -margin);
wlSimulate.setLayoutData(fdlSimulate);
wSimulate = new Button(wSettings, SWT.CHECK);
props.setLook(wSimulate);
wSimulate.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.Simulate.Tooltip"));
fdSimulate = new FormData();
fdSimulate.left = new FormAttachment(middle, 0);
fdSimulate.top = new FormAttachment(wMoveEmptyFolders, margin);
fdSimulate.right = new FormAttachment(100, 0);
wSimulate.setLayoutData(fdSimulate);
wSimulate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// previous
wlPrevious = new Label(wSettings, SWT.RIGHT);
wlPrevious.setText(BaseMessages.getString(PKG, "JobMoveFiles.Previous.Label"));
props.setLook(wlPrevious);
fdlPrevious = new FormData();
fdlPrevious.left = new FormAttachment(0, 0);
fdlPrevious.top = new FormAttachment(wSimulate, margin);
fdlPrevious.right = new FormAttachment(middle, -margin);
wlPrevious.setLayoutData(fdlPrevious);
wPrevious = new Button(wSettings, SWT.CHECK);
props.setLook(wPrevious);
wPrevious.setSelection(jobEntry.arg_from_previous);
wPrevious.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.Previous.Tooltip"));
fdPrevious = new FormData();
fdPrevious.left = new FormAttachment(middle, 0);
fdPrevious.top = new FormAttachment(wSimulate, margin);
fdPrevious.right = new FormAttachment(100, 0);
wPrevious.setLayoutData(fdPrevious);
wPrevious.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
RefreshArgFromPrevious();
}
});
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, "JobMoveFiles.SourceFileFolder.Label"));
props.setLook(wlSourceFileFolder);
FormData 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, "JobMoveFiles.BrowseFolders.Label"));
FormData 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, "JobMoveFiles.BrowseFiles.Label"));
FormData 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, "JobMoveFiles.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, "JobMoveFiles.SourceFileFolder.Tooltip"));
props.setLook(wSourceFileFolder);
wSourceFileFolder.addModifyListener(lsMod);
FormData 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());
}
}
});
// Destination
wlDestinationFileFolder = new Label(wGeneralComp, SWT.RIGHT);
wlDestinationFileFolder.setText(BaseMessages.getString(PKG, "JobMoveFiles.DestinationFileFolder.Label"));
props.setLook(wlDestinationFileFolder);
fdlDestinationFileFolder = new FormData();
fdlDestinationFileFolder.left = new FormAttachment(0, 0);
fdlDestinationFileFolder.top = new FormAttachment(wSourceFileFolder, margin);
fdlDestinationFileFolder.right = new FormAttachment(middle, -margin);
wlDestinationFileFolder.setLayoutData(fdlDestinationFileFolder);
// Browse Destination folders button ...
wbDestinationDirectory = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbDestinationDirectory);
wbDestinationDirectory.setText(BaseMessages.getString(PKG, "JobMoveFiles.BrowseFolders.Label"));
FormData fdbDestinationDirectory = new FormData();
fdbDestinationDirectory.right = new FormAttachment(100, 0);
fdbDestinationDirectory.top = new FormAttachment(wSourceFileFolder, margin);
wbDestinationDirectory.setLayoutData(fdbDestinationDirectory);
wbDestinationDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wDestinationFileFolder.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wDestinationFileFolder.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
wDestinationFileFolder.setText(dir);
}
}
});
// Browse Destination file browse button ...
wbDestinationFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbDestinationFileFolder);
wbDestinationFileFolder.setText(BaseMessages.getString(PKG, "JobMoveFiles.BrowseFiles.Label"));
FormData fdbDestinationFileFolder = new FormData();
fdbDestinationFileFolder.right = new FormAttachment(wbDestinationDirectory, -margin);
fdbDestinationFileFolder.top = new FormAttachment(wSourceFileFolder, margin);
wbDestinationFileFolder.setLayoutData(fdbDestinationFileFolder);
wDestinationFileFolder = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wDestinationFileFolder.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.DestinationFileFolder.Tooltip"));
props.setLook(wDestinationFileFolder);
wDestinationFileFolder.addModifyListener(lsMod);
fdDestinationFileFolder = new FormData();
fdDestinationFileFolder.left = new FormAttachment(middle, 0);
fdDestinationFileFolder.top = new FormAttachment(wSourceFileFolder, margin);
fdDestinationFileFolder.right = new FormAttachment(wbSourceFileFolder, -55);
wDestinationFileFolder.setLayoutData(fdDestinationFileFolder);
wbDestinationFileFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*" });
if (wDestinationFileFolder.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wDestinationFileFolder.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wDestinationFileFolder.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, "JobMoveFiles.FilenameDelete.Button"));
wbdSourceFileFolder.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.FilenameDelete.Tooltip"));
fdbdSourceFileFolder = new FormData();
fdbdSourceFileFolder.right = new FormAttachment(100, 0);
fdbdSourceFileFolder.top = new FormAttachment(wDestinationFileFolder, 40);
wbdSourceFileFolder.setLayoutData(fdbdSourceFileFolder);
wbeSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbeSourceFileFolder);
wbeSourceFileFolder.setText(BaseMessages.getString(PKG, "JobMoveFiles.FilenameEdit.Button"));
wbeSourceFileFolder.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.FilenameEdit.Tooltip"));
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, "JobMoveFiles.Wildcard.Label"));
props.setLook(wlWildcard);
fdlWildcard = new FormData();
fdlWildcard.left = new FormAttachment(0, 0);
fdlWildcard.top = new FormAttachment(wDestinationFileFolder, 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, "JobMoveFiles.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(middle, 0);
fdWildcard.top = new FormAttachment(wDestinationFileFolder, margin);
fdWildcard.right = new FormAttachment(wbSourceFileFolder, -55);
wWildcard.setLayoutData(fdWildcard);
wlFields = new Label(wGeneralComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "JobMoveFiles.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.source_filefolder == null ? 1 : (jobEntry.source_filefolder.length == 0 ? 0 : jobEntry.source_filefolder.length);
final int FieldsRows = rows;
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobMoveFiles.Fields.SourceFileFolder.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobMoveFiles.Fields.DestinationFileFolder.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobMoveFiles.Fields.Wildcard.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(BaseMessages.getString(PKG, "JobMoveFiles.Fields.SourceFileFolder.Tooltip"));
colinf[1].setUsingVariables(true);
colinf[1].setToolTip(BaseMessages.getString(PKG, "JobMoveFiles.Fields.DestinationFileFolder.Tooltip"));
colinf[2].setUsingVariables(true);
colinf[2].setToolTip(BaseMessages.getString(PKG, "JobMoveFiles.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(100, -75);
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(), wDestinationFileFolder.getText(), wWildcard.getText() });
wSourceFileFolder.setText("");
wDestinationFileFolder.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]);
wDestinationFileFolder.setText(string[1]);
wWildcard.setText(string[2]);
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 DESTINATION FILE TAB ///
// ///////////////////////////////////
wDestinationFileTab = new CTabItem(wTabFolder, SWT.NONE);
wDestinationFileTab.setText(BaseMessages.getString(PKG, "JobMoveFiles.DestinationFileTab.Label"));
FormLayout DestcontentLayout = new FormLayout();
DestcontentLayout.marginWidth = 3;
DestcontentLayout.marginHeight = 3;
wDestinationFileComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wDestinationFileComp);
wDestinationFileComp.setLayout(DestcontentLayout);
// DestinationFile grouping?
// ////////////////////////
// START OF DestinationFile GROUP
//
wDestinationFile = new Group(wDestinationFileComp, SWT.SHADOW_NONE);
props.setLook(wDestinationFile);
wDestinationFile.setText(BaseMessages.getString(PKG, "JobMoveFiles.GroupDestinationFile.Label"));
FormLayout groupLayoutFile = new FormLayout();
groupLayoutFile.marginWidth = 10;
groupLayoutFile.marginHeight = 10;
wDestinationFile.setLayout(groupLayoutFile);
// Create destination folder/parent folder
wlCreateDestinationFolder = new Label(wDestinationFile, SWT.RIGHT);
wlCreateDestinationFolder.setText(BaseMessages.getString(PKG, "JobMoveFiles.CreateDestinationFolder.Label"));
props.setLook(wlCreateDestinationFolder);
fdlCreateDestinationFolder = new FormData();
fdlCreateDestinationFolder.left = new FormAttachment(0, 0);
fdlCreateDestinationFolder.top = new FormAttachment(0, margin);
fdlCreateDestinationFolder.right = new FormAttachment(middle, -margin);
wlCreateDestinationFolder.setLayoutData(fdlCreateDestinationFolder);
wCreateDestinationFolder = new Button(wDestinationFile, SWT.CHECK);
props.setLook(wCreateDestinationFolder);
wCreateDestinationFolder.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.CreateDestinationFolder.Tooltip"));
fdCreateDestinationFolder = new FormData();
fdCreateDestinationFolder.left = new FormAttachment(middle, 0);
fdCreateDestinationFolder.top = new FormAttachment(0, margin);
fdCreateDestinationFolder.right = new FormAttachment(100, 0);
wCreateDestinationFolder.setLayoutData(fdCreateDestinationFolder);
wCreateDestinationFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Destination is a file?
wlDestinationIsAFile = new Label(wDestinationFile, SWT.RIGHT);
wlDestinationIsAFile.setText(BaseMessages.getString(PKG, "JobMoveFiles.DestinationIsAFile.Label"));
props.setLook(wlDestinationIsAFile);
fdlDestinationIsAFile = new FormData();
fdlDestinationIsAFile.left = new FormAttachment(0, 0);
fdlDestinationIsAFile.top = new FormAttachment(wCreateDestinationFolder, margin);
fdlDestinationIsAFile.right = new FormAttachment(middle, -margin);
wlDestinationIsAFile.setLayoutData(fdlDestinationIsAFile);
wDestinationIsAFile = new Button(wDestinationFile, SWT.CHECK);
props.setLook(wDestinationIsAFile);
wDestinationIsAFile.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.DestinationIsAFile.Tooltip"));
fdDestinationIsAFile = new FormData();
fdDestinationIsAFile.left = new FormAttachment(middle, 0);
fdDestinationIsAFile.top = new FormAttachment(wCreateDestinationFolder, margin);
fdDestinationIsAFile.right = new FormAttachment(100, 0);
wDestinationIsAFile.setLayoutData(fdDestinationIsAFile);
wDestinationIsAFile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Do not keep folder structure?
wlDoNotKeepFolderStructure = new Label(wDestinationFile, SWT.RIGHT);
wlDoNotKeepFolderStructure.setText(BaseMessages.getString(PKG, "JobMoveFiles.DoNotKeepFolderStructure.Label"));
props.setLook(wlDoNotKeepFolderStructure);
fdlDoNotKeepFolderStructure = new FormData();
fdlDoNotKeepFolderStructure.left = new FormAttachment(0, 0);
fdlDoNotKeepFolderStructure.top = new FormAttachment(wDestinationIsAFile, margin);
fdlDoNotKeepFolderStructure.right = new FormAttachment(middle, -margin);
wlDoNotKeepFolderStructure.setLayoutData(fdlDoNotKeepFolderStructure);
wDoNotKeepFolderStructure = new Button(wDestinationFile, SWT.CHECK);
props.setLook(wDoNotKeepFolderStructure);
wDoNotKeepFolderStructure.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.DoNotKeepFolderStructure.Tooltip"));
fdDoNotKeepFolderStructure = new FormData();
fdDoNotKeepFolderStructure.left = new FormAttachment(middle, 0);
fdDoNotKeepFolderStructure.top = new FormAttachment(wDestinationIsAFile, margin);
fdDoNotKeepFolderStructure.right = new FormAttachment(100, 0);
wDoNotKeepFolderStructure.setLayoutData(fdDoNotKeepFolderStructure);
wDoNotKeepFolderStructure.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Create multi-part file?
wlAddDate = new Label(wDestinationFile, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "JobMoveFiles.AddDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wDoNotKeepFolderStructure, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(wDestinationFile, SWT.CHECK);
props.setLook(wAddDate);
wAddDate.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.AddDate.Tooltip"));
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, 0);
fdAddDate.top = new FormAttachment(wDoNotKeepFolderStructure, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
setAddDateBeforeExtension();
}
});
// Create multi-part file?
wlAddTime = new Label(wDestinationFile, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "JobMoveFiles.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(wDestinationFile, SWT.CHECK);
props.setLook(wAddTime);
wAddTime.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.AddTime.Tooltip"));
fdAddTime = new FormData();
fdAddTime.left = new FormAttachment(middle, 0);
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();
setAddDateBeforeExtension();
}
});
// Specify date time format?
wlSpecifyFormat = new Label(wDestinationFile, SWT.RIGHT);
wlSpecifyFormat.setText(BaseMessages.getString(PKG, "JobMoveFiles.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(wDestinationFile, SWT.CHECK);
props.setLook(wSpecifyFormat);
wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.SpecifyFormat.Tooltip"));
fdSpecifyFormat = new FormData();
fdSpecifyFormat.left = new FormAttachment(middle, 0);
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();
setAddDateBeforeExtension();
}
});
// DateTimeFormat
wlDateTimeFormat = new Label(wDestinationFile, SWT.RIGHT);
wlDateTimeFormat.setText(BaseMessages.getString(PKG, "JobMoveFiles.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(wDestinationFile, SWT.BORDER | SWT.READ_ONLY);
wDateTimeFormat.setEditable(true);
props.setLook(wDateTimeFormat);
wDateTimeFormat.addModifyListener(lsMod);
fdDateTimeFormat = new FormData();
fdDateTimeFormat.left = new FormAttachment(middle, 0);
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]);
}
// Add Date before extension?
wlAddDateBeforeExtension = new Label(wDestinationFile, SWT.RIGHT);
wlAddDateBeforeExtension.setText(BaseMessages.getString(PKG, "JobMoveFiles.AddDateBeforeExtension.Label"));
props.setLook(wlAddDateBeforeExtension);
fdlAddDateBeforeExtension = new FormData();
fdlAddDateBeforeExtension.left = new FormAttachment(0, 0);
fdlAddDateBeforeExtension.top = new FormAttachment(wDateTimeFormat, margin);
fdlAddDateBeforeExtension.right = new FormAttachment(middle, -margin);
wlAddDateBeforeExtension.setLayoutData(fdlAddDateBeforeExtension);
wAddDateBeforeExtension = new Button(wDestinationFile, SWT.CHECK);
props.setLook(wAddDateBeforeExtension);
wAddDateBeforeExtension.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.AddDateBeforeExtension.Tooltip"));
fdAddDateBeforeExtension = new FormData();
fdAddDateBeforeExtension.left = new FormAttachment(middle, 0);
fdAddDateBeforeExtension.top = new FormAttachment(wDateTimeFormat, margin);
fdAddDateBeforeExtension.right = new FormAttachment(100, 0);
wAddDateBeforeExtension.setLayoutData(fdAddDateBeforeExtension);
wAddDateBeforeExtension.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// If File Exists
wlIfFileExists = new Label(wDestinationFile, SWT.RIGHT);
wlIfFileExists.setText(BaseMessages.getString(PKG, "JobMoveFiles.IfFileExists.Label"));
props.setLook(wlIfFileExists);
fdlIfFileExists = new FormData();
fdlIfFileExists.left = new FormAttachment(0, 0);
fdlIfFileExists.right = new FormAttachment(middle, 0);
fdlIfFileExists.top = new FormAttachment(wAddDateBeforeExtension, margin);
wlIfFileExists.setLayoutData(fdlIfFileExists);
wIfFileExists = new CCombo(wDestinationFile, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wIfFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.Do_Nothing_IfFileExists.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.Overwrite_File_IfFileExists.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.Unique_Name_IfFileExists.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.Delete_Source_File_IfFileExists.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.Move_To_Folder_IfFileExists.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.Fail_IfFileExists.Label"));
// +1: starts at -1
wIfFileExists.select(0);
props.setLook(wIfFileExists);
fdIfFileExists = new FormData();
fdIfFileExists.left = new FormAttachment(middle, 0);
fdIfFileExists.top = new FormAttachment(wAddDateBeforeExtension, margin);
fdIfFileExists.right = new FormAttachment(100, 0);
wIfFileExists.setLayoutData(fdIfFileExists);
fdIfFileExists = new FormData();
fdIfFileExists.left = new FormAttachment(middle, 0);
fdIfFileExists.top = new FormAttachment(wAddDateBeforeExtension, margin);
fdIfFileExists.right = new FormAttachment(100, 0);
wIfFileExists.setLayoutData(fdIfFileExists);
wIfFileExists.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeDestinationFolder();
setMovedDateTimeFormat();
// setAddDateBeforeExtension();
setAddMovedDateBeforeExtension();
}
});
fdDestinationFile = new FormData();
fdDestinationFile.left = new FormAttachment(0, margin);
fdDestinationFile.top = new FormAttachment(wName, margin);
fdDestinationFile.right = new FormAttachment(100, -margin);
wDestinationFile.setLayoutData(fdDestinationFile);
// ///////////////////////////////////////////////////////////
// / END OF DestinationFile GROUP
// ///////////////////////////////////////////////////////////
// MoveTo grouping?
// ////////////////////////
// START OF MoveTo GROUP
//
wMoveToGroup = new Group(wDestinationFileComp, SWT.SHADOW_NONE);
props.setLook(wMoveToGroup);
wMoveToGroup.setText(BaseMessages.getString(PKG, "JobMoveFiles.GroupMoveToGroup.Label"));
FormLayout MovetoLayoutFile = new FormLayout();
MovetoLayoutFile.marginWidth = 10;
MovetoLayoutFile.marginHeight = 10;
wMoveToGroup.setLayout(MovetoLayoutFile);
// DestinationFolder line
wlDestinationFolder = new Label(wMoveToGroup, SWT.RIGHT);
wlDestinationFolder.setText(BaseMessages.getString(PKG, "JobMoveFiles.DestinationFolder.Label"));
props.setLook(wlDestinationFolder);
fdlDestinationFolder = new FormData();
fdlDestinationFolder.left = new FormAttachment(0, 0);
fdlDestinationFolder.top = new FormAttachment(wDestinationFile, margin);
fdlDestinationFolder.right = new FormAttachment(middle, -margin);
wlDestinationFolder.setLayoutData(fdlDestinationFolder);
wbDestinationFolder = new Button(wMoveToGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbDestinationFolder);
wbDestinationFolder.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbDestinationFolder = new FormData();
fdbDestinationFolder.right = new FormAttachment(100, 0);
fdbDestinationFolder.top = new FormAttachment(wDestinationFile, 0);
wbDestinationFolder.setLayoutData(fdbDestinationFolder);
wDestinationFolder = new TextVar(jobMeta, wMoveToGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wDestinationFolder);
wDestinationFolder.addModifyListener(lsMod);
fdDestinationFolder = new FormData();
fdDestinationFolder.left = new FormAttachment(middle, 0);
fdDestinationFolder.top = new FormAttachment(wDestinationFile, margin);
fdDestinationFolder.right = new FormAttachment(wbDestinationFolder, -margin);
wDestinationFolder.setLayoutData(fdDestinationFolder);
// Whenever something changes, set the tooltip to the expanded version:
wDestinationFolder.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wDestinationFolder.setToolTipText(jobMeta.environmentSubstitute(wDestinationFolder.getText()));
}
});
wbDestinationFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
if (wDestinationFolder.getText() != null) {
dialog.setFilterPath(jobMeta.environmentSubstitute(wDestinationFolder.getText()));
}
String dir = dialog.open();
if (dir != null) {
wDestinationFolder.setText(dir);
}
}
});
// Create destination folder/parent folder
wlCreateMoveToFolder = new Label(wMoveToGroup, SWT.RIGHT);
wlCreateMoveToFolder.setText(BaseMessages.getString(PKG, "JobMoveFiles.CreateMoveToFolder.Label"));
props.setLook(wlCreateMoveToFolder);
fdlCreateMoveToFolder = new FormData();
fdlCreateMoveToFolder.left = new FormAttachment(0, 0);
fdlCreateMoveToFolder.top = new FormAttachment(wDestinationFolder, margin);
fdlCreateMoveToFolder.right = new FormAttachment(middle, -margin);
wlCreateMoveToFolder.setLayoutData(fdlCreateMoveToFolder);
wCreateMoveToFolder = new Button(wMoveToGroup, SWT.CHECK);
props.setLook(wCreateMoveToFolder);
wCreateMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.CreateMoveToFolder.Tooltip"));
fdCreateMoveToFolder = new FormData();
fdCreateMoveToFolder.left = new FormAttachment(middle, 0);
fdCreateMoveToFolder.top = new FormAttachment(wDestinationFolder, margin);
fdCreateMoveToFolder.right = new FormAttachment(100, 0);
wCreateMoveToFolder.setLayoutData(fdCreateMoveToFolder);
wCreateMoveToFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Create multi-part file?
wlAddMovedDate = new Label(wMoveToGroup, SWT.RIGHT);
wlAddMovedDate.setText(BaseMessages.getString(PKG, "JobMoveFiles.AddMovedDate.Label"));
props.setLook(wlAddMovedDate);
fdlAddMovedDate = new FormData();
fdlAddMovedDate.left = new FormAttachment(0, 0);
fdlAddMovedDate.top = new FormAttachment(wCreateMoveToFolder, margin);
fdlAddMovedDate.right = new FormAttachment(middle, -margin);
wlAddMovedDate.setLayoutData(fdlAddMovedDate);
wAddMovedDate = new Button(wMoveToGroup, SWT.CHECK);
props.setLook(wAddMovedDate);
wAddMovedDate.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.AddMovedDate.Tooltip"));
fdAddMovedDate = new FormData();
fdAddMovedDate.left = new FormAttachment(middle, 0);
fdAddMovedDate.top = new FormAttachment(wCreateMoveToFolder, margin);
fdAddMovedDate.right = new FormAttachment(100, 0);
wAddMovedDate.setLayoutData(fdAddMovedDate);
wAddMovedDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
setAddMovedDateBeforeExtension();
}
});
// Create multi-part file?
wlAddMovedTime = new Label(wMoveToGroup, SWT.RIGHT);
wlAddMovedTime.setText(BaseMessages.getString(PKG, "JobMoveFiles.AddMovedTime.Label"));
props.setLook(wlAddMovedTime);
fdlAddMovedTime = new FormData();
fdlAddMovedTime.left = new FormAttachment(0, 0);
fdlAddMovedTime.top = new FormAttachment(wAddMovedDate, margin);
fdlAddMovedTime.right = new FormAttachment(middle, -margin);
wlAddMovedTime.setLayoutData(fdlAddMovedTime);
wAddMovedTime = new Button(wMoveToGroup, SWT.CHECK);
props.setLook(wAddMovedTime);
wAddMovedTime.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.AddMovedTime.Tooltip"));
fdAddMovedTime = new FormData();
fdAddMovedTime.left = new FormAttachment(middle, 0);
fdAddMovedTime.top = new FormAttachment(wAddMovedDate, margin);
fdAddMovedTime.right = new FormAttachment(100, 0);
wAddMovedTime.setLayoutData(fdAddMovedTime);
wAddMovedTime.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
setAddMovedDateBeforeExtension();
}
});
// Specify date time format?
wlSpecifyMoveFormat = new Label(wMoveToGroup, SWT.RIGHT);
wlSpecifyMoveFormat.setText(BaseMessages.getString(PKG, "JobMoveFiles.SpecifyMoveFormat.Label"));
props.setLook(wlSpecifyMoveFormat);
fdlSpecifyMoveFormat = new FormData();
fdlSpecifyMoveFormat.left = new FormAttachment(0, 0);
fdlSpecifyMoveFormat.top = new FormAttachment(wAddMovedTime, margin);
fdlSpecifyMoveFormat.right = new FormAttachment(middle, -margin);
wlSpecifyMoveFormat.setLayoutData(fdlSpecifyMoveFormat);
wSpecifyMoveFormat = new Button(wMoveToGroup, SWT.CHECK);
props.setLook(wSpecifyMoveFormat);
wSpecifyMoveFormat.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.SpecifyMoveFormat.Tooltip"));
fdSpecifyMoveFormat = new FormData();
fdSpecifyMoveFormat.left = new FormAttachment(middle, 0);
fdSpecifyMoveFormat.top = new FormAttachment(wAddMovedTime, margin);
fdSpecifyMoveFormat.right = new FormAttachment(100, 0);
wSpecifyMoveFormat.setLayoutData(fdSpecifyMoveFormat);
wSpecifyMoveFormat.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
setMovedDateTimeFormat();
setAddMovedDateBeforeExtension();
}
});
// Moved DateTimeFormat
wlMovedDateTimeFormat = new Label(wMoveToGroup, SWT.RIGHT);
wlMovedDateTimeFormat.setText(BaseMessages.getString(PKG, "JobMoveFiles.MovedDateTimeFormat.Label"));
props.setLook(wlMovedDateTimeFormat);
fdlMovedDateTimeFormat = new FormData();
fdlMovedDateTimeFormat.left = new FormAttachment(0, 0);
fdlMovedDateTimeFormat.top = new FormAttachment(wSpecifyMoveFormat, margin);
fdlMovedDateTimeFormat.right = new FormAttachment(middle, -margin);
wlMovedDateTimeFormat.setLayoutData(fdlMovedDateTimeFormat);
wMovedDateTimeFormat = new CCombo(wMoveToGroup, SWT.BORDER | SWT.READ_ONLY);
wMovedDateTimeFormat.setEditable(true);
props.setLook(wMovedDateTimeFormat);
wMovedDateTimeFormat.addModifyListener(lsMod);
fdMovedDateTimeFormat = new FormData();
fdMovedDateTimeFormat.left = new FormAttachment(middle, 0);
fdMovedDateTimeFormat.top = new FormAttachment(wSpecifyMoveFormat, margin);
fdMovedDateTimeFormat.right = new FormAttachment(100, 0);
wMovedDateTimeFormat.setLayoutData(fdMovedDateTimeFormat);
for (int x = 0; x < dats.length; x++) {
wMovedDateTimeFormat.add(dats[x]);
}
// Add Date before extension?
wlAddMovedDateBeforeExtension = new Label(wMoveToGroup, SWT.RIGHT);
wlAddMovedDateBeforeExtension.setText(BaseMessages.getString(PKG, "JobMoveFiles.AddMovedDateBeforeExtension.Label"));
props.setLook(wlAddMovedDateBeforeExtension);
fdlAddMovedDateBeforeExtension = new FormData();
fdlAddMovedDateBeforeExtension.left = new FormAttachment(0, 0);
fdlAddMovedDateBeforeExtension.top = new FormAttachment(wMovedDateTimeFormat, margin);
fdlAddMovedDateBeforeExtension.right = new FormAttachment(middle, -margin);
wlAddMovedDateBeforeExtension.setLayoutData(fdlAddMovedDateBeforeExtension);
wAddMovedDateBeforeExtension = new Button(wMoveToGroup, SWT.CHECK);
props.setLook(wAddMovedDateBeforeExtension);
wAddMovedDateBeforeExtension.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.AddMovedDateBeforeExtension.Tooltip"));
fdAddMovedDateBeforeExtension = new FormData();
fdAddMovedDateBeforeExtension.left = new FormAttachment(middle, 0);
fdAddMovedDateBeforeExtension.top = new FormAttachment(wMovedDateTimeFormat, margin);
fdAddMovedDateBeforeExtension.right = new FormAttachment(100, 0);
wAddMovedDateBeforeExtension.setLayoutData(fdAddMovedDateBeforeExtension);
wAddMovedDateBeforeExtension.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// If moved File Exists
wlIfMovedFileExists = new Label(wMoveToGroup, SWT.RIGHT);
wlIfMovedFileExists.setText(BaseMessages.getString(PKG, "JobMoveFiles.IfMovedFileExists.Label"));
props.setLook(wlIfMovedFileExists);
fdlIfMovedFileExists = new FormData();
fdlIfMovedFileExists.left = new FormAttachment(0, 0);
fdlIfMovedFileExists.right = new FormAttachment(middle, 0);
fdlIfMovedFileExists.top = new FormAttachment(wAddMovedDateBeforeExtension, margin);
wlIfMovedFileExists.setLayoutData(fdlIfMovedFileExists);
wIfMovedFileExists = new CCombo(wMoveToGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wIfMovedFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.Do_Nothing_IfMovedFileExists.Label"));
wIfMovedFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.Overwrite_Filename_IffMovedFileExists.Label"));
wIfMovedFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.UniqueName_IfMovedFileExists.Label"));
wIfMovedFileExists.add(BaseMessages.getString(PKG, "JobMoveFiles.Fail_IfMovedFileExists.Label"));
// +1: starts at -1
wIfMovedFileExists.select(0);
props.setLook(wIfMovedFileExists);
fdIfMovedFileExists = new FormData();
fdIfMovedFileExists.left = new FormAttachment(middle, 0);
fdIfMovedFileExists.top = new FormAttachment(wAddMovedDateBeforeExtension, margin);
fdIfMovedFileExists.right = new FormAttachment(100, 0);
wIfMovedFileExists.setLayoutData(fdIfMovedFileExists);
fdIfMovedFileExists = new FormData();
fdIfMovedFileExists.left = new FormAttachment(middle, 0);
fdIfMovedFileExists.top = new FormAttachment(wAddMovedDateBeforeExtension, margin);
fdIfMovedFileExists.right = new FormAttachment(100, 0);
wIfMovedFileExists.setLayoutData(fdIfMovedFileExists);
fdMoveToGroup = new FormData();
fdMoveToGroup.left = new FormAttachment(0, margin);
fdMoveToGroup.top = new FormAttachment(wDestinationFile, margin);
fdMoveToGroup.right = new FormAttachment(100, -margin);
wMoveToGroup.setLayoutData(fdMoveToGroup);
// ///////////////////////////////////////////////////////////
// / END OF MoveToGroup GROUP
// ///////////////////////////////////////////////////////////
fdDestinationFileComp = new FormData();
fdDestinationFileComp.left = new FormAttachment(0, 0);
fdDestinationFileComp.top = new FormAttachment(0, 0);
fdDestinationFileComp.right = new FormAttachment(100, 0);
fdDestinationFileComp.bottom = new FormAttachment(100, 0);
wDestinationFileComp.setLayoutData(wDestinationFileComp);
wDestinationFileComp.layout();
wDestinationFileTab.setControl(wDestinationFileComp);
// ///////////////////////////////////////////////////////////
// / END OF DESTINATION FILETAB
// ///////////////////////////////////////////////////////////
// ////////////////////////////////////
// START OF ADVANCED TAB ///
// ///////////////////////////////////
wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
wAdvancedTab.setText(BaseMessages.getString(PKG, "JobMoveFiles.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, "JobMoveFiles.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, "JobMoveFiles.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, "JobMoveFiles.SuccessWhenAllWorksFine.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobMoveFiles.SuccessWhenAtLeat.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobMoveFiles.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
wlNrErrorsLessThan = new Label(wSuccessOn, SWT.RIGHT);
wlNrErrorsLessThan.setText(BaseMessages.getString(PKG, "JobMoveFiles.NrErrorsLessThan.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, "JobMoveFiles.NrErrorsLessThan.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(wDestinationFile, margin);
fdSuccessOn.right = new FormAttachment(100, -margin);
wSuccessOn.setLayoutData(fdSuccessOn);
// ///////////////////////////////////////////////////////////
// / END OF Success ON GROUP
// ///////////////////////////////////////////////////////////
// fileresult grouping?
// ////////////////////////
// START OF LOGGING GROUP///
// /
wFileResult = new Group(wAdvancedComp, SWT.SHADOW_NONE);
props.setLook(wFileResult);
wFileResult.setText(BaseMessages.getString(PKG, "JobMoveFiles.FileResult.Group.Label"));
FormLayout fileresultgroupLayout = new FormLayout();
fileresultgroupLayout.marginWidth = 10;
fileresultgroupLayout.marginHeight = 10;
wFileResult.setLayout(fileresultgroupLayout);
// Add file to result
wlAddFileToResult = new Label(wFileResult, SWT.RIGHT);
wlAddFileToResult.setText(BaseMessages.getString(PKG, "JobMoveFiles.AddFileToResult.Label"));
props.setLook(wlAddFileToResult);
fdlAddFileToResult = new FormData();
fdlAddFileToResult.left = new FormAttachment(0, 0);
fdlAddFileToResult.top = new FormAttachment(wSuccessOn, margin);
fdlAddFileToResult.right = new FormAttachment(middle, -margin);
wlAddFileToResult.setLayoutData(fdlAddFileToResult);
wAddFileToResult = new Button(wFileResult, SWT.CHECK);
props.setLook(wAddFileToResult);
wAddFileToResult.setToolTipText(BaseMessages.getString(PKG, "JobMoveFiles.AddFileToResult.Tooltip"));
fdAddFileToResult = new FormData();
fdAddFileToResult.left = new FormAttachment(middle, 0);
fdAddFileToResult.top = new FormAttachment(wSuccessOn, margin);
fdAddFileToResult.right = new FormAttachment(100, 0);
wAddFileToResult.setLayoutData(fdAddFileToResult);
wAddFileToResult.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
fdFileResult = new FormData();
fdFileResult.left = new FormAttachment(0, margin);
fdFileResult.top = new FormAttachment(wSuccessOn, margin);
fdFileResult.right = new FormAttachment(100, -margin);
wFileResult.setLayoutData(fdFileResult);
// ///////////////////////////////////////////////////////////
// / END OF FilesResult 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();
CheckIncludeSubFolders();
activeSuccessCondition();
setDateTimeFormat();
activeSuccessCondition();
activeDestinationFolder();
setMovedDateTimeFormat();
setAddDateBeforeExtension();
setAddMovedDateBeforeExtension();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class JobEntryMsgBoxInfoDialog 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, "MsgBoxInfo.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
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"));
// at the bottom
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, null);
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "MsgBoxInfo.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, 0);
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);
// Title Msgbox
wlTitleMessage = new Label(shell, SWT.RIGHT);
wlTitleMessage.setText(BaseMessages.getString(PKG, "MsgBoxInfo.TitleMessage.Label"));
props.setLook(wlTitleMessage);
fdlTitleMessage = new FormData();
fdlTitleMessage.left = new FormAttachment(0, 0);
fdlTitleMessage.top = new FormAttachment(wName, margin);
fdlTitleMessage.right = new FormAttachment(middle, -margin);
wlTitleMessage.setLayoutData(fdlTitleMessage);
wTitleMessage = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTitleMessage);
wTitleMessage.addModifyListener(lsMod);
fdTitleMessage = new FormData();
fdTitleMessage.left = new FormAttachment(middle, 0);
fdTitleMessage.top = new FormAttachment(wName, margin);
fdTitleMessage.right = new FormAttachment(100, 0);
wTitleMessage.setLayoutData(fdTitleMessage);
// Body Msgbox
wlBodyMessage = new Label(shell, SWT.RIGHT);
wlBodyMessage.setText(BaseMessages.getString(PKG, "MsgBoxInfo.BodyMessage.Label"));
props.setLook(wlBodyMessage);
fdlBodyMessage = new FormData();
fdlBodyMessage.left = new FormAttachment(0, 0);
fdlBodyMessage.top = new FormAttachment(wTitleMessage, margin);
fdlBodyMessage.right = new FormAttachment(middle, -margin);
wlBodyMessage.setLayoutData(fdlBodyMessage);
wBodyMessage = new TextVar(jobMeta, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
wBodyMessage.setText(BaseMessages.getString(PKG, "MsgBoxInfo.Name.Default"));
props.setLook(wBodyMessage, Props.WIDGET_STYLE_FIXED);
wBodyMessage.addModifyListener(lsMod);
fdBodyMessage = new FormData();
fdBodyMessage.left = new FormAttachment(middle, 0);
fdBodyMessage.top = new FormAttachment(wTitleMessage, margin);
fdBodyMessage.right = new FormAttachment(100, 0);
fdBodyMessage.bottom = new FormAttachment(wOK, -margin);
wBodyMessage.setLayoutData(fdBodyMessage);
// SelectionAdapter lsVar = VariableButtonListenerFactory.getSelectionAdapter(shell, wBodyMessage, jobMeta);
wBodyMessage.addKeyListener(new ControlSpaceKeyAdapter(jobMeta, wBodyMessage));
// 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);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
BaseStepDialog.setSize(shell, 250, 250, false);
shell.open();
props.setDialogSize(shell, "JobEvalDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class JobEntryGetPOPDialog 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) {
closeMailConnection();
jobEntry.setChanged();
}
};
SelectionListener lsSelection = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
closeMailConnection();
}
};
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, "JobGetPOP.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobGetPOP.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, "JobGetPOP.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, "JobGetPOP.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wlServerName = new Label(wServerSettings, SWT.RIGHT);
wlServerName.setText(BaseMessages.getString(PKG, "JobGetPOP.Server.Label"));
props.setLook(wlServerName);
fdlServerName = new FormData();
fdlServerName.left = new FormAttachment(0, 0);
fdlServerName.top = new FormAttachment(0, 2 * margin);
fdlServerName.right = new FormAttachment(middle, -margin);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, 0);
fdServerName.top = new FormAttachment(0, 2 * margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// USE connection with SSL
wlUseSSL = new Label(wServerSettings, SWT.RIGHT);
wlUseSSL.setText(BaseMessages.getString(PKG, "JobGetPOP.UseSSLMails.Label"));
props.setLook(wlUseSSL);
fdlUseSSL = new FormData();
fdlUseSSL.left = new FormAttachment(0, 0);
fdlUseSSL.top = new FormAttachment(wServerName, margin);
fdlUseSSL.right = new FormAttachment(middle, -margin);
wlUseSSL.setLayoutData(fdlUseSSL);
wUseSSL = new Button(wServerSettings, SWT.CHECK);
props.setLook(wUseSSL);
fdUseSSL = new FormData();
wUseSSL.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.UseSSLMails.Tooltip"));
fdUseSSL.left = new FormAttachment(middle, 0);
fdUseSSL.top = new FormAttachment(wServerName, margin);
fdUseSSL.right = new FormAttachment(100, 0);
wUseSSL.setLayoutData(fdUseSSL);
wUseSSL.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
closeMailConnection();
refreshPort(true);
}
});
// port
wlPort = new Label(wServerSettings, SWT.RIGHT);
wlPort.setText(BaseMessages.getString(PKG, "JobGetPOP.SSLPort.Label"));
props.setLook(wlPort);
fdlPort = new FormData();
fdlPort.left = new FormAttachment(0, 0);
fdlPort.top = new FormAttachment(wUseSSL, margin);
fdlPort.right = new FormAttachment(middle, -margin);
wlPort.setLayoutData(fdlPort);
wPort = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPort);
wPort.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.SSLPort.Tooltip"));
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(middle, 0);
fdPort.top = new FormAttachment(wUseSSL, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// UserName line
wlUserName = new Label(wServerSettings, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "JobGetPOP.Username.Label"));
props.setLook(wlUserName);
fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wPort, margin);
fdlUserName.right = new FormAttachment(middle, -margin);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.Username.Tooltip"));
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, 0);
fdUserName.top = new FormAttachment(wPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wlPassword = new Label(wServerSettings, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "JobGetPOP.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// USE proxy
wlUseProxy = new Label(wServerSettings, SWT.RIGHT);
wlUseProxy.setText(BaseMessages.getString(PKG, "JobGetPOP.UseProxyMails.Label"));
props.setLook(wlUseProxy);
fdlUseProxy = new FormData();
fdlUseProxy.left = new FormAttachment(0, 0);
fdlUseProxy.top = new FormAttachment(wPassword, 2 * margin);
fdlUseProxy.right = new FormAttachment(middle, -margin);
wlUseProxy.setLayoutData(fdlUseProxy);
wUseProxy = new Button(wServerSettings, SWT.CHECK);
props.setLook(wUseProxy);
fdUseProxy = new FormData();
wUseProxy.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.UseProxyMails.Tooltip"));
fdUseProxy.left = new FormAttachment(middle, 0);
fdUseProxy.top = new FormAttachment(wPassword, 2 * margin);
fdUseProxy.right = new FormAttachment(100, 0);
wUseProxy.setLayoutData(fdUseProxy);
wUseProxy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setUserProxy();
jobEntry.setChanged();
}
});
// ProxyUsername line
wlProxyUsername = new Label(wServerSettings, SWT.RIGHT);
wlProxyUsername.setText(BaseMessages.getString(PKG, "JobGetPOP.ProxyUsername.Label"));
props.setLook(wlProxyUsername);
fdlProxyUsername = new FormData();
fdlProxyUsername.left = new FormAttachment(0, 0);
fdlProxyUsername.top = new FormAttachment(wUseProxy, margin);
fdlProxyUsername.right = new FormAttachment(middle, -margin);
wlProxyUsername.setLayoutData(fdlProxyUsername);
wProxyUsername = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wProxyUsername);
wProxyUsername.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.ProxyUsername.Tooltip"));
wProxyUsername.addModifyListener(lsMod);
fdProxyUsername = new FormData();
fdProxyUsername.left = new FormAttachment(middle, 0);
fdProxyUsername.top = new FormAttachment(wUseProxy, margin);
fdProxyUsername.right = new FormAttachment(100, 0);
wProxyUsername.setLayoutData(fdProxyUsername);
// Protocol
wlProtocol = new Label(wServerSettings, SWT.RIGHT);
wlProtocol.setText(BaseMessages.getString(PKG, "JobGetPOP.Protocol.Label"));
props.setLook(wlProtocol);
fdlProtocol = new FormData();
fdlProtocol.left = new FormAttachment(0, 0);
fdlProtocol.right = new FormAttachment(middle, -margin);
fdlProtocol.top = new FormAttachment(wProxyUsername, margin);
wlProtocol.setLayoutData(fdlProtocol);
wProtocol = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wProtocol.setItems(MailConnectionMeta.protocolCodes);
wProtocol.select(0);
props.setLook(wProtocol);
fdProtocol = new FormData();
fdProtocol.left = new FormAttachment(middle, 0);
fdProtocol.top = new FormAttachment(wProxyUsername, margin);
fdProtocol.right = new FormAttachment(100, 0);
wProtocol.setLayoutData(fdProtocol);
wProtocol.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refreshProtocol(true);
}
});
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobGetPOP.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wProtocol, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wProtocol, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Target Folder GROUP///
// /
wTargetFolder = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wTargetFolder);
wTargetFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.TargetFolder.Group.Label"));
FormLayout TargetFoldergroupLayout = new FormLayout();
TargetFoldergroupLayout.marginWidth = 10;
TargetFoldergroupLayout.marginHeight = 10;
wTargetFolder.setLayout(TargetFoldergroupLayout);
// OutputDirectory line
wlOutputDirectory = new Label(wTargetFolder, SWT.RIGHT);
wlOutputDirectory.setText(BaseMessages.getString(PKG, "JobGetPOP.OutputDirectory.Label"));
props.setLook(wlOutputDirectory);
fdlOutputDirectory = new FormData();
fdlOutputDirectory.left = new FormAttachment(0, 0);
fdlOutputDirectory.top = new FormAttachment(wServerSettings, margin);
fdlOutputDirectory.right = new FormAttachment(middle, -margin);
wlOutputDirectory.setLayoutData(fdlOutputDirectory);
// Browse Source folders button ...
wbDirectory = new Button(wTargetFolder, SWT.PUSH | SWT.CENTER);
props.setLook(wbDirectory);
wbDirectory.setText(BaseMessages.getString(PKG, "JobGetPOP.BrowseFolders.Label"));
fdbDirectory = new FormData();
fdbDirectory.right = new FormAttachment(100, -margin);
fdbDirectory.top = new FormAttachment(wServerSettings, margin);
wbDirectory.setLayoutData(fdbDirectory);
wbDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wOutputDirectory.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wOutputDirectory.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
wOutputDirectory.setText(dir);
}
}
});
wOutputDirectory = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wOutputDirectory);
wOutputDirectory.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.OutputDirectory.Tooltip"));
wOutputDirectory.addModifyListener(lsMod);
fdOutputDirectory = new FormData();
fdOutputDirectory.left = new FormAttachment(middle, 0);
fdOutputDirectory.top = new FormAttachment(wServerSettings, margin);
fdOutputDirectory.right = new FormAttachment(wbDirectory, -margin);
wOutputDirectory.setLayoutData(fdOutputDirectory);
// Create local folder
wlcreateLocalFolder = new Label(wTargetFolder, SWT.RIGHT);
wlcreateLocalFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.createLocalFolder.Label"));
props.setLook(wlcreateLocalFolder);
fdlcreateLocalFolder = new FormData();
fdlcreateLocalFolder.left = new FormAttachment(0, 0);
fdlcreateLocalFolder.top = new FormAttachment(wOutputDirectory, margin);
fdlcreateLocalFolder.right = new FormAttachment(middle, -margin);
wlcreateLocalFolder.setLayoutData(fdlcreateLocalFolder);
wcreateLocalFolder = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wcreateLocalFolder);
fdcreateLocalFolder = new FormData();
wcreateLocalFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.createLocalFolder.Tooltip"));
fdcreateLocalFolder.left = new FormAttachment(middle, 0);
fdcreateLocalFolder.top = new FormAttachment(wOutputDirectory, margin);
fdcreateLocalFolder.right = new FormAttachment(100, 0);
wcreateLocalFolder.setLayoutData(fdcreateLocalFolder);
// Filename pattern line
wlFilenamePattern = new Label(wTargetFolder, SWT.RIGHT);
wlFilenamePattern.setText(BaseMessages.getString(PKG, "JobGetPOP.FilenamePattern.Label"));
props.setLook(wlFilenamePattern);
fdlFilenamePattern = new FormData();
fdlFilenamePattern.left = new FormAttachment(0, 0);
fdlFilenamePattern.top = new FormAttachment(wcreateLocalFolder, margin);
fdlFilenamePattern.right = new FormAttachment(middle, -margin);
wlFilenamePattern.setLayoutData(fdlFilenamePattern);
wFilenamePattern = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilenamePattern);
wFilenamePattern.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.FilenamePattern.Tooltip"));
wFilenamePattern.addModifyListener(lsMod);
fdFilenamePattern = new FormData();
fdFilenamePattern.left = new FormAttachment(middle, 0);
fdFilenamePattern.top = new FormAttachment(wcreateLocalFolder, margin);
fdFilenamePattern.right = new FormAttachment(100, 0);
wFilenamePattern.setLayoutData(fdFilenamePattern);
// Whenever something changes, set the tooltip to the expanded version:
wFilenamePattern.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFilenamePattern.setToolTipText(jobMeta.environmentSubstitute(wFilenamePattern.getText()));
}
});
// Get message?
wlGetMessage = new Label(wTargetFolder, SWT.RIGHT);
wlGetMessage.setText(BaseMessages.getString(PKG, "JobGetPOP.GetMessageMails.Label"));
props.setLook(wlGetMessage);
fdlGetMessage = new FormData();
fdlGetMessage.left = new FormAttachment(0, 0);
fdlGetMessage.top = new FormAttachment(wFilenamePattern, margin);
fdlGetMessage.right = new FormAttachment(middle, -margin);
wlGetMessage.setLayoutData(fdlGetMessage);
wGetMessage = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wGetMessage);
fdGetMessage = new FormData();
wGetMessage.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.GetMessageMails.Tooltip"));
fdGetMessage.left = new FormAttachment(middle, 0);
fdGetMessage.top = new FormAttachment(wFilenamePattern, margin);
fdGetMessage.right = new FormAttachment(100, 0);
wGetMessage.setLayoutData(fdGetMessage);
wGetMessage.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (!wGetAttachment.getSelection() && !wGetMessage.getSelection()) {
wGetAttachment.setSelection(true);
}
}
});
// Get attachment?
wlGetAttachment = new Label(wTargetFolder, SWT.RIGHT);
wlGetAttachment.setText(BaseMessages.getString(PKG, "JobGetPOP.GetAttachmentMails.Label"));
props.setLook(wlGetAttachment);
fdlGetAttachment = new FormData();
fdlGetAttachment.left = new FormAttachment(0, 0);
fdlGetAttachment.top = new FormAttachment(wGetMessage, margin);
fdlGetAttachment.right = new FormAttachment(middle, -margin);
wlGetAttachment.setLayoutData(fdlGetAttachment);
wGetAttachment = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wGetAttachment);
fdGetAttachment = new FormData();
wGetAttachment.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.GetAttachmentMails.Tooltip"));
fdGetAttachment.left = new FormAttachment(middle, 0);
fdGetAttachment.top = new FormAttachment(wGetMessage, margin);
fdGetAttachment.right = new FormAttachment(100, 0);
wGetAttachment.setLayoutData(fdGetAttachment);
wGetAttachment.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeAttachmentFolder();
}
});
// different folder for attachment?
wlDifferentFolderForAttachment = new Label(wTargetFolder, SWT.RIGHT);
wlDifferentFolderForAttachment.setText(BaseMessages.getString(PKG, "JobGetPOP.DifferentFolderForAttachmentMails.Label"));
props.setLook(wlDifferentFolderForAttachment);
fdlDifferentFolderForAttachment = new FormData();
fdlDifferentFolderForAttachment.left = new FormAttachment(0, 0);
fdlDifferentFolderForAttachment.top = new FormAttachment(wGetAttachment, margin);
fdlDifferentFolderForAttachment.right = new FormAttachment(middle, -margin);
wlDifferentFolderForAttachment.setLayoutData(fdlDifferentFolderForAttachment);
wDifferentFolderForAttachment = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wDifferentFolderForAttachment);
fdDifferentFolderForAttachment = new FormData();
wDifferentFolderForAttachment.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.DifferentFolderForAttachmentMails.Tooltip"));
fdDifferentFolderForAttachment.left = new FormAttachment(middle, 0);
fdDifferentFolderForAttachment.top = new FormAttachment(wGetAttachment, margin);
fdDifferentFolderForAttachment.right = new FormAttachment(100, 0);
wDifferentFolderForAttachment.setLayoutData(fdDifferentFolderForAttachment);
wDifferentFolderForAttachment.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeAttachmentFolder();
}
});
// AttachmentFolder line
wlAttachmentFolder = new Label(wTargetFolder, SWT.RIGHT);
wlAttachmentFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentFolder.Label"));
props.setLook(wlAttachmentFolder);
fdlAttachmentFolder = new FormData();
fdlAttachmentFolder.left = new FormAttachment(0, 0);
fdlAttachmentFolder.top = new FormAttachment(wDifferentFolderForAttachment, margin);
fdlAttachmentFolder.right = new FormAttachment(middle, -margin);
wlAttachmentFolder.setLayoutData(fdlAttachmentFolder);
// Browse Source folders button ...
wbAttachmentFolder = new Button(wTargetFolder, SWT.PUSH | SWT.CENTER);
props.setLook(wbAttachmentFolder);
wbAttachmentFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.BrowseFolders.Label"));
fdbAttachmentFolder = new FormData();
fdbAttachmentFolder.right = new FormAttachment(100, -margin);
fdbAttachmentFolder.top = new FormAttachment(wDifferentFolderForAttachment, margin);
wbAttachmentFolder.setLayoutData(fdbAttachmentFolder);
wbAttachmentFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wAttachmentFolder.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wAttachmentFolder.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
wAttachmentFolder.setText(dir);
}
}
});
wAttachmentFolder = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wAttachmentFolder);
wAttachmentFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentFolder.Tooltip"));
wAttachmentFolder.addModifyListener(lsMod);
fdAttachmentFolder = new FormData();
fdAttachmentFolder.left = new FormAttachment(middle, 0);
fdAttachmentFolder.top = new FormAttachment(wDifferentFolderForAttachment, margin);
fdAttachmentFolder.right = new FormAttachment(wbAttachmentFolder, -margin);
wAttachmentFolder.setLayoutData(fdAttachmentFolder);
// Limit attached files
wlAttachmentWildcard = new Label(wTargetFolder, SWT.RIGHT);
wlAttachmentWildcard.setText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentWildcard.Label"));
props.setLook(wlAttachmentWildcard);
fdlAttachmentWildcard = new FormData();
fdlAttachmentWildcard.left = new FormAttachment(0, 0);
fdlAttachmentWildcard.top = new FormAttachment(wbAttachmentFolder, margin);
fdlAttachmentWildcard.right = new FormAttachment(middle, -margin);
wlAttachmentWildcard.setLayoutData(fdlAttachmentWildcard);
wAttachmentWildcard = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wAttachmentWildcard);
wAttachmentWildcard.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentWildcard.Tooltip"));
wAttachmentWildcard.addModifyListener(lsMod);
fdAttachmentWildcard = new FormData();
fdAttachmentWildcard.left = new FormAttachment(middle, 0);
fdAttachmentWildcard.top = new FormAttachment(wbAttachmentFolder, margin);
fdAttachmentWildcard.right = new FormAttachment(100, 0);
wAttachmentWildcard.setLayoutData(fdAttachmentWildcard);
// Whenever something changes, set the tooltip to the expanded version:
wAttachmentWildcard.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wAttachmentWildcard.setToolTipText(jobMeta.environmentSubstitute(wAttachmentWildcard.getText()));
}
});
fdTargetFolder = new FormData();
fdTargetFolder.left = new FormAttachment(0, margin);
fdTargetFolder.top = new FormAttachment(wServerSettings, margin);
fdTargetFolder.right = new FormAttachment(100, -margin);
wTargetFolder.setLayoutData(fdTargetFolder);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wName, 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 SETTINGS TAB ///
// ////////////////////////
wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
wSettingsTab.setText(BaseMessages.getString(PKG, "JobGetPOP.Tab.Pop.Label"));
wSettingsComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSettingsComp);
FormLayout PopLayout = new FormLayout();
PopLayout.marginWidth = 3;
PopLayout.marginHeight = 3;
wSettingsComp.setLayout(PopLayout);
// Action type
wlActionType = new Label(wSettingsComp, SWT.RIGHT);
wlActionType.setText(BaseMessages.getString(PKG, "JobGetPOP.ActionType.Label"));
props.setLook(wlActionType);
fdlActionType = new FormData();
fdlActionType.left = new FormAttachment(0, 0);
fdlActionType.right = new FormAttachment(middle, -margin);
fdlActionType.top = new FormAttachment(0, 3 * margin);
wlActionType.setLayoutData(fdlActionType);
wActionType = new CCombo(wSettingsComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wActionType.setItems(MailConnectionMeta.actionTypeDesc);
// +1: starts at -1
wActionType.select(0);
props.setLook(wActionType);
fdActionType = new FormData();
fdActionType.left = new FormAttachment(middle, 0);
fdActionType.top = new FormAttachment(0, 3 * margin);
fdActionType.right = new FormAttachment(100, 0);
wActionType.setLayoutData(fdActionType);
wActionType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setActionType();
jobEntry.setChanged();
}
});
// Message: for POP3, only INBOX folder is available!
wlPOP3Message = new Label(wSettingsComp, SWT.RIGHT);
wlPOP3Message.setText(BaseMessages.getString(PKG, "JobGetPOP.POP3Message.Label"));
props.setLook(wlPOP3Message);
fdlPOP3Message = new FormData();
fdlPOP3Message.left = new FormAttachment(0, margin);
fdlPOP3Message.top = new FormAttachment(wActionType, 3 * margin);
wlPOP3Message.setLayoutData(fdlPOP3Message);
wlPOP3Message.setForeground(GUIResource.getInstance().getColorOrange());
// ////////////////////////
// START OF POP3 Settings GROUP///
// /
wPOP3Settings = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wPOP3Settings);
wPOP3Settings.setText(BaseMessages.getString(PKG, "JobGetPOP.POP3Settings.Group.Label"));
FormLayout POP3SettingsgroupLayout = new FormLayout();
POP3SettingsgroupLayout.marginWidth = 10;
POP3SettingsgroupLayout.marginHeight = 10;
wPOP3Settings.setLayout(POP3SettingsgroupLayout);
// List of mails of retrieve
wlListmails = new Label(wPOP3Settings, SWT.RIGHT);
wlListmails.setText(BaseMessages.getString(PKG, "JobGetPOP.Listmails.Label"));
props.setLook(wlListmails);
fdlListmails = new FormData();
fdlListmails.left = new FormAttachment(0, 0);
fdlListmails.right = new FormAttachment(middle, 0);
fdlListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
wlListmails.setLayoutData(fdlListmails);
wListmails = new CCombo(wPOP3Settings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wListmails.add(BaseMessages.getString(PKG, "JobGetPOP.RetrieveAllMails.Label"));
// PDI-7241 POP3 does not support retrive unread
// wListmails.add( BaseMessages.getString( PKG, "JobGetPOP.RetrieveUnreadMails.Label" ) );
wListmails.add(BaseMessages.getString(PKG, "JobGetPOP.RetrieveFirstMails.Label"));
// +1: starts at -1
wListmails.select(0);
props.setLook(wListmails);
fdListmails = new FormData();
fdListmails.left = new FormAttachment(middle, 0);
fdListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
fdListmails.right = new FormAttachment(100, 0);
wListmails.setLayoutData(fdListmails);
wListmails.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
chooseListMails();
}
});
// Retrieve the first ... mails
wlFirstmails = new Label(wPOP3Settings, SWT.RIGHT);
wlFirstmails.setText(BaseMessages.getString(PKG, "JobGetPOP.Firstmails.Label"));
props.setLook(wlFirstmails);
fdlFirstmails = new FormData();
fdlFirstmails.left = new FormAttachment(0, 0);
fdlFirstmails.right = new FormAttachment(middle, -margin);
fdlFirstmails.top = new FormAttachment(wListmails, margin);
wlFirstmails.setLayoutData(fdlFirstmails);
wFirstmails = new TextVar(jobMeta, wPOP3Settings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFirstmails);
wFirstmails.addModifyListener(lsMod);
fdFirstmails = new FormData();
fdFirstmails.left = new FormAttachment(middle, 0);
fdFirstmails.top = new FormAttachment(wListmails, margin);
fdFirstmails.right = new FormAttachment(100, 0);
wFirstmails.setLayoutData(fdFirstmails);
// Delete mails after retrieval...
wlDelete = new Label(wPOP3Settings, SWT.RIGHT);
wlDelete.setText(BaseMessages.getString(PKG, "JobGetPOP.DeleteMails.Label"));
props.setLook(wlDelete);
fdlDelete = new FormData();
fdlDelete.left = new FormAttachment(0, 0);
fdlDelete.top = new FormAttachment(wFirstmails, margin);
fdlDelete.right = new FormAttachment(middle, -margin);
wlDelete.setLayoutData(fdlDelete);
wDelete = new Button(wPOP3Settings, SWT.CHECK);
props.setLook(wDelete);
fdDelete = new FormData();
wDelete.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.DeleteMails.Tooltip"));
fdDelete.left = new FormAttachment(middle, 0);
fdDelete.top = new FormAttachment(wFirstmails, margin);
fdDelete.right = new FormAttachment(100, 0);
wDelete.setLayoutData(fdDelete);
fdPOP3Settings = new FormData();
fdPOP3Settings.left = new FormAttachment(0, margin);
fdPOP3Settings.top = new FormAttachment(wlPOP3Message, 2 * margin);
fdPOP3Settings.right = new FormAttachment(100, -margin);
wPOP3Settings.setLayoutData(fdPOP3Settings);
// ///////////////////////////////////////////////////////////
// / END OF POP3 SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF IMAP Settings GROUP///
// /
wIMAPSettings = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wIMAPSettings);
wIMAPSettings.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPSettings.Groupp.Label"));
FormLayout IMAPSettingsgroupLayout = new FormLayout();
IMAPSettingsgroupLayout.marginWidth = 10;
IMAPSettingsgroupLayout.marginHeight = 10;
wIMAPSettings.setLayout(IMAPSettingsgroupLayout);
// SelectFolder button
wSelectFolder = new Button(wIMAPSettings, SWT.PUSH);
wSelectFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectFolderConnection.Label"));
props.setLook(wSelectFolder);
fdSelectFolder = new FormData();
wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.SelectFolderConnection.Tooltip"));
fdSelectFolder.top = new FormAttachment(wPOP3Settings, margin);
fdSelectFolder.right = new FormAttachment(100, 0);
wSelectFolder.setLayoutData(fdSelectFolder);
// TestIMAPFolder button
wTestIMAPFolder = new Button(wIMAPSettings, SWT.PUSH);
wTestIMAPFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.TestIMAPFolderConnection.Label"));
props.setLook(wTestIMAPFolder);
fdTestIMAPFolder = new FormData();
wTestIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.TestIMAPFolderConnection.Tooltip"));
fdTestIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
fdTestIMAPFolder.right = new FormAttachment(wSelectFolder, -margin);
wTestIMAPFolder.setLayoutData(fdTestIMAPFolder);
// IMAPFolder line
wlIMAPFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPFolder.Label"));
props.setLook(wlIMAPFolder);
fdlIMAPFolder = new FormData();
fdlIMAPFolder.left = new FormAttachment(0, 0);
fdlIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
fdlIMAPFolder.right = new FormAttachment(middle, -margin);
wlIMAPFolder.setLayoutData(fdlIMAPFolder);
wIMAPFolder = new TextVar(jobMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIMAPFolder);
wIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.IMAPFolder.Tooltip"));
wIMAPFolder.addModifyListener(lsMod);
fdIMAPFolder = new FormData();
fdIMAPFolder.left = new FormAttachment(middle, 0);
fdIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
fdIMAPFolder.right = new FormAttachment(wTestIMAPFolder, -margin);
wIMAPFolder.setLayoutData(fdIMAPFolder);
// Include subfolders?
wlIncludeSubFolders = new Label(wIMAPSettings, SWT.RIGHT);
wlIncludeSubFolders.setText(BaseMessages.getString(PKG, "JobGetPOP.IncludeSubFoldersMails.Label"));
props.setLook(wlIncludeSubFolders);
fdlIncludeSubFolders = new FormData();
fdlIncludeSubFolders.left = new FormAttachment(0, 0);
fdlIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
fdlIncludeSubFolders.right = new FormAttachment(middle, -margin);
wlIncludeSubFolders.setLayoutData(fdlIncludeSubFolders);
wIncludeSubFolders = new Button(wIMAPSettings, SWT.CHECK);
props.setLook(wIncludeSubFolders);
fdIncludeSubFolders = new FormData();
wIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.IncludeSubFoldersMails.Tooltip"));
fdIncludeSubFolders.left = new FormAttachment(middle, 0);
fdIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
fdIncludeSubFolders.right = new FormAttachment(100, 0);
wIncludeSubFolders.setLayoutData(fdIncludeSubFolders);
wIncludeSubFolders.addSelectionListener(lsSelection);
// List of mails of retrieve
wlIMAPListmails = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPListmails.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPListmails.Label"));
props.setLook(wlIMAPListmails);
fdlIMAPListmails = new FormData();
fdlIMAPListmails.left = new FormAttachment(0, 0);
fdlIMAPListmails.right = new FormAttachment(middle, -margin);
fdlIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
wlIMAPListmails.setLayoutData(fdlIMAPListmails);
wIMAPListmails = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wIMAPListmails.setItems(MailConnectionMeta.valueIMAPListDesc);
// +1: starts at -1
wIMAPListmails.select(0);
props.setLook(wIMAPListmails);
fdIMAPListmails = new FormData();
fdIMAPListmails.left = new FormAttachment(middle, 0);
fdIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
fdIMAPListmails.right = new FormAttachment(100, 0);
wIMAPListmails.setLayoutData(fdIMAPListmails);
wIMAPListmails.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// ChooseIMAPListmails();
}
});
// Retrieve the first ... mails
wlIMAPFirstmails = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPFirstmails.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPFirstmails.Label"));
props.setLook(wlIMAPFirstmails);
fdlIMAPFirstmails = new FormData();
fdlIMAPFirstmails.left = new FormAttachment(0, 0);
fdlIMAPFirstmails.right = new FormAttachment(middle, -margin);
fdlIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
wlIMAPFirstmails.setLayoutData(fdlIMAPFirstmails);
wIMAPFirstmails = new TextVar(jobMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIMAPFirstmails);
wIMAPFirstmails.addModifyListener(lsMod);
fdIMAPFirstmails = new FormData();
fdIMAPFirstmails.left = new FormAttachment(middle, 0);
fdIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
fdIMAPFirstmails.right = new FormAttachment(100, 0);
wIMAPFirstmails.setLayoutData(fdIMAPFirstmails);
// After get IMAP
wlAfterGetIMAP = new Label(wIMAPSettings, SWT.RIGHT);
wlAfterGetIMAP.setText(BaseMessages.getString(PKG, "JobGetPOP.AfterGetIMAP.Label"));
props.setLook(wlAfterGetIMAP);
fdlAfterGetIMAP = new FormData();
fdlAfterGetIMAP.left = new FormAttachment(0, 0);
fdlAfterGetIMAP.right = new FormAttachment(middle, -margin);
fdlAfterGetIMAP.top = new FormAttachment(wIMAPFirstmails, 2 * margin);
wlAfterGetIMAP.setLayoutData(fdlAfterGetIMAP);
wAfterGetIMAP = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wAfterGetIMAP.setItems(MailConnectionMeta.afterGetIMAPDesc);
// +1: starts at -1
wAfterGetIMAP.select(0);
props.setLook(wAfterGetIMAP);
fdAfterGetIMAP = new FormData();
fdAfterGetIMAP.left = new FormAttachment(middle, 0);
fdAfterGetIMAP.top = new FormAttachment(wIMAPFirstmails, 2 * margin);
fdAfterGetIMAP.right = new FormAttachment(100, 0);
wAfterGetIMAP.setLayoutData(fdAfterGetIMAP);
wAfterGetIMAP.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setAfterIMAPRetrived();
jobEntry.setChanged();
}
});
// MoveToFolder line
wlMoveToFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.MoveToFolder.Label"));
props.setLook(wlMoveToFolder);
fdlMoveToFolder = new FormData();
fdlMoveToFolder.left = new FormAttachment(0, 0);
fdlMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdlMoveToFolder.right = new FormAttachment(middle, -margin);
wlMoveToFolder.setLayoutData(fdlMoveToFolder);
// SelectMoveToFolder button
wSelectMoveToFolder = new Button(wIMAPSettings, SWT.PUSH);
wSelectMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectMoveToFolderConnection.Label"));
props.setLook(wSelectMoveToFolder);
fdSelectMoveToFolder = new FormData();
wSelectMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.SelectMoveToFolderConnection.Tooltip"));
fdSelectMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdSelectMoveToFolder.right = new FormAttachment(100, 0);
wSelectMoveToFolder.setLayoutData(fdSelectMoveToFolder);
// TestMoveToFolder button
wTestMoveToFolder = new Button(wIMAPSettings, SWT.PUSH);
wTestMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.TestMoveToFolderConnection.Label"));
props.setLook(wTestMoveToFolder);
fdTestMoveToFolder = new FormData();
wTestMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.TestMoveToFolderConnection.Tooltip"));
fdTestMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdTestMoveToFolder.right = new FormAttachment(wSelectMoveToFolder, -margin);
wTestMoveToFolder.setLayoutData(fdTestMoveToFolder);
wMoveToFolder = new TextVar(jobMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMoveToFolder);
wMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.MoveToFolder.Tooltip"));
wMoveToFolder.addModifyListener(lsMod);
fdMoveToFolder = new FormData();
fdMoveToFolder.left = new FormAttachment(middle, 0);
fdMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdMoveToFolder.right = new FormAttachment(wTestMoveToFolder, -margin);
wMoveToFolder.setLayoutData(fdMoveToFolder);
// Create move to folder
wlcreateMoveToFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlcreateMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.createMoveToFolderMails.Label"));
props.setLook(wlcreateMoveToFolder);
fdlcreateMoveToFolder = new FormData();
fdlcreateMoveToFolder.left = new FormAttachment(0, 0);
fdlcreateMoveToFolder.top = new FormAttachment(wMoveToFolder, margin);
fdlcreateMoveToFolder.right = new FormAttachment(middle, -margin);
wlcreateMoveToFolder.setLayoutData(fdlcreateMoveToFolder);
wcreateMoveToFolder = new Button(wIMAPSettings, SWT.CHECK);
props.setLook(wcreateMoveToFolder);
fdcreateMoveToFolder = new FormData();
wcreateMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.createMoveToFolderMails.Tooltip"));
fdcreateMoveToFolder.left = new FormAttachment(middle, 0);
fdcreateMoveToFolder.top = new FormAttachment(wMoveToFolder, margin);
fdcreateMoveToFolder.right = new FormAttachment(100, 0);
wcreateMoveToFolder.setLayoutData(fdcreateMoveToFolder);
fdIMAPSettings = new FormData();
fdIMAPSettings.left = new FormAttachment(0, margin);
fdIMAPSettings.top = new FormAttachment(wPOP3Settings, 2 * margin);
fdIMAPSettings.right = new FormAttachment(100, -margin);
wIMAPSettings.setLayoutData(fdIMAPSettings);
// ///////////////////////////////////////////////////////////
// / END OF IMAP SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdSettingsComp = new FormData();
fdSettingsComp.left = new FormAttachment(0, 0);
fdSettingsComp.top = new FormAttachment(wName, 0);
fdSettingsComp.right = new FormAttachment(100, 0);
fdSettingsComp.bottom = new FormAttachment(100, 0);
wSettingsComp.setLayoutData(fdSettingsComp);
wSettingsComp.layout();
wSettingsTab.setControl(wSettingsComp);
props.setLook(wSettingsComp);
// ///////////////////////////////////////////////////////////
// / END OF Pop TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF SEARCH TAB ///
// ////////////////////////
wSearchTab = new CTabItem(wTabFolder, SWT.NONE);
wSearchTab.setText(BaseMessages.getString(PKG, "JobGetPOP.Tab.Search.Label"));
wSearchComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSearchComp);
FormLayout searchLayout = new FormLayout();
searchLayout.marginWidth = 3;
searchLayout.marginHeight = 3;
wSearchComp.setLayout(searchLayout);
// ////////////////////////
// START OF HEADER ROUP///
// /
wHeader = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wHeader);
wHeader.setText(BaseMessages.getString(PKG, "JobGetPOP.Header.Group.Label"));
FormLayout HeadergroupLayout = new FormLayout();
HeadergroupLayout.marginWidth = 10;
HeadergroupLayout.marginHeight = 10;
wHeader.setLayout(HeadergroupLayout);
wNegateSender = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateSender);
fdNegateSender = new FormData();
wNegateSender.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateSender.Tooltip"));
fdNegateSender.top = new FormAttachment(0, margin);
fdNegateSender.right = new FormAttachment(100, -margin);
wNegateSender.setLayoutData(fdNegateSender);
// From line
wlSender = new Label(wHeader, SWT.RIGHT);
wlSender.setText(BaseMessages.getString(PKG, "JobGetPOP.wSender.Label"));
props.setLook(wlSender);
fdlSender = new FormData();
fdlSender.left = new FormAttachment(0, 0);
fdlSender.top = new FormAttachment(0, margin);
fdlSender.right = new FormAttachment(middle, -margin);
wlSender.setLayoutData(fdlSender);
wSender = new TextVar(jobMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSender);
wSender.addModifyListener(lsMod);
fdSender = new FormData();
fdSender.left = new FormAttachment(middle, 0);
fdSender.top = new FormAttachment(0, margin);
fdSender.right = new FormAttachment(wNegateSender, -margin);
wSender.setLayoutData(fdSender);
wNegateReceipient = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateReceipient);
fdNegateReceipient = new FormData();
wNegateReceipient.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateReceipient.Tooltip"));
fdNegateReceipient.top = new FormAttachment(wSender, margin);
fdNegateReceipient.right = new FormAttachment(100, -margin);
wNegateReceipient.setLayoutData(fdNegateReceipient);
// Receipient line
wlReceipient = new Label(wHeader, SWT.RIGHT);
wlReceipient.setText(BaseMessages.getString(PKG, "JobGetPOP.Receipient.Label"));
props.setLook(wlReceipient);
fdlReceipient = new FormData();
fdlReceipient.left = new FormAttachment(0, 0);
fdlReceipient.top = new FormAttachment(wSender, margin);
fdlReceipient.right = new FormAttachment(middle, -margin);
wlReceipient.setLayoutData(fdlReceipient);
wReceipient = new TextVar(jobMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wReceipient);
wReceipient.addModifyListener(lsMod);
fdReceipient = new FormData();
fdReceipient.left = new FormAttachment(middle, 0);
fdReceipient.top = new FormAttachment(wSender, margin);
fdReceipient.right = new FormAttachment(wNegateReceipient, -margin);
wReceipient.setLayoutData(fdReceipient);
wNegateSubject = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateSubject);
fdNegateSubject = new FormData();
wNegateSubject.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateSubject.Tooltip"));
fdNegateSubject.top = new FormAttachment(wReceipient, margin);
fdNegateSubject.right = new FormAttachment(100, -margin);
wNegateSubject.setLayoutData(fdNegateSubject);
// Subject line
wlSubject = new Label(wHeader, SWT.RIGHT);
wlSubject.setText(BaseMessages.getString(PKG, "JobGetPOP.Subject.Label"));
props.setLook(wlSubject);
fdlSubject = new FormData();
fdlSubject.left = new FormAttachment(0, 0);
fdlSubject.top = new FormAttachment(wReceipient, margin);
fdlSubject.right = new FormAttachment(middle, -margin);
wlSubject.setLayoutData(fdlSubject);
wSubject = new TextVar(jobMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSubject);
wSubject.addModifyListener(lsMod);
fdSubject = new FormData();
fdSubject.left = new FormAttachment(middle, 0);
fdSubject.top = new FormAttachment(wReceipient, margin);
fdSubject.right = new FormAttachment(wNegateSubject, -margin);
wSubject.setLayoutData(fdSubject);
fdHeader = new FormData();
fdHeader.left = new FormAttachment(0, margin);
fdHeader.top = new FormAttachment(wReceipient, 2 * margin);
fdHeader.right = new FormAttachment(100, -margin);
wHeader.setLayoutData(fdHeader);
// ///////////////////////////////////////////////////////////
// / END OF HEADER GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT GROUP///
// /
wContent = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wContent);
wContent.setText(BaseMessages.getString(PKG, "JobGetPOP.Content.Group.Label"));
FormLayout ContentgroupLayout = new FormLayout();
ContentgroupLayout.marginWidth = 10;
ContentgroupLayout.marginHeight = 10;
wContent.setLayout(ContentgroupLayout);
wNegateBody = new Button(wContent, SWT.CHECK);
props.setLook(wNegateBody);
fdNegateBody = new FormData();
wNegateBody.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateBody.Tooltip"));
fdNegateBody.top = new FormAttachment(wHeader, margin);
fdNegateBody.right = new FormAttachment(100, -margin);
wNegateBody.setLayoutData(fdNegateBody);
// Body line
wlBody = new Label(wContent, SWT.RIGHT);
wlBody.setText(BaseMessages.getString(PKG, "JobGetPOP.Body.Label"));
props.setLook(wlBody);
fdlBody = new FormData();
fdlBody.left = new FormAttachment(0, 0);
fdlBody.top = new FormAttachment(wHeader, margin);
fdlBody.right = new FormAttachment(middle, -margin);
wlBody.setLayoutData(fdlBody);
wBody = new TextVar(jobMeta, wContent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBody);
wBody.addModifyListener(lsMod);
fdBody = new FormData();
fdBody.left = new FormAttachment(middle, 0);
fdBody.top = new FormAttachment(wHeader, margin);
fdBody.right = new FormAttachment(wNegateBody, -margin);
wBody.setLayoutData(fdBody);
fdContent = new FormData();
fdContent.left = new FormAttachment(0, margin);
fdContent.top = new FormAttachment(wHeader, margin);
fdContent.right = new FormAttachment(100, -margin);
wContent.setLayoutData(fdContent);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF RECEIVED DATE ROUP///
// /
wReceivedDate = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wReceivedDate);
wReceivedDate.setText(BaseMessages.getString(PKG, "JobGetPOP.ReceivedDate.Group.Label"));
FormLayout ReceivedDategroupLayout = new FormLayout();
ReceivedDategroupLayout.marginWidth = 10;
ReceivedDategroupLayout.marginHeight = 10;
wReceivedDate.setLayout(ReceivedDategroupLayout);
wNegateReceivedDate = new Button(wReceivedDate, SWT.CHECK);
props.setLook(wNegateReceivedDate);
fdNegateReceivedDate = new FormData();
wNegateReceivedDate.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateReceivedDate.Tooltip"));
fdNegateReceivedDate.top = new FormAttachment(wContent, margin);
fdNegateReceivedDate.right = new FormAttachment(100, -margin);
wNegateReceivedDate.setLayoutData(fdNegateReceivedDate);
// Received Date Condition
wlConditionOnReceivedDate = new Label(wReceivedDate, SWT.RIGHT);
wlConditionOnReceivedDate.setText(BaseMessages.getString(PKG, "JobGetPOP.ConditionOnReceivedDate.Label"));
props.setLook(wlConditionOnReceivedDate);
fdlConditionOnReceivedDate = new FormData();
fdlConditionOnReceivedDate.left = new FormAttachment(0, 0);
fdlConditionOnReceivedDate.right = new FormAttachment(middle, -margin);
fdlConditionOnReceivedDate.top = new FormAttachment(wContent, margin);
wlConditionOnReceivedDate.setLayoutData(fdlConditionOnReceivedDate);
wConditionOnReceivedDate = new CCombo(wReceivedDate, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wConditionOnReceivedDate.setItems(MailConnectionMeta.conditionDateDesc);
// +1: starts at -1
wConditionOnReceivedDate.select(0);
props.setLook(wConditionOnReceivedDate);
fdConditionOnReceivedDate = new FormData();
fdConditionOnReceivedDate.left = new FormAttachment(middle, 0);
fdConditionOnReceivedDate.top = new FormAttachment(wContent, margin);
fdConditionOnReceivedDate.right = new FormAttachment(wNegateReceivedDate, -margin);
wConditionOnReceivedDate.setLayoutData(fdConditionOnReceivedDate);
wConditionOnReceivedDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
conditionReceivedDate();
jobEntry.setChanged();
}
});
open = new Button(wReceivedDate, SWT.PUSH);
open.setImage(GUIResource.getInstance().getImageCalendar());
open.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.OpenCalendar"));
FormData fdlButton = new FormData();
fdlButton.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdlButton.right = new FormAttachment(100, 0);
open.setLayoutData(fdlButton);
open.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
dialog.setText(BaseMessages.getString(PKG, "JobGetPOP.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() {
public void widgetSelected(SelectionEvent e) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, calendar.getYear());
cal.set(Calendar.MONTH, calendar.getMonth());
cal.set(Calendar.DAY_OF_MONTH, calendar.getDay());
cal.set(Calendar.HOUR_OF_DAY, time.getHours());
cal.set(Calendar.MINUTE, time.getMinutes());
cal.set(Calendar.SECOND, time.getSeconds());
wReadFrom.setText(new SimpleDateFormat(JobEntryGetPOP.DATE_PATTERN).format(cal.getTime()));
dialog.close();
}
});
dialog.setDefaultButton(ok);
dialog.pack();
dialog.open();
}
});
wlReadFrom = new Label(wReceivedDate, SWT.RIGHT);
wlReadFrom.setText(BaseMessages.getString(PKG, "JobGetPOP.ReadFrom.Label"));
props.setLook(wlReadFrom);
fdlReadFrom = new FormData();
fdlReadFrom.left = new FormAttachment(0, 0);
fdlReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdlReadFrom.right = new FormAttachment(middle, -margin);
wlReadFrom.setLayoutData(fdlReadFrom);
wReadFrom = new TextVar(jobMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadFrom.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.ReadFrom.Tooltip"));
props.setLook(wReadFrom);
wReadFrom.addModifyListener(lsMod);
fdReadFrom = new FormData();
fdReadFrom.left = new FormAttachment(middle, 0);
fdReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdReadFrom.right = new FormAttachment(open, -margin);
wReadFrom.setLayoutData(fdReadFrom);
opento = new Button(wReceivedDate, SWT.PUSH);
opento.setImage(GUIResource.getInstance().getImageCalendar());
opento.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.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() {
public void widgetSelected(SelectionEvent e) {
final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
dialogto.setText(BaseMessages.getString(PKG, "JobGetPOP.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() {
public void widgetSelected(SelectionEvent e) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, calendarto.getYear());
cal.set(Calendar.MONTH, calendarto.getMonth());
cal.set(Calendar.DAY_OF_MONTH, calendarto.getDay());
cal.set(Calendar.HOUR_OF_DAY, timeto.getHours());
cal.set(Calendar.MINUTE, timeto.getMinutes());
cal.set(Calendar.SECOND, timeto.getSeconds());
wReadTo.setText(new SimpleDateFormat(JobEntryGetPOP.DATE_PATTERN).format(cal.getTime()));
dialogto.close();
}
});
dialogto.setDefaultButton(okto);
dialogto.pack();
dialogto.open();
}
});
wlReadTo = new Label(wReceivedDate, SWT.RIGHT);
wlReadTo.setText(BaseMessages.getString(PKG, "JobGetPOP.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(jobMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadTo.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.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);
fdReceivedDate = new FormData();
fdReceivedDate.left = new FormAttachment(0, margin);
fdReceivedDate.top = new FormAttachment(wContent, margin);
fdReceivedDate.right = new FormAttachment(100, -margin);
wReceivedDate.setLayoutData(fdReceivedDate);
// ///////////////////////////////////////////////////////////
// / END OF RECEIVED DATE GROUP
// ///////////////////////////////////////////////////////////
fdSearchComp = new FormData();
fdSearchComp.left = new FormAttachment(0, 0);
fdSearchComp.top = new FormAttachment(wName, 0);
fdSearchComp.right = new FormAttachment(100, 0);
fdSearchComp.bottom = new FormAttachment(100, 0);
wSearchComp.setLayoutData(fdSearchComp);
wSearchComp.layout();
wSearchTab.setControl(wSearchComp);
props.setLook(wSearchComp);
// ////////////////////////////////
// / END OF SEARCH 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();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wTest.addListener(SWT.Selection, lsTest);
lsTestIMAPFolder = new Listener() {
public void handleEvent(Event e) {
checkFolder(jobMeta.environmentSubstitute(wIMAPFolder.getText()));
}
};
wTestIMAPFolder.addListener(SWT.Selection, lsTestIMAPFolder);
lsTestMoveToFolder = new Listener() {
public void handleEvent(Event e) {
checkFolder(jobMeta.environmentSubstitute(wMoveToFolder.getText()));
}
};
wTestMoveToFolder.addListener(SWT.Selection, lsTestMoveToFolder);
lsSelectFolder = new Listener() {
public void handleEvent(Event e) {
selectFolder(wIMAPFolder);
}
};
wSelectFolder.addListener(SWT.Selection, lsSelectFolder);
lsSelectMoveToFolder = new Listener() {
public void handleEvent(Event e) {
selectFolder(wMoveToFolder);
}
};
wSelectMoveToFolder.addListener(SWT.Selection, lsSelectMoveToFolder);
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
setUserProxy();
chooseListMails();
activeAttachmentFolder();
refreshProtocol(false);
conditionReceivedDate();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobEntryGetPOPDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class JobEntrySetVariablesDialog 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, "JobEntrySetVariables.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Name line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobEntrySetVariables.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);
gFilename = new Group(shell, SWT.SHADOW_NONE);
props.setLook(gFilename);
gFilename.setText(BaseMessages.getString(PKG, "JobEntrySetVariables.FilenameGroup.Label"));
FormLayout groupFilenameLayout = new FormLayout();
groupFilenameLayout.marginWidth = 10;
groupFilenameLayout.marginHeight = 10;
gFilename.setLayout(groupFilenameLayout);
// Name line
wlFilename = new Label(gFilename, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "JobEntrySetVariables.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.right = new FormAttachment(middle, -margin);
fdlFilename.top = new FormAttachment(0, margin);
wlFilename.setLayoutData(fdlFilename);
wFilename = new TextVar(jobMeta, gFilename, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.addModifyListener(lsMod);
fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.top = new FormAttachment(0, margin);
fdFilename.right = new FormAttachment(100, 0);
wFilename.setLayoutData(fdFilename);
// file variable type line
wlFileVariableType = new Label(gFilename, SWT.RIGHT);
wlFileVariableType.setText(BaseMessages.getString(PKG, "JobEntrySetVariables.FileVariableType.Label"));
props.setLook(wlFileVariableType);
fdlFileVariableType = new FormData();
fdlFileVariableType.left = new FormAttachment(0, 0);
fdlFileVariableType.right = new FormAttachment(middle, -margin);
fdlFileVariableType.top = new FormAttachment(wFilename, margin);
wlFileVariableType.setLayoutData(fdlFileVariableType);
wFileVariableType = new CCombo(gFilename, SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.READ_ONLY);
props.setLook(wFileVariableType);
wFileVariableType.addModifyListener(lsMod);
fdFileVariableType = new FormData();
fdFileVariableType.left = new FormAttachment(middle, 0);
fdFileVariableType.top = new FormAttachment(wFilename, margin);
fdFileVariableType.right = new FormAttachment(100, 0);
wFileVariableType.setLayoutData(fdFileVariableType);
wFileVariableType.setItems(JobEntrySetVariables.getVariableTypeDescriptions());
fdgFilename = new FormData();
fdgFilename.left = new FormAttachment(0, margin);
fdgFilename.top = new FormAttachment(wName, margin);
fdgFilename.right = new FormAttachment(100, -margin);
gFilename.setLayoutData(fdgFilename);
//
// START OF SETTINGS GROUP
//
gSettings = new Group(shell, SWT.SHADOW_NONE);
props.setLook(gSettings);
gSettings.setText(BaseMessages.getString(PKG, "JobEntrySetVariables.Settings.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
gSettings.setLayout(groupLayout);
wlVarSubs = new Label(gSettings, SWT.RIGHT);
wlVarSubs.setText(BaseMessages.getString(PKG, "JobEntrySetVariables.VarsReplace.Label"));
props.setLook(wlVarSubs);
fdlVarSubs = new FormData();
fdlVarSubs.left = new FormAttachment(0, 0);
fdlVarSubs.top = new FormAttachment(wName, margin);
fdlVarSubs.right = new FormAttachment(middle, -margin);
wlVarSubs.setLayoutData(fdlVarSubs);
wVarSubs = new Button(gSettings, SWT.CHECK);
props.setLook(wVarSubs);
wVarSubs.setToolTipText(BaseMessages.getString(PKG, "JobEntrySetVariables.VarsReplace.Tooltip"));
fdVarSubs = new FormData();
fdVarSubs.left = new FormAttachment(middle, 0);
fdVarSubs.top = new FormAttachment(wName, margin);
fdVarSubs.right = new FormAttachment(100, 0);
wVarSubs.setLayoutData(fdVarSubs);
wVarSubs.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
fdgSettings = new FormData();
fdgSettings.left = new FormAttachment(0, margin);
fdgSettings.top = new FormAttachment(gFilename, margin);
fdgSettings.right = new FormAttachment(100, -margin);
gSettings.setLayoutData(fdgSettings);
// ///////////////////////////////////////////////////////////
// / END OF SETTINGS GROUP
// ///////////////////////////////////////////////////////////
wlFields = new Label(shell, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "SetVariableDialog.Variables.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(gSettings, margin);
wlFields.setLayoutData(fdlFields);
int rows = jobEntry.variableName == null ? 1 : (jobEntry.variableName.length == 0 ? 0 : jobEntry.variableName.length);
final int FieldsRows = rows;
ColumnInfo[] colinf = { new ColumnInfo(BaseMessages.getString(PKG, "SetVariableDialog.Fields.Column.VariableName"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SetVariableDialog.Fields.Column.Value"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SetVariableDialog.Fields.Column.VariableType"), ColumnInfo.COLUMN_TYPE_CCOMBO, JobEntrySetVariables.getVariableTypeDescriptions(), false) };
colinf[0].setUsingVariables(true);
colinf[1].setUsingVariables(true);
wFields = new TableView(jobMeta, shell, 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(100, 0);
fdFields.bottom = new FormAttachment(100, -50);
wFields.setLayoutData(fdFields);
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, wFields);
// 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);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class JobEntryShellDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
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();
}
};
backupChanged = jobEntry.hasChanged();
backupLogfile = jobEntry.setLogfile;
backupDate = jobEntry.addDate;
backupTime = jobEntry.addTime;
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobShell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Name line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobShell.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.top = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, 0);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(middle, 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, "JobShell.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);
// Insert Script?
wlInsertScript = new Label(wGeneralComp, SWT.RIGHT);
wlInsertScript.setText(BaseMessages.getString(PKG, "JobShell.InsertScript.Label"));
props.setLook(wlInsertScript);
fdlInsertScript = new FormData();
fdlInsertScript.left = new FormAttachment(0, 0);
fdlInsertScript.top = new FormAttachment(wName, margin);
fdlInsertScript.right = new FormAttachment(middle, -margin);
wlInsertScript.setLayoutData(fdlInsertScript);
wInsertScript = new Button(wGeneralComp, SWT.CHECK);
wInsertScript.setToolTipText(BaseMessages.getString(PKG, "JobShell.InsertScript.Tooltip"));
props.setLook(wInsertScript);
fdInsertScript = new FormData();
fdInsertScript.left = new FormAttachment(middle, 0);
fdInsertScript.top = new FormAttachment(wName, margin);
fdInsertScript.right = new FormAttachment(100, 0);
wInsertScript.setLayoutData(fdInsertScript);
wInsertScript.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ActiveInsertScript();
jobEntry.setChanged();
}
});
// /////////////////////
// Filename line
// /////////////////////
wlFilename = new Label(wGeneralComp, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "JobShell.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(wInsertScript, margin);
fdlFilename.right = new FormAttachment(middle, 0);
wlFilename.setLayoutData(fdlFilename);
wbFilename = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFilename = new FormData();
fdbFilename.top = new FormAttachment(wInsertScript, margin);
fdbFilename.right = new FormAttachment(100, 0);
wbFilename.setLayoutData(fdbFilename);
wFilename = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.addModifyListener(lsMod);
fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.right = new FormAttachment(wbFilename, -margin);
fdFilename.top = new FormAttachment(wInsertScript, margin);
wFilename.setLayoutData(fdFilename);
// /////////////////////
// Working dir line
// /////////////////////
wlWorkDirectory = new Label(wGeneralComp, SWT.RIGHT);
wlWorkDirectory.setText(BaseMessages.getString(PKG, "JobShell.WorkingDirectory.Label"));
props.setLook(wlWorkDirectory);
fdlWorkDirectory = new FormData();
fdlWorkDirectory.left = new FormAttachment(0, 0);
fdlWorkDirectory.top = new FormAttachment(wFilename, margin);
fdlWorkDirectory.right = new FormAttachment(middle, 0);
wlWorkDirectory.setLayoutData(fdlWorkDirectory);
wWorkDirectory = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wWorkDirectory);
wWorkDirectory.addModifyListener(lsMod);
fdWorkDirectory = new FormData();
fdWorkDirectory.left = new FormAttachment(middle, 0);
fdWorkDirectory.right = new FormAttachment(wbFilename, -margin);
fdWorkDirectory.top = new FormAttachment(wFilename, margin);
wWorkDirectory.setLayoutData(fdWorkDirectory);
// ////////////////////////
// START OF LOGGING GROUP
//
wLogging = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wLogging);
wLogging.setText(BaseMessages.getString(PKG, "JobShell.LogSettings.Group.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wLogging.setLayout(groupLayout);
// Set the logfile?
wlSetLogfile = new Label(wLogging, SWT.RIGHT);
wlSetLogfile.setText(BaseMessages.getString(PKG, "JobShell.Specify.Logfile.Label"));
props.setLook(wlSetLogfile);
fdlSetLogfile = new FormData();
fdlSetLogfile.left = new FormAttachment(0, 0);
fdlSetLogfile.top = new FormAttachment(0, margin);
fdlSetLogfile.right = new FormAttachment(middle, -margin);
wlSetLogfile.setLayoutData(fdlSetLogfile);
wSetLogfile = new Button(wLogging, SWT.CHECK);
props.setLook(wSetLogfile);
fdSetLogfile = new FormData();
fdSetLogfile.left = new FormAttachment(middle, 0);
fdSetLogfile.top = new FormAttachment(0, margin);
fdSetLogfile.right = new FormAttachment(100, 0);
wSetLogfile.setLayoutData(fdSetLogfile);
wSetLogfile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setLogfile = !jobEntry.setLogfile;
jobEntry.setChanged();
setActive();
}
});
// Append logfile?
wlAppendLogfile = new Label(wLogging, SWT.RIGHT);
wlAppendLogfile.setText(BaseMessages.getString(PKG, "JobShell.Append.Logfile.Label"));
props.setLook(wlAppendLogfile);
fdlAppendLogfile = new FormData();
fdlAppendLogfile.left = new FormAttachment(0, 0);
fdlAppendLogfile.top = new FormAttachment(wSetLogfile, margin);
fdlAppendLogfile.right = new FormAttachment(middle, -margin);
wlAppendLogfile.setLayoutData(fdlAppendLogfile);
wAppendLogfile = new Button(wLogging, SWT.CHECK);
wAppendLogfile.setToolTipText(BaseMessages.getString(PKG, "JobShell.Append.Logfile.Tooltip"));
props.setLook(wAppendLogfile);
fdAppendLogfile = new FormData();
fdAppendLogfile.left = new FormAttachment(middle, 0);
fdAppendLogfile.top = new FormAttachment(wSetLogfile, margin);
fdAppendLogfile.right = new FormAttachment(100, 0);
wAppendLogfile.setLayoutData(fdAppendLogfile);
wAppendLogfile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Set the logfile path + base-name
wlLogfile = new Label(wLogging, SWT.RIGHT);
wlLogfile.setText(BaseMessages.getString(PKG, "JobShell.NameOfLogfile.Label"));
props.setLook(wlLogfile);
fdlLogfile = new FormData();
fdlLogfile.left = new FormAttachment(0, 0);
fdlLogfile.top = new FormAttachment(wAppendLogfile, margin);
fdlLogfile.right = new FormAttachment(middle, 0);
wlLogfile.setLayoutData(fdlLogfile);
wLogfile = new TextVar(jobMeta, wLogging, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wLogfile.setText("");
props.setLook(wLogfile);
fdLogfile = new FormData();
fdLogfile.left = new FormAttachment(middle, 0);
fdLogfile.top = new FormAttachment(wAppendLogfile, margin);
fdLogfile.right = new FormAttachment(100, 0);
wLogfile.setLayoutData(fdLogfile);
// Set the logfile filename extention
wlLogext = new Label(wLogging, SWT.RIGHT);
wlLogext.setText(BaseMessages.getString(PKG, "JobShell.LogfileExtension.Label"));
props.setLook(wlLogext);
fdlLogext = new FormData();
fdlLogext.left = new FormAttachment(0, 0);
fdlLogext.top = new FormAttachment(wLogfile, margin);
fdlLogext.right = new FormAttachment(middle, 0);
wlLogext.setLayoutData(fdlLogext);
wLogext = new TextVar(jobMeta, wLogging, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wLogext.setText("");
props.setLook(wLogext);
fdLogext = new FormData();
fdLogext.left = new FormAttachment(middle, 0);
fdLogext.top = new FormAttachment(wLogfile, margin);
fdLogext.right = new FormAttachment(100, 0);
wLogext.setLayoutData(fdLogext);
// Add date to logfile name?
wlAddDate = new Label(wLogging, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "JobShell.Logfile.IncludeDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wLogext, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(wLogging, SWT.CHECK);
props.setLook(wAddDate);
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, 0);
fdAddDate.top = new FormAttachment(wLogext, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.addDate = !jobEntry.addDate;
jobEntry.setChanged();
}
});
// Add time to logfile name?
wlAddTime = new Label(wLogging, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "JobShell.Logfile.IncludeTime.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(wLogging, SWT.CHECK);
props.setLook(wAddTime);
fdAddTime = new FormData();
fdAddTime.left = new FormAttachment(middle, 0);
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.addTime = !jobEntry.addTime;
jobEntry.setChanged();
}
});
wlLoglevel = new Label(wLogging, SWT.RIGHT);
wlLoglevel.setText(BaseMessages.getString(PKG, "JobShell.Loglevel.Label"));
props.setLook(wlLoglevel);
fdlLoglevel = new FormData();
fdlLoglevel.left = new FormAttachment(0, 0);
fdlLoglevel.right = new FormAttachment(middle, -margin);
fdlLoglevel.top = new FormAttachment(wAddTime, margin);
wlLoglevel.setLayoutData(fdlLoglevel);
wLoglevel = new CCombo(wLogging, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wLoglevel.setItems(LogLevel.getLogLevelDescriptions());
props.setLook(wLoglevel);
fdLoglevel = new FormData();
fdLoglevel.left = new FormAttachment(middle, 0);
fdLoglevel.top = new FormAttachment(wAddTime, margin);
fdLoglevel.right = new FormAttachment(100, 0);
wLoglevel.setLayoutData(fdLoglevel);
fdLogging = new FormData();
fdLogging.left = new FormAttachment(0, margin);
fdLogging.top = new FormAttachment(wWorkDirectory, margin);
fdLogging.right = new FormAttachment(100, -margin);
wLogging.setLayoutData(fdLogging);
// ///////////////////////////////////////////////////////////
// / END OF LOGGING GROUP
// ///////////////////////////////////////////////////////////
wlPrevious = new Label(wGeneralComp, SWT.RIGHT);
wlPrevious.setText(BaseMessages.getString(PKG, "JobShell.Previous.Label"));
props.setLook(wlPrevious);
fdlPrevious = new FormData();
fdlPrevious.left = new FormAttachment(0, 0);
fdlPrevious.top = new FormAttachment(wLogging, margin * 3);
fdlPrevious.right = new FormAttachment(middle, -margin);
wlPrevious.setLayoutData(fdlPrevious);
wPrevious = new Button(wGeneralComp, SWT.CHECK);
props.setLook(wPrevious);
wPrevious.setSelection(jobEntry.argFromPrevious);
wPrevious.setToolTipText(BaseMessages.getString(PKG, "JobShell.Previous.Tooltip"));
fdPrevious = new FormData();
fdPrevious.left = new FormAttachment(middle, 0);
fdPrevious.top = new FormAttachment(wLogging, margin * 3);
fdPrevious.right = new FormAttachment(100, 0);
wPrevious.setLayoutData(fdPrevious);
wPrevious.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.argFromPrevious = !jobEntry.argFromPrevious;
jobEntry.setChanged();
wlFields.setEnabled(!jobEntry.argFromPrevious);
wFields.setEnabled(!jobEntry.argFromPrevious);
}
});
wlEveryRow = new Label(wGeneralComp, SWT.RIGHT);
wlEveryRow.setText(BaseMessages.getString(PKG, "JobShell.ExecForEveryInputRow.Label"));
props.setLook(wlEveryRow);
fdlEveryRow = new FormData();
fdlEveryRow.left = new FormAttachment(0, 0);
fdlEveryRow.top = new FormAttachment(wPrevious, margin * 3);
fdlEveryRow.right = new FormAttachment(middle, -margin);
wlEveryRow.setLayoutData(fdlEveryRow);
wEveryRow = new Button(wGeneralComp, SWT.CHECK);
props.setLook(wEveryRow);
wEveryRow.setSelection(jobEntry.execPerRow);
wEveryRow.setToolTipText(BaseMessages.getString(PKG, "JobShell.ExecForEveryInputRow.Tooltip"));
fdEveryRow = new FormData();
fdEveryRow.left = new FormAttachment(middle, 0);
fdEveryRow.top = new FormAttachment(wPrevious, margin * 3);
fdEveryRow.right = new FormAttachment(100, 0);
wEveryRow.setLayoutData(fdEveryRow);
wEveryRow.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.execPerRow = !jobEntry.execPerRow;
jobEntry.setChanged();
}
});
wlFields = new Label(wGeneralComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "JobShell.Fields.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(wEveryRow, margin);
wlFields.setLayoutData(fdlFields);
final int FieldsCols = 1;
int rows = jobEntry.arguments == null ? 1 : (jobEntry.arguments.length == 0 ? 0 : jobEntry.arguments.length);
final int FieldsRows = rows;
ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "JobShell.Fields.Argument.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[0].setUsingVariables(true);
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(100, 0);
fdFields.bottom = new FormAttachment(100, -margin);
wFields.setLayoutData(fdFields);
wlFields.setEnabled(!jobEntry.argFromPrevious);
wFields.setEnabled(!jobEntry.argFromPrevious);
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(500, -margin);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////////////////
// START OF Script TAB ///
// ///////////////////////////////////
wScriptTab = new CTabItem(wTabFolder, SWT.NONE);
wScriptTab.setText(BaseMessages.getString(PKG, "JobShell.Tab.Script.Label"));
FormLayout ScriptLayout = new FormLayout();
ScriptLayout.marginWidth = 3;
ScriptLayout.marginHeight = 3;
wScriptComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wScriptComp);
wScriptComp.setLayout(ScriptLayout);
// Script line
wScript = new Text(wScriptComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
props.setLook(wScript);
wScript.addModifyListener(lsMod);
fdScript = new FormData();
fdScript.left = new FormAttachment(0, margin);
fdScript.top = new FormAttachment(wlScript, margin);
fdScript.right = new FormAttachment(100, 0);
fdScript.bottom = new FormAttachment(100, -margin);
wScript.setLayoutData(fdScript);
fdScriptComp = new FormData();
fdScriptComp.left = new FormAttachment(0, 0);
fdScriptComp.top = new FormAttachment(0, 0);
fdScriptComp.right = new FormAttachment(100, 0);
fdScriptComp.bottom = new FormAttachment(100, 0);
wScriptComp.setLayoutData(wScriptComp);
wScriptComp.layout();
wScriptTab.setControl(wScriptComp);
// ///////////////////////////////////////////////////////////
// / END OF Script 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);
// Some 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"));
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();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wFilename.addSelectionListener(lsDef);
wbFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.sh;*.bat;*.BAT", "*;*.*" });
dialog.setFilterNames(FILEFORMATS);
if (wFilename.getText() != null) {
dialog.setFileName(wFilename.getText());
}
if (dialog.open() != null) {
wFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
wName.setText(dialog.getFileName());
}
}
});
// Detect [X] or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
setActive();
ActiveInsertScript();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobShellDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
Aggregations