use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class JobEntrySSH2GETDialog 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) {
conn = null;
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobSSH2GET.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobSSH2GET.Name.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobSSH2GET.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 Host GROUP
// ////////////////////////
wHost = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wHost);
wHost.setText(BaseMessages.getString(PKG, "JobMail.Group.Host.Label"));
FormLayout HostLayout = new FormLayout();
HostLayout.marginWidth = 10;
HostLayout.marginHeight = 10;
wHost.setLayout(HostLayout);
// ServerName line
wServerName = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2GET.Server.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// ServerPort line
wlServerPort = new Label(wHost, SWT.RIGHT);
wlServerPort.setText(BaseMessages.getString(PKG, "JobSSH2GET.Port.Label"));
props.setLook(wlServerPort);
fdlServerPort = new FormData();
fdlServerPort.left = new FormAttachment(0, 0);
fdlServerPort.top = new FormAttachment(wServerName, margin);
fdlServerPort.right = new FormAttachment(middle, -margin);
wlServerPort.setLayoutData(fdlServerPort);
wServerPort = new TextVar(jobMeta, wHost, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerPort);
wServerPort.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.Port.Tooltip"));
wServerPort.addModifyListener(lsMod);
fdServerPort = new FormData();
fdServerPort.left = new FormAttachment(middle, margin);
fdServerPort.top = new FormAttachment(wServerName, margin);
fdServerPort.right = new FormAttachment(100, 0);
wServerPort.setLayoutData(fdServerPort);
// cacheHostKey
wlcacheHostKey = new Label(wHost, SWT.RIGHT);
wlcacheHostKey.setText(BaseMessages.getString(PKG, "JobSSH2GET.cacheHostKeyFiles.Label"));
props.setLook(wlcacheHostKey);
fdlcacheHostKey = new FormData();
fdlcacheHostKey.left = new FormAttachment(0, 0);
fdlcacheHostKey.top = new FormAttachment(wServerPort, margin);
fdlcacheHostKey.right = new FormAttachment(middle, 0);
wlcacheHostKey.setLayoutData(fdlcacheHostKey);
wcacheHostKey = new Button(wHost, SWT.CHECK);
wcacheHostKey.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.cacheHostKeyFiles.Tooltip"));
props.setLook(wcacheHostKey);
fdcacheHostKey = new FormData();
fdcacheHostKey.left = new FormAttachment(middle, margin);
fdcacheHostKey.top = new FormAttachment(wServerPort, margin);
fdcacheHostKey.right = new FormAttachment(100, 0);
wcacheHostKey.setLayoutData(fdcacheHostKey);
wcacheHostKey.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// UserName line
wUserName = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2GET.User.Label"), BaseMessages.getString(PKG, "JobSSH2GET.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wcacheHostKey, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2GET.Password.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Timeout line
wTimeout = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2GET.Timeout.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.addModifyListener(lsMod);
fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(0, 0);
fdTimeout.top = new FormAttachment(wPassword, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// Test connection button
wTest = new Button(wHost, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobSSH2GET.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wTimeout, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdHost = new FormData();
fdHost.left = new FormAttachment(0, margin);
fdHost.top = new FormAttachment(wName, margin);
fdHost.right = new FormAttachment(100, -margin);
wHost.setLayoutData(fdHost);
// ///////////////////////////////////////////////////////////
// / END OF Host GROUP
// /////////////////////////////////////////////////////////
// ////////////////////////
// START OF HTTPProxy GROUP
// ////////////////////////
wHTTPProxyGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wHTTPProxyGroup);
wHTTPProxyGroup.setText(BaseMessages.getString(PKG, "JobSSH2GET.Group.HTTPProxyGroup.Label"));
FormLayout HTTPProxyGroupLayout = new FormLayout();
HTTPProxyGroupLayout.marginWidth = 10;
HTTPProxyGroupLayout.marginHeight = 10;
wHTTPProxyGroup.setLayout(HTTPProxyGroupLayout);
// useHTTPProxy
wluseHTTPProxy = new Label(wHTTPProxyGroup, SWT.RIGHT);
wluseHTTPProxy.setText(BaseMessages.getString(PKG, "JobSSH2GET.useHTTPProxyFiles.Label"));
props.setLook(wluseHTTPProxy);
fdluseHTTPProxy = new FormData();
fdluseHTTPProxy.left = new FormAttachment(0, 0);
fdluseHTTPProxy.top = new FormAttachment(wHost, margin);
fdluseHTTPProxy.right = new FormAttachment(middle, 0);
wluseHTTPProxy.setLayoutData(fdluseHTTPProxy);
wuseHTTPProxy = new Button(wHTTPProxyGroup, SWT.CHECK);
wuseHTTPProxy.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.useHTTPProxyFiles.Tooltip"));
props.setLook(wuseHTTPProxy);
fduseHTTPProxy = new FormData();
fduseHTTPProxy.left = new FormAttachment(middle, margin);
fduseHTTPProxy.top = new FormAttachment(wHost, margin);
fduseHTTPProxy.right = new FormAttachment(100, 0);
wuseHTTPProxy.setLayoutData(fduseHTTPProxy);
wuseHTTPProxy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeUseHttpProxy();
jobEntry.setChanged();
}
});
// ProxyHost line
wHTTPProxyHost = new LabelTextVar(jobMeta, wHTTPProxyGroup, BaseMessages.getString(PKG, "JobSSH2GET.ProxyHost.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Server.Tooltip"));
props.setLook(wHTTPProxyHost);
wHTTPProxyHost.addModifyListener(lsMod);
fdHTTPProxyHost = new FormData();
fdHTTPProxyHost.left = new FormAttachment(0, 0);
fdHTTPProxyHost.top = new FormAttachment(wuseHTTPProxy, margin);
fdHTTPProxyHost.right = new FormAttachment(100, 0);
wHTTPProxyHost.setLayoutData(fdHTTPProxyHost);
// ProxyPort line
wlHTTPProxyPort = new Label(wHTTPProxyGroup, SWT.RIGHT);
wlHTTPProxyPort.setText(BaseMessages.getString(PKG, "JobSSH2GET.ProxyPort.Label"));
props.setLook(wlHTTPProxyPort);
fdlProxyPort = new FormData();
fdlProxyPort.left = new FormAttachment(0, 0);
fdlProxyPort.top = new FormAttachment(wHTTPProxyHost, margin);
fdlProxyPort.right = new FormAttachment(middle, -margin);
wlHTTPProxyPort.setLayoutData(fdlProxyPort);
wHTTPProxyPort = new TextVar(jobMeta, wHTTPProxyGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wHTTPProxyPort);
wHTTPProxyPort.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.ProxyPort.Tooltip"));
wHTTPProxyPort.addModifyListener(lsMod);
fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(middle, margin);
fdProxyPort.top = new FormAttachment(wHTTPProxyHost, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wHTTPProxyPort.setLayoutData(fdProxyPort);
// useBasicAutentication
wluseBasicAuthentication = new Label(wHTTPProxyGroup, SWT.RIGHT);
wluseBasicAuthentication.setText(BaseMessages.getString(PKG, "JobSSH2GET.useBasicAuthentication.Label"));
props.setLook(wluseBasicAuthentication);
fdluseBasicAuthentication = new FormData();
fdluseBasicAuthentication.left = new FormAttachment(0, 0);
fdluseBasicAuthentication.top = new FormAttachment(wHTTPProxyPort, margin);
fdluseBasicAuthentication.right = new FormAttachment(middle, 0);
wluseBasicAuthentication.setLayoutData(fdluseBasicAuthentication);
wuseBasicAuthentication = new Button(wHTTPProxyGroup, SWT.CHECK);
wuseBasicAuthentication.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.useBasicAuthentication.Tooltip"));
props.setLook(wuseBasicAuthentication);
fduseBasicAuthentication = new FormData();
fduseBasicAuthentication.left = new FormAttachment(middle, margin);
fduseBasicAuthentication.top = new FormAttachment(wHTTPProxyPort, margin);
fduseBasicAuthentication.right = new FormAttachment(100, 0);
wuseBasicAuthentication.setLayoutData(fduseBasicAuthentication);
wuseBasicAuthentication.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeuseBasicAutentication();
jobEntry.setChanged();
}
});
// ProxyUsername line
wHTTPProxyUsername = new LabelTextVar(jobMeta, wHTTPProxyGroup, BaseMessages.getString(PKG, "JobSSH2GET.HttpProxyUsername.Label"), BaseMessages.getString(PKG, "JobSSH2GET.HttpProxyUsername.Tooltip"));
props.setLook(wHTTPProxyUsername);
wHTTPProxyUsername.addModifyListener(lsMod);
fdHTTPProxyUsername = new FormData();
fdHTTPProxyUsername.left = new FormAttachment(0, 0);
fdHTTPProxyUsername.top = new FormAttachment(wuseBasicAuthentication, margin);
fdHTTPProxyUsername.right = new FormAttachment(100, 0);
wHTTPProxyUsername.setLayoutData(fdHTTPProxyUsername);
// HttpProxyPassword line
wHTTPProxyPassword = new LabelTextVar(jobMeta, wHTTPProxyGroup, BaseMessages.getString(PKG, "JobSSH2GET.HttpProxyPassword.Label"), BaseMessages.getString(PKG, "JobSSH2GET.HttpProxyPassword.Tooltip"), true);
props.setLook(wHTTPProxyPassword);
wHTTPProxyPassword.addModifyListener(lsMod);
fdHTTPProxyPassword = new FormData();
fdHTTPProxyPassword.left = new FormAttachment(0, 0);
fdHTTPProxyPassword.top = new FormAttachment(wHTTPProxyUsername, margin);
fdHTTPProxyPassword.right = new FormAttachment(100, 0);
wHTTPProxyPassword.setLayoutData(fdHTTPProxyPassword);
fdHTTPProxyGroup = new FormData();
fdHTTPProxyGroup.left = new FormAttachment(0, margin);
fdHTTPProxyGroup.top = new FormAttachment(wHost, margin);
fdHTTPProxyGroup.right = new FormAttachment(100, -margin);
wHTTPProxyGroup.setLayoutData(fdHTTPProxyGroup);
// ///////////////////////////////////////////////////////////
// / END OF HTTPProxy GROUP
// /////////////////////////////////////////////////////////
// ////////////////////////
// START OF PublicKey GROUP
// ////////////////////////
wPublicKey = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wPublicKey);
wPublicKey.setText(BaseMessages.getString(PKG, "JobSSH2GET.Group.PublicKey.Label"));
FormLayout PublicKeyLayout = new FormLayout();
PublicKeyLayout.marginWidth = 10;
PublicKeyLayout.marginHeight = 10;
wPublicKey.setLayout(PublicKeyLayout);
// usePublicKey
wlusePublicKey = new Label(wPublicKey, SWT.RIGHT);
wlusePublicKey.setText(BaseMessages.getString(PKG, "JobSSH2GET.usePublicKeyFiles.Label"));
props.setLook(wlusePublicKey);
fdlusePublicKey = new FormData();
fdlusePublicKey.left = new FormAttachment(0, 0);
fdlusePublicKey.top = new FormAttachment(wHTTPProxyGroup, margin);
fdlusePublicKey.right = new FormAttachment(middle, 0);
wlusePublicKey.setLayoutData(fdlusePublicKey);
wusePublicKey = new Button(wPublicKey, SWT.CHECK);
wusePublicKey.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.usePublicKeyFiles.Tooltip"));
props.setLook(wusePublicKey);
fdusePublicKey = new FormData();
fdusePublicKey.left = new FormAttachment(middle, margin);
fdusePublicKey.top = new FormAttachment(wHTTPProxyGroup, margin);
fdusePublicKey.right = new FormAttachment(100, 0);
wusePublicKey.setLayoutData(fdusePublicKey);
wusePublicKey.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeUsePublicKey();
jobEntry.setChanged();
}
});
// Key File
wlKeyFilename = new Label(wPublicKey, SWT.RIGHT);
wlKeyFilename.setText(BaseMessages.getString(PKG, "JobSSH2GET.KeyFilename.Label"));
props.setLook(wlKeyFilename);
fdlKeyFilename = new FormData();
fdlKeyFilename.left = new FormAttachment(0, 0);
fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdlKeyFilename.right = new FormAttachment(middle, -margin);
wlKeyFilename.setLayoutData(fdlKeyFilename);
wbKeyFilename = new Button(wPublicKey, SWT.PUSH | SWT.CENTER);
props.setLook(wbKeyFilename);
wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbKeyFilename = new FormData();
fdbKeyFilename.right = new FormAttachment(100, 0);
fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
// fdbKeyFilename.height = 22;
wbKeyFilename.setLayoutData(fdbKeyFilename);
wKeyFilename = new TextVar(jobMeta, wPublicKey, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.KeyFilename.Tooltip"));
props.setLook(wKeyFilename);
wKeyFilename.addModifyListener(lsMod);
fdKeyFilename = new FormData();
fdKeyFilename.left = new FormAttachment(middle, margin);
fdKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
wKeyFilename.setLayoutData(fdKeyFilename);
// Whenever something changes, set the tooltip to the expanded version:
wKeyFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wKeyFilename.setToolTipText(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
});
wbKeyFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.pem", "*" });
if (wKeyFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// keyfilePass line
wkeyfilePass = new LabelTextVar(jobMeta, wPublicKey, BaseMessages.getString(PKG, "JobSSH2GET.keyfilePass.Label"), BaseMessages.getString(PKG, "JobSSH2GET.keyfilePass.Tooltip"), true);
props.setLook(wkeyfilePass);
wkeyfilePass.addModifyListener(lsMod);
fdkeyfilePass = new FormData();
fdkeyfilePass.left = new FormAttachment(0, 0);
fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
fdkeyfilePass.right = new FormAttachment(100, 0);
wkeyfilePass.setLayoutData(fdkeyfilePass);
fdPublicKey = new FormData();
fdPublicKey.left = new FormAttachment(0, margin);
fdPublicKey.top = new FormAttachment(wHTTPProxyGroup, margin);
fdPublicKey.right = new FormAttachment(100, -margin);
wPublicKey.setLayoutData(fdPublicKey);
// ///////////////////////////////////////////////////////////
// / END OF PublicKey GROUP
// /////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(500, -margin);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF FILES TAB ///
// ////////////////////////
wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "JobSSH2GET.Tab.Files.Label"));
wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout FilesTabLayout = new FormLayout();
FilesTabLayout.marginWidth = 3;
FilesTabLayout.marginHeight = 3;
wFilesComp.setLayout(FilesTabLayout);
// ////////////////////////
// START OF Files GROUP
// ////////////////////////
wFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wFiles);
wFiles.setText(BaseMessages.getString(PKG, "JobSSH2GET.Group.Files.Label"));
FormLayout FilesLayout = new FormLayout();
FilesLayout.marginWidth = 10;
FilesLayout.marginHeight = 10;
wFiles.setLayout(FilesLayout);
// FTP directory
wlFtpDirectory = new Label(wFiles, SWT.RIGHT);
wlFtpDirectory.setText(BaseMessages.getString(PKG, "JobSSH2GET.RemoteDir.Label"));
props.setLook(wlFtpDirectory);
fdlFtpDirectory = new FormData();
fdlFtpDirectory.left = new FormAttachment(0, 0);
fdlFtpDirectory.top = new FormAttachment(0, margin);
fdlFtpDirectory.right = new FormAttachment(middle, 0);
wlFtpDirectory.setLayoutData(fdlFtpDirectory);
// Test remote folder button ...
wbTestChangeFolderExists = new Button(wFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestChangeFolderExists);
wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobSSH2GET.TestFolderExists.Label"));
fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(0, margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
// FtpDirectory line
wFtpDirectory = new TextVar(jobMeta, wFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSSH2GET.RemoteDir.Label"));
props.setLook(wFtpDirectory);
wFtpDirectory.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.RemoteDir.Tooltip"));
wFtpDirectory.addModifyListener(lsMod);
fdFtpDirectory = new FormData();
fdFtpDirectory.left = new FormAttachment(middle, margin);
fdFtpDirectory.top = new FormAttachment(wWildcard, 2 * margin);
fdFtpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wFtpDirectory.setLayoutData(fdFtpDirectory);
// Whenever something changes, set the tooltip to the expanded version:
wFtpDirectory.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFtpDirectory.setToolTipText(jobMeta.environmentSubstitute(wFtpDirectory.getText()));
}
});
// includeSubFolders
wlincludeSubFolders = new Label(wFiles, SWT.RIGHT);
wlincludeSubFolders.setText(BaseMessages.getString(PKG, "JobSSH2GET.includeSubFolders.Label"));
props.setLook(wlincludeSubFolders);
fdlincludeSubFolders = new FormData();
fdlincludeSubFolders.left = new FormAttachment(0, 0);
fdlincludeSubFolders.top = new FormAttachment(wFtpDirectory, margin);
fdlincludeSubFolders.right = new FormAttachment(middle, 0);
wlincludeSubFolders.setLayoutData(fdlincludeSubFolders);
wincludeSubFolders = new Button(wFiles, SWT.CHECK);
wincludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.includeSubFolders.Tooltip"));
props.setLook(wincludeSubFolders);
fdincludeSubFolders = new FormData();
fdincludeSubFolders.left = new FormAttachment(middle, margin);
fdincludeSubFolders.top = new FormAttachment(wFtpDirectory, margin);
fdincludeSubFolders.right = new FormAttachment(100, 0);
wincludeSubFolders.setLayoutData(fdincludeSubFolders);
wincludeSubFolders.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeuseBasicAutentication();
}
});
// Wildcard line
wWildcard = new LabelTextVar(jobMeta, wFiles, BaseMessages.getString(PKG, "JobSSH2GET.Wildcard.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(0, 0);
fdWildcard.top = new FormAttachment(wincludeSubFolders, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
wlLocalDirectory = new Label(wFiles, SWT.RIGHT);
wlLocalDirectory.setText(BaseMessages.getString(PKG, "JobSSH2GET.TargetDir.Label"));
props.setLook(wlLocalDirectory);
fdlLocalDirectory = new FormData();
fdlLocalDirectory.left = new FormAttachment(0, 0);
fdlLocalDirectory.top = new FormAttachment(wWildcard, 2 * margin);
fdlLocalDirectory.right = new FormAttachment(middle, -margin);
wlLocalDirectory.setLayoutData(fdlLocalDirectory);
// Browse Local folders button ...
wbLocalDirectory = new Button(wFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbLocalDirectory);
wbLocalDirectory.setText(BaseMessages.getString(PKG, "JobSSH2GET.BrowseFolders.Label"));
fdbLocalDirectory = new FormData();
fdbLocalDirectory.right = new FormAttachment(100, -margin);
fdbLocalDirectory.top = new FormAttachment(wWildcard, margin);
wbLocalDirectory.setLayoutData(fdbLocalDirectory);
// LocalDirectory line
wLocalDirectory = new TextVar(jobMeta, wFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLocalDirectory);
wLocalDirectory.addModifyListener(lsMod);
fdLocalDirectory = new FormData();
fdLocalDirectory.left = new FormAttachment(middle, margin);
fdLocalDirectory.top = new FormAttachment(wWildcard, 2 * margin);
fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, 0);
wLocalDirectory.setLayoutData(fdLocalDirectory);
// Whenever something changes, set the tooltip to the expanded version:
wLocalDirectory.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wLocalDirectory.setToolTipText(jobMeta.environmentSubstitute(wLocalDirectory.getText()));
}
});
wbLocalDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wLocalDirectory.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wLocalDirectory.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
wLocalDirectory.setText(dir);
}
}
});
// createTargetFolder
wlcreateTargetFolder = new Label(wFiles, SWT.RIGHT);
wlcreateTargetFolder.setText(BaseMessages.getString(PKG, "JobSSH2GET.createTargetFolder.Label"));
props.setLook(wlcreateTargetFolder);
fdlcreateTargetFolder = new FormData();
fdlcreateTargetFolder.left = new FormAttachment(0, 0);
fdlcreateTargetFolder.top = new FormAttachment(wLocalDirectory, margin);
fdlcreateTargetFolder.right = new FormAttachment(middle, 0);
wlcreateTargetFolder.setLayoutData(fdlcreateTargetFolder);
wcreateTargetFolder = new Button(wFiles, SWT.CHECK);
wcreateTargetFolder.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.createTargetFolder.Tooltip"));
props.setLook(wcreateTargetFolder);
fdcreateTargetFolder = new FormData();
fdcreateTargetFolder.left = new FormAttachment(middle, margin);
fdcreateTargetFolder.top = new FormAttachment(wLocalDirectory, margin);
fdcreateTargetFolder.right = new FormAttachment(100, 0);
wcreateTargetFolder.setLayoutData(fdcreateTargetFolder);
wcreateTargetFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeuseBasicAutentication();
}
});
// OnlyNew files after retrieval...
wlOnlyNew = new Label(wFiles, SWT.RIGHT);
wlOnlyNew.setText(BaseMessages.getString(PKG, "JobSSH2GET.DontOverwrite.Label"));
props.setLook(wlOnlyNew);
fdlOnlyNew = new FormData();
fdlOnlyNew.left = new FormAttachment(0, 0);
fdlOnlyNew.top = new FormAttachment(wcreateTargetFolder, margin);
fdlOnlyNew.right = new FormAttachment(middle, 0);
wlOnlyNew.setLayoutData(fdlOnlyNew);
wOnlyNew = new Button(wFiles, SWT.CHECK);
wOnlyNew.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.DontOverwrite.Tooltip"));
props.setLook(wOnlyNew);
fdOnlyNew = new FormData();
fdOnlyNew.left = new FormAttachment(middle, margin);
fdOnlyNew.top = new FormAttachment(wcreateTargetFolder, margin);
fdOnlyNew.right = new FormAttachment(100, 0);
wOnlyNew.setLayoutData(fdOnlyNew);
// After FTP Put
wlAfterFTPPut = new Label(wFiles, SWT.RIGHT);
wlAfterFTPPut.setText(BaseMessages.getString(PKG, "JobSSH2GET.AfterFTPPut.Label"));
props.setLook(wlAfterFTPPut);
fdlAfterFTPPut = new FormData();
fdlAfterFTPPut.left = new FormAttachment(0, 0);
fdlAfterFTPPut.right = new FormAttachment(middle, 0);
fdlAfterFTPPut.top = new FormAttachment(wOnlyNew, 2 * margin);
wlAfterFTPPut.setLayoutData(fdlAfterFTPPut);
wAfterFTPPut = new CCombo(wFiles, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSSH2GET.Do_Nothing_AfterFTPPut.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSSH2GET.Delete_Files_AfterFTPPut.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSSH2GET.Move_Files_AfterFTPPut.Label"));
// +1: starts at -1
wAfterFTPPut.select(0);
props.setLook(wAfterFTPPut);
fdAfterFTPPut = new FormData();
fdAfterFTPPut.left = new FormAttachment(middle, margin);
fdAfterFTPPut.top = new FormAttachment(wOnlyNew, 2 * margin);
fdAfterFTPPut.right = new FormAttachment(100, 0);
wAfterFTPPut.setLayoutData(fdAfterFTPPut);
wAfterFTPPut.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
AfterFTPPutActivate();
}
});
// moveTo Directory
wlDestinationFolder = new Label(wFiles, SWT.RIGHT);
wlDestinationFolder.setText(BaseMessages.getString(PKG, "JobSSH2GET.DestinationFolder.Label"));
props.setLook(wlDestinationFolder);
fdlDestinationFolder = new FormData();
fdlDestinationFolder.left = new FormAttachment(0, 0);
fdlDestinationFolder.top = new FormAttachment(wAfterFTPPut, margin);
fdlDestinationFolder.right = new FormAttachment(middle, -margin);
wlDestinationFolder.setLayoutData(fdlDestinationFolder);
wDestinationFolder = new TextVar(jobMeta, wFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSSH2GET.DestinationFolder.Tooltip"));
props.setLook(wDestinationFolder);
wDestinationFolder.addModifyListener(lsMod);
fdDestinationFolder = new FormData();
fdDestinationFolder.left = new FormAttachment(middle, margin);
fdDestinationFolder.top = new FormAttachment(wAfterFTPPut, margin);
fdDestinationFolder.right = new FormAttachment(100, -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()));
}
});
// Create destination folder if necessary ...
wlCreateDestinationFolder = new Label(wFiles, SWT.RIGHT);
wlCreateDestinationFolder.setText(BaseMessages.getString(PKG, "JobSSH2GET.CreateDestinationFolder.Label"));
props.setLook(wlCreateDestinationFolder);
fdlCreateDestinationFolder = new FormData();
fdlCreateDestinationFolder.left = new FormAttachment(0, 0);
fdlCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
fdlCreateDestinationFolder.right = new FormAttachment(middle, 0);
wlCreateDestinationFolder.setLayoutData(fdlCreateDestinationFolder);
wCreateDestinationFolder = new Button(wFiles, SWT.CHECK);
wCreateDestinationFolder.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.CreateDestinationFolder.Tooltip"));
props.setLook(wCreateDestinationFolder);
fdCreateDestinationFolder = new FormData();
fdCreateDestinationFolder.left = new FormAttachment(middle, margin);
fdCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
fdCreateDestinationFolder.right = new FormAttachment(100, 0);
wCreateDestinationFolder.setLayoutData(fdCreateDestinationFolder);
fdFiles = new FormData();
fdFiles.left = new FormAttachment(0, margin);
fdFiles.top = new FormAttachment(0, margin);
fdFiles.right = new FormAttachment(100, -margin);
wFiles.setLayoutData(fdFiles);
// ///////////////////////////////////////////////////////////
// / END OF Files GROUP
// /////////////////////////////////////////////////////////
fdFilesComp = new FormData();
fdFilesComp.left = new FormAttachment(0, 0);
fdFilesComp.top = new FormAttachment(0, 0);
fdFilesComp.right = new FormAttachment(100, 0);
fdFilesComp.bottom = new FormAttachment(500, -margin);
wFilesComp.setLayoutData(fdFilesComp);
// ///////////////////////////////////////////////////////////
// / END OF FILES TAB
// ///////////////////////////////////////////////////////////
wFilesComp.layout();
wFilesTab.setControl(wFilesComp);
props.setLook(wFilesComp);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsCheckFolder = new Listener() {
public void handleEvent(Event e) {
checkFTPFolder();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckFolder);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wLocalDirectory.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wWildcard.addSelectionListener(lsDef);
// wTimeout.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activeUseHttpProxy();
AfterFTPPutActivate();
activeUsePublicKey();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobFTPDialogSize");
wTabFolder.setSelection(0);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class SalesforceDeleteDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
ModifyListener lsTableMod = new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF FILE TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.General.Tab"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ///////////////////////////////
// START OF Connection GROUP //
// ///////////////////////////////
wConnectionGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wConnectionGroup);
wConnectionGroup.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.ConnectionGroup.Label"));
FormLayout connectionGroupLayout = new FormLayout();
connectionGroupLayout.marginWidth = 10;
connectionGroupLayout.marginHeight = 10;
wConnectionGroup.setLayout(connectionGroupLayout);
// Webservice URL
wURL = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceDeleteDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceDeleteDialog.URL.Tooltip"));
props.setLook(wURL);
wURL.addModifyListener(lsMod);
fdURL = new FormData();
fdURL.left = new FormAttachment(0, 0);
fdURL.top = new FormAttachment(wStepname, margin);
fdURL.right = new FormAttachment(100, 0);
wURL.setLayoutData(fdURL);
// UserName line
wUserName = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceDeleteDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceDeleteDialog.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wURL, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceDeleteDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceDeleteDialog.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Test Salesforce connection button
wTest = new Button(wConnectionGroup, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wPassword, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdConnectionGroup = new FormData();
fdConnectionGroup.left = new FormAttachment(0, margin);
fdConnectionGroup.top = new FormAttachment(wStepname, margin);
fdConnectionGroup.right = new FormAttachment(100, -margin);
wConnectionGroup.setLayoutData(fdConnectionGroup);
// ///////////////////////////////
// END OF Connection GROUP //
// ///////////////////////////////
// ///////////////////////////////
// START OF Settings GROUP //
// ///////////////////////////////
wSettingsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSettingsGroup);
wSettingsGroup.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.SettingsGroup.Label"));
FormLayout settingGroupLayout = new FormLayout();
settingGroupLayout.marginWidth = 10;
settingGroupLayout.marginHeight = 10;
wSettingsGroup.setLayout(settingGroupLayout);
// Timeout
wlTimeOut = new Label(wSettingsGroup, SWT.RIGHT);
wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.TimeOut.Label"));
props.setLook(wlTimeOut);
fdlTimeOut = new FormData();
fdlTimeOut.left = new FormAttachment(0, 0);
fdlTimeOut.top = new FormAttachment(wSettingsGroup, margin);
fdlTimeOut.right = new FormAttachment(middle, -margin);
wlTimeOut.setLayoutData(fdlTimeOut);
wTimeOut = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTimeOut);
wTimeOut.addModifyListener(lsMod);
fdTimeOut = new FormData();
fdTimeOut.left = new FormAttachment(middle, 0);
fdTimeOut.top = new FormAttachment(wSettingsGroup, margin);
fdTimeOut.right = new FormAttachment(100, 0);
wTimeOut.setLayoutData(fdTimeOut);
// Use compression?
wlUseCompression = new Label(wSettingsGroup, SWT.RIGHT);
wlUseCompression.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.UseCompression.Label"));
props.setLook(wlUseCompression);
fdlUseCompression = new FormData();
fdlUseCompression.left = new FormAttachment(0, 0);
fdlUseCompression.top = new FormAttachment(wTimeOut, margin);
fdlUseCompression.right = new FormAttachment(middle, -margin);
wlUseCompression.setLayoutData(fdlUseCompression);
wUseCompression = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wUseCompression);
wUseCompression.setToolTipText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.UseCompression.Tooltip"));
fdUseCompression = new FormData();
fdUseCompression.left = new FormAttachment(middle, 0);
fdUseCompression.top = new FormAttachment(wTimeOut, margin);
wUseCompression.setLayoutData(fdUseCompression);
wUseCompression.addSelectionListener(new ComponentSelectionListener(input));
// Rollback all changes on error?
wlRollbackAllChangesOnError = new Label(wSettingsGroup, SWT.RIGHT);
wlRollbackAllChangesOnError.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.RollbackAllChangesOnError.Label"));
props.setLook(wlRollbackAllChangesOnError);
fdlRollbackAllChangesOnError = new FormData();
fdlRollbackAllChangesOnError.left = new FormAttachment(0, 0);
fdlRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
fdlRollbackAllChangesOnError.right = new FormAttachment(middle, -margin);
wlRollbackAllChangesOnError.setLayoutData(fdlRollbackAllChangesOnError);
wRollbackAllChangesOnError = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wRollbackAllChangesOnError);
wRollbackAllChangesOnError.setToolTipText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.RollbackAllChangesOnError.Tooltip"));
fdRollbackAllChangesOnError = new FormData();
fdRollbackAllChangesOnError.left = new FormAttachment(middle, 0);
fdRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
wRollbackAllChangesOnError.setLayoutData(fdRollbackAllChangesOnError);
wRollbackAllChangesOnError.addSelectionListener(new ComponentSelectionListener(input));
// BatchSize value
wlBatchSize = new Label(wSettingsGroup, SWT.RIGHT);
wlBatchSize.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.Limit.Label"));
props.setLook(wlBatchSize);
fdlBatchSize = new FormData();
fdlBatchSize.left = new FormAttachment(0, 0);
fdlBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
fdlBatchSize.right = new FormAttachment(middle, -margin);
wlBatchSize.setLayoutData(fdlBatchSize);
wBatchSize = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBatchSize);
wBatchSize.addModifyListener(lsMod);
fdBatchSize = new FormData();
fdBatchSize.left = new FormAttachment(middle, 0);
fdBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
fdBatchSize.right = new FormAttachment(100, 0);
wBatchSize.setLayoutData(fdBatchSize);
// Module
wlModule = new Label(wSettingsGroup, SWT.RIGHT);
wlModule.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.Module.Label"));
props.setLook(wlModule);
fdlModule = new FormData();
fdlModule.left = new FormAttachment(0, 0);
fdlModule.top = new FormAttachment(wBatchSize, margin);
fdlModule.right = new FormAttachment(middle, -margin);
wlModule.setLayoutData(fdlModule);
wModule = new ComboVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wModule.setEditable(true);
props.setLook(wModule);
wModule.addModifyListener(lsTableMod);
fdModule = new FormData();
fdModule.left = new FormAttachment(middle, 0);
fdModule.top = new FormAttachment(wBatchSize, margin);
fdModule.right = new FormAttachment(100, -margin);
wModule.setLayoutData(fdModule);
wModule.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
getModulesListError = false;
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
// check if the URL and login credentials passed and not just had error
if (Utils.isEmpty(wURL.getText()) || Utils.isEmpty(wUserName.getText()) || Utils.isEmpty(wPassword.getText()) || (getModulesListError)) {
return;
}
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
getModulesList();
shell.setCursor(null);
busy.dispose();
}
});
// Salesforce Id Field
wlDeleteField = new Label(wSettingsGroup, SWT.RIGHT);
wlDeleteField.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.KeyField.Label"));
props.setLook(wlDeleteField);
fdlDeleteField = new FormData();
fdlDeleteField.left = new FormAttachment(0, 0);
fdlDeleteField.top = new FormAttachment(wModule, margin);
fdlDeleteField.right = new FormAttachment(middle, -margin);
wlDeleteField.setLayoutData(fdlDeleteField);
wDeleteField = new ComboVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wDeleteField.setEditable(true);
props.setLook(wDeleteField);
wDeleteField.addModifyListener(lsMod);
fdDeleteField = new FormData();
fdDeleteField.left = new FormAttachment(middle, 0);
fdDeleteField.top = new FormAttachment(wModule, margin);
fdDeleteField.right = new FormAttachment(100, -margin);
wDeleteField.setLayoutData(fdDeleteField);
wDeleteField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
getPreviousFields();
}
});
fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, margin);
fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin);
fdSettingsGroup.right = new FormAttachment(100, -margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// ///////////////////////////////
// END OF Settings GROUP //
// ///////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wStepname, margin);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, null);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOK, -margin);
wTabFolder.setLayoutData(fdTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData(input);
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class JobEntrySendNagiosPassiveCheckDialog 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, "JobSendNagiosPassiveCheck.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Name.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, PropsUI.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ServerSettings.General"));
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, "JobSendNagiosPassiveCheck.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Server.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Server port line
wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Port.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(wServerName, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// Password String line
wPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Password.Label"), BaseMessages.getString("JobSendNagiosPassiveCheck.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wPort, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Server wConnectionTimeOut line
wConnectionTimeOut = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ConnectionTimeOut.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ConnectionTimeOut.Tooltip"));
props.setLook(wConnectionTimeOut);
wConnectionTimeOut.addModifyListener(lsMod);
fdwConnectionTimeOut = new FormData();
fdwConnectionTimeOut.left = new FormAttachment(0, 0);
fdwConnectionTimeOut.top = new FormAttachment(wPassword, margin);
fdwConnectionTimeOut.right = new FormAttachment(100, 0);
wConnectionTimeOut.setLayoutData(fdwConnectionTimeOut);
// ResponseTimeOut line
wResponseTimeOut = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ResponseTimeOut.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ResponseTimeOut.Tooltip"));
props.setLook(wResponseTimeOut);
wResponseTimeOut.addModifyListener(lsMod);
fdResponseTimeOut = new FormData();
fdResponseTimeOut.left = new FormAttachment(0, 0);
fdResponseTimeOut.top = new FormAttachment(wConnectionTimeOut, margin);
fdResponseTimeOut.right = new FormAttachment(100, 0);
wResponseTimeOut.setLayoutData(fdResponseTimeOut);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wResponseTimeOut, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wName, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Advanced SETTINGS GROUP///
// /
wSenderSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSenderSettings);
wSenderSettings.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderSettings.Group.Label"));
FormLayout SenderSettingsgroupLayout = new FormLayout();
SenderSettingsgroupLayout.marginWidth = 10;
SenderSettingsgroupLayout.marginHeight = 10;
wSenderSettings.setLayout(SenderSettingsgroupLayout);
// SenderServerName line
wSenderServerName = new LabelTextVar(jobMeta, wSenderSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServerName.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServerName.Tooltip"));
props.setLook(wSenderServerName);
wSenderServerName.addModifyListener(lsMod);
fdSenderServerName = new FormData();
fdSenderServerName.left = new FormAttachment(0, 0);
fdSenderServerName.top = new FormAttachment(wServerSettings, margin);
fdSenderServerName.right = new FormAttachment(100, 0);
wSenderServerName.setLayoutData(fdSenderServerName);
// SenderServiceName line
wSenderServiceName = new LabelTextVar(jobMeta, wSenderSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServiceName.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServiceName.Tooltip"));
props.setLook(wSenderServiceName);
wSenderServiceName.addModifyListener(lsMod);
fdSenderServiceName = new FormData();
fdSenderServiceName.left = new FormAttachment(0, 0);
fdSenderServiceName.top = new FormAttachment(wSenderServerName, margin);
fdSenderServiceName.right = new FormAttachment(100, 0);
wSenderServiceName.setLayoutData(fdSenderServiceName);
// Encryption mode
wlEncryptionMode = new Label(wSenderSettings, SWT.RIGHT);
wlEncryptionMode.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.EncryptionMode.Label"));
props.setLook(wlEncryptionMode);
fdlEncryptionMode = new FormData();
fdlEncryptionMode.left = new FormAttachment(0, margin);
fdlEncryptionMode.right = new FormAttachment(middle, -margin);
fdlEncryptionMode.top = new FormAttachment(wSenderServiceName, margin);
wlEncryptionMode.setLayoutData(fdlEncryptionMode);
wEncryptionMode = new CCombo(wSenderSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wEncryptionMode.setItems(JobEntrySendNagiosPassiveCheck.encryption_mode_Desc);
props.setLook(wEncryptionMode);
fdEncryptionMode = new FormData();
fdEncryptionMode.left = new FormAttachment(middle, margin);
fdEncryptionMode.top = new FormAttachment(wSenderServiceName, margin);
fdEncryptionMode.right = new FormAttachment(100, 0);
wEncryptionMode.setLayoutData(fdEncryptionMode);
wEncryptionMode.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Level mode
wlLevelMode = new Label(wSenderSettings, SWT.RIGHT);
wlLevelMode.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.LevelMode.Label"));
props.setLook(wlLevelMode);
fdlLevelMode = new FormData();
fdlLevelMode.left = new FormAttachment(0, margin);
fdlLevelMode.right = new FormAttachment(middle, -margin);
fdlLevelMode.top = new FormAttachment(wEncryptionMode, margin);
wlLevelMode.setLayoutData(fdlLevelMode);
wLevelMode = new CCombo(wSenderSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wLevelMode.setItems(JobEntrySendNagiosPassiveCheck.level_type_Desc);
props.setLook(wLevelMode);
fdLevelMode = new FormData();
fdLevelMode.left = new FormAttachment(middle, margin);
fdLevelMode.top = new FormAttachment(wEncryptionMode, margin);
fdLevelMode.right = new FormAttachment(100, 0);
wLevelMode.setLayoutData(fdLevelMode);
wLevelMode.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
fdSenderSettings = new FormData();
fdSenderSettings.left = new FormAttachment(0, margin);
fdSenderSettings.top = new FormAttachment(wServerSettings, margin);
fdSenderSettings.right = new FormAttachment(100, -margin);
wSenderSettings.setLayoutData(fdSenderSettings);
// ///////////////////////////////////////////////////////////
// / END OF Advanced SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF MESSAGE GROUP///
// /
wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wMessageGroup);
wMessageGroup.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.MessageGroup.Group.Label"));
FormLayout MessageGroupgroupLayout = new FormLayout();
MessageGroupgroupLayout.marginWidth = 10;
MessageGroupgroupLayout.marginHeight = 10;
wMessageGroup.setLayout(MessageGroupgroupLayout);
// Message line
wlMessage = new Label(wMessageGroup, SWT.RIGHT);
wlMessage.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Message.Label"));
props.setLook(wlMessage);
fdlMessage = new FormData();
fdlMessage.left = new FormAttachment(0, 0);
fdlMessage.top = new FormAttachment(wSenderSettings, margin);
fdlMessage.right = new FormAttachment(middle, -margin);
wlMessage.setLayoutData(fdlMessage);
wMessage = new StyledTextComp(jobMeta, wMessageGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wMessage);
wMessage.addModifyListener(lsMod);
fdMessage = new FormData();
fdMessage.left = new FormAttachment(middle, 0);
fdMessage.top = new FormAttachment(wSenderSettings, margin);
fdMessage.right = new FormAttachment(100, -2 * margin);
fdMessage.bottom = new FormAttachment(100, -margin);
wMessage.setLayoutData(fdMessage);
fdMessageGroup = new FormData();
fdMessageGroup.left = new FormAttachment(0, margin);
fdMessageGroup.top = new FormAttachment(wSenderSettings, margin);
fdMessageGroup.right = new FormAttachment(100, -margin);
fdMessageGroup.bottom = new FormAttachment(100, -margin);
wMessageGroup.setLayoutData(fdMessageGroup);
// ///////////////////////////////////////////////////////////
// / END OF MESSAGE GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wResponseTimeOut.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobSendNagiosPassiveCheckDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class JobEntryMailDialog 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();
backupDate = jobEntry.getIncludeDate();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobMail.Header"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobMail.NameOfEntry.Label"), BaseMessages.getString(PKG, "JobMail.NameOfEntry.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobMail.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 Destination Settings GROUP
// ////////////////////////
wDestinationGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wDestinationGroup);
wDestinationGroup.setText(BaseMessages.getString(PKG, "JobMail.Group.DestinationAddress.Label"));
FormLayout destinationgroupLayout = new FormLayout();
destinationgroupLayout.marginWidth = 10;
destinationgroupLayout.marginHeight = 10;
wDestinationGroup.setLayout(destinationgroupLayout);
// Destination line
wDestination = new LabelTextVar(jobMeta, wDestinationGroup, BaseMessages.getString(PKG, "JobMail.DestinationAddress.Label"), BaseMessages.getString(PKG, "JobMail.DestinationAddress.Tooltip"));
wDestination.addModifyListener(lsMod);
fdDestination = new FormData();
fdDestination.left = new FormAttachment(0, 0);
fdDestination.top = new FormAttachment(wName, margin);
fdDestination.right = new FormAttachment(100, 0);
wDestination.setLayoutData(fdDestination);
// Destination Cc
wDestinationCc = new LabelTextVar(jobMeta, wDestinationGroup, BaseMessages.getString(PKG, "JobMail.DestinationAddressCc.Label"), BaseMessages.getString(PKG, "JobMail.DestinationAddressCc.Tooltip"));
wDestinationCc.addModifyListener(lsMod);
fdDestinationCc = new FormData();
fdDestinationCc.left = new FormAttachment(0, 0);
fdDestinationCc.top = new FormAttachment(wDestination, margin);
fdDestinationCc.right = new FormAttachment(100, 0);
wDestinationCc.setLayoutData(fdDestinationCc);
// Destination BCc
wDestinationBCc = new LabelTextVar(jobMeta, wDestinationGroup, BaseMessages.getString(PKG, "JobMail.DestinationAddressBCc.Label"), BaseMessages.getString(PKG, "JobMail.DestinationAddressBCc.Tooltip"));
wDestinationBCc.addModifyListener(lsMod);
fdDestinationBCc = new FormData();
fdDestinationBCc.left = new FormAttachment(0, 0);
fdDestinationBCc.top = new FormAttachment(wDestinationCc, margin);
fdDestinationBCc.right = new FormAttachment(100, 0);
wDestinationBCc.setLayoutData(fdDestinationBCc);
FormData fdDestinationGroup = new FormData();
fdDestinationGroup.left = new FormAttachment(0, margin);
fdDestinationGroup.top = new FormAttachment(wName, margin);
fdDestinationGroup.right = new FormAttachment(100, -margin);
wDestinationGroup.setLayoutData(fdDestinationGroup);
// ///////////////////////////////////////////////////////////
// / END OF DESTINATION ADDRESS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Reply Settings GROUP
// ////////////////////////
wReplyGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wReplyGroup);
wReplyGroup.setText(BaseMessages.getString(PKG, "JobMail.Group.Reply.Label"));
FormLayout replygroupLayout = new FormLayout();
replygroupLayout.marginWidth = 10;
replygroupLayout.marginHeight = 10;
wReplyGroup.setLayout(replygroupLayout);
// Reply name
wReplyName = new LabelTextVar(jobMeta, wReplyGroup, BaseMessages.getString(PKG, "JobMail.ReplyName.Label"), BaseMessages.getString(PKG, "JobMail.ReplyName.Tooltip"));
wReplyName.addModifyListener(lsMod);
fdReplyName = new FormData();
fdReplyName.left = new FormAttachment(0, 0);
fdReplyName.top = new FormAttachment(wDestinationGroup, 2 * margin);
fdReplyName.right = new FormAttachment(100, 0);
wReplyName.setLayoutData(fdReplyName);
// Reply line
wReply = new LabelTextVar(jobMeta, wReplyGroup, BaseMessages.getString(PKG, "JobMail.ReplyAddress.Label"), BaseMessages.getString(PKG, "JobMail.ReplyAddress.Tooltip"));
wReply.addModifyListener(lsMod);
fdReply = new FormData();
fdReply.left = new FormAttachment(0, 0);
fdReply.top = new FormAttachment(wReplyName, margin);
fdReply.right = new FormAttachment(100, 0);
wReply.setLayoutData(fdReply);
FormData fdReplyGroup = new FormData();
fdReplyGroup.left = new FormAttachment(0, margin);
fdReplyGroup.top = new FormAttachment(wDestinationGroup, margin);
fdReplyGroup.right = new FormAttachment(100, -margin);
wReplyGroup.setLayoutData(fdReplyGroup);
// ///////////////////////////////////////////////////////////
// / END OF Replay GROUP
// ///////////////////////////////////////////////////////////
// Reply to
wReplyToAddress = new LabelTextVar(jobMeta, wGeneralComp, BaseMessages.getString(PKG, "JobMail.ReplyToAddress.Label"), BaseMessages.getString(PKG, "JobMail.ReplyToAddress.Tooltip"));
wReplyToAddress.addModifyListener(lsMod);
fdReplyToAddress = new FormData();
fdReplyToAddress.left = new FormAttachment(0, 0);
fdReplyToAddress.top = new FormAttachment(wReplyGroup, 2 * margin);
fdReplyToAddress.right = new FormAttachment(100, 0);
wReplyToAddress.setLayoutData(fdReplyToAddress);
// Contact line
wPerson = new LabelTextVar(jobMeta, wGeneralComp, BaseMessages.getString(PKG, "JobMail.ContactPerson.Label"), BaseMessages.getString(PKG, "JobMail.ContactPerson.Tooltip"));
wPerson.addModifyListener(lsMod);
fdPerson = new FormData();
fdPerson.left = new FormAttachment(0, 0);
fdPerson.top = new FormAttachment(wReplyToAddress, 2 * margin);
fdPerson.right = new FormAttachment(100, 0);
wPerson.setLayoutData(fdPerson);
// Phone line
wPhone = new LabelTextVar(jobMeta, wGeneralComp, BaseMessages.getString(PKG, "JobMail.ContactPhone.Label"), BaseMessages.getString(PKG, "JobMail.ContactPhone.Tooltip"));
wPhone.addModifyListener(lsMod);
fdPhone = new FormData();
fdPhone.left = new FormAttachment(0, 0);
fdPhone.top = new FormAttachment(wPerson, margin);
fdPhone.right = new FormAttachment(100, 0);
wPhone.setLayoutData(fdPhone);
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 SERVER TAB ///
// ///////////////////////////////////
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "JobMailDialog.Server.Label"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// ////////////////////////
// START OF SERVER GROUP
// /////////////////////////
wServerGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wServerGroup);
wServerGroup.setText(BaseMessages.getString(PKG, "JobMail.Group.SMTPServer.Label"));
FormLayout servergroupLayout = new FormLayout();
servergroupLayout.marginWidth = 10;
servergroupLayout.marginHeight = 10;
wServerGroup.setLayout(servergroupLayout);
// Server line
wServer = new LabelTextVar(jobMeta, wServerGroup, BaseMessages.getString(PKG, "JobMail.SMTPServer.Label"), BaseMessages.getString(PKG, "JobMail.SMTPServer.Tooltip"));
wServer.addModifyListener(lsMod);
fdServer = new FormData();
fdServer.left = new FormAttachment(0, 0);
fdServer.top = new FormAttachment(0, margin);
fdServer.right = new FormAttachment(100, 0);
wServer.setLayoutData(fdServer);
// Port line
wPort = new LabelTextVar(jobMeta, wServerGroup, BaseMessages.getString(PKG, "JobMail.Port.Label"), BaseMessages.getString(PKG, "JobMail.Port.Tooltip"));
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(wServer, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
FormData fdServerGroup = new FormData();
fdServerGroup.left = new FormAttachment(0, margin);
fdServerGroup.top = new FormAttachment(wName, margin);
fdServerGroup.right = new FormAttachment(100, -margin);
wServerGroup.setLayoutData(fdServerGroup);
// //////////////////////////////////////
// / END OF SERVER ADDRESS GROUP
// ///////////////////////////////////////
// ////////////////////////////////////
// START OF AUTHENTIFICATION GROUP
// ////////////////////////////////////
wAuthentificationGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wAuthentificationGroup);
wAuthentificationGroup.setText(BaseMessages.getString(PKG, "JobMail.Group.Authentification.Label"));
FormLayout authentificationgroupLayout = new FormLayout();
authentificationgroupLayout.marginWidth = 10;
authentificationgroupLayout.marginHeight = 10;
wAuthentificationGroup.setLayout(authentificationgroupLayout);
// Authentication?
wlUseAuth = new Label(wAuthentificationGroup, SWT.RIGHT);
wlUseAuth.setText(BaseMessages.getString(PKG, "JobMail.UseAuthentication.Label"));
props.setLook(wlUseAuth);
fdlUseAuth = new FormData();
fdlUseAuth.left = new FormAttachment(0, 0);
fdlUseAuth.top = new FormAttachment(wServerGroup, 2 * margin);
fdlUseAuth.right = new FormAttachment(middle, -margin);
wlUseAuth.setLayoutData(fdlUseAuth);
wUseAuth = new Button(wAuthentificationGroup, SWT.CHECK);
props.setLook(wUseAuth);
fdUseAuth = new FormData();
fdUseAuth.left = new FormAttachment(middle, margin);
fdUseAuth.top = new FormAttachment(wServerGroup, 2 * margin);
fdUseAuth.right = new FormAttachment(100, 0);
wUseAuth.setLayoutData(fdUseAuth);
wUseAuth.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setUseAuth();
jobEntry.setChanged();
}
});
// AuthUser line
wAuthUser = new LabelTextVar(jobMeta, wAuthentificationGroup, BaseMessages.getString(PKG, "JobMail.AuthenticationUser.Label"), BaseMessages.getString(PKG, "JobMail.AuthenticationUser.Tooltip"));
wAuthUser.addModifyListener(lsMod);
fdAuthUser = new FormData();
fdAuthUser.left = new FormAttachment(0, 0);
fdAuthUser.top = new FormAttachment(wUseAuth, margin);
fdAuthUser.right = new FormAttachment(100, 0);
wAuthUser.setLayoutData(fdAuthUser);
// AuthPass line
wAuthPass = new LabelTextVar(jobMeta, wAuthentificationGroup, BaseMessages.getString(PKG, "JobMail.AuthenticationPassword.Label"), BaseMessages.getString(PKG, "JobMail.AuthenticationPassword.Tooltip"), true);
wAuthPass.addModifyListener(lsMod);
fdAuthPass = new FormData();
fdAuthPass.left = new FormAttachment(0, 0);
fdAuthPass.top = new FormAttachment(wAuthUser, margin);
fdAuthPass.right = new FormAttachment(100, 0);
wAuthPass.setLayoutData(fdAuthPass);
// Use secure authentication?
wlUseSecAuth = new Label(wAuthentificationGroup, SWT.RIGHT);
wlUseSecAuth.setText(BaseMessages.getString(PKG, "JobMail.UseSecAuthentication.Label"));
props.setLook(wlUseSecAuth);
fdlUseSecAuth = new FormData();
fdlUseSecAuth.left = new FormAttachment(0, 0);
fdlUseSecAuth.top = new FormAttachment(wAuthPass, 2 * margin);
fdlUseSecAuth.right = new FormAttachment(middle, -margin);
wlUseSecAuth.setLayoutData(fdlUseSecAuth);
wUseSecAuth = new Button(wAuthentificationGroup, SWT.CHECK);
props.setLook(wUseSecAuth);
fdUseSecAuth = new FormData();
fdUseSecAuth.left = new FormAttachment(middle, margin);
fdUseSecAuth.top = new FormAttachment(wAuthPass, 2 * margin);
fdUseSecAuth.right = new FormAttachment(100, 0);
wUseSecAuth.setLayoutData(fdUseSecAuth);
wUseSecAuth.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setSecureConnectiontype();
jobEntry.setChanged();
}
});
// SecureConnectionType
wlSecureConnectionType = new Label(wAuthentificationGroup, SWT.RIGHT);
wlSecureConnectionType.setText(BaseMessages.getString(PKG, "JobMail.SecureConnectionType.Label"));
props.setLook(wlSecureConnectionType);
fdlSecureConnectionType = new FormData();
fdlSecureConnectionType.left = new FormAttachment(0, 0);
fdlSecureConnectionType.top = new FormAttachment(wUseSecAuth, margin);
fdlSecureConnectionType.right = new FormAttachment(middle, -margin);
wlSecureConnectionType.setLayoutData(fdlSecureConnectionType);
wSecureConnectionType = new CCombo(wAuthentificationGroup, SWT.BORDER | SWT.READ_ONLY);
wSecureConnectionType.setEditable(true);
props.setLook(wSecureConnectionType);
wSecureConnectionType.addModifyListener(lsMod);
fdSecureConnectionType = new FormData();
fdSecureConnectionType.left = new FormAttachment(middle, margin);
fdSecureConnectionType.top = new FormAttachment(wUseSecAuth, margin);
fdSecureConnectionType.right = new FormAttachment(100, 0);
wSecureConnectionType.setLayoutData(fdSecureConnectionType);
wSecureConnectionType.add("SSL");
wSecureConnectionType.add("TLS");
wSecureConnectionType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setSecureConnectiontype();
jobEntry.setChanged();
}
});
FormData fdAuthentificationGroup = new FormData();
fdAuthentificationGroup.left = new FormAttachment(0, margin);
fdAuthentificationGroup.top = new FormAttachment(wServerGroup, margin);
fdAuthentificationGroup.right = new FormAttachment(100, -margin);
fdAuthentificationGroup.bottom = new FormAttachment(100, -margin);
wAuthentificationGroup.setLayoutData(fdAuthentificationGroup);
// //////////////////////////////////////
// / END OF AUTHENTIFICATION GROUP
// ///////////////////////////////////////
fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(wContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF SERVER TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////////////////
// START OF MESSAGE TAB ///
// ///////////////////////////////////
wMessageTab = new CTabItem(wTabFolder, SWT.NONE);
wMessageTab.setText(BaseMessages.getString(PKG, "JobMail.Tab.Message.Label"));
FormLayout messageLayout = new FormLayout();
messageLayout.marginWidth = 3;
messageLayout.marginHeight = 3;
wMessageComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wMessageComp);
wMessageComp.setLayout(contentLayout);
// ////////////////////////////////////
// START OF MESSAGE SETTINGS GROUP
// ////////////////////////////////////
wMessageSettingsGroup = new Group(wMessageComp, SWT.SHADOW_NONE);
props.setLook(wMessageSettingsGroup);
wMessageSettingsGroup.setText(BaseMessages.getString(PKG, "JobMail.Group.MessageSettings.Label"));
FormLayout messagesettingsgroupLayout = new FormLayout();
messagesettingsgroupLayout.marginWidth = 10;
messagesettingsgroupLayout.marginHeight = 10;
wMessageSettingsGroup.setLayout(messagesettingsgroupLayout);
// Add date to logfile name?
wlAddDate = new Label(wMessageSettingsGroup, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "JobMail.IncludeDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(0, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(wMessageSettingsGroup, SWT.CHECK);
props.setLook(wAddDate);
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, margin);
fdAddDate.top = new FormAttachment(0, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Only send the comment in the mail body
wlOnlyComment = new Label(wMessageSettingsGroup, SWT.RIGHT);
wlOnlyComment.setText(BaseMessages.getString(PKG, "JobMail.OnlyCommentInBody.Label"));
props.setLook(wlOnlyComment);
fdlOnlyComment = new FormData();
fdlOnlyComment.left = new FormAttachment(0, 0);
fdlOnlyComment.top = new FormAttachment(wAddDate, margin);
fdlOnlyComment.right = new FormAttachment(middle, -margin);
wlOnlyComment.setLayoutData(fdlOnlyComment);
wOnlyComment = new Button(wMessageSettingsGroup, SWT.CHECK);
props.setLook(wOnlyComment);
fdOnlyComment = new FormData();
fdOnlyComment.left = new FormAttachment(middle, margin);
fdOnlyComment.top = new FormAttachment(wAddDate, margin);
fdOnlyComment.right = new FormAttachment(100, 0);
wOnlyComment.setLayoutData(fdOnlyComment);
wOnlyComment.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// HTML format ?
wlUseHTML = new Label(wMessageSettingsGroup, SWT.RIGHT);
wlUseHTML.setText(BaseMessages.getString(PKG, "JobMail.UseHTMLInBody.Label"));
props.setLook(wlUseHTML);
fdlUseHTML = new FormData();
fdlUseHTML.left = new FormAttachment(0, 0);
fdlUseHTML.top = new FormAttachment(wOnlyComment, margin);
fdlUseHTML.right = new FormAttachment(middle, -margin);
wlUseHTML.setLayoutData(fdlUseHTML);
wUseHTML = new Button(wMessageSettingsGroup, SWT.CHECK);
props.setLook(wUseHTML);
fdUseHTML = new FormData();
fdUseHTML.left = new FormAttachment(middle, margin);
fdUseHTML.top = new FormAttachment(wOnlyComment, margin);
fdUseHTML.right = new FormAttachment(100, 0);
wUseHTML.setLayoutData(fdUseHTML);
wUseHTML.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
SetEnabledEncoding();
jobEntry.setChanged();
}
});
// Encoding
wlEncoding = new Label(wMessageSettingsGroup, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "JobMail.Encoding.Label"));
props.setLook(wlEncoding);
fdlEncoding = new FormData();
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.top = new FormAttachment(wUseHTML, margin);
fdlEncoding.right = new FormAttachment(middle, -margin);
wlEncoding.setLayoutData(fdlEncoding);
wEncoding = new CCombo(wMessageSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
wEncoding.setEditable(true);
props.setLook(wEncoding);
wEncoding.addModifyListener(lsMod);
fdEncoding = new FormData();
fdEncoding.left = new FormAttachment(middle, margin);
fdEncoding.top = new FormAttachment(wUseHTML, margin);
fdEncoding.right = new FormAttachment(100, 0);
wEncoding.setLayoutData(fdEncoding);
wEncoding.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
setEncodings();
shell.setCursor(null);
busy.dispose();
}
});
// Use Priority ?
wlUsePriority = new Label(wMessageSettingsGroup, SWT.RIGHT);
wlUsePriority.setText(BaseMessages.getString(PKG, "JobMail.UsePriority.Label"));
props.setLook(wlUsePriority);
fdlPriority = new FormData();
fdlPriority.left = new FormAttachment(0, 0);
fdlPriority.top = new FormAttachment(wEncoding, margin);
fdlPriority.right = new FormAttachment(middle, -margin);
wlUsePriority.setLayoutData(fdlPriority);
wUsePriority = new Button(wMessageSettingsGroup, SWT.CHECK);
wUsePriority.setToolTipText(BaseMessages.getString(PKG, "JobMail.UsePriority.Tooltip"));
props.setLook(wUsePriority);
fdUsePriority = new FormData();
fdUsePriority.left = new FormAttachment(middle, margin);
fdUsePriority.top = new FormAttachment(wEncoding, margin);
fdUsePriority.right = new FormAttachment(100, 0);
wUsePriority.setLayoutData(fdUsePriority);
wUsePriority.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeUsePriority();
jobEntry.setChanged();
}
});
// Priority
wlPriority = new Label(wMessageSettingsGroup, SWT.RIGHT);
wlPriority.setText(BaseMessages.getString(PKG, "JobMail.Priority.Label"));
props.setLook(wlPriority);
fdlPriority = new FormData();
fdlPriority.left = new FormAttachment(0, 0);
fdlPriority.right = new FormAttachment(middle, -margin);
fdlPriority.top = new FormAttachment(wUsePriority, margin);
wlPriority.setLayoutData(fdlPriority);
wPriority = new CCombo(wMessageSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wPriority.add(BaseMessages.getString(PKG, "JobMail.Priority.Low.Label"));
wPriority.add(BaseMessages.getString(PKG, "JobMail.Priority.Normal.Label"));
wPriority.add(BaseMessages.getString(PKG, "JobMail.Priority.High.Label"));
// +1: starts at -1
wPriority.select(1);
props.setLook(wPriority);
fdPriority = new FormData();
fdPriority.left = new FormAttachment(middle, 0);
fdPriority.top = new FormAttachment(wUsePriority, margin);
fdPriority.right = new FormAttachment(100, 0);
wPriority.setLayoutData(fdPriority);
// Importance
wlImportance = new Label(wMessageSettingsGroup, SWT.RIGHT);
wlImportance.setText(BaseMessages.getString(PKG, "JobMail.Importance.Label"));
props.setLook(wlImportance);
fdlImportance = new FormData();
fdlImportance.left = new FormAttachment(0, 0);
fdlImportance.right = new FormAttachment(middle, -margin);
fdlImportance.top = new FormAttachment(wPriority, margin);
wlImportance.setLayoutData(fdlImportance);
wImportance = new CCombo(wMessageSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wImportance.add(BaseMessages.getString(PKG, "JobMail.Priority.Low.Label"));
wImportance.add(BaseMessages.getString(PKG, "JobMail.Priority.Normal.Label"));
wImportance.add(BaseMessages.getString(PKG, "JobMail.Priority.High.Label"));
// +1: starts at -1
wImportance.select(1);
props.setLook(wImportance);
fdImportance = new FormData();
fdImportance.left = new FormAttachment(middle, 0);
fdImportance.top = new FormAttachment(wPriority, margin);
fdImportance.right = new FormAttachment(100, 0);
wImportance.setLayoutData(fdImportance);
// Sensitivity
wlSensitivity = new Label(wMessageSettingsGroup, SWT.RIGHT);
wlSensitivity.setText(BaseMessages.getString(PKG, "JobMail.Sensitivity.Label"));
props.setLook(wlSensitivity);
fdlSensitivity = new FormData();
fdlSensitivity.left = new FormAttachment(0, 0);
fdlSensitivity.right = new FormAttachment(middle, -margin);
fdlSensitivity.top = new FormAttachment(wImportance, margin);
wlSensitivity.setLayoutData(fdlSensitivity);
wSensitivity = new CCombo(wMessageSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSensitivity.add(BaseMessages.getString(PKG, "JobMail.Sensitivity.normal.Label"));
wSensitivity.add(BaseMessages.getString(PKG, "JobMail.Sensitivity.personal.Label"));
wSensitivity.add(BaseMessages.getString(PKG, "JobMail.Sensitivity.private.Label"));
wSensitivity.add(BaseMessages.getString(PKG, "JobMail.Sensitivity.confidential.Label"));
wSensitivity.select(0);
props.setLook(wSensitivity);
fdSensitivity = new FormData();
fdSensitivity.left = new FormAttachment(middle, 0);
fdSensitivity.top = new FormAttachment(wImportance, margin);
fdSensitivity.right = new FormAttachment(100, 0);
wSensitivity.setLayoutData(fdSensitivity);
FormData fdMessageSettingsGroup = new FormData();
fdMessageSettingsGroup.left = new FormAttachment(0, margin);
fdMessageSettingsGroup.top = new FormAttachment(wName, margin);
fdMessageSettingsGroup.right = new FormAttachment(100, -margin);
wMessageSettingsGroup.setLayoutData(fdMessageSettingsGroup);
// //////////////////////////////////////
// / END OF MESSAGE SETTINGS GROUP
// ///////////////////////////////////////
// ////////////////////////////////////
// START OF MESSAGE GROUP
// ////////////////////////////////////
wMessageGroup = new Group(wMessageComp, SWT.SHADOW_NONE);
props.setLook(wMessageGroup);
wMessageGroup.setText(BaseMessages.getString(PKG, "JobMail.Group.Message.Label"));
FormLayout messagegroupLayout = new FormLayout();
messagegroupLayout.marginWidth = 10;
messagegroupLayout.marginHeight = 10;
wMessageGroup.setLayout(messagegroupLayout);
// Subject line
wSubject = new LabelTextVar(jobMeta, wMessageGroup, BaseMessages.getString(PKG, "JobMail.Subject.Label"), BaseMessages.getString(PKG, "JobMail.Subject.Tooltip"));
wSubject.addModifyListener(lsMod);
fdSubject = new FormData();
fdSubject.left = new FormAttachment(0, 0);
fdSubject.top = new FormAttachment(wMessageSettingsGroup, margin);
fdSubject.right = new FormAttachment(100, 0);
wSubject.setLayoutData(fdSubject);
// Comment line
wlComment = new Label(wMessageGroup, SWT.RIGHT);
wlComment.setText(BaseMessages.getString(PKG, "JobMail.Comment.Label"));
props.setLook(wlComment);
fdlComment = new FormData();
fdlComment.left = new FormAttachment(0, 0);
fdlComment.top = new FormAttachment(wSubject, 2 * margin);
fdlComment.right = new FormAttachment(middle, margin);
wlComment.setLayoutData(fdlComment);
wComment = new TextVar(jobMeta, wMessageGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
props.setLook(wComment);
wComment.addModifyListener(lsMod);
fdComment = new FormData();
fdComment.left = new FormAttachment(middle, margin);
fdComment.top = new FormAttachment(wSubject, 2 * margin);
fdComment.right = new FormAttachment(100, 0);
fdComment.bottom = new FormAttachment(100, -margin);
wComment.setLayoutData(fdComment);
FormData fdMessageGroup = new FormData();
fdMessageGroup.left = new FormAttachment(0, margin);
fdMessageGroup.top = new FormAttachment(wMessageSettingsGroup, margin);
fdMessageGroup.bottom = new FormAttachment(100, -margin);
fdMessageGroup.right = new FormAttachment(100, -margin);
wMessageGroup.setLayoutData(fdMessageGroup);
// //////////////////////////////////////
// / END OF MESSAGE GROUP
// ///////////////////////////////////////
fdMessageComp = new FormData();
fdMessageComp.left = new FormAttachment(0, 0);
fdMessageComp.top = new FormAttachment(0, 0);
fdMessageComp.right = new FormAttachment(100, 0);
fdMessageComp.bottom = new FormAttachment(100, 0);
wMessageComp.setLayoutData(wMessageComp);
wMessageComp.layout();
wMessageTab.setControl(wMessageComp);
// ///////////////////////////////////////////////////////////
// / END OF MESSAGE TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////////////////
// START OF ATTACHED FILES TAB ///
// ///////////////////////////////////
wAttachedTab = new CTabItem(wTabFolder, SWT.NONE);
wAttachedTab.setText(BaseMessages.getString(PKG, "JobMail.Tab.AttachedFiles.Label"));
FormLayout attachedLayout = new FormLayout();
attachedLayout.marginWidth = 3;
attachedLayout.marginHeight = 3;
wAttachedComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wAttachedComp);
wAttachedComp.setLayout(attachedLayout);
// ////////////////////////////////////
// START OF Result File GROUP
// ////////////////////////////////////
wResultFilesGroup = new Group(wAttachedComp, SWT.SHADOW_NONE);
props.setLook(wResultFilesGroup);
wResultFilesGroup.setText(BaseMessages.getString(PKG, "JobMail.Group.AddPreviousFiles.Label"));
FormLayout resultfilesgroupLayout = new FormLayout();
resultfilesgroupLayout.marginWidth = 10;
resultfilesgroupLayout.marginHeight = 10;
wResultFilesGroup.setLayout(resultfilesgroupLayout);
// Include Files?
wlIncludeFiles = new Label(wResultFilesGroup, SWT.RIGHT);
wlIncludeFiles.setText(BaseMessages.getString(PKG, "JobMail.AttachFiles.Label"));
props.setLook(wlIncludeFiles);
fdlIncludeFiles = new FormData();
fdlIncludeFiles.left = new FormAttachment(0, 0);
fdlIncludeFiles.top = new FormAttachment(0, margin);
fdlIncludeFiles.right = new FormAttachment(middle, -margin);
wlIncludeFiles.setLayoutData(fdlIncludeFiles);
wIncludeFiles = new Button(wResultFilesGroup, SWT.CHECK);
props.setLook(wIncludeFiles);
fdIncludeFiles = new FormData();
fdIncludeFiles.left = new FormAttachment(middle, margin);
fdIncludeFiles.top = new FormAttachment(0, margin);
fdIncludeFiles.right = new FormAttachment(100, 0);
wIncludeFiles.setLayoutData(fdIncludeFiles);
wIncludeFiles.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
setFlags();
}
});
// Include Files?
wlTypes = new Label(wResultFilesGroup, SWT.RIGHT);
wlTypes.setText(BaseMessages.getString(PKG, "JobMail.SelectFileTypes.Label"));
props.setLook(wlTypes);
fdlTypes = new FormData();
fdlTypes.left = new FormAttachment(0, 0);
fdlTypes.top = new FormAttachment(wIncludeFiles, margin);
fdlTypes.right = new FormAttachment(middle, -margin);
wlTypes.setLayoutData(fdlTypes);
wTypes = new List(wResultFilesGroup, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
props.setLook(wTypes);
fdTypes = new FormData();
fdTypes.left = new FormAttachment(middle, margin);
fdTypes.top = new FormAttachment(wIncludeFiles, margin);
fdTypes.bottom = new FormAttachment(wIncludeFiles, margin + 150);
fdTypes.right = new FormAttachment(100, 0);
wTypes.setLayoutData(fdTypes);
for (int i = 0; i < ResultFile.getAllTypeDesc().length; i++) {
wTypes.add(ResultFile.getAllTypeDesc()[i]);
}
// Zip Files?
wlZipFiles = new Label(wResultFilesGroup, SWT.RIGHT);
wlZipFiles.setText(BaseMessages.getString(PKG, "JobMail.ZipFiles.Label"));
props.setLook(wlZipFiles);
fdlZipFiles = new FormData();
fdlZipFiles.left = new FormAttachment(0, 0);
fdlZipFiles.top = new FormAttachment(wTypes, margin);
fdlZipFiles.right = new FormAttachment(middle, -margin);
wlZipFiles.setLayoutData(fdlZipFiles);
wZipFiles = new Button(wResultFilesGroup, SWT.CHECK);
props.setLook(wZipFiles);
fdZipFiles = new FormData();
fdZipFiles.left = new FormAttachment(middle, margin);
fdZipFiles.top = new FormAttachment(wTypes, margin);
fdZipFiles.right = new FormAttachment(100, 0);
wZipFiles.setLayoutData(fdZipFiles);
wZipFiles.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
setFlags();
}
});
// ZipFilename line
wZipFilename = new LabelTextVar(jobMeta, wResultFilesGroup, BaseMessages.getString(PKG, "JobMail.ZipFilename.Label"), BaseMessages.getString(PKG, "JobMail.ZipFilename.Tooltip"));
wZipFilename.addModifyListener(lsMod);
fdZipFilename = new FormData();
fdZipFilename.left = new FormAttachment(0, 0);
fdZipFilename.top = new FormAttachment(wZipFiles, margin);
fdZipFilename.right = new FormAttachment(100, 0);
wZipFilename.setLayoutData(fdZipFilename);
FormData fdResultFilesGroup = new FormData();
fdResultFilesGroup.left = new FormAttachment(0, margin);
fdResultFilesGroup.top = new FormAttachment(0, margin);
// fdResultFilesGroup.bottom = new FormAttachment(100, -margin);
fdResultFilesGroup.right = new FormAttachment(100, -margin);
wResultFilesGroup.setLayoutData(fdResultFilesGroup);
// //////////////////////////////////////
// / END OF RESULT FILES GROUP
// ///////////////////////////////////////
// ////////////////////////////////////
// START OF Embedded Images GROUP
// ////////////////////////////////////
wEmbeddedImagesGroup = new Group(wAttachedComp, SWT.SHADOW_NONE);
props.setLook(wEmbeddedImagesGroup);
wEmbeddedImagesGroup.setText(BaseMessages.getString(PKG, "JobMail.Group.EmbeddedImages.Label"));
FormLayout attachedimagesgroupLayout = new FormLayout();
attachedimagesgroupLayout.marginWidth = 10;
attachedimagesgroupLayout.marginHeight = 10;
wEmbeddedImagesGroup.setLayout(attachedimagesgroupLayout);
// ImageFilename line
wlImageFilename = new Label(wEmbeddedImagesGroup, SWT.RIGHT);
wlImageFilename.setText(BaseMessages.getString(PKG, "JobMail.ImageFilename.Label"));
props.setLook(wlImageFilename);
FormData fdlImageFilename = new FormData();
fdlImageFilename.left = new FormAttachment(0, 0);
fdlImageFilename.top = new FormAttachment(wResultFilesGroup, margin);
fdlImageFilename.right = new FormAttachment(middle, -margin);
wlImageFilename.setLayoutData(fdlImageFilename);
wbImageFilename = new Button(wEmbeddedImagesGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbImageFilename);
wbImageFilename.setText(BaseMessages.getString(PKG, "JobMail.BrowseFiles.Label"));
FormData fdbImageFilename = new FormData();
fdbImageFilename.right = new FormAttachment(100, 0);
fdbImageFilename.top = new FormAttachment(wResultFilesGroup, margin);
fdbImageFilename.right = new FormAttachment(100, -margin);
wbImageFilename.setLayoutData(fdbImageFilename);
wbaImageFilename = new Button(wEmbeddedImagesGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbaImageFilename);
wbaImageFilename.setText(BaseMessages.getString(PKG, "JobMail.ImageFilenameAdd.Button"));
FormData fdbaImageFilename = new FormData();
fdbaImageFilename.right = new FormAttachment(wbImageFilename, -margin);
fdbaImageFilename.top = new FormAttachment(wResultFilesGroup, margin);
wbaImageFilename.setLayoutData(fdbaImageFilename);
wImageFilename = new TextVar(jobMeta, wEmbeddedImagesGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wImageFilename);
wImageFilename.addModifyListener(lsMod);
FormData fdImageFilename = new FormData();
fdImageFilename.left = new FormAttachment(middle, 0);
fdImageFilename.top = new FormAttachment(wResultFilesGroup, margin);
fdImageFilename.right = new FormAttachment(wbImageFilename, -40);
wImageFilename.setLayoutData(fdImageFilename);
// Whenever something changes, set the tooltip to the expanded version:
wImageFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wImageFilename.setToolTipText(jobMeta.environmentSubstitute(wImageFilename.getText()));
}
});
wbImageFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*png;*PNG", "*jpeg;*jpg;*JPEG;*JPG", "*gif;*GIF", "*" });
if (wImageFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wImageFilename.getText()));
}
dialog.setFilterNames(IMAGES_FILE_TYPES);
if (dialog.open() != null) {
wImageFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
Random randomgen = new Random();
wContentID.setText(Long.toString(Math.abs(randomgen.nextLong()), 32));
}
}
});
// ContentID
wlContentID = new Label(wEmbeddedImagesGroup, SWT.RIGHT);
wlContentID.setText(BaseMessages.getString(PKG, "JobMail.ContentID.Label"));
props.setLook(wlContentID);
FormData fdlContentID = new FormData();
fdlContentID.left = new FormAttachment(0, 0);
fdlContentID.top = new FormAttachment(wImageFilename, margin);
fdlContentID.right = new FormAttachment(middle, -margin);
wlContentID.setLayoutData(fdlContentID);
wContentID = new TextVar(jobMeta, wEmbeddedImagesGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobMail.ContentID.Tooltip"));
props.setLook(wContentID);
wContentID.addModifyListener(lsMod);
FormData fdContentID = new FormData();
fdContentID.left = new FormAttachment(middle, 0);
fdContentID.top = new FormAttachment(wImageFilename, margin);
fdContentID.right = new FormAttachment(wbImageFilename, -40);
wContentID.setLayoutData(fdContentID);
// Buttons to the right of the screen...
wbdImageFilename = new Button(wEmbeddedImagesGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbdImageFilename);
wbdImageFilename.setText(BaseMessages.getString(PKG, "JobMail.ImageFilenameDelete.Button"));
wbdImageFilename.setToolTipText(BaseMessages.getString(PKG, "JobMail.ImageFilenameDelete.Tooltip"));
FormData fdbdImageFilename = new FormData();
fdbdImageFilename.right = new FormAttachment(100, 0);
fdbdImageFilename.top = new FormAttachment(wContentID, 40);
wbdImageFilename.setLayoutData(fdbdImageFilename);
wbeImageFilename = new Button(wEmbeddedImagesGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbeImageFilename);
wbeImageFilename.setText(BaseMessages.getString(PKG, "JobMail.ImageFilenameEdit.Button"));
wbeImageFilename.setToolTipText(BaseMessages.getString(PKG, "JobMail.ImageFilenameEdit.Tooltip"));
FormData fdbeImageFilename = new FormData();
fdbeImageFilename.right = new FormAttachment(100, 0);
fdbeImageFilename.left = new FormAttachment(wbdImageFilename, 0, SWT.LEFT);
fdbeImageFilename.top = new FormAttachment(wbdImageFilename, margin);
wbeImageFilename.setLayoutData(fdbeImageFilename);
wlFields = new Label(wEmbeddedImagesGroup, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "JobMail.Fields.Label"));
props.setLook(wlFields);
FormData fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.right = new FormAttachment(middle, -margin);
fdlFields.top = new FormAttachment(wContentID, margin);
wlFields.setLayoutData(fdlFields);
int rows = jobEntry.embeddedimages == null ? 1 : (jobEntry.embeddedimages.length == 0 ? 0 : jobEntry.embeddedimages.length);
final int FieldsRows = rows;
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobMail.Fields.Image.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobMail.Fields.ContentID.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(BaseMessages.getString(PKG, "JobMail.Fields.Image.Tooltip"));
colinf[1].setUsingVariables(true);
colinf[1].setToolTip(BaseMessages.getString(PKG, "JobMail.Fields.ContentID.Tooltip"));
wFields = new TableView(jobMeta, wEmbeddedImagesGroup, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
FormData fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(wbeImageFilename, -margin);
fdFields.bottom = new FormAttachment(100, -margin);
wFields.setLayoutData(fdFields);
// Add the file to the list of files...
SelectionAdapter selA = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
wFields.add(new String[] { wImageFilename.getText(), wContentID.getText() });
wImageFilename.setText("");
wContentID.setText("");
wFields.removeEmptyRows();
wFields.setRowNums();
wFields.optWidth(true);
}
};
wbaImageFilename.addSelectionListener(selA);
wImageFilename.addSelectionListener(selA);
// Delete files from the list of files...
wbdImageFilename.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...
wbeImageFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
int idx = wFields.getSelectionIndex();
if (idx >= 0) {
String[] string = wFields.getItem(idx);
wImageFilename.setText(string[0]);
wContentID.setText(string[1]);
wFields.remove(idx);
}
wFields.removeEmptyRows();
wFields.setRowNums();
}
});
FormData fdEmbeddedImagesGroup = new FormData();
fdEmbeddedImagesGroup.left = new FormAttachment(0, margin);
fdEmbeddedImagesGroup.top = new FormAttachment(wResultFilesGroup, margin);
fdEmbeddedImagesGroup.bottom = new FormAttachment(100, -margin);
fdEmbeddedImagesGroup.right = new FormAttachment(100, -margin);
wEmbeddedImagesGroup.setLayoutData(fdEmbeddedImagesGroup);
// //////////////////////////////////////
// / END OF Embedded Images GROUP
// ///////////////////////////////////////
fdAttachedComp = new FormData();
fdAttachedComp.left = new FormAttachment(0, 0);
fdAttachedComp.top = new FormAttachment(0, 0);
fdAttachedComp.right = new FormAttachment(100, 0);
fdAttachedComp.bottom = new FormAttachment(100, 0);
wAttachedComp.setLayoutData(wAttachedComp);
wAttachedComp.layout();
wAttachedTab.setControl(wAttachedComp);
// ///////////////////////////////////////////////////////////
// / END OF FILES 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);
// setButtonPositions(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);
wServer.addSelectionListener(lsDef);
wSubject.addSelectionListener(lsDef);
wDestination.addSelectionListener(lsDef);
wDestinationCc.addSelectionListener(lsDef);
wDestinationBCc.addSelectionListener(lsDef);
wReply.addSelectionListener(lsDef);
wPerson.addSelectionListener(lsDef);
wPhone.addSelectionListener(lsDef);
wZipFilename.addSelectionListener(lsDef);
// Detect [X] or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
// BaseStepDialog.setTraverseOrder(new Control[] {wName, wDestination, wServer, wUseAuth,
// wAuthUser, wAuthPass, wReply,
// wSubject, wAddDate, wIncludeFiles, wTypes, wZipFiles, wZipFilename, wPerson, wPhone,
// wComment, wOK, wCancel });
getData();
SetEnabledEncoding();
activeUsePriority();
setFlags();
setUseAuth();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobMailDialogSize");
wTabFolder.setSelection(0);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class JobEntryMailValidatorDialog 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();
}
};
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, "JobEntryMailValidatorDialog.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.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, margin);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
// eMail address
wMailAddress = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.MailAddress.Label"), BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.MailAddress.Tooltip"));
wMailAddress.addModifyListener(lsMod);
fdMailAddress = new FormData();
fdMailAddress.left = new FormAttachment(0, 0);
fdMailAddress.top = new FormAttachment(wName, margin);
fdMailAddress.right = new FormAttachment(100, 0);
wMailAddress.setLayoutData(fdMailAddress);
// ////////////////////////
// START OF Settings GROUP
// ////////////////////////
wSettingsGroup = new Group(shell, SWT.SHADOW_NONE);
props.setLook(wSettingsGroup);
wSettingsGroup.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.Group.SettingsAddress.Label"));
FormLayout SettingsgroupLayout = new FormLayout();
SettingsgroupLayout.marginWidth = 10;
SettingsgroupLayout.marginHeight = 10;
wSettingsGroup.setLayout(SettingsgroupLayout);
// perform SMTP check?
wlSMTPCheck = new Label(wSettingsGroup, SWT.RIGHT);
wlSMTPCheck.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.SMTPCheck.Label"));
props.setLook(wlSMTPCheck);
fdlSMTPCheck = new FormData();
fdlSMTPCheck.left = new FormAttachment(0, 0);
fdlSMTPCheck.top = new FormAttachment(wMailAddress, margin);
fdlSMTPCheck.right = new FormAttachment(middle, -2 * margin);
wlSMTPCheck.setLayoutData(fdlSMTPCheck);
wSMTPCheck = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wSMTPCheck);
wSMTPCheck.setToolTipText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.SMTPCheck.Tooltip"));
fdSMTPCheck = new FormData();
fdSMTPCheck.left = new FormAttachment(middle, -margin);
fdSMTPCheck.top = new FormAttachment(wMailAddress, margin);
wSMTPCheck.setLayoutData(fdSMTPCheck);
wSMTPCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeSMTPCheck();
}
});
// TimeOut fieldname ...
wlTimeOut = new Label(wSettingsGroup, SWT.RIGHT);
wlTimeOut.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.TimeOutField.Label"));
props.setLook(wlTimeOut);
fdlTimeOut = new FormData();
fdlTimeOut.left = new FormAttachment(0, 0);
fdlTimeOut.right = new FormAttachment(middle, -2 * margin);
fdlTimeOut.top = new FormAttachment(wSMTPCheck, margin);
wlTimeOut.setLayoutData(fdlTimeOut);
wTimeOut = new TextVar(jobMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wTimeOut.setToolTipText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.TimeOutField.Tooltip"));
props.setLook(wTimeOut);
wTimeOut.addModifyListener(lsMod);
fdTimeOut = new FormData();
fdTimeOut.left = new FormAttachment(middle, -margin);
fdTimeOut.top = new FormAttachment(wSMTPCheck, margin);
fdTimeOut.right = new FormAttachment(100, 0);
wTimeOut.setLayoutData(fdTimeOut);
// eMailSender fieldname ...
wleMailSender = new Label(wSettingsGroup, SWT.RIGHT);
wleMailSender.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.eMailSenderField.Label"));
props.setLook(wleMailSender);
fdleMailSender = new FormData();
fdleMailSender.left = new FormAttachment(0, 0);
fdleMailSender.right = new FormAttachment(middle, -2 * margin);
fdleMailSender.top = new FormAttachment(wTimeOut, margin);
wleMailSender.setLayoutData(fdleMailSender);
weMailSender = new TextVar(jobMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
weMailSender.setToolTipText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.eMailSenderField.Tooltip"));
props.setLook(weMailSender);
weMailSender.addModifyListener(lsMod);
fdeMailSender = new FormData();
fdeMailSender.left = new FormAttachment(middle, -margin);
fdeMailSender.top = new FormAttachment(wTimeOut, margin);
fdeMailSender.right = new FormAttachment(100, 0);
weMailSender.setLayoutData(fdeMailSender);
// DefaultSMTP fieldname ...
wlDefaultSMTP = new Label(wSettingsGroup, SWT.RIGHT);
wlDefaultSMTP.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.DefaultSMTPField.Label"));
props.setLook(wlDefaultSMTP);
fdlDefaultSMTP = new FormData();
fdlDefaultSMTP.left = new FormAttachment(0, 0);
fdlDefaultSMTP.right = new FormAttachment(middle, -2 * margin);
fdlDefaultSMTP.top = new FormAttachment(weMailSender, margin);
wlDefaultSMTP.setLayoutData(fdlDefaultSMTP);
wDefaultSMTP = new TextVar(jobMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wDefaultSMTP.setToolTipText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.DefaultSMTPField.Tooltip"));
props.setLook(wDefaultSMTP);
wDefaultSMTP.addModifyListener(lsMod);
fdDefaultSMTP = new FormData();
fdDefaultSMTP.left = new FormAttachment(middle, -margin);
fdDefaultSMTP.top = new FormAttachment(weMailSender, margin);
fdDefaultSMTP.right = new FormAttachment(100, 0);
wDefaultSMTP.setLayoutData(fdDefaultSMTP);
fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, margin);
fdSettingsGroup.top = new FormAttachment(wMailAddress, margin);
fdSettingsGroup.right = new FormAttachment(100, -margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// ///////////////////////////////////////////////////////////
// / END OF Settings GROUP
// ///////////////////////////////////////////////////////////
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, wSettingsGroup);
// 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();
activeSMTPCheck();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobSuccessDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
Aggregations