use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class JobEntryGetPOPDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
closeMailConnection();
jobEntry.setChanged();
}
};
SelectionListener lsSelection = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
closeMailConnection();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobGetPOP.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobGetPOP.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobGetPOP.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobGetPOP.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wlServerName = new Label(wServerSettings, SWT.RIGHT);
wlServerName.setText(BaseMessages.getString(PKG, "JobGetPOP.Server.Label"));
props.setLook(wlServerName);
fdlServerName = new FormData();
fdlServerName.left = new FormAttachment(0, 0);
fdlServerName.top = new FormAttachment(0, 2 * margin);
fdlServerName.right = new FormAttachment(middle, -margin);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, 0);
fdServerName.top = new FormAttachment(0, 2 * margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// USE connection with SSL
wlUseSSL = new Label(wServerSettings, SWT.RIGHT);
wlUseSSL.setText(BaseMessages.getString(PKG, "JobGetPOP.UseSSLMails.Label"));
props.setLook(wlUseSSL);
fdlUseSSL = new FormData();
fdlUseSSL.left = new FormAttachment(0, 0);
fdlUseSSL.top = new FormAttachment(wServerName, margin);
fdlUseSSL.right = new FormAttachment(middle, -margin);
wlUseSSL.setLayoutData(fdlUseSSL);
wUseSSL = new Button(wServerSettings, SWT.CHECK);
props.setLook(wUseSSL);
fdUseSSL = new FormData();
wUseSSL.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.UseSSLMails.Tooltip"));
fdUseSSL.left = new FormAttachment(middle, 0);
fdUseSSL.top = new FormAttachment(wServerName, margin);
fdUseSSL.right = new FormAttachment(100, 0);
wUseSSL.setLayoutData(fdUseSSL);
wUseSSL.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
closeMailConnection();
refreshPort(true);
}
});
// port
wlPort = new Label(wServerSettings, SWT.RIGHT);
wlPort.setText(BaseMessages.getString(PKG, "JobGetPOP.SSLPort.Label"));
props.setLook(wlPort);
fdlPort = new FormData();
fdlPort.left = new FormAttachment(0, 0);
fdlPort.top = new FormAttachment(wUseSSL, margin);
fdlPort.right = new FormAttachment(middle, -margin);
wlPort.setLayoutData(fdlPort);
wPort = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPort);
wPort.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.SSLPort.Tooltip"));
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(middle, 0);
fdPort.top = new FormAttachment(wUseSSL, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// UserName line
wlUserName = new Label(wServerSettings, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "JobGetPOP.Username.Label"));
props.setLook(wlUserName);
fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wPort, margin);
fdlUserName.right = new FormAttachment(middle, -margin);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.Username.Tooltip"));
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, 0);
fdUserName.top = new FormAttachment(wPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wlPassword = new Label(wServerSettings, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "JobGetPOP.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// USE proxy
wlUseProxy = new Label(wServerSettings, SWT.RIGHT);
wlUseProxy.setText(BaseMessages.getString(PKG, "JobGetPOP.UseProxyMails.Label"));
props.setLook(wlUseProxy);
fdlUseProxy = new FormData();
fdlUseProxy.left = new FormAttachment(0, 0);
fdlUseProxy.top = new FormAttachment(wPassword, 2 * margin);
fdlUseProxy.right = new FormAttachment(middle, -margin);
wlUseProxy.setLayoutData(fdlUseProxy);
wUseProxy = new Button(wServerSettings, SWT.CHECK);
props.setLook(wUseProxy);
fdUseProxy = new FormData();
wUseProxy.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.UseProxyMails.Tooltip"));
fdUseProxy.left = new FormAttachment(middle, 0);
fdUseProxy.top = new FormAttachment(wPassword, 2 * margin);
fdUseProxy.right = new FormAttachment(100, 0);
wUseProxy.setLayoutData(fdUseProxy);
wUseProxy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setUserProxy();
jobEntry.setChanged();
}
});
// ProxyUsername line
wlProxyUsername = new Label(wServerSettings, SWT.RIGHT);
wlProxyUsername.setText(BaseMessages.getString(PKG, "JobGetPOP.ProxyUsername.Label"));
props.setLook(wlProxyUsername);
fdlProxyUsername = new FormData();
fdlProxyUsername.left = new FormAttachment(0, 0);
fdlProxyUsername.top = new FormAttachment(wUseProxy, margin);
fdlProxyUsername.right = new FormAttachment(middle, -margin);
wlProxyUsername.setLayoutData(fdlProxyUsername);
wProxyUsername = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wProxyUsername);
wProxyUsername.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.ProxyUsername.Tooltip"));
wProxyUsername.addModifyListener(lsMod);
fdProxyUsername = new FormData();
fdProxyUsername.left = new FormAttachment(middle, 0);
fdProxyUsername.top = new FormAttachment(wUseProxy, margin);
fdProxyUsername.right = new FormAttachment(100, 0);
wProxyUsername.setLayoutData(fdProxyUsername);
// Protocol
wlProtocol = new Label(wServerSettings, SWT.RIGHT);
wlProtocol.setText(BaseMessages.getString(PKG, "JobGetPOP.Protocol.Label"));
props.setLook(wlProtocol);
fdlProtocol = new FormData();
fdlProtocol.left = new FormAttachment(0, 0);
fdlProtocol.right = new FormAttachment(middle, -margin);
fdlProtocol.top = new FormAttachment(wProxyUsername, margin);
wlProtocol.setLayoutData(fdlProtocol);
wProtocol = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wProtocol.setItems(MailConnectionMeta.protocolCodes);
wProtocol.select(0);
props.setLook(wProtocol);
fdProtocol = new FormData();
fdProtocol.left = new FormAttachment(middle, 0);
fdProtocol.top = new FormAttachment(wProxyUsername, margin);
fdProtocol.right = new FormAttachment(100, 0);
wProtocol.setLayoutData(fdProtocol);
wProtocol.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refreshProtocol(true);
}
});
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobGetPOP.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wProtocol, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wProtocol, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Target Folder GROUP///
// /
wTargetFolder = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wTargetFolder);
wTargetFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.TargetFolder.Group.Label"));
FormLayout TargetFoldergroupLayout = new FormLayout();
TargetFoldergroupLayout.marginWidth = 10;
TargetFoldergroupLayout.marginHeight = 10;
wTargetFolder.setLayout(TargetFoldergroupLayout);
// OutputDirectory line
wlOutputDirectory = new Label(wTargetFolder, SWT.RIGHT);
wlOutputDirectory.setText(BaseMessages.getString(PKG, "JobGetPOP.OutputDirectory.Label"));
props.setLook(wlOutputDirectory);
fdlOutputDirectory = new FormData();
fdlOutputDirectory.left = new FormAttachment(0, 0);
fdlOutputDirectory.top = new FormAttachment(wServerSettings, margin);
fdlOutputDirectory.right = new FormAttachment(middle, -margin);
wlOutputDirectory.setLayoutData(fdlOutputDirectory);
// Browse Source folders button ...
wbDirectory = new Button(wTargetFolder, SWT.PUSH | SWT.CENTER);
props.setLook(wbDirectory);
wbDirectory.setText(BaseMessages.getString(PKG, "JobGetPOP.BrowseFolders.Label"));
fdbDirectory = new FormData();
fdbDirectory.right = new FormAttachment(100, -margin);
fdbDirectory.top = new FormAttachment(wServerSettings, margin);
wbDirectory.setLayoutData(fdbDirectory);
wbDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wOutputDirectory.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wOutputDirectory.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wOutputDirectory.setText(dir);
}
}
});
wOutputDirectory = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wOutputDirectory);
wOutputDirectory.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.OutputDirectory.Tooltip"));
wOutputDirectory.addModifyListener(lsMod);
fdOutputDirectory = new FormData();
fdOutputDirectory.left = new FormAttachment(middle, 0);
fdOutputDirectory.top = new FormAttachment(wServerSettings, margin);
fdOutputDirectory.right = new FormAttachment(wbDirectory, -margin);
wOutputDirectory.setLayoutData(fdOutputDirectory);
// Create local folder
wlcreateLocalFolder = new Label(wTargetFolder, SWT.RIGHT);
wlcreateLocalFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.createLocalFolder.Label"));
props.setLook(wlcreateLocalFolder);
fdlcreateLocalFolder = new FormData();
fdlcreateLocalFolder.left = new FormAttachment(0, 0);
fdlcreateLocalFolder.top = new FormAttachment(wOutputDirectory, margin);
fdlcreateLocalFolder.right = new FormAttachment(middle, -margin);
wlcreateLocalFolder.setLayoutData(fdlcreateLocalFolder);
wcreateLocalFolder = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wcreateLocalFolder);
fdcreateLocalFolder = new FormData();
wcreateLocalFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.createLocalFolder.Tooltip"));
fdcreateLocalFolder.left = new FormAttachment(middle, 0);
fdcreateLocalFolder.top = new FormAttachment(wOutputDirectory, margin);
fdcreateLocalFolder.right = new FormAttachment(100, 0);
wcreateLocalFolder.setLayoutData(fdcreateLocalFolder);
// Filename pattern line
wlFilenamePattern = new Label(wTargetFolder, SWT.RIGHT);
wlFilenamePattern.setText(BaseMessages.getString(PKG, "JobGetPOP.FilenamePattern.Label"));
props.setLook(wlFilenamePattern);
fdlFilenamePattern = new FormData();
fdlFilenamePattern.left = new FormAttachment(0, 0);
fdlFilenamePattern.top = new FormAttachment(wcreateLocalFolder, margin);
fdlFilenamePattern.right = new FormAttachment(middle, -margin);
wlFilenamePattern.setLayoutData(fdlFilenamePattern);
wFilenamePattern = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilenamePattern);
wFilenamePattern.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.FilenamePattern.Tooltip"));
wFilenamePattern.addModifyListener(lsMod);
fdFilenamePattern = new FormData();
fdFilenamePattern.left = new FormAttachment(middle, 0);
fdFilenamePattern.top = new FormAttachment(wcreateLocalFolder, margin);
fdFilenamePattern.right = new FormAttachment(100, 0);
wFilenamePattern.setLayoutData(fdFilenamePattern);
// Whenever something changes, set the tooltip to the expanded version:
wFilenamePattern.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFilenamePattern.setToolTipText(jobMeta.environmentSubstitute(wFilenamePattern.getText()));
}
});
// Get message?
wlGetMessage = new Label(wTargetFolder, SWT.RIGHT);
wlGetMessage.setText(BaseMessages.getString(PKG, "JobGetPOP.GetMessageMails.Label"));
props.setLook(wlGetMessage);
fdlGetMessage = new FormData();
fdlGetMessage.left = new FormAttachment(0, 0);
fdlGetMessage.top = new FormAttachment(wFilenamePattern, margin);
fdlGetMessage.right = new FormAttachment(middle, -margin);
wlGetMessage.setLayoutData(fdlGetMessage);
wGetMessage = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wGetMessage);
fdGetMessage = new FormData();
wGetMessage.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.GetMessageMails.Tooltip"));
fdGetMessage.left = new FormAttachment(middle, 0);
fdGetMessage.top = new FormAttachment(wFilenamePattern, margin);
fdGetMessage.right = new FormAttachment(100, 0);
wGetMessage.setLayoutData(fdGetMessage);
wGetMessage.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (!wGetAttachment.getSelection() && !wGetMessage.getSelection()) {
wGetAttachment.setSelection(true);
}
}
});
// Get attachment?
wlGetAttachment = new Label(wTargetFolder, SWT.RIGHT);
wlGetAttachment.setText(BaseMessages.getString(PKG, "JobGetPOP.GetAttachmentMails.Label"));
props.setLook(wlGetAttachment);
fdlGetAttachment = new FormData();
fdlGetAttachment.left = new FormAttachment(0, 0);
fdlGetAttachment.top = new FormAttachment(wGetMessage, margin);
fdlGetAttachment.right = new FormAttachment(middle, -margin);
wlGetAttachment.setLayoutData(fdlGetAttachment);
wGetAttachment = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wGetAttachment);
fdGetAttachment = new FormData();
wGetAttachment.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.GetAttachmentMails.Tooltip"));
fdGetAttachment.left = new FormAttachment(middle, 0);
fdGetAttachment.top = new FormAttachment(wGetMessage, margin);
fdGetAttachment.right = new FormAttachment(100, 0);
wGetAttachment.setLayoutData(fdGetAttachment);
wGetAttachment.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeAttachmentFolder();
}
});
// different folder for attachment?
wlDifferentFolderForAttachment = new Label(wTargetFolder, SWT.RIGHT);
wlDifferentFolderForAttachment.setText(BaseMessages.getString(PKG, "JobGetPOP.DifferentFolderForAttachmentMails.Label"));
props.setLook(wlDifferentFolderForAttachment);
fdlDifferentFolderForAttachment = new FormData();
fdlDifferentFolderForAttachment.left = new FormAttachment(0, 0);
fdlDifferentFolderForAttachment.top = new FormAttachment(wGetAttachment, margin);
fdlDifferentFolderForAttachment.right = new FormAttachment(middle, -margin);
wlDifferentFolderForAttachment.setLayoutData(fdlDifferentFolderForAttachment);
wDifferentFolderForAttachment = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wDifferentFolderForAttachment);
fdDifferentFolderForAttachment = new FormData();
wDifferentFolderForAttachment.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.DifferentFolderForAttachmentMails.Tooltip"));
fdDifferentFolderForAttachment.left = new FormAttachment(middle, 0);
fdDifferentFolderForAttachment.top = new FormAttachment(wGetAttachment, margin);
fdDifferentFolderForAttachment.right = new FormAttachment(100, 0);
wDifferentFolderForAttachment.setLayoutData(fdDifferentFolderForAttachment);
wDifferentFolderForAttachment.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeAttachmentFolder();
}
});
// AttachmentFolder line
wlAttachmentFolder = new Label(wTargetFolder, SWT.RIGHT);
wlAttachmentFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentFolder.Label"));
props.setLook(wlAttachmentFolder);
fdlAttachmentFolder = new FormData();
fdlAttachmentFolder.left = new FormAttachment(0, 0);
fdlAttachmentFolder.top = new FormAttachment(wDifferentFolderForAttachment, margin);
fdlAttachmentFolder.right = new FormAttachment(middle, -margin);
wlAttachmentFolder.setLayoutData(fdlAttachmentFolder);
// Browse Source folders button ...
wbAttachmentFolder = new Button(wTargetFolder, SWT.PUSH | SWT.CENTER);
props.setLook(wbAttachmentFolder);
wbAttachmentFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.BrowseFolders.Label"));
fdbAttachmentFolder = new FormData();
fdbAttachmentFolder.right = new FormAttachment(100, -margin);
fdbAttachmentFolder.top = new FormAttachment(wDifferentFolderForAttachment, margin);
wbAttachmentFolder.setLayoutData(fdbAttachmentFolder);
wbAttachmentFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wAttachmentFolder.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wAttachmentFolder.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wAttachmentFolder.setText(dir);
}
}
});
wAttachmentFolder = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wAttachmentFolder);
wAttachmentFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentFolder.Tooltip"));
wAttachmentFolder.addModifyListener(lsMod);
fdAttachmentFolder = new FormData();
fdAttachmentFolder.left = new FormAttachment(middle, 0);
fdAttachmentFolder.top = new FormAttachment(wDifferentFolderForAttachment, margin);
fdAttachmentFolder.right = new FormAttachment(wbAttachmentFolder, -margin);
wAttachmentFolder.setLayoutData(fdAttachmentFolder);
// Limit attached files
wlAttachmentWildcard = new Label(wTargetFolder, SWT.RIGHT);
wlAttachmentWildcard.setText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentWildcard.Label"));
props.setLook(wlAttachmentWildcard);
fdlAttachmentWildcard = new FormData();
fdlAttachmentWildcard.left = new FormAttachment(0, 0);
fdlAttachmentWildcard.top = new FormAttachment(wbAttachmentFolder, margin);
fdlAttachmentWildcard.right = new FormAttachment(middle, -margin);
wlAttachmentWildcard.setLayoutData(fdlAttachmentWildcard);
wAttachmentWildcard = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wAttachmentWildcard);
wAttachmentWildcard.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentWildcard.Tooltip"));
wAttachmentWildcard.addModifyListener(lsMod);
fdAttachmentWildcard = new FormData();
fdAttachmentWildcard.left = new FormAttachment(middle, 0);
fdAttachmentWildcard.top = new FormAttachment(wbAttachmentFolder, margin);
fdAttachmentWildcard.right = new FormAttachment(100, 0);
wAttachmentWildcard.setLayoutData(fdAttachmentWildcard);
// Whenever something changes, set the tooltip to the expanded version:
wAttachmentWildcard.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wAttachmentWildcard.setToolTipText(jobMeta.environmentSubstitute(wAttachmentWildcard.getText()));
}
});
fdTargetFolder = new FormData();
fdTargetFolder.left = new FormAttachment(0, margin);
fdTargetFolder.top = new FormAttachment(wServerSettings, margin);
fdTargetFolder.right = new FormAttachment(100, -margin);
wTargetFolder.setLayoutData(fdTargetFolder);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wName, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF SETTINGS TAB ///
// ////////////////////////
wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
wSettingsTab.setText(BaseMessages.getString(PKG, "JobGetPOP.Tab.Pop.Label"));
wSettingsComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSettingsComp);
FormLayout PopLayout = new FormLayout();
PopLayout.marginWidth = 3;
PopLayout.marginHeight = 3;
wSettingsComp.setLayout(PopLayout);
// Action type
wlActionType = new Label(wSettingsComp, SWT.RIGHT);
wlActionType.setText(BaseMessages.getString(PKG, "JobGetPOP.ActionType.Label"));
props.setLook(wlActionType);
fdlActionType = new FormData();
fdlActionType.left = new FormAttachment(0, 0);
fdlActionType.right = new FormAttachment(middle, -margin);
fdlActionType.top = new FormAttachment(0, 3 * margin);
wlActionType.setLayoutData(fdlActionType);
wActionType = new CCombo(wSettingsComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wActionType.setItems(MailConnectionMeta.actionTypeDesc);
// +1: starts at -1
wActionType.select(0);
props.setLook(wActionType);
fdActionType = new FormData();
fdActionType.left = new FormAttachment(middle, 0);
fdActionType.top = new FormAttachment(0, 3 * margin);
fdActionType.right = new FormAttachment(100, 0);
wActionType.setLayoutData(fdActionType);
wActionType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setActionType();
jobEntry.setChanged();
}
});
// Message: for POP3, only INBOX folder is available!
wlPOP3Message = new Label(wSettingsComp, SWT.RIGHT);
wlPOP3Message.setText(BaseMessages.getString(PKG, "JobGetPOP.POP3Message.Label"));
props.setLook(wlPOP3Message);
fdlPOP3Message = new FormData();
fdlPOP3Message.left = new FormAttachment(0, margin);
fdlPOP3Message.top = new FormAttachment(wActionType, 3 * margin);
wlPOP3Message.setLayoutData(fdlPOP3Message);
wlPOP3Message.setForeground(GUIResource.getInstance().getColorOrange());
// ////////////////////////
// START OF POP3 Settings GROUP///
// /
wPOP3Settings = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wPOP3Settings);
wPOP3Settings.setText(BaseMessages.getString(PKG, "JobGetPOP.POP3Settings.Group.Label"));
FormLayout POP3SettingsgroupLayout = new FormLayout();
POP3SettingsgroupLayout.marginWidth = 10;
POP3SettingsgroupLayout.marginHeight = 10;
wPOP3Settings.setLayout(POP3SettingsgroupLayout);
// List of mails of retrieve
wlListmails = new Label(wPOP3Settings, SWT.RIGHT);
wlListmails.setText(BaseMessages.getString(PKG, "JobGetPOP.Listmails.Label"));
props.setLook(wlListmails);
fdlListmails = new FormData();
fdlListmails.left = new FormAttachment(0, 0);
fdlListmails.right = new FormAttachment(middle, 0);
fdlListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
wlListmails.setLayoutData(fdlListmails);
wListmails = new CCombo(wPOP3Settings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wListmails.add(BaseMessages.getString(PKG, "JobGetPOP.RetrieveAllMails.Label"));
// PDI-7241 POP3 does not support retrive unread
// wListmails.add( BaseMessages.getString( PKG, "JobGetPOP.RetrieveUnreadMails.Label" ) );
wListmails.add(BaseMessages.getString(PKG, "JobGetPOP.RetrieveFirstMails.Label"));
// +1: starts at -1
wListmails.select(0);
props.setLook(wListmails);
fdListmails = new FormData();
fdListmails.left = new FormAttachment(middle, 0);
fdListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
fdListmails.right = new FormAttachment(100, 0);
wListmails.setLayoutData(fdListmails);
wListmails.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
chooseListMails();
}
});
// Retrieve the first ... mails
wlFirstmails = new Label(wPOP3Settings, SWT.RIGHT);
wlFirstmails.setText(BaseMessages.getString(PKG, "JobGetPOP.Firstmails.Label"));
props.setLook(wlFirstmails);
fdlFirstmails = new FormData();
fdlFirstmails.left = new FormAttachment(0, 0);
fdlFirstmails.right = new FormAttachment(middle, -margin);
fdlFirstmails.top = new FormAttachment(wListmails, margin);
wlFirstmails.setLayoutData(fdlFirstmails);
wFirstmails = new TextVar(jobMeta, wPOP3Settings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFirstmails);
wFirstmails.addModifyListener(lsMod);
fdFirstmails = new FormData();
fdFirstmails.left = new FormAttachment(middle, 0);
fdFirstmails.top = new FormAttachment(wListmails, margin);
fdFirstmails.right = new FormAttachment(100, 0);
wFirstmails.setLayoutData(fdFirstmails);
// Delete mails after retrieval...
wlDelete = new Label(wPOP3Settings, SWT.RIGHT);
wlDelete.setText(BaseMessages.getString(PKG, "JobGetPOP.DeleteMails.Label"));
props.setLook(wlDelete);
fdlDelete = new FormData();
fdlDelete.left = new FormAttachment(0, 0);
fdlDelete.top = new FormAttachment(wFirstmails, margin);
fdlDelete.right = new FormAttachment(middle, -margin);
wlDelete.setLayoutData(fdlDelete);
wDelete = new Button(wPOP3Settings, SWT.CHECK);
props.setLook(wDelete);
fdDelete = new FormData();
wDelete.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.DeleteMails.Tooltip"));
fdDelete.left = new FormAttachment(middle, 0);
fdDelete.top = new FormAttachment(wFirstmails, margin);
fdDelete.right = new FormAttachment(100, 0);
wDelete.setLayoutData(fdDelete);
fdPOP3Settings = new FormData();
fdPOP3Settings.left = new FormAttachment(0, margin);
fdPOP3Settings.top = new FormAttachment(wlPOP3Message, 2 * margin);
fdPOP3Settings.right = new FormAttachment(100, -margin);
wPOP3Settings.setLayoutData(fdPOP3Settings);
// ///////////////////////////////////////////////////////////
// / END OF POP3 SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF IMAP Settings GROUP///
// /
wIMAPSettings = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wIMAPSettings);
wIMAPSettings.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPSettings.Groupp.Label"));
FormLayout IMAPSettingsgroupLayout = new FormLayout();
IMAPSettingsgroupLayout.marginWidth = 10;
IMAPSettingsgroupLayout.marginHeight = 10;
wIMAPSettings.setLayout(IMAPSettingsgroupLayout);
// SelectFolder button
wSelectFolder = new Button(wIMAPSettings, SWT.PUSH);
wSelectFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectFolderConnection.Label"));
props.setLook(wSelectFolder);
fdSelectFolder = new FormData();
wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.SelectFolderConnection.Tooltip"));
fdSelectFolder.top = new FormAttachment(wPOP3Settings, margin);
fdSelectFolder.right = new FormAttachment(100, 0);
wSelectFolder.setLayoutData(fdSelectFolder);
// TestIMAPFolder button
wTestIMAPFolder = new Button(wIMAPSettings, SWT.PUSH);
wTestIMAPFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.TestIMAPFolderConnection.Label"));
props.setLook(wTestIMAPFolder);
fdTestIMAPFolder = new FormData();
wTestIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.TestIMAPFolderConnection.Tooltip"));
fdTestIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
fdTestIMAPFolder.right = new FormAttachment(wSelectFolder, -margin);
wTestIMAPFolder.setLayoutData(fdTestIMAPFolder);
// IMAPFolder line
wlIMAPFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPFolder.Label"));
props.setLook(wlIMAPFolder);
fdlIMAPFolder = new FormData();
fdlIMAPFolder.left = new FormAttachment(0, 0);
fdlIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
fdlIMAPFolder.right = new FormAttachment(middle, -margin);
wlIMAPFolder.setLayoutData(fdlIMAPFolder);
wIMAPFolder = new TextVar(jobMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIMAPFolder);
wIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.IMAPFolder.Tooltip"));
wIMAPFolder.addModifyListener(lsMod);
fdIMAPFolder = new FormData();
fdIMAPFolder.left = new FormAttachment(middle, 0);
fdIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
fdIMAPFolder.right = new FormAttachment(wTestIMAPFolder, -margin);
wIMAPFolder.setLayoutData(fdIMAPFolder);
// Include subfolders?
wlIncludeSubFolders = new Label(wIMAPSettings, SWT.RIGHT);
wlIncludeSubFolders.setText(BaseMessages.getString(PKG, "JobGetPOP.IncludeSubFoldersMails.Label"));
props.setLook(wlIncludeSubFolders);
fdlIncludeSubFolders = new FormData();
fdlIncludeSubFolders.left = new FormAttachment(0, 0);
fdlIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
fdlIncludeSubFolders.right = new FormAttachment(middle, -margin);
wlIncludeSubFolders.setLayoutData(fdlIncludeSubFolders);
wIncludeSubFolders = new Button(wIMAPSettings, SWT.CHECK);
props.setLook(wIncludeSubFolders);
fdIncludeSubFolders = new FormData();
wIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.IncludeSubFoldersMails.Tooltip"));
fdIncludeSubFolders.left = new FormAttachment(middle, 0);
fdIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
fdIncludeSubFolders.right = new FormAttachment(100, 0);
wIncludeSubFolders.setLayoutData(fdIncludeSubFolders);
wIncludeSubFolders.addSelectionListener(lsSelection);
// List of mails of retrieve
wlIMAPListmails = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPListmails.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPListmails.Label"));
props.setLook(wlIMAPListmails);
fdlIMAPListmails = new FormData();
fdlIMAPListmails.left = new FormAttachment(0, 0);
fdlIMAPListmails.right = new FormAttachment(middle, -margin);
fdlIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
wlIMAPListmails.setLayoutData(fdlIMAPListmails);
wIMAPListmails = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wIMAPListmails.setItems(MailConnectionMeta.valueIMAPListDesc);
// +1: starts at -1
wIMAPListmails.select(0);
props.setLook(wIMAPListmails);
fdIMAPListmails = new FormData();
fdIMAPListmails.left = new FormAttachment(middle, 0);
fdIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
fdIMAPListmails.right = new FormAttachment(100, 0);
wIMAPListmails.setLayoutData(fdIMAPListmails);
wIMAPListmails.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// ChooseIMAPListmails();
}
});
// Retrieve the first ... mails
wlIMAPFirstmails = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPFirstmails.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPFirstmails.Label"));
props.setLook(wlIMAPFirstmails);
fdlIMAPFirstmails = new FormData();
fdlIMAPFirstmails.left = new FormAttachment(0, 0);
fdlIMAPFirstmails.right = new FormAttachment(middle, -margin);
fdlIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
wlIMAPFirstmails.setLayoutData(fdlIMAPFirstmails);
wIMAPFirstmails = new TextVar(jobMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIMAPFirstmails);
wIMAPFirstmails.addModifyListener(lsMod);
fdIMAPFirstmails = new FormData();
fdIMAPFirstmails.left = new FormAttachment(middle, 0);
fdIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
fdIMAPFirstmails.right = new FormAttachment(100, 0);
wIMAPFirstmails.setLayoutData(fdIMAPFirstmails);
// After get IMAP
wlAfterGetIMAP = new Label(wIMAPSettings, SWT.RIGHT);
wlAfterGetIMAP.setText(BaseMessages.getString(PKG, "JobGetPOP.AfterGetIMAP.Label"));
props.setLook(wlAfterGetIMAP);
fdlAfterGetIMAP = new FormData();
fdlAfterGetIMAP.left = new FormAttachment(0, 0);
fdlAfterGetIMAP.right = new FormAttachment(middle, -margin);
fdlAfterGetIMAP.top = new FormAttachment(wIMAPFirstmails, 2 * margin);
wlAfterGetIMAP.setLayoutData(fdlAfterGetIMAP);
wAfterGetIMAP = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wAfterGetIMAP.setItems(MailConnectionMeta.afterGetIMAPDesc);
// +1: starts at -1
wAfterGetIMAP.select(0);
props.setLook(wAfterGetIMAP);
fdAfterGetIMAP = new FormData();
fdAfterGetIMAP.left = new FormAttachment(middle, 0);
fdAfterGetIMAP.top = new FormAttachment(wIMAPFirstmails, 2 * margin);
fdAfterGetIMAP.right = new FormAttachment(100, 0);
wAfterGetIMAP.setLayoutData(fdAfterGetIMAP);
wAfterGetIMAP.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setAfterIMAPRetrived();
jobEntry.setChanged();
}
});
// MoveToFolder line
wlMoveToFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.MoveToFolder.Label"));
props.setLook(wlMoveToFolder);
fdlMoveToFolder = new FormData();
fdlMoveToFolder.left = new FormAttachment(0, 0);
fdlMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdlMoveToFolder.right = new FormAttachment(middle, -margin);
wlMoveToFolder.setLayoutData(fdlMoveToFolder);
// SelectMoveToFolder button
wSelectMoveToFolder = new Button(wIMAPSettings, SWT.PUSH);
wSelectMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectMoveToFolderConnection.Label"));
props.setLook(wSelectMoveToFolder);
fdSelectMoveToFolder = new FormData();
wSelectMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.SelectMoveToFolderConnection.Tooltip"));
fdSelectMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdSelectMoveToFolder.right = new FormAttachment(100, 0);
wSelectMoveToFolder.setLayoutData(fdSelectMoveToFolder);
// TestMoveToFolder button
wTestMoveToFolder = new Button(wIMAPSettings, SWT.PUSH);
wTestMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.TestMoveToFolderConnection.Label"));
props.setLook(wTestMoveToFolder);
fdTestMoveToFolder = new FormData();
wTestMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.TestMoveToFolderConnection.Tooltip"));
fdTestMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdTestMoveToFolder.right = new FormAttachment(wSelectMoveToFolder, -margin);
wTestMoveToFolder.setLayoutData(fdTestMoveToFolder);
wMoveToFolder = new TextVar(jobMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMoveToFolder);
wMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.MoveToFolder.Tooltip"));
wMoveToFolder.addModifyListener(lsMod);
fdMoveToFolder = new FormData();
fdMoveToFolder.left = new FormAttachment(middle, 0);
fdMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdMoveToFolder.right = new FormAttachment(wTestMoveToFolder, -margin);
wMoveToFolder.setLayoutData(fdMoveToFolder);
// Create move to folder
wlcreateMoveToFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlcreateMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.createMoveToFolderMails.Label"));
props.setLook(wlcreateMoveToFolder);
fdlcreateMoveToFolder = new FormData();
fdlcreateMoveToFolder.left = new FormAttachment(0, 0);
fdlcreateMoveToFolder.top = new FormAttachment(wMoveToFolder, margin);
fdlcreateMoveToFolder.right = new FormAttachment(middle, -margin);
wlcreateMoveToFolder.setLayoutData(fdlcreateMoveToFolder);
wcreateMoveToFolder = new Button(wIMAPSettings, SWT.CHECK);
props.setLook(wcreateMoveToFolder);
fdcreateMoveToFolder = new FormData();
wcreateMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.createMoveToFolderMails.Tooltip"));
fdcreateMoveToFolder.left = new FormAttachment(middle, 0);
fdcreateMoveToFolder.top = new FormAttachment(wMoveToFolder, margin);
fdcreateMoveToFolder.right = new FormAttachment(100, 0);
wcreateMoveToFolder.setLayoutData(fdcreateMoveToFolder);
fdIMAPSettings = new FormData();
fdIMAPSettings.left = new FormAttachment(0, margin);
fdIMAPSettings.top = new FormAttachment(wPOP3Settings, 2 * margin);
fdIMAPSettings.right = new FormAttachment(100, -margin);
wIMAPSettings.setLayoutData(fdIMAPSettings);
// ///////////////////////////////////////////////////////////
// / END OF IMAP SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdSettingsComp = new FormData();
fdSettingsComp.left = new FormAttachment(0, 0);
fdSettingsComp.top = new FormAttachment(wName, 0);
fdSettingsComp.right = new FormAttachment(100, 0);
fdSettingsComp.bottom = new FormAttachment(100, 0);
wSettingsComp.setLayoutData(fdSettingsComp);
wSettingsComp.layout();
wSettingsTab.setControl(wSettingsComp);
props.setLook(wSettingsComp);
// ///////////////////////////////////////////////////////////
// / END OF Pop TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF SEARCH TAB ///
// ////////////////////////
wSearchTab = new CTabItem(wTabFolder, SWT.NONE);
wSearchTab.setText(BaseMessages.getString(PKG, "JobGetPOP.Tab.Search.Label"));
wSearchComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSearchComp);
FormLayout searchLayout = new FormLayout();
searchLayout.marginWidth = 3;
searchLayout.marginHeight = 3;
wSearchComp.setLayout(searchLayout);
// ////////////////////////
// START OF HEADER ROUP///
// /
wHeader = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wHeader);
wHeader.setText(BaseMessages.getString(PKG, "JobGetPOP.Header.Group.Label"));
FormLayout HeadergroupLayout = new FormLayout();
HeadergroupLayout.marginWidth = 10;
HeadergroupLayout.marginHeight = 10;
wHeader.setLayout(HeadergroupLayout);
wNegateSender = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateSender);
fdNegateSender = new FormData();
wNegateSender.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateSender.Tooltip"));
fdNegateSender.top = new FormAttachment(0, margin);
fdNegateSender.right = new FormAttachment(100, -margin);
wNegateSender.setLayoutData(fdNegateSender);
// From line
wlSender = new Label(wHeader, SWT.RIGHT);
wlSender.setText(BaseMessages.getString(PKG, "JobGetPOP.wSender.Label"));
props.setLook(wlSender);
fdlSender = new FormData();
fdlSender.left = new FormAttachment(0, 0);
fdlSender.top = new FormAttachment(0, margin);
fdlSender.right = new FormAttachment(middle, -margin);
wlSender.setLayoutData(fdlSender);
wSender = new TextVar(jobMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSender);
wSender.addModifyListener(lsMod);
fdSender = new FormData();
fdSender.left = new FormAttachment(middle, 0);
fdSender.top = new FormAttachment(0, margin);
fdSender.right = new FormAttachment(wNegateSender, -margin);
wSender.setLayoutData(fdSender);
wNegateReceipient = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateReceipient);
fdNegateReceipient = new FormData();
wNegateReceipient.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateReceipient.Tooltip"));
fdNegateReceipient.top = new FormAttachment(wSender, margin);
fdNegateReceipient.right = new FormAttachment(100, -margin);
wNegateReceipient.setLayoutData(fdNegateReceipient);
// Receipient line
wlReceipient = new Label(wHeader, SWT.RIGHT);
wlReceipient.setText(BaseMessages.getString(PKG, "JobGetPOP.Receipient.Label"));
props.setLook(wlReceipient);
fdlReceipient = new FormData();
fdlReceipient.left = new FormAttachment(0, 0);
fdlReceipient.top = new FormAttachment(wSender, margin);
fdlReceipient.right = new FormAttachment(middle, -margin);
wlReceipient.setLayoutData(fdlReceipient);
wReceipient = new TextVar(jobMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wReceipient);
wReceipient.addModifyListener(lsMod);
fdReceipient = new FormData();
fdReceipient.left = new FormAttachment(middle, 0);
fdReceipient.top = new FormAttachment(wSender, margin);
fdReceipient.right = new FormAttachment(wNegateReceipient, -margin);
wReceipient.setLayoutData(fdReceipient);
wNegateSubject = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateSubject);
fdNegateSubject = new FormData();
wNegateSubject.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateSubject.Tooltip"));
fdNegateSubject.top = new FormAttachment(wReceipient, margin);
fdNegateSubject.right = new FormAttachment(100, -margin);
wNegateSubject.setLayoutData(fdNegateSubject);
// Subject line
wlSubject = new Label(wHeader, SWT.RIGHT);
wlSubject.setText(BaseMessages.getString(PKG, "JobGetPOP.Subject.Label"));
props.setLook(wlSubject);
fdlSubject = new FormData();
fdlSubject.left = new FormAttachment(0, 0);
fdlSubject.top = new FormAttachment(wReceipient, margin);
fdlSubject.right = new FormAttachment(middle, -margin);
wlSubject.setLayoutData(fdlSubject);
wSubject = new TextVar(jobMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSubject);
wSubject.addModifyListener(lsMod);
fdSubject = new FormData();
fdSubject.left = new FormAttachment(middle, 0);
fdSubject.top = new FormAttachment(wReceipient, margin);
fdSubject.right = new FormAttachment(wNegateSubject, -margin);
wSubject.setLayoutData(fdSubject);
fdHeader = new FormData();
fdHeader.left = new FormAttachment(0, margin);
fdHeader.top = new FormAttachment(wReceipient, 2 * margin);
fdHeader.right = new FormAttachment(100, -margin);
wHeader.setLayoutData(fdHeader);
// ///////////////////////////////////////////////////////////
// / END OF HEADER GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT GROUP///
// /
wContent = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wContent);
wContent.setText(BaseMessages.getString(PKG, "JobGetPOP.Content.Group.Label"));
FormLayout ContentgroupLayout = new FormLayout();
ContentgroupLayout.marginWidth = 10;
ContentgroupLayout.marginHeight = 10;
wContent.setLayout(ContentgroupLayout);
wNegateBody = new Button(wContent, SWT.CHECK);
props.setLook(wNegateBody);
fdNegateBody = new FormData();
wNegateBody.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateBody.Tooltip"));
fdNegateBody.top = new FormAttachment(wHeader, margin);
fdNegateBody.right = new FormAttachment(100, -margin);
wNegateBody.setLayoutData(fdNegateBody);
// Body line
wlBody = new Label(wContent, SWT.RIGHT);
wlBody.setText(BaseMessages.getString(PKG, "JobGetPOP.Body.Label"));
props.setLook(wlBody);
fdlBody = new FormData();
fdlBody.left = new FormAttachment(0, 0);
fdlBody.top = new FormAttachment(wHeader, margin);
fdlBody.right = new FormAttachment(middle, -margin);
wlBody.setLayoutData(fdlBody);
wBody = new TextVar(jobMeta, wContent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBody);
wBody.addModifyListener(lsMod);
fdBody = new FormData();
fdBody.left = new FormAttachment(middle, 0);
fdBody.top = new FormAttachment(wHeader, margin);
fdBody.right = new FormAttachment(wNegateBody, -margin);
wBody.setLayoutData(fdBody);
fdContent = new FormData();
fdContent.left = new FormAttachment(0, margin);
fdContent.top = new FormAttachment(wHeader, margin);
fdContent.right = new FormAttachment(100, -margin);
wContent.setLayoutData(fdContent);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF RECEIVED DATE ROUP///
// /
wReceivedDate = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wReceivedDate);
wReceivedDate.setText(BaseMessages.getString(PKG, "JobGetPOP.ReceivedDate.Group.Label"));
FormLayout ReceivedDategroupLayout = new FormLayout();
ReceivedDategroupLayout.marginWidth = 10;
ReceivedDategroupLayout.marginHeight = 10;
wReceivedDate.setLayout(ReceivedDategroupLayout);
wNegateReceivedDate = new Button(wReceivedDate, SWT.CHECK);
props.setLook(wNegateReceivedDate);
fdNegateReceivedDate = new FormData();
wNegateReceivedDate.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateReceivedDate.Tooltip"));
fdNegateReceivedDate.top = new FormAttachment(wContent, margin);
fdNegateReceivedDate.right = new FormAttachment(100, -margin);
wNegateReceivedDate.setLayoutData(fdNegateReceivedDate);
// Received Date Condition
wlConditionOnReceivedDate = new Label(wReceivedDate, SWT.RIGHT);
wlConditionOnReceivedDate.setText(BaseMessages.getString(PKG, "JobGetPOP.ConditionOnReceivedDate.Label"));
props.setLook(wlConditionOnReceivedDate);
fdlConditionOnReceivedDate = new FormData();
fdlConditionOnReceivedDate.left = new FormAttachment(0, 0);
fdlConditionOnReceivedDate.right = new FormAttachment(middle, -margin);
fdlConditionOnReceivedDate.top = new FormAttachment(wContent, margin);
wlConditionOnReceivedDate.setLayoutData(fdlConditionOnReceivedDate);
wConditionOnReceivedDate = new CCombo(wReceivedDate, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wConditionOnReceivedDate.setItems(MailConnectionMeta.conditionDateDesc);
// +1: starts at -1
wConditionOnReceivedDate.select(0);
props.setLook(wConditionOnReceivedDate);
fdConditionOnReceivedDate = new FormData();
fdConditionOnReceivedDate.left = new FormAttachment(middle, 0);
fdConditionOnReceivedDate.top = new FormAttachment(wContent, margin);
fdConditionOnReceivedDate.right = new FormAttachment(wNegateReceivedDate, -margin);
wConditionOnReceivedDate.setLayoutData(fdConditionOnReceivedDate);
wConditionOnReceivedDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
conditionReceivedDate();
jobEntry.setChanged();
}
});
open = new Button(wReceivedDate, SWT.PUSH);
open.setImage(GUIResource.getInstance().getImageCalendar());
open.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.OpenCalendar"));
FormData fdlButton = new FormData();
fdlButton.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdlButton.right = new FormAttachment(100, 0);
open.setLayoutData(fdlButton);
open.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
dialog.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectDate"));
dialog.setImage(GUIResource.getInstance().getImageSpoon());
dialog.setLayout(new GridLayout(3, false));
final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
final DateTime time = new DateTime(dialog, SWT.TIME | SWT.TIME);
new Label(dialog, SWT.NONE);
new Label(dialog, SWT.NONE);
Button ok = new Button(dialog, SWT.PUSH);
ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
ok.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, calendar.getYear());
cal.set(Calendar.MONTH, calendar.getMonth());
cal.set(Calendar.DAY_OF_MONTH, calendar.getDay());
cal.set(Calendar.HOUR_OF_DAY, time.getHours());
cal.set(Calendar.MINUTE, time.getMinutes());
cal.set(Calendar.SECOND, time.getSeconds());
wReadFrom.setText(new SimpleDateFormat(JobEntryGetPOP.DATE_PATTERN).format(cal.getTime()));
dialog.close();
}
});
dialog.setDefaultButton(ok);
dialog.pack();
dialog.open();
}
});
wlReadFrom = new Label(wReceivedDate, SWT.RIGHT);
wlReadFrom.setText(BaseMessages.getString(PKG, "JobGetPOP.ReadFrom.Label"));
props.setLook(wlReadFrom);
fdlReadFrom = new FormData();
fdlReadFrom.left = new FormAttachment(0, 0);
fdlReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdlReadFrom.right = new FormAttachment(middle, -margin);
wlReadFrom.setLayoutData(fdlReadFrom);
wReadFrom = new TextVar(jobMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadFrom.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.ReadFrom.Tooltip"));
props.setLook(wReadFrom);
wReadFrom.addModifyListener(lsMod);
fdReadFrom = new FormData();
fdReadFrom.left = new FormAttachment(middle, 0);
fdReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdReadFrom.right = new FormAttachment(open, -margin);
wReadFrom.setLayoutData(fdReadFrom);
opento = new Button(wReceivedDate, SWT.PUSH);
opento.setImage(GUIResource.getInstance().getImageCalendar());
opento.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.OpenCalendar"));
FormData fdlButtonto = new FormData();
fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
fdlButtonto.right = new FormAttachment(100, 0);
opento.setLayoutData(fdlButtonto);
opento.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
dialogto.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectDate"));
dialogto.setImage(GUIResource.getInstance().getImageSpoon());
dialogto.setLayout(new GridLayout(3, false));
final DateTime calendarto = new DateTime(dialogto, SWT.CALENDAR | SWT.BORDER);
final DateTime timeto = new DateTime(dialogto, SWT.TIME | SWT.TIME);
new Label(dialogto, SWT.NONE);
new Label(dialogto, SWT.NONE);
Button okto = new Button(dialogto, SWT.PUSH);
okto.setText(BaseMessages.getString(PKG, "System.Button.OK"));
okto.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
okto.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, calendarto.getYear());
cal.set(Calendar.MONTH, calendarto.getMonth());
cal.set(Calendar.DAY_OF_MONTH, calendarto.getDay());
cal.set(Calendar.HOUR_OF_DAY, timeto.getHours());
cal.set(Calendar.MINUTE, timeto.getMinutes());
cal.set(Calendar.SECOND, timeto.getSeconds());
wReadTo.setText(new SimpleDateFormat(JobEntryGetPOP.DATE_PATTERN).format(cal.getTime()));
dialogto.close();
}
});
dialogto.setDefaultButton(okto);
dialogto.pack();
dialogto.open();
}
});
wlReadTo = new Label(wReceivedDate, SWT.RIGHT);
wlReadTo.setText(BaseMessages.getString(PKG, "JobGetPOP.ReadTo.Label"));
props.setLook(wlReadTo);
fdlReadTo = new FormData();
fdlReadTo.left = new FormAttachment(0, 0);
fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdlReadTo.right = new FormAttachment(middle, -margin);
wlReadTo.setLayoutData(fdlReadTo);
wReadTo = new TextVar(jobMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadTo.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.ReadTo.Tooltip"));
props.setLook(wReadTo);
wReadTo.addModifyListener(lsMod);
fdReadTo = new FormData();
fdReadTo.left = new FormAttachment(middle, 0);
fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdReadTo.right = new FormAttachment(opento, -margin);
wReadTo.setLayoutData(fdReadTo);
fdReceivedDate = new FormData();
fdReceivedDate.left = new FormAttachment(0, margin);
fdReceivedDate.top = new FormAttachment(wContent, margin);
fdReceivedDate.right = new FormAttachment(100, -margin);
wReceivedDate.setLayoutData(fdReceivedDate);
// ///////////////////////////////////////////////////////////
// / END OF RECEIVED DATE GROUP
// ///////////////////////////////////////////////////////////
fdSearchComp = new FormData();
fdSearchComp.left = new FormAttachment(0, 0);
fdSearchComp.top = new FormAttachment(wName, 0);
fdSearchComp.right = new FormAttachment(100, 0);
fdSearchComp.bottom = new FormAttachment(100, 0);
wSearchComp.setLayoutData(fdSearchComp);
wSearchComp.layout();
wSearchTab.setControl(wSearchComp);
props.setLook(wSearchComp);
// ////////////////////////////////
// / END OF SEARCH TAB
// ////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wTest.addListener(SWT.Selection, lsTest);
lsTestIMAPFolder = new Listener() {
public void handleEvent(Event e) {
checkFolder(jobMeta.environmentSubstitute(wIMAPFolder.getText()));
}
};
wTestIMAPFolder.addListener(SWT.Selection, lsTestIMAPFolder);
lsTestMoveToFolder = new Listener() {
public void handleEvent(Event e) {
checkFolder(jobMeta.environmentSubstitute(wMoveToFolder.getText()));
}
};
wTestMoveToFolder.addListener(SWT.Selection, lsTestMoveToFolder);
lsSelectFolder = new Listener() {
public void handleEvent(Event e) {
selectFolder(wIMAPFolder);
}
};
wSelectFolder.addListener(SWT.Selection, lsSelectFolder);
lsSelectMoveToFolder = new Listener() {
public void handleEvent(Event e) {
selectFolder(wMoveToFolder);
}
};
wSelectMoveToFolder.addListener(SWT.Selection, lsSelectMoveToFolder);
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
setUserProxy();
chooseListMails();
activeAttachmentFolder();
refreshProtocol(false);
conditionReceivedDate();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobEntryGetPOPDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-cassandra-plugin by pentaho.
the class CassandraInputDialog method open.
@Override
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
setShellImage(shell, m_currentMeta);
// used to listen to a text field (m_wStepname)
ModifyListener lsMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_currentMeta.setChanged();
}
};
changed = m_currentMeta.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
// $NON-NLS-1$
shell.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
m_stepnameLabel = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
m_stepnameLabel.setText(BaseMessages.getString(PKG, "CassandraInputDialog.StepName.Label"));
props.setLook(m_stepnameLabel);
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(middle, -margin);
fd.top = new FormAttachment(0, margin);
m_stepnameLabel.setLayoutData(fd);
m_stepnameText = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
m_stepnameText.setText(stepname);
props.setLook(m_stepnameText);
m_stepnameText.addModifyListener(lsMod);
// format the text field
fd = new FormData();
fd.left = new FormAttachment(middle, 0);
fd.top = new FormAttachment(0, margin);
fd.right = new FormAttachment(100, 0);
m_stepnameText.setLayoutData(fd);
// host line
m_hostLab = new Label(shell, SWT.RIGHT);
props.setLook(m_hostLab);
// $NON-NLS-1$
m_hostLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Hostname.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_stepnameText, margin);
fd.right = new FormAttachment(middle, -margin);
m_hostLab.setLayoutData(fd);
m_hostText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_hostText);
m_hostText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_hostText.setToolTipText(transMeta.environmentSubstitute(m_hostText.getText()));
}
});
m_hostText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_stepnameText, margin);
fd.left = new FormAttachment(middle, 0);
m_hostText.setLayoutData(fd);
// port line
m_portLab = new Label(shell, SWT.RIGHT);
props.setLook(m_portLab);
// $NON-NLS-1$
m_portLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Port.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_hostText, margin);
fd.right = new FormAttachment(middle, -margin);
m_portLab.setLayoutData(fd);
m_portText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_portText);
m_portText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_portText.setToolTipText(transMeta.environmentSubstitute(m_portText.getText()));
}
});
m_portText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_hostText, margin);
fd.left = new FormAttachment(middle, 0);
m_portText.setLayoutData(fd);
// timeout line
m_timeoutLab = new Label(shell, SWT.RIGHT);
props.setLook(m_timeoutLab);
// $NON-NLS-1$
m_timeoutLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Timeout.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_portText, margin);
fd.right = new FormAttachment(middle, -margin);
m_timeoutLab.setLayoutData(fd);
m_timeoutText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_timeoutText);
m_timeoutText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_timeoutText.setToolTipText(transMeta.environmentSubstitute(m_timeoutText.getText()));
}
});
m_timeoutText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_portText, margin);
fd.left = new FormAttachment(middle, 0);
m_timeoutText.setLayoutData(fd);
// max length line
m_maxLengthLab = new Label(shell, SWT.RIGHT);
props.setLook(m_maxLengthLab);
m_maxLengthLab.setText(// $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraInputDialog.TransportMaxLength.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_timeoutText, margin);
fd.right = new FormAttachment(middle, -margin);
m_maxLengthLab.setLayoutData(fd);
m_maxLengthText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_maxLengthText);
m_maxLengthText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_maxLengthText.setToolTipText(transMeta.environmentSubstitute(m_maxLengthText.getText()));
}
});
m_maxLengthText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_timeoutText, margin);
fd.left = new FormAttachment(middle, 0);
m_maxLengthText.setLayoutData(fd);
// username line
m_userLab = new Label(shell, SWT.RIGHT);
props.setLook(m_userLab);
// $NON-NLS-1$
m_userLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.User.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_maxLengthText, margin);
fd.right = new FormAttachment(middle, -margin);
m_userLab.setLayoutData(fd);
m_userText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_userText);
m_userText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_maxLengthText, margin);
fd.left = new FormAttachment(middle, 0);
m_userText.setLayoutData(fd);
// password line
m_passLab = new Label(shell, SWT.RIGHT);
props.setLook(m_passLab);
// $NON-NLS-1$
m_passLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Password.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_userText, margin);
fd.right = new FormAttachment(middle, -margin);
m_passLab.setLayoutData(fd);
m_passText = new PasswordTextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_passText);
m_passText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_userText, margin);
fd.left = new FormAttachment(middle, 0);
m_passText.setLayoutData(fd);
// keyspace line
m_keyspaceLab = new Label(shell, SWT.RIGHT);
props.setLook(m_keyspaceLab);
// $NON-NLS-1$
m_keyspaceLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Keyspace.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_passText, margin);
fd.right = new FormAttachment(middle, -margin);
m_keyspaceLab.setLayoutData(fd);
m_keyspaceText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_keyspaceText);
m_keyspaceText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_keyspaceText.setToolTipText(transMeta.environmentSubstitute(m_keyspaceText.getText()));
}
});
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_passText, margin);
fd.left = new FormAttachment(middle, 0);
m_keyspaceText.setLayoutData(fd);
// compression check box
m_compressionLab = new Label(shell, SWT.RIGHT);
props.setLook(m_compressionLab);
m_compressionLab.setText(// $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraInputDialog.UseCompression.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_keyspaceText, margin);
fd.right = new FormAttachment(middle, -margin);
m_compressionLab.setLayoutData(fd);
m_useCompressionBut = new Button(shell, SWT.CHECK);
props.setLook(m_useCompressionBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.left = new FormAttachment(middle, 0);
fd.top = new FormAttachment(m_keyspaceText, margin);
m_useCompressionBut.setLayoutData(fd);
m_useCompressionBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
m_currentMeta.setChanged();
}
});
// execute for each row
Label executeForEachLab = new Label(shell, SWT.RIGHT);
props.setLook(executeForEachLab);
executeForEachLab.setText(// $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraInputDialog.ExecuteForEachRow.Label"));
fd = new FormData();
fd.right = new FormAttachment(middle, -margin);
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_useCompressionBut, margin);
executeForEachLab.setLayoutData(fd);
m_executeForEachRowBut = new Button(shell, SWT.CHECK);
props.setLook(m_executeForEachRowBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.left = new FormAttachment(middle, 0);
fd.top = new FormAttachment(m_useCompressionBut, margin);
m_executeForEachRowBut.setLayoutData(fd);
// Buttons inherited from BaseStepDialog
wOK = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wPreview = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wPreview.setText(BaseMessages.getString(PKG, "System.Button.Preview"));
wCancel = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, m_cqlText);
// position label
m_positionLab = new Label(shell, SWT.NONE);
props.setLook(m_positionLab);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(middle, -margin);
fd.bottom = new FormAttachment(wOK, -margin);
m_positionLab.setLayoutData(fd);
m_showSchemaBut = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
m_showSchemaBut.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Schema.Button"));
props.setLook(m_showSchemaBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(wOK, -margin);
m_showSchemaBut.setLayoutData(fd);
m_showSchemaBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
popupSchemaInfo();
}
});
// cql stuff
m_cqlLab = new Label(shell, SWT.NONE);
props.setLook(m_cqlLab);
// $NON-NLS-1$
m_cqlLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.CQL.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_executeForEachRowBut, margin);
fd.right = new FormAttachment(middle, -margin);
m_cqlLab.setLayoutData(fd);
m_cqlText = new StyledTextComp(transMeta, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, // $NON-NLS-1$
"");
props.setLook(m_cqlText, PropsUI.WIDGET_STYLE_FIXED);
m_cqlText.addModifyListener(lsMod);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_cqlLab, margin);
fd.right = new FormAttachment(100, -2 * margin);
fd.bottom = new FormAttachment(m_showSchemaBut, -margin);
m_cqlText.setLayoutData(fd);
m_cqlText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
setPosition();
m_cqlText.setToolTipText(transMeta.environmentSubstitute(m_cqlText.getText()));
}
});
// Text Highlighting
m_cqlText.addLineStyleListener(new SQLValuesHighlight());
m_cqlText.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setPosition();
}
@Override
public void keyReleased(KeyEvent e) {
setPosition();
}
});
m_cqlText.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setPosition();
}
@Override
public void focusLost(FocusEvent e) {
setPosition();
}
});
m_cqlText.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
@Override
public void mouseDown(MouseEvent e) {
setPosition();
}
@Override
public void mouseUp(MouseEvent e) {
setPosition();
}
});
// Add listeners
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsPreview = new Listener() {
@Override
public void handleEvent(Event e) {
preview();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wPreview.addListener(SWT.Selection, lsPreview);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
m_stepnameText.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
setSize();
getData();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class JobEntryFTPPUTDialog 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) {
ftpclient = null;
pwdFolder = 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, "JobFTPPUT.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobFTPPUT.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobFTPPUT.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobFTPPUT.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wlServerName = new Label(wServerSettings, SWT.RIGHT);
wlServerName.setText(BaseMessages.getString(PKG, "JobFTPPUT.Server.Label"));
props.setLook(wlServerName);
fdlServerName = new FormData();
fdlServerName.left = new FormAttachment(0, 0);
fdlServerName.top = new FormAttachment(wName, margin);
fdlServerName.right = new FormAttachment(middle, 0);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, margin);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// ServerPort line
wlServerPort = new Label(wServerSettings, SWT.RIGHT);
wlServerPort.setText(BaseMessages.getString(PKG, "JobFTPPUT.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, 0);
wlServerPort.setLayoutData(fdlServerPort);
wServerPort = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerPort);
wServerPort.setToolTipText(BaseMessages.getString(PKG, "JobFTPPUT.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);
// UserName line
wlUserName = new Label(wServerSettings, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "JobFTPPUT.Username.Label"));
props.setLook(wlUserName);
fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wServerPort, margin);
fdlUserName.right = new FormAttachment(middle, 0);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, margin);
fdUserName.top = new FormAttachment(wServerPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wlPassword = new Label(wServerSettings, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "JobFTPPUT.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, 0);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, margin);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Proxy host line
wProxyHost = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPPUT.ProxyHost.Label"), BaseMessages.getString(PKG, "JobFTPPUT.ProxyHost.Tooltip"));
props.setLook(wProxyHost);
wProxyHost.addModifyListener(lsMod);
fdProxyHost = new FormData();
fdProxyHost.left = new FormAttachment(0, 0);
fdProxyHost.top = new FormAttachment(wPassword, 2 * margin);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// Proxy port line
wProxyPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPPUT.ProxyPort.Label"), BaseMessages.getString(PKG, "JobFTPPUT.ProxyPort.Tooltip"));
props.setLook(wProxyPort);
wProxyPort.addModifyListener(lsMod);
fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(0, 0);
fdProxyPort.top = new FormAttachment(wProxyHost, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
// Proxy username line
wProxyUsername = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPPUT.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTPPUT.ProxyUsername.Tooltip"));
props.setLook(wProxyUsername);
wProxyUsername.addModifyListener(lsMod);
fdProxyUsername = new FormData();
fdProxyUsername.left = new FormAttachment(0, 0);
fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
fdProxyUsername.right = new FormAttachment(100, 0);
wProxyUsername.setLayoutData(fdProxyUsername);
// Proxy password line
wProxyPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPPUT.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTPPUT.ProxyPassword.Tooltip"), true);
props.setLook(wProxyPassword);
wProxyPassword.addModifyListener(lsMod);
fdProxyPasswd = new FormData();
fdProxyPasswd.left = new FormAttachment(0, 0);
fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
fdProxyPasswd.right = new FormAttachment(100, 0);
wProxyPassword.setLayoutData(fdProxyPasswd);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobFTPPUT.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobFTPPUT.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wProxyPassword, 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///
// /
wAdvancedSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedSettings);
wAdvancedSettings.setText(BaseMessages.getString(PKG, "JobFTPPUT.AdvancedSettings.Group.Label"));
FormLayout AdvancedSettingsgroupLayout = new FormLayout();
AdvancedSettingsgroupLayout.marginWidth = 10;
AdvancedSettingsgroupLayout.marginHeight = 10;
wAdvancedSettings.setLayout(AdvancedSettingsgroupLayout);
// Binary mode selection...
wlBinaryMode = new Label(wAdvancedSettings, SWT.RIGHT);
wlBinaryMode.setText(BaseMessages.getString(PKG, "JobFTPPUT.BinaryMode.Label"));
props.setLook(wlBinaryMode);
fdlBinaryMode = new FormData();
fdlBinaryMode.left = new FormAttachment(0, 0);
fdlBinaryMode.top = new FormAttachment(wServerSettings, margin);
fdlBinaryMode.right = new FormAttachment(middle, 0);
wlBinaryMode.setLayoutData(fdlBinaryMode);
wBinaryMode = new Button(wAdvancedSettings, SWT.CHECK);
props.setLook(wBinaryMode);
wBinaryMode.setToolTipText(BaseMessages.getString(PKG, "JobFTPPUT.BinaryMode.Tooltip"));
fdBinaryMode = new FormData();
fdBinaryMode.left = new FormAttachment(middle, 0);
fdBinaryMode.top = new FormAttachment(wServerSettings, margin);
fdBinaryMode.right = new FormAttachment(100, 0);
wBinaryMode.setLayoutData(fdBinaryMode);
// TimeOut...
wlTimeout = new Label(wAdvancedSettings, SWT.RIGHT);
wlTimeout.setText(BaseMessages.getString(PKG, "JobFTPPUT.Timeout.Label"));
props.setLook(wlTimeout);
fdlTimeout = new FormData();
fdlTimeout.left = new FormAttachment(0, 0);
fdlTimeout.top = new FormAttachment(wBinaryMode, margin);
fdlTimeout.right = new FormAttachment(middle, 0);
wlTimeout.setLayoutData(fdlTimeout);
wTimeout = new TextVar(jobMeta, wAdvancedSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPPUT.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.setToolTipText(BaseMessages.getString(PKG, "JobFTPPUT.Timeout.Tooltip"));
fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(middle, 0);
fdTimeout.top = new FormAttachment(wBinaryMode, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// active connection?
wlActive = new Label(wAdvancedSettings, SWT.RIGHT);
wlActive.setText(BaseMessages.getString(PKG, "JobFTPPUT.ActiveConns.Label"));
props.setLook(wlActive);
fdlActive = new FormData();
fdlActive.left = new FormAttachment(0, 0);
fdlActive.top = new FormAttachment(wTimeout, margin);
fdlActive.right = new FormAttachment(middle, 0);
wlActive.setLayoutData(fdlActive);
wActive = new Button(wAdvancedSettings, SWT.CHECK);
wActive.setToolTipText(BaseMessages.getString(PKG, "JobFTPPUT.ActiveConns.Tooltip"));
props.setLook(wActive);
fdActive = new FormData();
fdActive.left = new FormAttachment(middle, 0);
fdActive.top = new FormAttachment(wTimeout, margin);
fdActive.right = new FormAttachment(100, 0);
wActive.setLayoutData(fdActive);
// Control encoding line
//
// The drop down is editable as it may happen an encoding may not be present
// on one machine, but you may want to use it on your execution server
//
wlControlEncoding = new Label(wAdvancedSettings, SWT.RIGHT);
wlControlEncoding.setText(BaseMessages.getString(PKG, "JobFTPPUT.ControlEncoding.Label"));
props.setLook(wlControlEncoding);
fdlControlEncoding = new FormData();
fdlControlEncoding.left = new FormAttachment(0, 0);
fdlControlEncoding.top = new FormAttachment(wActive, margin);
fdlControlEncoding.right = new FormAttachment(middle, 0);
wlControlEncoding.setLayoutData(fdlControlEncoding);
wControlEncoding = new Combo(wAdvancedSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wControlEncoding.setToolTipText(BaseMessages.getString(PKG, "JobFTPPUT.ControlEncoding.Tooltip"));
wControlEncoding.setItems(encodings);
props.setLook(wControlEncoding);
fdControlEncoding = new FormData();
fdControlEncoding.left = new FormAttachment(middle, 0);
fdControlEncoding.top = new FormAttachment(wActive, margin);
fdControlEncoding.right = new FormAttachment(100, 0);
wControlEncoding.setLayoutData(fdControlEncoding);
fdAdvancedSettings = new FormData();
fdAdvancedSettings.left = new FormAttachment(0, margin);
fdAdvancedSettings.top = new FormAttachment(wServerSettings, margin);
fdAdvancedSettings.right = new FormAttachment(100, -margin);
wAdvancedSettings.setLayoutData(fdAdvancedSettings);
// ///////////////////////////////////////////////////////////
// / END OF Advanced SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Files TAB ///
// ////////////////////////
wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "JobFTPPUT.Tab.Files.Label"));
wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout FilesLayout = new FormLayout();
FilesLayout.marginWidth = 3;
FilesLayout.marginHeight = 3;
wFilesComp.setLayout(FilesLayout);
// ////////////////////////
// START OF Source SETTINGS GROUP///
// /
wSourceSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wSourceSettings);
wSourceSettings.setText(BaseMessages.getString(PKG, "JobFTPPUT.SourceSettings.Group.Label"));
FormLayout SourceSettinsgroupLayout = new FormLayout();
SourceSettinsgroupLayout.marginWidth = 10;
SourceSettinsgroupLayout.marginHeight = 10;
wSourceSettings.setLayout(SourceSettinsgroupLayout);
// Local (source) directory line
wlLocalDirectory = new Label(wSourceSettings, SWT.RIGHT);
wlLocalDirectory.setText(BaseMessages.getString(PKG, "JobFTPPUT.LocalDir.Label"));
props.setLook(wlLocalDirectory);
fdlLocalDirectory = new FormData();
fdlLocalDirectory.left = new FormAttachment(0, 0);
fdlLocalDirectory.top = new FormAttachment(0, margin);
fdlLocalDirectory.right = new FormAttachment(middle, -margin);
wlLocalDirectory.setLayoutData(fdlLocalDirectory);
// Browse folders button ...
wbLocalDirectory = new Button(wSourceSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbLocalDirectory);
wbLocalDirectory.setText(BaseMessages.getString(PKG, "JobFTPPUT.BrowseFolders.Label"));
fdbLocalDirectory = new FormData();
fdbLocalDirectory.right = new FormAttachment(100, 0);
fdbLocalDirectory.top = new FormAttachment(0, margin);
wbLocalDirectory.setLayoutData(fdbLocalDirectory);
wLocalDirectory = new TextVar(jobMeta, wSourceSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPPUT.LocalDir.Tooltip"));
props.setLook(wLocalDirectory);
wLocalDirectory.addModifyListener(lsMod);
fdLocalDirectory = new FormData();
fdLocalDirectory.left = new FormAttachment(middle, 0);
fdLocalDirectory.top = new FormAttachment(0, margin);
fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, -margin);
wLocalDirectory.setLayoutData(fdLocalDirectory);
// Wildcard line
wlWildcard = new Label(wSourceSettings, SWT.RIGHT);
wlWildcard.setText(BaseMessages.getString(PKG, "JobFTPPUT.Wildcard.Label"));
props.setLook(wlWildcard);
fdlWildcard = new FormData();
fdlWildcard.left = new FormAttachment(0, 0);
fdlWildcard.top = new FormAttachment(wLocalDirectory, margin);
fdlWildcard.right = new FormAttachment(middle, -margin);
wlWildcard.setLayoutData(fdlWildcard);
wWildcard = new TextVar(jobMeta, wSourceSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPPUT.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(middle, 0);
fdWildcard.top = new FormAttachment(wLocalDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
// Remove files after retrieval...
wlRemove = new Label(wSourceSettings, SWT.RIGHT);
wlRemove.setText(BaseMessages.getString(PKG, "JobFTPPUT.RemoveFiles.Label"));
props.setLook(wlRemove);
fdlRemove = new FormData();
fdlRemove.left = new FormAttachment(0, 0);
fdlRemove.top = new FormAttachment(wWildcard, 2 * margin);
fdlRemove.right = new FormAttachment(middle, -margin);
wlRemove.setLayoutData(fdlRemove);
wRemove = new Button(wSourceSettings, SWT.CHECK);
props.setLook(wRemove);
wRemove.setToolTipText(BaseMessages.getString(PKG, "JobFTPPUT.RemoveFiles.Tooltip"));
fdRemove = new FormData();
fdRemove.left = new FormAttachment(middle, 0);
fdRemove.top = new FormAttachment(wWildcard, 2 * margin);
fdRemove.right = new FormAttachment(100, 0);
wRemove.setLayoutData(fdRemove);
// OnlyNew files after retrieval...
wlOnlyNew = new Label(wSourceSettings, SWT.RIGHT);
wlOnlyNew.setText(BaseMessages.getString(PKG, "JobFTPPUT.DontOverwrite.Label"));
props.setLook(wlOnlyNew);
fdlOnlyNew = new FormData();
fdlOnlyNew.left = new FormAttachment(0, 0);
fdlOnlyNew.top = new FormAttachment(wRemove, margin);
fdlOnlyNew.right = new FormAttachment(middle, 0);
wlOnlyNew.setLayoutData(fdlOnlyNew);
wOnlyNew = new Button(wSourceSettings, SWT.CHECK);
wOnlyNew.setToolTipText(BaseMessages.getString(PKG, "JobFTPPUT.DontOverwrite.Tooltip"));
props.setLook(wOnlyNew);
fdOnlyNew = new FormData();
fdOnlyNew.left = new FormAttachment(middle, 0);
fdOnlyNew.top = new FormAttachment(wRemove, margin);
fdOnlyNew.right = new FormAttachment(100, 0);
wOnlyNew.setLayoutData(fdOnlyNew);
fdSourceSettings = new FormData();
fdSourceSettings.left = new FormAttachment(0, margin);
fdSourceSettings.top = new FormAttachment(0, 2 * margin);
fdSourceSettings.right = new FormAttachment(100, -margin);
wSourceSettings.setLayoutData(fdSourceSettings);
// ///////////////////////////////////////////////////////////
// / END OF Source SETTINGSGROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Target SETTINGS GROUP///
// /
wTargetSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wTargetSettings);
wTargetSettings.setText(BaseMessages.getString(PKG, "JobFTPPUT.TargetSettings.Group.Label"));
FormLayout TargetSettinsgroupLayout = new FormLayout();
TargetSettinsgroupLayout.marginWidth = 10;
TargetSettinsgroupLayout.marginHeight = 10;
wTargetSettings.setLayout(TargetSettinsgroupLayout);
// Remote Directory line
wlRemoteDirectory = new Label(wTargetSettings, SWT.RIGHT);
wlRemoteDirectory.setText(BaseMessages.getString(PKG, "JobFTPPUT.RemoteDir.Label"));
props.setLook(wlRemoteDirectory);
fdlRemoteDirectory = new FormData();
fdlRemoteDirectory.left = new FormAttachment(0, 0);
fdlRemoteDirectory.top = new FormAttachment(wSourceSettings, margin);
fdlRemoteDirectory.right = new FormAttachment(middle, -margin);
wlRemoteDirectory.setLayoutData(fdlRemoteDirectory);
// Test remote folder button ...
wbTestRemoteDirectoryExists = new Button(wTargetSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestRemoteDirectoryExists);
wbTestRemoteDirectoryExists.setText(BaseMessages.getString(PKG, "JobFTPPUT.TestFolderExists.Label"));
fdbTestRemoteDirectoryExists = new FormData();
fdbTestRemoteDirectoryExists.right = new FormAttachment(100, 0);
fdbTestRemoteDirectoryExists.top = new FormAttachment(wSourceSettings, margin);
wbTestRemoteDirectoryExists.setLayoutData(fdbTestRemoteDirectoryExists);
wRemoteDirectory = new TextVar(jobMeta, wTargetSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPPUT.RemoteDir.Tooltip"));
props.setLook(wRemoteDirectory);
wRemoteDirectory.addModifyListener(lsMod);
fdRemoteDirectory = new FormData();
fdRemoteDirectory.left = new FormAttachment(middle, 0);
fdRemoteDirectory.top = new FormAttachment(wSourceSettings, margin);
fdRemoteDirectory.right = new FormAttachment(wbTestRemoteDirectoryExists, -margin);
wRemoteDirectory.setLayoutData(fdRemoteDirectory);
fdTargetSettings = new FormData();
fdTargetSettings.left = new FormAttachment(0, margin);
fdTargetSettings.top = new FormAttachment(wSourceSettings, margin);
fdTargetSettings.right = new FormAttachment(100, -margin);
wTargetSettings.setLayoutData(fdTargetSettings);
// ///////////////////////////////////////////////////////////
// / END OF Target SETTINGSGROUP
// ///////////////////////////////////////////////////////////
fdFilesComp = new FormData();
fdFilesComp.left = new FormAttachment(0, 0);
fdFilesComp.top = new FormAttachment(0, 0);
fdFilesComp.right = new FormAttachment(100, 0);
fdFilesComp.bottom = new FormAttachment(100, 0);
wFilesComp.setLayoutData(fdFilesComp);
wFilesComp.layout();
wFilesTab.setControl(wFilesComp);
props.setLook(wFilesComp);
// ///////////////////////////////////////////////////////////
// / END OF Files TAB
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// Start of Socks Proxy Tab
// ///////////////////////////////////////////////////////////
wSocksProxyTab = new CTabItem(wTabFolder, SWT.NONE);
wSocksProxyTab.setText(BaseMessages.getString(PKG, "JobFTPPUT.Tab.Socks.Label"));
wSocksProxyComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSocksProxyComp);
FormLayout SoxProxyLayout = new FormLayout();
SoxProxyLayout.marginWidth = 3;
SoxProxyLayout.marginHeight = 3;
wSocksProxyComp.setLayout(SoxProxyLayout);
// ////////////////////////////////////////////////////////
// Start of Proxy Group
// ////////////////////////////////////////////////////////
wSocksProxy = new Group(wSocksProxyComp, SWT.SHADOW_NONE);
props.setLook(wSocksProxy);
wSocksProxy.setText(BaseMessages.getString(PKG, "JobFTPPUT.SocksProxy.Group.Label"));
FormLayout SocksProxyGroupLayout = new FormLayout();
SocksProxyGroupLayout.marginWidth = 10;
SocksProxyGroupLayout.marginHeight = 10;
wSocksProxy.setLayout(SocksProxyGroupLayout);
// host line
wSocksProxyHost = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPPUT.SocksProxyHost.Label"), BaseMessages.getString(PKG, "JobFTPPUT.SocksProxyHost.Tooltip"));
props.setLook(wSocksProxyHost);
wSocksProxyHost.addModifyListener(lsMod);
fdSocksProxyHost = new FormData();
fdSocksProxyHost.left = new FormAttachment(0, 0);
fdSocksProxyHost.top = new FormAttachment(wName, margin);
fdSocksProxyHost.right = new FormAttachment(100, margin);
wSocksProxyHost.setLayoutData(fdSocksProxyHost);
// port line
wSocksProxyPort = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPPUT.SocksProxyPort.Label"), BaseMessages.getString(PKG, "JobFTPPUT.SocksProxyPort.Tooltip"));
props.setLook(wSocksProxyPort);
wSocksProxyPort.addModifyListener(lsMod);
fdSocksProxyPort = new FormData();
fdSocksProxyPort.left = new FormAttachment(0, 0);
fdSocksProxyPort.top = new FormAttachment(wSocksProxyHost, margin);
fdSocksProxyPort.right = new FormAttachment(100, margin);
wSocksProxyPort.setLayoutData(fdSocksProxyPort);
// username line
wSocksProxyUsername = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPPUT.SocksProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTPPUT.SocksProxyPassword.Tooltip"));
props.setLook(wSocksProxyUsername);
wSocksProxyUsername.addModifyListener(lsMod);
fdSocksProxyUsername = new FormData();
fdSocksProxyUsername.left = new FormAttachment(0, 0);
fdSocksProxyUsername.top = new FormAttachment(wSocksProxyPort, margin);
fdSocksProxyUsername.right = new FormAttachment(100, margin);
wSocksProxyUsername.setLayoutData(fdSocksProxyUsername);
// password line
wSocksProxyPassword = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPPUT.SocksProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTPPUT.SocksProxyPassword.Tooltip"), true);
props.setLook(wSocksProxyPort);
wSocksProxyPassword.addModifyListener(lsMod);
fdSocksProxyPassword = new FormData();
fdSocksProxyPassword.left = new FormAttachment(0, 0);
fdSocksProxyPassword.top = new FormAttachment(wSocksProxyUsername, margin);
fdSocksProxyPassword.right = new FormAttachment(100, margin);
wSocksProxyPassword.setLayoutData(fdSocksProxyPassword);
// ///////////////////////////////////////////////////////////////
// End of socks proxy group
// ///////////////////////////////////////////////////////////////
fdSocksProxyComp = new FormData();
fdSocksProxyComp.left = new FormAttachment(0, margin);
fdSocksProxyComp.top = new FormAttachment(0, margin);
fdSocksProxyComp.right = new FormAttachment(100, -margin);
wSocksProxy.setLayoutData(fdSocksProxyComp);
wSocksProxyComp.layout();
wSocksProxyTab.setControl(wSocksProxyComp);
props.setLook(wSocksProxyComp);
// ////////////////////////////////////////////////////////
// End of Socks Proxy Tab
// ////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
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();
}
};
lsCheckRemoteFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder(jobMeta.environmentSubstitute(wRemoteDirectory.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);
}
}
});
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wbTestRemoteDirectoryExists.addListener(SWT.Selection, lsCheckRemoteFolder);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wRemoteDirectory.addSelectionListener(lsDef);
wLocalDirectory.addSelectionListener(lsDef);
wWildcard.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, "JobSFTPDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class SFTPPutDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SFTPPutDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "SFTPPutDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
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, "SFTPPutDialog.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "SFTPPUT.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wlServerName = new Label(wServerSettings, SWT.RIGHT);
wlServerName.setText(BaseMessages.getString(PKG, "SFTPPUT.Server.Label"));
props.setLook(wlServerName);
fdlServerName = new FormData();
fdlServerName.left = new FormAttachment(0, 0);
fdlServerName.top = new FormAttachment(wStepname, margin);
fdlServerName.right = new FormAttachment(middle, -margin);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, 0);
fdServerName.top = new FormAttachment(wStepname, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// ServerPort line
wlServerPort = new Label(wServerSettings, SWT.RIGHT);
wlServerPort.setText(BaseMessages.getString(PKG, "SFTPPUT.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(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerPort);
wServerPort.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.Port.Tooltip"));
wServerPort.addModifyListener(lsMod);
fdServerPort = new FormData();
fdServerPort.left = new FormAttachment(middle, 0);
fdServerPort.top = new FormAttachment(wServerName, margin);
fdServerPort.right = new FormAttachment(100, 0);
wServerPort.setLayoutData(fdServerPort);
// UserName line
wlUserName = new Label(wServerSettings, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "SFTPPUT.Username.Label"));
props.setLook(wlUserName);
fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wServerPort, margin);
fdlUserName.right = new FormAttachment(middle, -margin);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.Username.Tooltip"));
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, 0);
fdUserName.top = new FormAttachment(wServerPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wlPassword = new Label(wServerSettings, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "SFTPPUT.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// usePublicKey
wlusePublicKey = new Label(wServerSettings, SWT.RIGHT);
wlusePublicKey.setText(BaseMessages.getString(PKG, "SFTPPUT.useKeyFile.Label"));
props.setLook(wlusePublicKey);
fdlusePublicKey = new FormData();
fdlusePublicKey.left = new FormAttachment(0, 0);
fdlusePublicKey.top = new FormAttachment(wPassword, margin);
fdlusePublicKey.right = new FormAttachment(middle, -margin);
wlusePublicKey.setLayoutData(fdlusePublicKey);
wusePublicKey = new Button(wServerSettings, SWT.CHECK);
wusePublicKey.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.useKeyFile.Tooltip"));
props.setLook(wusePublicKey);
fdusePublicKey = new FormData();
fdusePublicKey.left = new FormAttachment(middle, 0);
fdusePublicKey.top = new FormAttachment(wPassword, margin);
fdusePublicKey.right = new FormAttachment(100, 0);
wusePublicKey.setLayoutData(fdusePublicKey);
wusePublicKey.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeUseKey();
transMeta.setChanged();
}
});
// Key File
wlKeyFilename = new Label(wServerSettings, SWT.RIGHT);
wlKeyFilename.setText(BaseMessages.getString(PKG, "SFTPPUT.KeyFilename.Label"));
props.setLook(wlKeyFilename);
fdlKeyFilename = new FormData();
fdlKeyFilename.left = new FormAttachment(0, 0);
fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdlKeyFilename.right = new FormAttachment(middle, -margin);
wlKeyFilename.setLayoutData(fdlKeyFilename);
wbKeyFilename = new Button(wServerSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbKeyFilename);
wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbKeyFilename = new FormData();
fdbKeyFilename.right = new FormAttachment(100, 0);
fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
// fdbKeyFilename.height = 22;
wbKeyFilename.setLayoutData(fdbKeyFilename);
wKeyFilename = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.KeyFilename.Tooltip"));
props.setLook(wKeyFilename);
wKeyFilename.addModifyListener(lsMod);
fdKeyFilename = new FormData();
fdKeyFilename.left = new FormAttachment(middle, 0);
fdKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
wKeyFilename.setLayoutData(fdKeyFilename);
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(transMeta.environmentSubstitute(wKeyFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// keyfilePass line
wkeyfilePass = new LabelTextVar(transMeta, wServerSettings, BaseMessages.getString(PKG, "SFTPPUT.keyfilePass.Label"), BaseMessages.getString(PKG, "SFTPPUT.keyfilePass.Tooltip"), true);
props.setLook(wkeyfilePass);
wkeyfilePass.addModifyListener(lsMod);
fdkeyfilePass = new FormData();
fdkeyfilePass.left = new FormAttachment(0, -margin);
fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
fdkeyfilePass.right = new FormAttachment(100, 0);
wkeyfilePass.setLayoutData(fdkeyfilePass);
wlProxyType = new Label(wServerSettings, SWT.RIGHT);
wlProxyType.setText(BaseMessages.getString(PKG, "SFTPPUT.ProxyType.Label"));
props.setLook(wlProxyType);
fdlProxyType = new FormData();
fdlProxyType.left = new FormAttachment(0, 0);
fdlProxyType.right = new FormAttachment(middle, -margin);
fdlProxyType.top = new FormAttachment(wkeyfilePass, 2 * margin);
wlProxyType.setLayoutData(fdlProxyType);
wProxyType = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wProxyType.add(SFTPClient.PROXY_TYPE_HTTP);
wProxyType.add(SFTPClient.PROXY_TYPE_SOCKS5);
// +1: starts at -1
wProxyType.select(0);
props.setLook(wProxyType);
fdProxyType = new FormData();
fdProxyType.left = new FormAttachment(middle, 0);
fdProxyType.top = new FormAttachment(wkeyfilePass, 2 * margin);
fdProxyType.right = new FormAttachment(100, 0);
wProxyType.setLayoutData(fdProxyType);
wProxyType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setDefaulProxyPort();
}
});
// Proxy host line
wProxyHost = new LabelTextVar(transMeta, wServerSettings, BaseMessages.getString(PKG, "SFTPPUT.ProxyHost.Label"), BaseMessages.getString(PKG, "SFTPPUT.ProxyHost.Tooltip"));
props.setLook(wProxyHost);
wProxyHost.addModifyListener(lsMod);
fdProxyHost = new FormData();
fdProxyHost.left = new FormAttachment(0, -2 * margin);
fdProxyHost.top = new FormAttachment(wProxyType, margin);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// Proxy port line
wProxyPort = new LabelTextVar(transMeta, wServerSettings, BaseMessages.getString(PKG, "SFTPPUT.ProxyPort.Label"), BaseMessages.getString(PKG, "SFTPPUT.ProxyPort.Tooltip"));
props.setLook(wProxyPort);
wProxyPort.addModifyListener(lsMod);
fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(0, -2 * margin);
fdProxyPort.top = new FormAttachment(wProxyHost, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
// Proxy username line
wProxyUsername = new LabelTextVar(transMeta, wServerSettings, BaseMessages.getString(PKG, "SFTPPUT.ProxyUsername.Label"), BaseMessages.getString(PKG, "SFTPPUT.ProxyUsername.Tooltip"));
props.setLook(wProxyUsername);
wProxyUsername.addModifyListener(lsMod);
fdProxyUsername = new FormData();
fdProxyUsername.left = new FormAttachment(0, -2 * margin);
fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
fdProxyUsername.right = new FormAttachment(100, 0);
wProxyUsername.setLayoutData(fdProxyUsername);
// Proxy password line
wProxyPassword = new LabelTextVar(transMeta, wServerSettings, BaseMessages.getString(PKG, "SFTPPUT.ProxyPassword.Label"), BaseMessages.getString(PKG, "SFTPPUT.ProxyPassword.Tooltip"), true);
props.setLook(wProxyPassword);
wProxyPassword.addModifyListener(lsMod);
fdProxyPasswd = new FormData();
fdProxyPasswd.left = new FormAttachment(0, -2 * margin);
fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
fdProxyPasswd.right = new FormAttachment(100, 0);
wProxyPassword.setLayoutData(fdProxyPasswd);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "SFTPPUT.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wProxyPassword, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wStepname, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
wlCompression = new Label(wGeneralComp, SWT.RIGHT);
wlCompression.setText(BaseMessages.getString(PKG, "SFTPPUT.Compression.Label"));
props.setLook(wlCompression);
fdlCompression = new FormData();
fdlCompression.left = new FormAttachment(0, -margin);
fdlCompression.right = new FormAttachment(middle, 0);
fdlCompression.top = new FormAttachment(wServerSettings, margin);
wlCompression.setLayoutData(fdlCompression);
wCompression = new CCombo(wGeneralComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wCompression.add("none");
wCompression.add("zlib");
// +1: starts at -1
wCompression.select(0);
props.setLook(wCompression);
fdCompression = new FormData();
fdCompression.left = new FormAttachment(middle, margin);
fdCompression.top = new FormAttachment(wServerSettings, margin);
fdCompression.right = new FormAttachment(100, 0);
wCompression.setLayoutData(fdCompression);
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Files TAB ///
// ////////////////////////
wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "SFTPPUT.Tab.Files.Label"));
wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout FilesLayout = new FormLayout();
FilesLayout.marginWidth = 3;
FilesLayout.marginHeight = 3;
wFilesComp.setLayout(FilesLayout);
// ////////////////////////
// START OF Source files GROUP///
// /
wSourceFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wSourceFiles);
wSourceFiles.setText(BaseMessages.getString(PKG, "SFTPPUT.SourceFiles.Group.Label"));
FormLayout SourceFilesgroupLayout = new FormLayout();
SourceFilesgroupLayout.marginWidth = 10;
SourceFilesgroupLayout.marginHeight = 10;
wSourceFiles.setLayout(SourceFilesgroupLayout);
// Add filenames to result filenames...
wlInputIsStream = new Label(wSourceFiles, SWT.RIGHT);
wlInputIsStream.setText(BaseMessages.getString(PKG, "SFTPPUT.InputIsStream.Label"));
props.setLook(wlInputIsStream);
fdlInputIsStream = new FormData();
fdlInputIsStream.left = new FormAttachment(0, 0);
fdlInputIsStream.top = new FormAttachment(wStepname, margin);
fdlInputIsStream.right = new FormAttachment(middle, -margin);
wlInputIsStream.setLayoutData(fdlInputIsStream);
wInputIsStream = new Button(wSourceFiles, SWT.CHECK);
wInputIsStream.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.InputIsStream.Tooltip"));
props.setLook(wInputIsStream);
fdInputIsStream = new FormData();
fdInputIsStream.left = new FormAttachment(middle, 0);
fdInputIsStream.top = new FormAttachment(wStepname, margin);
fdInputIsStream.right = new FormAttachment(100, 0);
wInputIsStream.setLayoutData(fdInputIsStream);
wInputIsStream.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setInputStream();
transMeta.setChanged();
}
});
// SourceFileNameField field
wlSourceFileNameField = new Label(wSourceFiles, SWT.RIGHT);
wlSourceFileNameField.setText(BaseMessages.getString(PKG, "SFTPPUTDialog.SourceFileNameField.Label"));
props.setLook(wlSourceFileNameField);
fdlSourceFileNameField = new FormData();
fdlSourceFileNameField.left = new FormAttachment(0, 0);
fdlSourceFileNameField.right = new FormAttachment(middle, -margin);
fdlSourceFileNameField.top = new FormAttachment(wInputIsStream, margin);
wlSourceFileNameField.setLayoutData(fdlSourceFileNameField);
wSourceFileNameField = new CCombo(wSourceFiles, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wSourceFileNameField);
wSourceFileNameField.setEditable(true);
wSourceFileNameField.addModifyListener(lsMod);
fdSourceFileNameField = new FormData();
fdSourceFileNameField.left = new FormAttachment(middle, 0);
fdSourceFileNameField.top = new FormAttachment(wInputIsStream, margin);
fdSourceFileNameField.right = new FormAttachment(100, -margin);
wSourceFileNameField.setLayoutData(fdSourceFileNameField);
wSourceFileNameField.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);
getFields();
shell.setCursor(null);
busy.dispose();
}
});
// Add filenames to result filenames...
wlAddFilenameToResult = new Label(wSourceFiles, SWT.RIGHT);
wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "SFTPPUT.AddfilenametoResult.Label"));
props.setLook(wlAddFilenameToResult);
fdlAddFilenameToResult = new FormData();
fdlAddFilenameToResult.left = new FormAttachment(0, 0);
fdlAddFilenameToResult.top = new FormAttachment(wSourceFileNameField, margin);
fdlAddFilenameToResult.right = new FormAttachment(middle, -margin);
wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
wAddFilenameToResult = new Button(wSourceFiles, SWT.CHECK);
wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.AddfilenametoResult.Tooltip"));
props.setLook(wAddFilenameToResult);
fdAddFilenameToResult = new FormData();
fdAddFilenameToResult.left = new FormAttachment(middle, 0);
fdAddFilenameToResult.top = new FormAttachment(wSourceFileNameField, margin);
fdAddFilenameToResult.right = new FormAttachment(100, 0);
wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
// After FTP Put
wlAfterFTPPut = new Label(wSourceFiles, SWT.RIGHT);
wlAfterFTPPut.setText(BaseMessages.getString(PKG, "SFTPPUT.AfterFTPPut.Label"));
props.setLook(wlAfterFTPPut);
fdlAfterFTPPut = new FormData();
fdlAfterFTPPut.left = new FormAttachment(0, 0);
fdlAfterFTPPut.right = new FormAttachment(middle, -margin);
fdlAfterFTPPut.top = new FormAttachment(wAddFilenameToResult, 2 * margin);
wlAfterFTPPut.setLayoutData(fdlAfterFTPPut);
wAfterFTPPut = new CCombo(wSourceFiles, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wAfterFTPPut.add(BaseMessages.getString(PKG, "SFTPPUT.AfterSFTP.DoNothing.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "SFTPPUT.AfterSFTP.Delete.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "SFTPPUT.AfterSFTP.Move.Label"));
// +1: starts at -1
wAfterFTPPut.select(0);
props.setLook(wAfterFTPPut);
fdAfterFTPPut = new FormData();
fdAfterFTPPut.left = new FormAttachment(middle, 0);
fdAfterFTPPut.top = new FormAttachment(wAddFilenameToResult, 2 * margin);
fdAfterFTPPut.right = new FormAttachment(100, -margin);
wAfterFTPPut.setLayoutData(fdAfterFTPPut);
wAfterFTPPut.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
AfterFTPPutActivate();
}
});
// moveTo Directory
wlDestinationFolderFieldName = new Label(wSourceFiles, SWT.RIGHT);
wlDestinationFolderFieldName.setText(BaseMessages.getString(PKG, "SFTPPUT.DestinationFolder.Label"));
props.setLook(wlDestinationFolderFieldName);
fdlDestinationFolderFieldName = new FormData();
fdlDestinationFolderFieldName.left = new FormAttachment(0, 0);
fdlDestinationFolderFieldName.top = new FormAttachment(wAfterFTPPut, margin);
fdlDestinationFolderFieldName.right = new FormAttachment(middle, -margin);
wlDestinationFolderFieldName.setLayoutData(fdlDestinationFolderFieldName);
wDestinationFolderFieldName = new CCombo(wSourceFiles, SWT.BORDER | SWT.READ_ONLY);
wDestinationFolderFieldName.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.DestinationFolder.Tooltip"));
props.setLook(wDestinationFolderFieldName);
wDestinationFolderFieldName.addModifyListener(lsMod);
fdDestinationFolderFieldName = new FormData();
fdDestinationFolderFieldName.left = new FormAttachment(middle, 0);
fdDestinationFolderFieldName.top = new FormAttachment(wAfterFTPPut, margin);
fdDestinationFolderFieldName.right = new FormAttachment(100, -margin);
wDestinationFolderFieldName.setLayoutData(fdDestinationFolderFieldName);
// Whenever something changes, set the tooltip to the expanded version:
wDestinationFolderFieldName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wDestinationFolderFieldName.setToolTipText(transMeta.environmentSubstitute(wDestinationFolderFieldName.getText()));
}
});
wDestinationFolderFieldName.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);
getFields();
shell.setCursor(null);
busy.dispose();
}
});
// Create destination folder if necessary ...
wlCreateDestinationFolder = new Label(wSourceFiles, SWT.RIGHT);
wlCreateDestinationFolder.setText(BaseMessages.getString(PKG, "SFTPPUT.CreateDestinationFolder.Label"));
props.setLook(wlCreateDestinationFolder);
fdlCreateDestinationFolder = new FormData();
fdlCreateDestinationFolder.left = new FormAttachment(0, 0);
fdlCreateDestinationFolder.top = new FormAttachment(wDestinationFolderFieldName, margin);
fdlCreateDestinationFolder.right = new FormAttachment(middle, -margin);
wlCreateDestinationFolder.setLayoutData(fdlCreateDestinationFolder);
wCreateDestinationFolder = new Button(wSourceFiles, SWT.CHECK);
wCreateDestinationFolder.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.CreateDestinationFolder.Tooltip"));
props.setLook(wCreateDestinationFolder);
fdCreateDestinationFolder = new FormData();
fdCreateDestinationFolder.left = new FormAttachment(middle, 0);
fdCreateDestinationFolder.top = new FormAttachment(wDestinationFolderFieldName, margin);
fdCreateDestinationFolder.right = new FormAttachment(100, 0);
wCreateDestinationFolder.setLayoutData(fdCreateDestinationFolder);
fdSourceFiles = new FormData();
fdSourceFiles.left = new FormAttachment(0, margin);
fdSourceFiles.top = new FormAttachment(wServerSettings, 2 * margin);
fdSourceFiles.right = new FormAttachment(100, -margin);
wSourceFiles.setLayoutData(fdSourceFiles);
// ///////////////////////////////////////////////////////////
// / END OF Source files GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Target files GROUP///
// /
wTargetFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wTargetFiles);
wTargetFiles.setText(BaseMessages.getString(PKG, "SFTPPUT.TargetFiles.Group.Label"));
FormLayout TargetFilesgroupLayout = new FormLayout();
TargetFilesgroupLayout.marginWidth = 10;
TargetFilesgroupLayout.marginHeight = 10;
wTargetFiles.setLayout(TargetFilesgroupLayout);
// FtpDirectory line
wlRemoteDirectory = new Label(wTargetFiles, SWT.RIGHT);
wlRemoteDirectory.setText(BaseMessages.getString(PKG, "SFTPPUT.RemoteDir.Label"));
props.setLook(wlRemoteDirectory);
fdlRemoteDirectory = new FormData();
fdlRemoteDirectory.left = new FormAttachment(0, 0);
fdlRemoteDirectory.top = new FormAttachment(wSourceFiles, margin);
fdlRemoteDirectory.right = new FormAttachment(middle, -margin);
wlRemoteDirectory.setLayoutData(fdlRemoteDirectory);
// Target (remote) folder
wRemoteDirectory = new CCombo(wTargetFiles, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
props.setLook(wRemoteDirectory);
wRemoteDirectory.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.RemoteDir.Tooltip"));
wRemoteDirectory.addModifyListener(lsMod);
fdRemoteDirectory = new FormData();
fdRemoteDirectory.left = new FormAttachment(middle, 0);
fdRemoteDirectory.top = new FormAttachment(wSourceFiles, margin);
fdRemoteDirectory.right = new FormAttachment(100, -margin);
wRemoteDirectory.setLayoutData(fdRemoteDirectory);
wRemoteDirectory.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);
getFields();
shell.setCursor(null);
busy.dispose();
}
});
// CreateRemoteFolder files after retrieval...
wlCreateRemoteFolder = new Label(wTargetFiles, SWT.RIGHT);
wlCreateRemoteFolder.setText(BaseMessages.getString(PKG, "SFTPPUT.CreateRemoteFolderFiles.Label"));
props.setLook(wlCreateRemoteFolder);
fdlCreateRemoteFolder = new FormData();
fdlCreateRemoteFolder.left = new FormAttachment(0, 0);
fdlCreateRemoteFolder.top = new FormAttachment(wRemoteDirectory, margin);
fdlCreateRemoteFolder.right = new FormAttachment(middle, -margin);
wlCreateRemoteFolder.setLayoutData(fdlCreateRemoteFolder);
wCreateRemoteFolder = new Button(wTargetFiles, SWT.CHECK);
props.setLook(wCreateRemoteFolder);
fdCreateRemoteFolder = new FormData();
wCreateRemoteFolder.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.CreateRemoteFolderFiles.Tooltip"));
fdCreateRemoteFolder.left = new FormAttachment(middle, 0);
fdCreateRemoteFolder.top = new FormAttachment(wRemoteDirectory, margin);
fdCreateRemoteFolder.right = new FormAttachment(100, 0);
wCreateRemoteFolder.setLayoutData(fdCreateRemoteFolder);
wCreateRemoteFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
transMeta.setChanged();
}
});
// Remote filename
wlRemoteFileName = new Label(wTargetFiles, SWT.RIGHT);
wlRemoteFileName.setText(BaseMessages.getString(PKG, "SFTPPUT.RemoteFilename.Label"));
props.setLook(wlRemoteFileName);
fdlRemoteFileName = new FormData();
fdlRemoteFileName.left = new FormAttachment(0, 0);
fdlRemoteFileName.top = new FormAttachment(wCreateRemoteFolder, margin);
fdlRemoteFileName.right = new FormAttachment(middle, -margin);
wlRemoteFileName.setLayoutData(fdlRemoteFileName);
// Target (remote) folder
wRemoteFileName = new CCombo(wTargetFiles, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
props.setLook(wRemoteFileName);
wRemoteFileName.setToolTipText(BaseMessages.getString(PKG, "SFTPPUT.RemoteFilename.Tooltip"));
wRemoteFileName.addModifyListener(lsMod);
fdRemoteFileName = new FormData();
fdRemoteFileName.left = new FormAttachment(middle, 0);
fdRemoteFileName.top = new FormAttachment(wCreateRemoteFolder, margin);
fdRemoteFileName.right = new FormAttachment(100, -margin);
wRemoteFileName.setLayoutData(fdRemoteFileName);
wRemoteFileName.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);
getFields();
shell.setCursor(null);
busy.dispose();
}
});
fdTargetFiles = new FormData();
fdTargetFiles.left = new FormAttachment(0, margin);
fdTargetFiles.top = new FormAttachment(wSourceFiles, margin);
fdTargetFiles.right = new FormAttachment(100, -margin);
wTargetFiles.setLayoutData(fdTargetFiles);
// ///////////////////////////////////////////////////////////
// / END OF Target 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(100, 0);
wFilesComp.setLayoutData(fdFilesComp);
wFilesComp.layout();
wFilesTab.setControl(wFilesComp);
props.setLook(wFilesComp);
// ///////////////////////////////////////////////////////////
// / END OF Files TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
// 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"));
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();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wRemoteDirectory.addSelectionListener(lsDef);
wRemoteFileName.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();
activeUseKey();
AfterFTPPutActivate();
setInputStream();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class SymmetricCryptoTransDialog 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();
}
};
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, "SymmetricCryptoTransDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// SecretKey line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
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, "SymmetricCryptoTransDialog.GeneralTab.TabTitle"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF Crypto settings GROUP
//
wCryptoSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wCryptoSettings);
wCryptoSettings.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.CryptoSettings.Group.Label"));
FormLayout CryptoSettingsgroupLayout = new FormLayout();
CryptoSettingsgroupLayout.marginWidth = 10;
CryptoSettingsgroupLayout.marginHeight = 10;
wCryptoSettings.setLayout(CryptoSettingsgroupLayout);
// Operation
wlOperation = new Label(wCryptoSettings, SWT.RIGHT);
wlOperation.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Operation.Label"));
props.setLook(wlOperation);
fdlOperation = new FormData();
fdlOperation.left = new FormAttachment(0, 0);
fdlOperation.right = new FormAttachment(middle, -margin);
fdlOperation.top = new FormAttachment(wStepname, margin);
wlOperation.setLayoutData(fdlOperation);
wOperation = new CCombo(wCryptoSettings, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wOperation);
wOperation.addModifyListener(lsMod);
fdOperation = new FormData();
fdOperation.left = new FormAttachment(middle, margin);
fdOperation.top = new FormAttachment(wStepname, margin);
fdOperation.right = new FormAttachment(100, -margin);
wOperation.setLayoutData(fdOperation);
wOperation.setItems(SymmetricCryptoTransMeta.operationTypeDesc);
wOperation.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Algorithm
wlAlgorithm = new Label(wCryptoSettings, SWT.RIGHT);
wlAlgorithm.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Algorithm.Label"));
props.setLook(wlAlgorithm);
fdlAlgorithm = new FormData();
fdlAlgorithm.left = new FormAttachment(0, 0);
fdlAlgorithm.right = new FormAttachment(middle, -margin);
fdlAlgorithm.top = new FormAttachment(wOperation, margin);
wlAlgorithm.setLayoutData(fdlAlgorithm);
wAlgorithm = new CCombo(wCryptoSettings, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wAlgorithm);
wAlgorithm.addModifyListener(lsMod);
fdAlgorithm = new FormData();
fdAlgorithm.left = new FormAttachment(middle, margin);
fdAlgorithm.top = new FormAttachment(wOperation, margin);
fdAlgorithm.right = new FormAttachment(100, -margin);
wAlgorithm.setLayoutData(fdAlgorithm);
wAlgorithm.setItems(SymmetricCryptoMeta.TYPE_ALGORYTHM_CODE);
wAlgorithm.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Scheme
wlScheme = new Label(wCryptoSettings, SWT.RIGHT);
wlScheme.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Scheme.Label"));
props.setLook(wlScheme);
fdlScheme = new FormData();
fdlScheme.left = new FormAttachment(0, 0);
fdlScheme.top = new FormAttachment(wAlgorithm, margin);
fdlScheme.right = new FormAttachment(middle, -margin);
wlScheme.setLayoutData(fdlScheme);
wScheme = new TextVar(transMeta, wCryptoSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wScheme);
wScheme.addModifyListener(lsMod);
fdScheme = new FormData();
fdScheme.left = new FormAttachment(middle, margin);
fdScheme.right = new FormAttachment(100, -margin);
fdScheme.top = new FormAttachment(wAlgorithm, margin);
wScheme.setLayoutData(fdScheme);
// SecretKey
wlSecretKey = new Label(wCryptoSettings, SWT.RIGHT);
wlSecretKey.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKey.Label"));
props.setLook(wlSecretKey);
FormData fdlSecretKey = new FormData();
fdlSecretKey.left = new FormAttachment(0, 0);
fdlSecretKey.top = new FormAttachment(wScheme, 2 * margin);
fdlSecretKey.right = new FormAttachment(middle, -margin);
wlSecretKey.setLayoutData(fdlSecretKey);
wSecretKey = new PasswordTextVar(transMeta, wCryptoSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKey.Tooltip"));
props.setLook(wSecretKey);
wSecretKey.addModifyListener(lsMod);
FormData fdSecretKey = new FormData();
fdSecretKey.left = new FormAttachment(middle, margin);
fdSecretKey.right = new FormAttachment(100, -margin);
fdSecretKey.top = new FormAttachment(wScheme, 2 * margin);
wSecretKey.setLayoutData(fdSecretKey);
// Is secret key extracted from a field?
wlSecretKeyInField = new Label(wCryptoSettings, SWT.RIGHT);
wlSecretKeyInField.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKeyFileField.Label"));
props.setLook(wlSecretKeyInField);
fdlSecretKeyInField = new FormData();
fdlSecretKeyInField.left = new FormAttachment(0, 0);
fdlSecretKeyInField.top = new FormAttachment(wSecretKey, margin);
fdlSecretKeyInField.right = new FormAttachment(middle, -margin);
wlSecretKeyInField.setLayoutData(fdlSecretKeyInField);
wSecretKeyInField = new Button(wCryptoSettings, SWT.CHECK);
props.setLook(wSecretKeyInField);
wSecretKeyInField.setToolTipText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKeyFileField.Tooltip"));
fdSecretKeyInField = new FormData();
fdSecretKeyInField.left = new FormAttachment(middle, margin);
fdSecretKeyInField.top = new FormAttachment(wSecretKey, margin);
wSecretKeyInField.setLayoutData(fdSecretKeyInField);
SelectionAdapter lsXslFile = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ActivewlSecretKeyField();
input.setChanged();
}
};
wSecretKeyInField.addSelectionListener(lsXslFile);
// If secret key defined in a Field
wlSecretKeyField = new Label(wCryptoSettings, SWT.RIGHT);
wlSecretKeyField.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKeyField.Label"));
props.setLook(wlSecretKeyField);
FormData fdlSecretKeyField = new FormData();
fdlSecretKeyField.left = new FormAttachment(0, 0);
fdlSecretKeyField.top = new FormAttachment(wSecretKeyInField, margin);
fdlSecretKeyField.right = new FormAttachment(middle, -margin);
wlSecretKeyField.setLayoutData(fdlSecretKeyField);
wSecretKeyField = new CCombo(wCryptoSettings, SWT.BORDER | SWT.READ_ONLY);
wSecretKeyField.setEditable(true);
props.setLook(wSecretKeyField);
wSecretKeyField.addModifyListener(lsMod);
FormData fdSecretKeyField = new FormData();
fdSecretKeyField.left = new FormAttachment(middle, margin);
fdSecretKeyField.top = new FormAttachment(wSecretKeyInField, margin);
fdSecretKeyField.right = new FormAttachment(100, -margin);
wSecretKeyField.setLayoutData(fdSecretKeyField);
wSecretKeyField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
setSecretKeyFieldname();
}
});
wlReadKeyAsBinary = new Label(wCryptoSettings, SWT.RIGHT);
wlReadKeyAsBinary.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ReadKeyAsBinary.Label"));
props.setLook(wlReadKeyAsBinary);
fdlReadKeyAsBinary = new FormData();
fdlReadKeyAsBinary.left = new FormAttachment(0, 0);
fdlReadKeyAsBinary.top = new FormAttachment(wSecretKeyField, margin);
fdlReadKeyAsBinary.right = new FormAttachment(middle, -margin);
wlReadKeyAsBinary.setLayoutData(fdlReadKeyAsBinary);
wReadKeyAsBinary = new Button(wCryptoSettings, SWT.CHECK);
wReadKeyAsBinary.setToolTipText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ReadKeyAsBinary.Tooltip"));
props.setLook(wReadKeyAsBinary);
fdReadKeyAsBinary = new FormData();
fdReadKeyAsBinary.left = new FormAttachment(middle, margin);
fdReadKeyAsBinary.top = new FormAttachment(wSecretKeyField, margin);
fdReadKeyAsBinary.right = new FormAttachment(100, -margin);
wReadKeyAsBinary.setLayoutData(fdReadKeyAsBinary);
wReadKeyAsBinary.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
fdCryptoSettings = new FormData();
fdCryptoSettings.left = new FormAttachment(0, margin);
fdCryptoSettings.top = new FormAttachment(wStepname, margin);
fdCryptoSettings.right = new FormAttachment(100, -margin);
wCryptoSettings.setLayoutData(fdCryptoSettings);
// ///////////////////////////////////////////////////////////
// / END OF Crypto settings GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Crypto settings GROUP
//
wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wMessageGroup);
wMessageGroup.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Message.Group.Label"));
FormLayout MessageGroupgroupLayout = new FormLayout();
MessageGroupgroupLayout.marginWidth = 10;
MessageGroupgroupLayout.marginHeight = 10;
wMessageGroup.setLayout(MessageGroupgroupLayout);
// FieldName to evaluate
wlMessage = new Label(wMessageGroup, SWT.RIGHT);
wlMessage.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Field.Label"));
props.setLook(wlMessage);
FormData fdlMessage = new FormData();
fdlMessage.left = new FormAttachment(0, 0);
fdlMessage.top = new FormAttachment(wCryptoSettings, margin);
fdlMessage.right = new FormAttachment(middle, -margin);
wlMessage.setLayoutData(fdlMessage);
wMessage = new CCombo(wMessageGroup, SWT.BORDER | SWT.READ_ONLY);
wMessage.setEditable(true);
props.setLook(wMessage);
wMessage.addModifyListener(lsMod);
FormData fdField = new FormData();
fdField.left = new FormAttachment(middle, margin);
fdField.top = new FormAttachment(wCryptoSettings, margin);
fdField.right = new FormAttachment(100, -margin);
wMessage.setLayoutData(fdField);
wMessage.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
setFieldname();
}
});
fdMessageGroup = new FormData();
fdMessageGroup.left = new FormAttachment(0, margin);
fdMessageGroup.top = new FormAttachment(wCryptoSettings, margin);
fdMessageGroup.right = new FormAttachment(100, -margin);
wMessageGroup.setLayoutData(fdMessageGroup);
// ///////////////////////////////////////////////////////////
// / END OF Crypto settings GROUP
// ///////////////////////////////////////////////////////////
// Step Output field grouping?
// ////////////////////////
// START OF Output Field GROUP
//
wOutputField = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wOutputField);
wOutputField.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ResultField.Group.Label"));
FormLayout outputfieldgroupLayout = new FormLayout();
outputfieldgroupLayout.marginWidth = 10;
outputfieldgroupLayout.marginHeight = 10;
wOutputField.setLayout(outputfieldgroupLayout);
// Output Fieldame
wResultField = new LabelTextVar(transMeta, wOutputField, BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ResultField.Label"), BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ResultField.Tooltip"));
props.setLook(wResultField);
wResultField.addModifyListener(lsMod);
FormData fdResultField = new FormData();
fdResultField.left = new FormAttachment(0, 0);
fdResultField.top = new FormAttachment(wMessageGroup, margin);
fdResultField.right = new FormAttachment(100, 0);
wResultField.setLayoutData(fdResultField);
wlOutputAsBinary = new Label(wOutputField, SWT.RIGHT);
wlOutputAsBinary.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.OutputAsBinary.Label"));
props.setLook(wlOutputAsBinary);
fdlOutputAsBinary = new FormData();
fdlOutputAsBinary.left = new FormAttachment(0, 0);
fdlOutputAsBinary.top = new FormAttachment(wResultField, margin);
fdlOutputAsBinary.right = new FormAttachment(middle, -margin);
wlOutputAsBinary.setLayoutData(fdlOutputAsBinary);
wOutputAsBinary = new Button(wOutputField, SWT.CHECK);
wOutputAsBinary.setToolTipText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.OutputAsBinary.Tooltip"));
props.setLook(wOutputAsBinary);
fdOutputAsBinary = new FormData();
fdOutputAsBinary.left = new FormAttachment(middle, margin);
fdOutputAsBinary.top = new FormAttachment(wResultField, margin);
fdOutputAsBinary.right = new FormAttachment(100, 0);
wOutputAsBinary.setLayoutData(fdOutputAsBinary);
wOutputAsBinary.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
fdOutputField = new FormData();
fdOutputField.left = new FormAttachment(0, margin);
fdOutputField.top = new FormAttachment(wMessageGroup, margin);
fdOutputField.right = new FormAttachment(100, -margin);
wOutputField.setLayoutData(fdOutputField);
// ///////////////////////////////////////////////////////////
// / END OF Output Field GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wOutputField, 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
// ///////////////////////////////////////////////////////////
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
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, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
ActivewlSecretKeyField();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations