use of org.pentaho.di.ui.core.widget.LabelTextVar 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.LabelTextVar in project pentaho-kettle by pentaho.
the class JobEntryFTPSGetDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
// pwdFolder=null;
connection = 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, "JobFTPS.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobFTPS.Name.Label"), BaseMessages.getString(PKG, "JobFTPS.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobFTPS.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, "JobFTPS.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPS.Server.Label"), BaseMessages.getString(PKG, "JobFTPS.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Server port line
wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPS.Port.Label"), BaseMessages.getString(PKG, "JobFTPS.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(wServerName, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// UserName line
wUserName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPS.User.Label"), BaseMessages.getString(PKG, "JobFTPS.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPS.Password.Label"), BaseMessages.getString(PKG, "JobFTPS.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Proxy host line
wProxyHost = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPS.ProxyHost.Label"), BaseMessages.getString(PKG, "JobFTPS.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, "JobFTPS.ProxyPort.Label"), BaseMessages.getString(PKG, "JobFTPS.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, "JobFTPS.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTPS.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, "JobFTPS.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTPS.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);
wlConnectionType = new Label(wServerSettings, SWT.RIGHT);
wlConnectionType.setText(BaseMessages.getString(PKG, "JobFTPS.ConnectionType.Label"));
props.setLook(wlConnectionType);
fdlConnectionType = new FormData();
fdlConnectionType.left = new FormAttachment(0, 0);
fdlConnectionType.right = new FormAttachment(middle, 0);
fdlConnectionType.top = new FormAttachment(wProxyPassword, 2 * margin);
wlConnectionType.setLayoutData(fdlConnectionType);
wConnectionType = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wConnectionType.setItems(FTPSConnection.connection_type_Desc);
props.setLook(wConnectionType);
fdConnectionType = new FormData();
fdConnectionType.left = new FormAttachment(middle, margin);
fdConnectionType.top = new FormAttachment(wProxyPassword, 2 * margin);
fdConnectionType.right = new FormAttachment(100, 0);
wConnectionType.setLayoutData(fdConnectionType);
wConnectionType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobFTPS.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wConnectionType, 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, "JobFTPS.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, "JobFTPS.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, "JobFTPS.BinaryMode.Tooltip"));
fdBinaryMode = new FormData();
fdBinaryMode.left = new FormAttachment(middle, margin);
fdBinaryMode.top = new FormAttachment(wServerSettings, margin);
fdBinaryMode.right = new FormAttachment(100, 0);
wBinaryMode.setLayoutData(fdBinaryMode);
// Timeout line
wTimeout = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobFTPS.Timeout.Label"), BaseMessages.getString(PKG, "JobFTPS.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.addModifyListener(lsMod);
fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(0, 0);
fdTimeout.top = new FormAttachment(wlBinaryMode, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// active connection?
wlActive = new Label(wAdvancedSettings, SWT.RIGHT);
wlActive.setText(BaseMessages.getString(PKG, "JobFTPS.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, "JobFTPS.ActiveConns.Tooltip"));
props.setLook(wActive);
fdActive = new FormData();
fdActive.left = new FormAttachment(middle, margin);
fdActive.top = new FormAttachment(wTimeout, margin);
fdActive.right = new FormAttachment(100, 0);
wActive.setLayoutData(fdActive);
fdAdvancedSettings = new FormData();
fdAdvancedSettings.left = new FormAttachment(0, margin);
fdAdvancedSettings.top = new FormAttachment(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, "JobFTPS.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 Remote SETTINGS GROUP///
// /
wRemoteSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wRemoteSettings);
wRemoteSettings.setText(BaseMessages.getString(PKG, "JobFTPS.RemoteSettings.Group.Label"));
FormLayout RemoteSettinsgroupLayout = new FormLayout();
RemoteSettinsgroupLayout.marginWidth = 10;
RemoteSettinsgroupLayout.marginHeight = 10;
wRemoteSettings.setLayout(RemoteSettinsgroupLayout);
// Move to directory
wlFTPSDirectory = new Label(wRemoteSettings, SWT.RIGHT);
wlFTPSDirectory.setText(BaseMessages.getString(PKG, "JobFTPS.RemoteDir.Label"));
props.setLook(wlFTPSDirectory);
fdlFTPSDirectory = new FormData();
fdlFTPSDirectory.left = new FormAttachment(0, 0);
fdlFTPSDirectory.top = new FormAttachment(0, margin);
fdlFTPSDirectory.right = new FormAttachment(middle, 0);
wlFTPSDirectory.setLayoutData(fdlFTPSDirectory);
// Test remote folder button ...
wbTestChangeFolderExists = new Button(wRemoteSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestChangeFolderExists);
wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobFTPS.TestFolderExists.Label"));
fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(0, margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
wFTPSDirectory = new TextVar(jobMeta, wRemoteSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFTPSDirectory);
wFTPSDirectory.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.RemoteDir.Tooltip"));
wFTPSDirectory.addModifyListener(lsMod);
fdFTPSDirectory = new FormData();
fdFTPSDirectory.left = new FormAttachment(middle, margin);
fdFTPSDirectory.top = new FormAttachment(0, margin);
fdFTPSDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wFTPSDirectory.setLayoutData(fdFTPSDirectory);
// Wildcard line
wWildcard = new LabelTextVar(jobMeta, wRemoteSettings, BaseMessages.getString(PKG, "JobFTPS.Wildcard.Label"), BaseMessages.getString(PKG, "JobFTPS.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(0, 0);
fdWildcard.top = new FormAttachment(wFTPSDirectory, 2 * margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
// Remove files after retrieval...
wlRemove = new Label(wRemoteSettings, SWT.RIGHT);
wlRemove.setText(BaseMessages.getString(PKG, "JobFTPS.RemoveFiles.Label"));
props.setLook(wlRemove);
fdlRemove = new FormData();
fdlRemove.left = new FormAttachment(0, 0);
fdlRemove.top = new FormAttachment(wWildcard, margin);
fdlRemove.right = new FormAttachment(middle, 0);
wlRemove.setLayoutData(fdlRemove);
wRemove = new Button(wRemoteSettings, SWT.CHECK);
wRemove.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.RemoveFiles.Tooltip"));
props.setLook(wRemove);
fdRemove = new FormData();
fdRemove.left = new FormAttachment(middle, margin);
fdRemove.top = new FormAttachment(wWildcard, margin);
fdRemove.right = new FormAttachment(100, 0);
wRemove.setLayoutData(fdRemove);
wRemove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (wRemove.getSelection()) {
wMove.setSelection(false);
activateMoveTo();
}
}
});
// Move files after the transfert?...
wlMove = new Label(wRemoteSettings, SWT.RIGHT);
wlMove.setText(BaseMessages.getString(PKG, "JobFTPS.MoveFiles.Label"));
props.setLook(wlMove);
fdlMove = new FormData();
fdlMove.left = new FormAttachment(0, 0);
fdlMove.top = new FormAttachment(wRemove, margin);
fdlMove.right = new FormAttachment(middle, -margin);
wlMove.setLayoutData(fdlMove);
wMove = new Button(wRemoteSettings, SWT.CHECK);
props.setLook(wMove);
wMove.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.MoveFiles.Tooltip"));
fdMove = new FormData();
fdMove.left = new FormAttachment(middle, margin);
fdMove.top = new FormAttachment(wRemove, margin);
fdMove.right = new FormAttachment(100, 0);
wMove.setLayoutData(fdMove);
wMove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activateMoveTo();
if (wMove.getSelection()) {
wRemove.setSelection(false);
}
}
});
// Move to directory
wlMoveToDirectory = new Label(wRemoteSettings, SWT.RIGHT);
wlMoveToDirectory.setText(BaseMessages.getString(PKG, "JobFTPS.MoveFolder.Label"));
props.setLook(wlMoveToDirectory);
fdlMoveToDirectory = new FormData();
fdlMoveToDirectory.left = new FormAttachment(0, 0);
fdlMoveToDirectory.top = new FormAttachment(wMove, margin);
fdlMoveToDirectory.right = new FormAttachment(middle, 0);
wlMoveToDirectory.setLayoutData(fdlMoveToDirectory);
// Test remote folder button ...
wbTestFolderExists = new Button(wRemoteSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestFolderExists);
wbTestFolderExists.setText(BaseMessages.getString(PKG, "JobFTPS.TestFolderExists.Label"));
fdbTestFolderExists = new FormData();
fdbTestFolderExists.right = new FormAttachment(100, 0);
fdbTestFolderExists.top = new FormAttachment(wMove, margin);
wbTestFolderExists.setLayoutData(fdbTestFolderExists);
wMoveToDirectory = new TextVar(jobMeta, wRemoteSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wMoveToDirectory.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.MoveToDirectory.Tooltip"));
props.setLook(wMoveToDirectory);
wMoveToDirectory.addModifyListener(lsMod);
fdMoveToDirectory = new FormData();
fdMoveToDirectory.left = new FormAttachment(middle, margin);
fdMoveToDirectory.top = new FormAttachment(wMove, margin);
fdMoveToDirectory.right = new FormAttachment(wbTestFolderExists, -margin);
wMoveToDirectory.setLayoutData(fdMoveToDirectory);
// create destination folder?...
wlCreateMoveFolder = new Label(wRemoteSettings, SWT.RIGHT);
wlCreateMoveFolder.setText(BaseMessages.getString(PKG, "JobFTPS.CreateMoveFolder.Label"));
props.setLook(wlCreateMoveFolder);
fdlCreateMoveFolder = new FormData();
fdlCreateMoveFolder.left = new FormAttachment(0, 0);
fdlCreateMoveFolder.top = new FormAttachment(wMoveToDirectory, margin);
fdlCreateMoveFolder.right = new FormAttachment(middle, 0);
wlCreateMoveFolder.setLayoutData(fdlCreateMoveFolder);
wCreateMoveFolder = new Button(wRemoteSettings, SWT.CHECK);
wCreateMoveFolder.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.CreateMoveFolder.Tooltip"));
props.setLook(wCreateMoveFolder);
fdCreateMoveFolder = new FormData();
fdCreateMoveFolder.left = new FormAttachment(middle, margin);
fdCreateMoveFolder.top = new FormAttachment(wMoveToDirectory, margin);
fdCreateMoveFolder.right = new FormAttachment(100, 0);
wCreateMoveFolder.setLayoutData(fdCreateMoveFolder);
fdRemoteSettings = new FormData();
fdRemoteSettings.left = new FormAttachment(0, margin);
fdRemoteSettings.top = new FormAttachment(0, 2 * margin);
fdRemoteSettings.right = new FormAttachment(100, -margin);
wRemoteSettings.setLayoutData(fdRemoteSettings);
// ///////////////////////////////////////////////////////////
// / END OF Remote SETTINGSGROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF LOCAL SETTINGS GROUP///
// /
wLocalSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wLocalSettings);
wLocalSettings.setText(BaseMessages.getString(PKG, "JobFTPS.LocalSettings.Group.Label"));
FormLayout LocalSettinsgroupLayout = new FormLayout();
LocalSettinsgroupLayout.marginWidth = 10;
LocalSettinsgroupLayout.marginHeight = 10;
wLocalSettings.setLayout(LocalSettinsgroupLayout);
// TargetDirectory
wlTargetDirectory = new Label(wLocalSettings, SWT.RIGHT);
wlTargetDirectory.setText(BaseMessages.getString(PKG, "JobFTPS.TargetDir.Label"));
props.setLook(wlTargetDirectory);
fdlTargetDirectory = new FormData();
fdlTargetDirectory.left = new FormAttachment(0, 0);
fdlTargetDirectory.top = new FormAttachment(wRemoteSettings, margin);
fdlTargetDirectory.right = new FormAttachment(middle, -margin);
wlTargetDirectory.setLayoutData(fdlTargetDirectory);
// Browse folders button ...
wbTargetDirectory = new Button(wLocalSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTargetDirectory);
wbTargetDirectory.setText(BaseMessages.getString(PKG, "JobFTPS.BrowseFolders.Label"));
fdbTargetDirectory = new FormData();
fdbTargetDirectory.right = new FormAttachment(100, 0);
fdbTargetDirectory.top = new FormAttachment(wRemoteSettings, margin);
wbTargetDirectory.setLayoutData(fdbTargetDirectory);
wbTargetDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wTargetDirectory.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wTargetDirectory.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
wTargetDirectory.setText(dir);
}
}
});
wTargetDirectory = new TextVar(jobMeta, wLocalSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTargetDirectory);
wTargetDirectory.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.TargetDir.Tooltip"));
wTargetDirectory.addModifyListener(lsMod);
fdTargetDirectory = new FormData();
fdTargetDirectory.left = new FormAttachment(middle, margin);
fdTargetDirectory.top = new FormAttachment(wRemoteSettings, margin);
fdTargetDirectory.right = new FormAttachment(wbTargetDirectory, -margin);
wTargetDirectory.setLayoutData(fdTargetDirectory);
// Create multi-part file?
wlAddDate = new Label(wLocalSettings, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "JobFTPS.AddDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wTargetDirectory, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(wLocalSettings, SWT.CHECK);
props.setLook(wAddDate);
wAddDate.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.AddDate.Tooltip"));
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, margin);
fdAddDate.top = new FormAttachment(wTargetDirectory, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Create multi-part file?
wlAddTime = new Label(wLocalSettings, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "JobFTPS.AddTime.Label"));
props.setLook(wlAddTime);
fdlAddTime = new FormData();
fdlAddTime.left = new FormAttachment(0, 0);
fdlAddTime.top = new FormAttachment(wAddDate, margin);
fdlAddTime.right = new FormAttachment(middle, -margin);
wlAddTime.setLayoutData(fdlAddTime);
wAddTime = new Button(wLocalSettings, SWT.CHECK);
props.setLook(wAddTime);
wAddTime.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.AddTime.Tooltip"));
fdAddTime = new FormData();
fdAddTime.left = new FormAttachment(middle, margin);
fdAddTime.top = new FormAttachment(wAddDate, margin);
fdAddTime.right = new FormAttachment(100, 0);
wAddTime.setLayoutData(fdAddTime);
wAddTime.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Specify date time format?
wlSpecifyFormat = new Label(wLocalSettings, SWT.RIGHT);
wlSpecifyFormat.setText(BaseMessages.getString(PKG, "JobFTPS.SpecifyFormat.Label"));
props.setLook(wlSpecifyFormat);
fdlSpecifyFormat = new FormData();
fdlSpecifyFormat.left = new FormAttachment(0, 0);
fdlSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdlSpecifyFormat.right = new FormAttachment(middle, -margin);
wlSpecifyFormat.setLayoutData(fdlSpecifyFormat);
wSpecifyFormat = new Button(wLocalSettings, SWT.CHECK);
props.setLook(wSpecifyFormat);
wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.SpecifyFormat.Tooltip"));
fdSpecifyFormat = new FormData();
fdSpecifyFormat.left = new FormAttachment(middle, margin);
fdSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdSpecifyFormat.right = new FormAttachment(100, 0);
wSpecifyFormat.setLayoutData(fdSpecifyFormat);
wSpecifyFormat.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
setDateTimeFormat();
setAddDateBeforeExtension();
}
});
// Prepare a list of possible DateTimeFormats...
String[] dats = Const.getDateFormats();
// DateTimeFormat
wlDateTimeFormat = new Label(wLocalSettings, SWT.RIGHT);
wlDateTimeFormat.setText(BaseMessages.getString(PKG, "JobFTPS.DateTimeFormat.Label"));
props.setLook(wlDateTimeFormat);
fdlDateTimeFormat = new FormData();
fdlDateTimeFormat.left = new FormAttachment(0, 0);
fdlDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdlDateTimeFormat.right = new FormAttachment(middle, -margin);
wlDateTimeFormat.setLayoutData(fdlDateTimeFormat);
wDateTimeFormat = new CCombo(wLocalSettings, SWT.BORDER | SWT.READ_ONLY);
wDateTimeFormat.setEditable(true);
props.setLook(wDateTimeFormat);
wDateTimeFormat.addModifyListener(lsMod);
fdDateTimeFormat = new FormData();
fdDateTimeFormat.left = new FormAttachment(middle, margin);
fdDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdDateTimeFormat.right = new FormAttachment(100, 0);
wDateTimeFormat.setLayoutData(fdDateTimeFormat);
for (int x = 0; x < dats.length; x++) {
wDateTimeFormat.add(dats[x]);
}
// Add Date before extension?
wlAddDateBeforeExtension = new Label(wLocalSettings, SWT.RIGHT);
wlAddDateBeforeExtension.setText(BaseMessages.getString(PKG, "JobFTPS.AddDateBeforeExtension.Label"));
props.setLook(wlAddDateBeforeExtension);
fdlAddDateBeforeExtension = new FormData();
fdlAddDateBeforeExtension.left = new FormAttachment(0, 0);
fdlAddDateBeforeExtension.top = new FormAttachment(wDateTimeFormat, margin);
fdlAddDateBeforeExtension.right = new FormAttachment(middle, -margin);
wlAddDateBeforeExtension.setLayoutData(fdlAddDateBeforeExtension);
wAddDateBeforeExtension = new Button(wLocalSettings, SWT.CHECK);
props.setLook(wAddDateBeforeExtension);
wAddDateBeforeExtension.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.AddDateBeforeExtension.Tooltip"));
fdAddDateBeforeExtension = new FormData();
fdAddDateBeforeExtension.left = new FormAttachment(middle, margin);
fdAddDateBeforeExtension.top = new FormAttachment(wDateTimeFormat, margin);
fdAddDateBeforeExtension.right = new FormAttachment(100, 0);
wAddDateBeforeExtension.setLayoutData(fdAddDateBeforeExtension);
wAddDateBeforeExtension.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// OnlyNew files after retrieval...
wlOnlyNew = new Label(wLocalSettings, SWT.RIGHT);
wlOnlyNew.setText(BaseMessages.getString(PKG, "JobFTPS.DontOverwrite.Label"));
props.setLook(wlOnlyNew);
fdlOnlyNew = new FormData();
fdlOnlyNew.left = new FormAttachment(0, 0);
fdlOnlyNew.top = new FormAttachment(wAddDateBeforeExtension, margin);
fdlOnlyNew.right = new FormAttachment(middle, 0);
wlOnlyNew.setLayoutData(fdlOnlyNew);
wOnlyNew = new Button(wLocalSettings, SWT.CHECK);
wOnlyNew.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.DontOverwrite.Tooltip"));
props.setLook(wOnlyNew);
fdOnlyNew = new FormData();
fdOnlyNew.left = new FormAttachment(middle, margin);
fdOnlyNew.top = new FormAttachment(wAddDateBeforeExtension, margin);
fdOnlyNew.right = new FormAttachment(100, 0);
wOnlyNew.setLayoutData(fdOnlyNew);
wOnlyNew.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeIfExists();
jobEntry.setChanged();
}
});
// Add filenames to result filenames...
wlAddFilenameToResult = new Label(wLocalSettings, SWT.RIGHT);
wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "JobFTPS.AddFilenameToResult.Label"));
props.setLook(wlAddFilenameToResult);
fdlAddFilenameToResult = new FormData();
fdlAddFilenameToResult.left = new FormAttachment(0, 0);
fdlAddFilenameToResult.top = new FormAttachment(wAddDateBeforeExtension, margin);
fdlAddFilenameToResult.right = new FormAttachment(middle, 0);
wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
wAddFilenameToResult = new Button(wLocalSettings, SWT.CHECK);
wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.AddFilenameToResult.Tooltip"));
props.setLook(wAddFilenameToResult);
fdAddFilenameToResult = new FormData();
fdAddFilenameToResult.left = new FormAttachment(middle, margin);
fdAddFilenameToResult.top = new FormAttachment(wAddDateBeforeExtension, margin);
fdAddFilenameToResult.right = new FormAttachment(100, 0);
wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
// If File Exists
wlIfFileExists = new Label(wLocalSettings, SWT.RIGHT);
wlIfFileExists.setText(BaseMessages.getString(PKG, "JobFTPS.IfFileExists.Label"));
props.setLook(wlIfFileExists);
fdlIfFileExists = new FormData();
fdlIfFileExists.left = new FormAttachment(0, 0);
fdlIfFileExists.right = new FormAttachment(middle, 0);
fdlIfFileExists.top = new FormAttachment(wOnlyNew, margin);
wlIfFileExists.setLayoutData(fdlIfFileExists);
wIfFileExists = new CCombo(wLocalSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wIfFileExists.add(BaseMessages.getString(PKG, "JobFTPS.Skip.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobFTPS.Give_Unique_Name.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobFTPS.Fail.Label"));
// +1: starts at -1
wIfFileExists.select(0);
props.setLook(wIfFileExists);
fdIfFileExists = new FormData();
fdIfFileExists.left = new FormAttachment(middle, 0);
fdIfFileExists.top = new FormAttachment(wOnlyNew, margin);
fdIfFileExists.right = new FormAttachment(100, 0);
wIfFileExists.setLayoutData(fdIfFileExists);
fdIfFileExists = new FormData();
fdIfFileExists.left = new FormAttachment(middle, margin);
fdIfFileExists.top = new FormAttachment(wOnlyNew, margin);
fdIfFileExists.right = new FormAttachment(100, 0);
wIfFileExists.setLayoutData(fdIfFileExists);
wIfFileExists.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Add filenames to result filenames...
wlAddFilenameToResult = new Label(wLocalSettings, SWT.RIGHT);
wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "JobFTPS.AddFilenameToResult.Label"));
props.setLook(wlAddFilenameToResult);
fdlAddFilenameToResult = new FormData();
fdlAddFilenameToResult.left = new FormAttachment(0, 0);
fdlAddFilenameToResult.top = new FormAttachment(wIfFileExists, 2 * margin);
fdlAddFilenameToResult.right = new FormAttachment(middle, 0);
wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
wAddFilenameToResult = new Button(wLocalSettings, SWT.CHECK);
wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.AddFilenameToResult.Tooltip"));
props.setLook(wAddFilenameToResult);
fdAddFilenameToResult = new FormData();
fdAddFilenameToResult.left = new FormAttachment(middle, margin);
fdAddFilenameToResult.top = new FormAttachment(wIfFileExists, 2 * margin);
fdAddFilenameToResult.right = new FormAttachment(100, 0);
wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
fdLocalSettings = new FormData();
fdLocalSettings.left = new FormAttachment(0, margin);
fdLocalSettings.top = new FormAttachment(wRemoteSettings, margin);
fdLocalSettings.right = new FormAttachment(100, -margin);
wLocalSettings.setLayoutData(fdLocalSettings);
// ///////////////////////////////////////////////////////////
// / END OF LOCAL 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 Advanced TAB ///
// ////////////////////////
wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
wAdvancedTab.setText(BaseMessages.getString(PKG, "JobFTPS.Tab.Advanced.Label"));
wAdvancedComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wAdvancedComp);
FormLayout AdvancedLayout = new FormLayout();
AdvancedLayout.marginWidth = 3;
AdvancedLayout.marginHeight = 3;
wAdvancedComp.setLayout(AdvancedLayout);
// SuccessOngrouping?
// ////////////////////////
// START OF SUCCESS ON GROUP///
// /
wSuccessOn = new Group(wAdvancedComp, SWT.SHADOW_NONE);
props.setLook(wSuccessOn);
wSuccessOn.setText(BaseMessages.getString(PKG, "JobFTPS.SuccessOn.Group.Label"));
FormLayout successongroupLayout = new FormLayout();
successongroupLayout.marginWidth = 10;
successongroupLayout.marginHeight = 10;
wSuccessOn.setLayout(successongroupLayout);
// Success Condition
wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT);
wlSuccessCondition.setText(BaseMessages.getString(PKG, "JobFTPS.SuccessCondition.Label") + " ");
props.setLook(wlSuccessCondition);
fdlSuccessCondition = new FormData();
fdlSuccessCondition.left = new FormAttachment(0, 0);
fdlSuccessCondition.right = new FormAttachment(middle, 0);
fdlSuccessCondition.top = new FormAttachment(0, margin);
wlSuccessCondition.setLayoutData(fdlSuccessCondition);
wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTPS.SuccessWhenAllWorksFine.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTPS.SuccessWhenAtLeat.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTPS.SuccessWhenNrErrorsLessThan.Label"));
// +1: starts at -1
wSuccessCondition.select(0);
props.setLook(wSuccessCondition);
fdSuccessCondition = new FormData();
fdSuccessCondition.left = new FormAttachment(middle, 0);
fdSuccessCondition.top = new FormAttachment(0, margin);
fdSuccessCondition.right = new FormAttachment(100, 0);
wSuccessCondition.setLayoutData(fdSuccessCondition);
wSuccessCondition.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeSuccessCondition();
}
});
// Success when number of errors less than
wlNrErrorsLessThan = new Label(wSuccessOn, SWT.RIGHT);
wlNrErrorsLessThan.setText(BaseMessages.getString(PKG, "JobFTPS.NrBadFormedLessThan.Label") + " ");
props.setLook(wlNrErrorsLessThan);
fdlNrErrorsLessThan = new FormData();
fdlNrErrorsLessThan.left = new FormAttachment(0, 0);
fdlNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
fdlNrErrorsLessThan.right = new FormAttachment(middle, -margin);
wlNrErrorsLessThan.setLayoutData(fdlNrErrorsLessThan);
wNrErrorsLessThan = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wNrErrorsLessThan);
wNrErrorsLessThan.setToolTipText(BaseMessages.getString(PKG, "JobFTPS.NrBadFormedLessThan.Tooltip"));
wNrErrorsLessThan.addModifyListener(lsMod);
fdNrErrorsLessThan = new FormData();
fdNrErrorsLessThan.left = new FormAttachment(middle, 0);
fdNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
fdNrErrorsLessThan.right = new FormAttachment(100, -margin);
wNrErrorsLessThan.setLayoutData(fdNrErrorsLessThan);
fdSuccessOn = new FormData();
fdSuccessOn.left = new FormAttachment(0, margin);
fdSuccessOn.top = new FormAttachment(0, margin);
fdSuccessOn.right = new FormAttachment(100, -margin);
wSuccessOn.setLayoutData(fdSuccessOn);
// ///////////////////////////////////////////////////////////
// / END OF Success ON GROUP
// ///////////////////////////////////////////////////////////
fdAdvancedComp = new FormData();
fdAdvancedComp.left = new FormAttachment(0, 0);
fdAdvancedComp.top = new FormAttachment(0, 0);
fdAdvancedComp.right = new FormAttachment(100, 0);
fdAdvancedComp.bottom = new FormAttachment(100, 0);
wAdvancedComp.setLayoutData(fdAdvancedComp);
wAdvancedComp.layout();
wAdvancedTab.setControl(wAdvancedComp);
props.setLook(wAdvancedComp);
// ///////////////////////////////////////////////////////////
// / END OF Advanced TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsCheckFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder(false, true, wMoveToDirectory.getText());
}
};
lsCheckChangeFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder(true, false, wFTPSDirectory.getText());
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
wbTestFolderExists.addListener(SWT.Selection, lsCheckFolder);
wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckChangeFolder);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wFTPSDirectory.addSelectionListener(lsDef);
wTargetDirectory.addSelectionListener(lsDef);
wFTPSDirectory.addSelectionListener(lsDef);
wWildcard.addSelectionListener(lsDef);
wTimeout.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activateMoveTo();
setDateTimeFormat();
setAddDateBeforeExtension();
activeSuccessCondition();
activeIfExists();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobFTPSDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class JobEntryFTPSPUTDialog 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) {
connection = 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, "JobFTPSPUT.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.ProxyHost.Label"), BaseMessages.getString(PKG, "JobFTPSPUT.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, "JobFTPSPUT.ProxyPort.Label"), BaseMessages.getString(PKG, "JobFTPSPUT.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, "JobFTPSPUT.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTPSPUT.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, "JobFTPSPUT.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTPSPUT.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);
wlConnectionType = new Label(wServerSettings, SWT.RIGHT);
wlConnectionType.setText(BaseMessages.getString(PKG, "JobFTPSPUT.ConnectionType.Label"));
props.setLook(wlConnectionType);
fdlConnectionType = new FormData();
fdlConnectionType.left = new FormAttachment(0, 0);
fdlConnectionType.right = new FormAttachment(middle, 0);
fdlConnectionType.top = new FormAttachment(wProxyPassword, 2 * margin);
wlConnectionType.setLayoutData(fdlConnectionType);
wConnectionType = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wConnectionType.setItems(FTPSConnection.connection_type_Desc);
props.setLook(wConnectionType);
fdConnectionType = new FormData();
fdConnectionType.left = new FormAttachment(middle, margin);
fdConnectionType.top = new FormAttachment(wProxyPassword, 2 * margin);
fdConnectionType.right = new FormAttachment(100, 0);
wConnectionType.setLayoutData(fdConnectionType);
wConnectionType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobFTPSPUT.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobFTPSPUT.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wConnectionType, 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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.setToolTipText(BaseMessages.getString(PKG, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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);
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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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, "JobFTPSPUT.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
// ///////////////////////////////////////////////////////////
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.LabelTextVar in project pentaho-kettle by pentaho.
the class HL7MLLPInputDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "HL7MLLPInputDialog.Title"));
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.Name.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.Name.Tooltip"));
wName.addModifyListener(lsMod);
FormData fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
Control lastControl = wName;
// the server
//
wServer = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.Server.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.Server.Tooltip"));
props.setLook(wServer);
wServer.addModifyListener(lsMod);
FormData fdBatchIdSchema = new FormData();
fdBatchIdSchema.left = new FormAttachment(0, 0);
fdBatchIdSchema.top = new FormAttachment(lastControl, margin);
fdBatchIdSchema.right = new FormAttachment(100, 0);
wServer.setLayoutData(fdBatchIdSchema);
lastControl = wServer;
// the port
//
wPort = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.Port.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
FormData fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(lastControl, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
lastControl = wPort;
// The Message Variable
//
wMessageVariable = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.MessageVariable.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.MessageVariable.Tooltip"));
props.setLook(wMessageVariable);
wMessageVariable.addModifyListener(lsMod);
FormData fdMessageVariable = new FormData();
fdMessageVariable.left = new FormAttachment(0, 0);
fdMessageVariable.top = new FormAttachment(lastControl, margin);
fdMessageVariable.right = new FormAttachment(100, 0);
wMessageVariable.setLayoutData(fdMessageVariable);
lastControl = wMessageVariable;
// The ControlId Variable
//
wMessageTypeVariable = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.MessageTypeVariable.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.MessageTypeVariable.Tooltip"));
props.setLook(wMessageTypeVariable);
wMessageTypeVariable.addModifyListener(lsMod);
FormData fdMessageTypeVariable = new FormData();
fdMessageTypeVariable.left = new FormAttachment(0, 0);
fdMessageTypeVariable.top = new FormAttachment(lastControl, margin);
fdMessageTypeVariable.right = new FormAttachment(100, 0);
wMessageTypeVariable.setLayoutData(fdMessageTypeVariable);
lastControl = wMessageTypeVariable;
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, lastControl);
// Add listeners
//
wCancel.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
cancel();
}
});
wOK.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
ok();
}
});
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServer.addSelectionListener(lsDef);
wPort.addSelectionListener(lsDef);
wMessageVariable.addSelectionListener(lsDef);
wMessageTypeVariable.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "HL7MLLPInputDialog.DialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class 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;
}
Aggregations