use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class JobEntrySFTPPUTDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
sftpclient = 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, "JobSFTPPUT.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobSFTPPUT.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, "JobSFTPPUT.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, "JobSFTPPUT.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, "JobSFTPPUT.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, -margin);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// ServerPort line
wlServerPort = new Label(wServerSettings, SWT.RIGHT);
wlServerPort.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Port.Label"));
props.setLook(wlServerPort);
fdlServerPort = new FormData();
fdlServerPort.left = new FormAttachment(0, 0);
fdlServerPort.top = new FormAttachment(wServerName, margin);
fdlServerPort.right = new FormAttachment(middle, -margin);
wlServerPort.setLayoutData(fdlServerPort);
wServerPort = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerPort);
wServerPort.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.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, "JobSFTPPUT.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(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.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, "JobSFTPPUT.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// usePublicKey
wlusePublicKey = new Label(wServerSettings, SWT.RIGHT);
wlusePublicKey.setText(BaseMessages.getString(PKG, "JobSFTPPUT.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, "JobSFTPPUT.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();
jobEntry.setChanged();
}
});
// Key File
wlKeyFilename = new Label(wServerSettings, SWT.RIGHT);
wlKeyFilename.setText(BaseMessages.getString(PKG, "JobSFTPPUT.KeyFilename.Label"));
props.setLook(wlKeyFilename);
fdlKeyFilename = new FormData();
fdlKeyFilename.left = new FormAttachment(0, 0);
fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdlKeyFilename.right = new FormAttachment(middle, -margin);
wlKeyFilename.setLayoutData(fdlKeyFilename);
wbKeyFilename = new Button(wServerSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbKeyFilename);
wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbKeyFilename = new FormData();
fdbKeyFilename.right = new FormAttachment(100, 0);
fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
// fdbKeyFilename.height = 22;
wbKeyFilename.setLayoutData(fdbKeyFilename);
wKeyFilename = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.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(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// keyfilePass line
wkeyfilePass = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.keyfilePass.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.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, "JobSFTPPUT.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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.ProxyHost.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.ProxyPort.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.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, "JobSFTPPUT.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.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
// ///////////////////////////////////////////////////////////
wlCompression = new Label(wGeneralComp, SWT.RIGHT);
wlCompression.setText(BaseMessages.getString(PKG, "JobSFTPPUT.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, "JobSFTPPUT.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, "JobSFTPPUT.SourceFiles.Group.Label"));
FormLayout SourceFilesgroupLayout = new FormLayout();
SourceFilesgroupLayout.marginWidth = 10;
SourceFilesgroupLayout.marginHeight = 10;
wSourceFiles.setLayout(SourceFilesgroupLayout);
// Get arguments from previous result...
wlgetPrevious = new Label(wSourceFiles, SWT.RIGHT);
wlgetPrevious.setText(BaseMessages.getString(PKG, "JobSFTPPUT.getPrevious.Label"));
props.setLook(wlgetPrevious);
fdlgetPrevious = new FormData();
fdlgetPrevious.left = new FormAttachment(0, 0);
fdlgetPrevious.top = new FormAttachment(wServerSettings, 2 * margin);
fdlgetPrevious.right = new FormAttachment(middle, -margin);
wlgetPrevious.setLayoutData(fdlgetPrevious);
wgetPrevious = new Button(wSourceFiles, SWT.CHECK);
props.setLook(wgetPrevious);
wgetPrevious.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.getPrevious.Tooltip"));
fdgetPrevious = new FormData();
fdgetPrevious.left = new FormAttachment(middle, 0);
fdgetPrevious.top = new FormAttachment(wServerSettings, 2 * margin);
fdgetPrevious.right = new FormAttachment(100, 0);
wgetPrevious.setLayoutData(fdgetPrevious);
wgetPrevious.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (wgetPrevious.getSelection()) {
// only one is allowed
wgetPreviousFiles.setSelection(false);
}
activeCopyFromPrevious();
jobEntry.setChanged();
}
});
// Get arguments from previous files result...
wlgetPreviousFiles = new Label(wSourceFiles, SWT.RIGHT);
wlgetPreviousFiles.setText(BaseMessages.getString(PKG, "JobSFTPPUT.getPreviousFiles.Label"));
props.setLook(wlgetPreviousFiles);
fdlgetPreviousFiles = new FormData();
fdlgetPreviousFiles.left = new FormAttachment(0, 0);
fdlgetPreviousFiles.top = new FormAttachment(wgetPrevious, 2 * margin);
fdlgetPreviousFiles.right = new FormAttachment(middle, -margin);
wlgetPreviousFiles.setLayoutData(fdlgetPreviousFiles);
wgetPreviousFiles = new Button(wSourceFiles, SWT.CHECK);
props.setLook(wgetPreviousFiles);
wgetPreviousFiles.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.getPreviousFiles.Tooltip"));
fdgetPreviousFiles = new FormData();
fdgetPreviousFiles.left = new FormAttachment(middle, 0);
fdgetPreviousFiles.top = new FormAttachment(wgetPrevious, 2 * margin);
fdgetPreviousFiles.right = new FormAttachment(100, 0);
wgetPreviousFiles.setLayoutData(fdgetPreviousFiles);
wgetPreviousFiles.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (wgetPreviousFiles.getSelection()) {
// only one is allowed
wgetPrevious.setSelection(false);
}
activeCopyFromPrevious();
jobEntry.setChanged();
}
});
// Local Directory line
wlLocalDirectory = new Label(wSourceFiles, SWT.RIGHT);
wlLocalDirectory.setText(BaseMessages.getString(PKG, "JobSFTPPUT.LocalDir.Label"));
props.setLook(wlLocalDirectory);
fdlLocalDirectory = new FormData();
fdlLocalDirectory.left = new FormAttachment(0, 0);
fdlLocalDirectory.top = new FormAttachment(wgetPreviousFiles, margin);
fdlLocalDirectory.right = new FormAttachment(middle, -margin);
wlLocalDirectory.setLayoutData(fdlLocalDirectory);
// Browse folders button ...
wbLocalDirectory = new Button(wSourceFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbLocalDirectory);
wbLocalDirectory.setText(BaseMessages.getString(PKG, "JobSFTPPUT.BrowseFolders.Label"));
fdbLocalDirectory = new FormData();
fdbLocalDirectory.right = new FormAttachment(100, 0);
fdbLocalDirectory.top = new FormAttachment(wgetPreviousFiles, margin);
wbLocalDirectory.setLayoutData(fdbLocalDirectory);
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);
}
}
});
wLocalDirectory = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLocalDirectory);
wLocalDirectory.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.LocalDir.Tooltip"));
wLocalDirectory.addModifyListener(lsMod);
fdLocalDirectory = new FormData();
fdLocalDirectory.left = new FormAttachment(middle, 0);
fdLocalDirectory.top = new FormAttachment(wgetPreviousFiles, margin);
fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, -margin);
wLocalDirectory.setLayoutData(fdLocalDirectory);
// Wildcard line
wlWildcard = new Label(wSourceFiles, SWT.RIGHT);
wlWildcard.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Wildcard.Label"));
props.setLook(wlWildcard);
fdlWildcard = new FormData();
fdlWildcard.left = new FormAttachment(0, 0);
fdlWildcard.top = new FormAttachment(wbLocalDirectory, margin);
fdlWildcard.right = new FormAttachment(middle, -margin);
wlWildcard.setLayoutData(fdlWildcard);
wWildcard = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wWildcard);
wWildcard.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.Wildcard.Tooltip"));
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(middle, 0);
fdWildcard.top = new FormAttachment(wbLocalDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
// Success when there is no file...
wlSuccessWhenNoFile = new Label(wSourceFiles, SWT.RIGHT);
wlSuccessWhenNoFile.setText(BaseMessages.getString(PKG, "JobSFTPPUT.SuccessWhenNoFile.Label"));
props.setLook(wlSuccessWhenNoFile);
fdlSuccessWhenNoFile = new FormData();
fdlSuccessWhenNoFile.left = new FormAttachment(0, 0);
fdlSuccessWhenNoFile.top = new FormAttachment(wWildcard, margin);
fdlSuccessWhenNoFile.right = new FormAttachment(middle, -margin);
wlSuccessWhenNoFile.setLayoutData(fdlSuccessWhenNoFile);
wSuccessWhenNoFile = new Button(wSourceFiles, SWT.CHECK);
props.setLook(wSuccessWhenNoFile);
wSuccessWhenNoFile.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.SuccessWhenNoFile.Tooltip"));
fdSuccessWhenNoFile = new FormData();
fdSuccessWhenNoFile.left = new FormAttachment(middle, 0);
fdSuccessWhenNoFile.top = new FormAttachment(wWildcard, margin);
fdSuccessWhenNoFile.right = new FormAttachment(100, 0);
wSuccessWhenNoFile.setLayoutData(fdSuccessWhenNoFile);
wSuccessWhenNoFile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// After FTP Put
wlAfterFTPPut = new Label(wSourceFiles, SWT.RIGHT);
wlAfterFTPPut.setText(BaseMessages.getString(PKG, "JobSFTPPUT.AfterFTPPut.Label"));
props.setLook(wlAfterFTPPut);
fdlAfterFTPPut = new FormData();
fdlAfterFTPPut.left = new FormAttachment(0, 0);
fdlAfterFTPPut.right = new FormAttachment(middle, -margin);
fdlAfterFTPPut.top = new FormAttachment(wSuccessWhenNoFile, 2 * margin);
wlAfterFTPPut.setLayoutData(fdlAfterFTPPut);
wAfterFTPPut = new CCombo(wSourceFiles, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSFTPPUT.AfterSFTP.DoNothing.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSFTPPUT.AfterSFTP.Delete.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSFTPPUT.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(wSuccessWhenNoFile, 2 * margin);
fdAfterFTPPut.right = new FormAttachment(100, -margin);
wAfterFTPPut.setLayoutData(fdAfterFTPPut);
wAfterFTPPut.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
AfterFTPPutActivate();
}
});
// moveTo Directory
wlDestinationFolder = new Label(wSourceFiles, SWT.RIGHT);
wlDestinationFolder.setText(BaseMessages.getString(PKG, "JobSFTPPUT.DestinationFolder.Label"));
props.setLook(wlDestinationFolder);
fdlDestinationFolder = new FormData();
fdlDestinationFolder.left = new FormAttachment(0, 0);
fdlDestinationFolder.top = new FormAttachment(wAfterFTPPut, margin);
fdlDestinationFolder.right = new FormAttachment(middle, -margin);
wlDestinationFolder.setLayoutData(fdlDestinationFolder);
// Browse folders button ...
wbMovetoDirectory = new Button(wSourceFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbMovetoDirectory);
wbMovetoDirectory.setText(BaseMessages.getString(PKG, "JobSFTPPUT.BrowseFolders.Label"));
fdbMovetoDirectory = new FormData();
fdbMovetoDirectory.right = new FormAttachment(100, 0);
fdbMovetoDirectory.top = new FormAttachment(wAfterFTPPut, margin);
wbMovetoDirectory.setLayoutData(fdbMovetoDirectory);
wbMovetoDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wDestinationFolder.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wDestinationFolder.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
wDestinationFolder.setText(dir);
}
}
});
wDestinationFolder = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSFTPPUT.DestinationFolder.Tooltip"));
props.setLook(wDestinationFolder);
wDestinationFolder.addModifyListener(lsMod);
fdDestinationFolder = new FormData();
fdDestinationFolder.left = new FormAttachment(middle, 0);
fdDestinationFolder.top = new FormAttachment(wAfterFTPPut, margin);
fdDestinationFolder.right = new FormAttachment(wbMovetoDirectory, -margin);
wDestinationFolder.setLayoutData(fdDestinationFolder);
// Whenever something changes, set the tooltip to the expanded version:
wDestinationFolder.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wDestinationFolder.setToolTipText(jobMeta.environmentSubstitute(wDestinationFolder.getText()));
}
});
// Create destination folder if necessary ...
wlCreateDestinationFolder = new Label(wSourceFiles, SWT.RIGHT);
wlCreateDestinationFolder.setText(BaseMessages.getString(PKG, "JobSFTPPUT.CreateDestinationFolder.Label"));
props.setLook(wlCreateDestinationFolder);
fdlCreateDestinationFolder = new FormData();
fdlCreateDestinationFolder.left = new FormAttachment(0, 0);
fdlCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
fdlCreateDestinationFolder.right = new FormAttachment(middle, -margin);
wlCreateDestinationFolder.setLayoutData(fdlCreateDestinationFolder);
wCreateDestinationFolder = new Button(wSourceFiles, SWT.CHECK);
wCreateDestinationFolder.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.CreateDestinationFolder.Tooltip"));
props.setLook(wCreateDestinationFolder);
fdCreateDestinationFolder = new FormData();
fdCreateDestinationFolder.left = new FormAttachment(middle, 0);
fdCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
fdCreateDestinationFolder.right = new FormAttachment(100, 0);
wCreateDestinationFolder.setLayoutData(fdCreateDestinationFolder);
// Add filenames to result filenames...
wlAddFilenameToResult = new Label(wSourceFiles, SWT.RIGHT);
wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "JobSFTPPUT.AddfilenametoResult.Label"));
props.setLook(wlAddFilenameToResult);
fdlAddFilenameToResult = new FormData();
fdlAddFilenameToResult.left = new FormAttachment(0, 0);
fdlAddFilenameToResult.top = new FormAttachment(wCreateDestinationFolder, margin);
fdlAddFilenameToResult.right = new FormAttachment(middle, -margin);
wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
wAddFilenameToResult = new Button(wSourceFiles, SWT.CHECK);
wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.AddfilenametoResult.Tooltip"));
props.setLook(wAddFilenameToResult);
fdAddFilenameToResult = new FormData();
fdAddFilenameToResult.left = new FormAttachment(middle, 0);
fdAddFilenameToResult.top = new FormAttachment(wCreateDestinationFolder, margin);
fdAddFilenameToResult.right = new FormAttachment(100, 0);
wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
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, "JobSFTPPUT.TargetFiles.Group.Label"));
FormLayout TargetFilesgroupLayout = new FormLayout();
TargetFilesgroupLayout.marginWidth = 10;
TargetFilesgroupLayout.marginHeight = 10;
wTargetFiles.setLayout(TargetFilesgroupLayout);
// FtpDirectory line
wlScpDirectory = new Label(wTargetFiles, SWT.RIGHT);
wlScpDirectory.setText(BaseMessages.getString(PKG, "JobSFTPPUT.RemoteDir.Label"));
props.setLook(wlScpDirectory);
fdlScpDirectory = new FormData();
fdlScpDirectory.left = new FormAttachment(0, 0);
fdlScpDirectory.top = new FormAttachment(wSourceFiles, margin);
fdlScpDirectory.right = new FormAttachment(middle, -margin);
wlScpDirectory.setLayoutData(fdlScpDirectory);
// Test remote folder button ...
wbTestChangeFolderExists = new Button(wTargetFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestChangeFolderExists);
wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobSFTPPUT.TestFolderExists.Label"));
fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(wSourceFiles, margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
// Target (remote) folder
wScpDirectory = new TextVar(jobMeta, wTargetFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wScpDirectory);
wScpDirectory.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.RemoteDir.Tooltip"));
wScpDirectory.addModifyListener(lsMod);
fdScpDirectory = new FormData();
fdScpDirectory.left = new FormAttachment(middle, 0);
fdScpDirectory.top = new FormAttachment(wSourceFiles, margin);
fdScpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wScpDirectory.setLayoutData(fdScpDirectory);
// CreateRemoteFolder files after retrieval...
wlCreateRemoteFolder = new Label(wTargetFiles, SWT.RIGHT);
wlCreateRemoteFolder.setText(BaseMessages.getString(PKG, "JobSFTPPUT.CreateRemoteFolderFiles.Label"));
props.setLook(wlCreateRemoteFolder);
fdlCreateRemoteFolder = new FormData();
fdlCreateRemoteFolder.left = new FormAttachment(0, 0);
fdlCreateRemoteFolder.top = new FormAttachment(wScpDirectory, 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, "JobSFTPPUT.CreateRemoteFolderFiles.Tooltip"));
fdCreateRemoteFolder.left = new FormAttachment(middle, 0);
fdCreateRemoteFolder.top = new FormAttachment(wScpDirectory, margin);
fdCreateRemoteFolder.right = new FormAttachment(100, 0);
wCreateRemoteFolder.setLayoutData(fdCreateRemoteFolder);
wCreateRemoteFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
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(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();
}
};
lsCheckChangeFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckChangeFolder);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wScpDirectory.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();
}
});
wTabFolder.setSelection(0);
getData();
activeCopyFromPrevious();
activeUseKey();
AfterFTPPutActivate();
BaseStepDialog.setSize(shell);
shell.open();
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 JobEntrySFTPDialog 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) {
sftpclient = 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, "JobSFTP.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobSFTP.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, "JobSFTP.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, "JobSFTP.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, "JobSFTP.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, -margin);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// ServerPort line
wlServerPort = new Label(wServerSettings, SWT.RIGHT);
wlServerPort.setText(BaseMessages.getString(PKG, "JobSFTP.Port.Label"));
props.setLook(wlServerPort);
fdlServerPort = new FormData();
fdlServerPort.left = new FormAttachment(0, 0);
fdlServerPort.top = new FormAttachment(wServerName, margin);
fdlServerPort.right = new FormAttachment(middle, -margin);
wlServerPort.setLayoutData(fdlServerPort);
wServerPort = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerPort);
wServerPort.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.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, "JobSFTP.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(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
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, "JobSFTP.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// usePublicKey
wlusePublicKey = new Label(wServerSettings, SWT.RIGHT);
wlusePublicKey.setText(BaseMessages.getString(PKG, "JobSFTP.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, "JobSFTP.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();
jobEntry.setChanged();
}
});
// Key File
wlKeyFilename = new Label(wServerSettings, SWT.RIGHT);
wlKeyFilename.setText(BaseMessages.getString(PKG, "JobSFTP.KeyFilename.Label"));
props.setLook(wlKeyFilename);
fdlKeyFilename = new FormData();
fdlKeyFilename.left = new FormAttachment(0, 0);
fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdlKeyFilename.right = new FormAttachment(middle, -margin);
wlKeyFilename.setLayoutData(fdlKeyFilename);
wbKeyFilename = new Button(wServerSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbKeyFilename);
wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbKeyFilename = new FormData();
fdbKeyFilename.right = new FormAttachment(100, 0);
fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
// fdbKeyFilename.height = 22;
wbKeyFilename.setLayoutData(fdbKeyFilename);
wKeyFilename = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.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);
// Whenever something changes, set the tooltip to the expanded version:
wbKeyFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.pem", "*" });
if (wKeyFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// keyfilePass line
wkeyfilePass = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.keyfilePass.Label"), BaseMessages.getString(PKG, "JobSFTP.keyfilePass.Tooltip"), true);
props.setLook(wkeyfilePass);
wkeyfilePass.addModifyListener(lsMod);
fdkeyfilePass = new FormData();
fdkeyfilePass.left = new FormAttachment(0, -2 * 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, "JobSFTP.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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.ProxyHost.Label"), BaseMessages.getString(PKG, "JobSFTP.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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.ProxyPort.Label"), BaseMessages.getString(PKG, "JobSFTP.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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobSFTP.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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobSFTP.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, "JobSFTP.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.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
// ///////////////////////////////////////////////////////////
wlCompression = new Label(wGeneralComp, SWT.RIGHT);
wlCompression.setText(BaseMessages.getString(PKG, "JobSFTP.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, "JobSFTP.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, "JobSFTP.SourceFiles.Group.Label"));
FormLayout SourceFilesgroupLayout = new FormLayout();
SourceFilesgroupLayout.marginWidth = 10;
SourceFilesgroupLayout.marginHeight = 10;
wSourceFiles.setLayout(SourceFilesgroupLayout);
// Get arguments from previous result...
wlgetPrevious = new Label(wSourceFiles, SWT.RIGHT);
wlgetPrevious.setText(BaseMessages.getString(PKG, "JobSFTP.getPrevious.Label"));
props.setLook(wlgetPrevious);
fdlgetPrevious = new FormData();
fdlgetPrevious.left = new FormAttachment(0, 0);
fdlgetPrevious.top = new FormAttachment(wServerSettings, 2 * margin);
fdlgetPrevious.right = new FormAttachment(middle, -margin);
wlgetPrevious.setLayoutData(fdlgetPrevious);
wgetPrevious = new Button(wSourceFiles, SWT.CHECK);
props.setLook(wgetPrevious);
wgetPrevious.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.getPrevious.Tooltip"));
fdgetPrevious = new FormData();
fdgetPrevious.left = new FormAttachment(middle, 0);
fdgetPrevious.top = new FormAttachment(wServerSettings, 2 * margin);
fdgetPrevious.right = new FormAttachment(100, 0);
wgetPrevious.setLayoutData(fdgetPrevious);
wgetPrevious.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeCopyFromPrevious();
jobEntry.setChanged();
}
});
// FtpDirectory line
wlScpDirectory = new Label(wSourceFiles, SWT.RIGHT);
wlScpDirectory.setText(BaseMessages.getString(PKG, "JobSFTP.RemoteDir.Label"));
props.setLook(wlScpDirectory);
fdlScpDirectory = new FormData();
fdlScpDirectory.left = new FormAttachment(0, 0);
fdlScpDirectory.top = new FormAttachment(wgetPrevious, 2 * margin);
fdlScpDirectory.right = new FormAttachment(middle, -margin);
wlScpDirectory.setLayoutData(fdlScpDirectory);
// Test remote folder button ...
wbTestChangeFolderExists = new Button(wSourceFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestChangeFolderExists);
wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobSFTP.TestFolderExists.Label"));
fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(wgetPrevious, 2 * margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
wScpDirectory = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSFTP.RemoteDir.Tooltip"));
props.setLook(wScpDirectory);
wScpDirectory.addModifyListener(lsMod);
fdScpDirectory = new FormData();
fdScpDirectory.left = new FormAttachment(middle, 0);
fdScpDirectory.top = new FormAttachment(wgetPrevious, 2 * margin);
fdScpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wScpDirectory.setLayoutData(fdScpDirectory);
// Wildcard line
wlWildcard = new Label(wSourceFiles, SWT.RIGHT);
wlWildcard.setText(BaseMessages.getString(PKG, "JobSFTP.Wildcard.Label"));
props.setLook(wlWildcard);
fdlWildcard = new FormData();
fdlWildcard.left = new FormAttachment(0, 0);
fdlWildcard.top = new FormAttachment(wScpDirectory, margin);
fdlWildcard.right = new FormAttachment(middle, -margin);
wlWildcard.setLayoutData(fdlWildcard);
wWildcard = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSFTP.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(middle, 0);
fdWildcard.top = new FormAttachment(wScpDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
// Remove files after retrieval...
wlRemove = new Label(wSourceFiles, SWT.RIGHT);
wlRemove.setText(BaseMessages.getString(PKG, "JobSFTP.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, -margin);
wlRemove.setLayoutData(fdlRemove);
wRemove = new Button(wSourceFiles, SWT.CHECK);
props.setLook(wRemove);
wRemove.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.RemoveFiles.Tooltip"));
fdRemove = new FormData();
fdRemove.left = new FormAttachment(middle, 0);
fdRemove.top = new FormAttachment(wWildcard, margin);
fdRemove.right = new FormAttachment(100, 0);
wRemove.setLayoutData(fdRemove);
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, "JobSFTP.TargetFiles.Group.Label"));
FormLayout TargetFilesgroupLayout = new FormLayout();
TargetFilesgroupLayout.marginWidth = 10;
TargetFilesgroupLayout.marginHeight = 10;
wTargetFiles.setLayout(TargetFilesgroupLayout);
// TargetDirectory line
wlTargetDirectory = new Label(wTargetFiles, SWT.RIGHT);
wlTargetDirectory.setText(BaseMessages.getString(PKG, "JobSFTP.TargetDir.Label"));
props.setLook(wlTargetDirectory);
fdlTargetDirectory = new FormData();
fdlTargetDirectory.left = new FormAttachment(0, 0);
fdlTargetDirectory.top = new FormAttachment(wSourceFiles, margin);
fdlTargetDirectory.right = new FormAttachment(middle, -margin);
wlTargetDirectory.setLayoutData(fdlTargetDirectory);
// Browse folders button ...
wbTargetDirectory = new Button(wTargetFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbTargetDirectory);
wbTargetDirectory.setText(BaseMessages.getString(PKG, "JobSFTP.BrowseFolders.Label"));
fdbTargetDirectory = new FormData();
fdbTargetDirectory.right = new FormAttachment(100, 0);
fdbTargetDirectory.top = new FormAttachment(wSourceFiles, 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, wTargetFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSFTP.TargetDir.Tooltip"));
props.setLook(wTargetDirectory);
wTargetDirectory.addModifyListener(lsMod);
fdTargetDirectory = new FormData();
fdTargetDirectory.left = new FormAttachment(middle, 0);
fdTargetDirectory.top = new FormAttachment(wSourceFiles, margin);
fdTargetDirectory.right = new FormAttachment(wbTargetDirectory, -margin);
wTargetDirectory.setLayoutData(fdTargetDirectory);
// Create target folder if necessary...
wlCreateTargetFolder = new Label(wTargetFiles, SWT.RIGHT);
wlCreateTargetFolder.setText(BaseMessages.getString(PKG, "JobSFTP.CreateTargetFolder.Label"));
props.setLook(wlCreateTargetFolder);
fdlCreateTargetFolder = new FormData();
fdlCreateTargetFolder.left = new FormAttachment(0, 0);
fdlCreateTargetFolder.top = new FormAttachment(wTargetDirectory, margin);
fdlCreateTargetFolder.right = new FormAttachment(middle, -margin);
wlCreateTargetFolder.setLayoutData(fdlCreateTargetFolder);
wCreateTargetFolder = new Button(wTargetFiles, SWT.CHECK);
wCreateTargetFolder.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.CreateTargetFolder.Tooltip"));
props.setLook(wCreateTargetFolder);
fdCreateTargetFolder = new FormData();
fdCreateTargetFolder.left = new FormAttachment(middle, 0);
fdCreateTargetFolder.top = new FormAttachment(wTargetDirectory, margin);
fdCreateTargetFolder.right = new FormAttachment(100, 0);
wCreateTargetFolder.setLayoutData(fdCreateTargetFolder);
// Add filenames to result filenames...
wlAddFilenameToResult = new Label(wTargetFiles, SWT.RIGHT);
wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "JobSFTP.AddfilenametoResult.Label"));
props.setLook(wlAddFilenameToResult);
fdlAddFilenameToResult = new FormData();
fdlAddFilenameToResult.left = new FormAttachment(0, 0);
fdlAddFilenameToResult.top = new FormAttachment(wCreateTargetFolder, margin);
fdlAddFilenameToResult.right = new FormAttachment(middle, -margin);
wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
wAddFilenameToResult = new Button(wTargetFiles, SWT.CHECK);
wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.AddfilenametoResult.Tooltip"));
props.setLook(wAddFilenameToResult);
fdAddFilenameToResult = new FormData();
fdAddFilenameToResult.left = new FormAttachment(middle, 0);
fdAddFilenameToResult.top = new FormAttachment(wCreateTargetFolder, margin);
fdAddFilenameToResult.right = new FormAttachment(100, 0);
wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
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(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();
}
};
lsCheckChangeFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
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);
wScpDirectory.addSelectionListener(lsDef);
wTargetDirectory.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();
activeCopyFromPrevious();
activeUseKey();
BaseStepDialog.setSize(shell);
wTabFolder.setSelection(0);
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 JobEntrySyslogDialog 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, "JobEntrySyslog.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobEntrySyslog.Name.Label"), BaseMessages.getString(PKG, "JobEntrySyslog.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, "JobEntrySyslog.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, "JobEntrySyslog.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// Server port line
wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobEntrySyslog.Server.Label"), BaseMessages.getString(PKG, "JobEntrySyslog.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, "JobEntrySyslog.Port.Label"), BaseMessages.getString(PKG, "JobEntrySyslog.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);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobEntrySyslog.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobEntrySyslog.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wPort, 2 * 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 Log SETTINGS GROUP///
// /
wLogSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wLogSettings);
wLogSettings.setText(BaseMessages.getString(PKG, "JobEntrySyslog.LogSettings.Group.Label"));
FormLayout LogSettingsgroupLayout = new FormLayout();
LogSettingsgroupLayout.marginWidth = 10;
LogSettingsgroupLayout.marginHeight = 10;
wLogSettings.setLayout(LogSettingsgroupLayout);
// Facility type
wlFacility = new Label(wLogSettings, SWT.RIGHT);
wlFacility.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Facility.Label"));
props.setLook(wlFacility);
fdlFacility = new FormData();
fdlFacility.left = new FormAttachment(0, margin);
fdlFacility.right = new FormAttachment(middle, -margin);
fdlFacility.top = new FormAttachment(wServerSettings, margin);
wlFacility.setLayoutData(fdlFacility);
wFacility = new CCombo(wLogSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wFacility.setItems(SyslogDefs.FACILITYS);
props.setLook(wFacility);
fdFacility = new FormData();
fdFacility.left = new FormAttachment(middle, margin);
fdFacility.top = new FormAttachment(wServerSettings, margin);
fdFacility.right = new FormAttachment(100, 0);
wFacility.setLayoutData(fdFacility);
wFacility.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Priority type
wlPriority = new Label(wLogSettings, SWT.RIGHT);
wlPriority.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Priority.Label"));
props.setLook(wlPriority);
fdlPriority = new FormData();
fdlPriority.left = new FormAttachment(0, margin);
fdlPriority.right = new FormAttachment(middle, -margin);
fdlPriority.top = new FormAttachment(wFacility, margin);
wlPriority.setLayoutData(fdlPriority);
wPriority = new CCombo(wLogSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wPriority.setItems(SyslogDefs.PRIORITYS);
props.setLook(wPriority);
fdPriority = new FormData();
fdPriority.left = new FormAttachment(middle, margin);
fdPriority.top = new FormAttachment(wFacility, margin);
fdPriority.right = new FormAttachment(100, 0);
wPriority.setLayoutData(fdPriority);
wPriority.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
fdLogSettings = new FormData();
fdLogSettings.left = new FormAttachment(0, margin);
fdLogSettings.top = new FormAttachment(wServerSettings, margin);
fdLogSettings.right = new FormAttachment(100, -margin);
wLogSettings.setLayoutData(fdLogSettings);
// ///////////////////////////////////////////////////////////
// / END OF Log SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF MESSAGE GROUP///
// /
wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wMessageGroup);
wMessageGroup.setText(BaseMessages.getString(PKG, "JobEntrySyslog.MessageGroup.Group.Label"));
FormLayout MessageGroupgroupLayout = new FormLayout();
MessageGroupgroupLayout.marginWidth = 10;
MessageGroupgroupLayout.marginHeight = 10;
wMessageGroup.setLayout(MessageGroupgroupLayout);
// Add HostName?
wlAddHostName = new Label(wMessageGroup, SWT.RIGHT);
wlAddHostName.setText(BaseMessages.getString(PKG, "JobEntrySyslog.AddHostName.Label"));
props.setLook(wlAddHostName);
fdlAddHostName = new FormData();
fdlAddHostName.left = new FormAttachment(0, 0);
fdlAddHostName.top = new FormAttachment(wLogSettings, margin);
fdlAddHostName.right = new FormAttachment(middle, -margin);
wlAddHostName.setLayoutData(fdlAddHostName);
wAddHostName = new Button(wMessageGroup, SWT.CHECK);
props.setLook(wAddHostName);
wAddHostName.setToolTipText(BaseMessages.getString(PKG, "JobEntrySyslog.AddHostName.Tooltip"));
fdAddHostName = new FormData();
fdAddHostName.left = new FormAttachment(middle, margin);
fdAddHostName.top = new FormAttachment(wLogSettings, margin);
fdAddHostName.right = new FormAttachment(100, 0);
wAddHostName.setLayoutData(fdAddHostName);
wAddHostName.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Add timestamp?
wlAddTimestamp = new Label(wMessageGroup, SWT.RIGHT);
wlAddTimestamp.setText(BaseMessages.getString(PKG, "JobEntrySyslog.AddTimestamp.Label"));
props.setLook(wlAddTimestamp);
fdlAddTimestamp = new FormData();
fdlAddTimestamp.left = new FormAttachment(0, 0);
fdlAddTimestamp.top = new FormAttachment(wAddHostName, margin);
fdlAddTimestamp.right = new FormAttachment(middle, -margin);
wlAddTimestamp.setLayoutData(fdlAddTimestamp);
wAddTimestamp = new Button(wMessageGroup, SWT.CHECK);
props.setLook(wAddTimestamp);
wAddTimestamp.setToolTipText(BaseMessages.getString(PKG, "JobEntrySyslog.AddTimestamp.Tooltip"));
fdAddTimestamp = new FormData();
fdAddTimestamp.left = new FormAttachment(middle, margin);
fdAddTimestamp.top = new FormAttachment(wAddHostName, margin);
fdAddTimestamp.right = new FormAttachment(100, 0);
wAddTimestamp.setLayoutData(fdAddTimestamp);
wAddTimestamp.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeAddTimestamp();
jobEntry.setChanged();
}
});
// DatePattern type
wlDatePattern = new Label(wMessageGroup, SWT.RIGHT);
wlDatePattern.setText(BaseMessages.getString(PKG, "JobEntrySyslog.DatePattern.Label"));
props.setLook(wlDatePattern);
fdlDatePattern = new FormData();
fdlDatePattern.left = new FormAttachment(0, margin);
fdlDatePattern.right = new FormAttachment(middle, -margin);
fdlDatePattern.top = new FormAttachment(wAddTimestamp, margin);
wlDatePattern.setLayoutData(fdlDatePattern);
wDatePattern = new ComboVar(jobMeta, wMessageGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wDatePattern.setItems(Const.getDateFormats());
props.setLook(wDatePattern);
fdDatePattern = new FormData();
fdDatePattern.left = new FormAttachment(middle, margin);
fdDatePattern.top = new FormAttachment(wAddTimestamp, margin);
fdDatePattern.right = new FormAttachment(100, 0);
wDatePattern.setLayoutData(fdDatePattern);
wDatePattern.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Message line
wlMessage = new Label(wMessageGroup, SWT.RIGHT);
wlMessage.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Message.Label"));
props.setLook(wlMessage);
fdlMessage = new FormData();
fdlMessage.left = new FormAttachment(0, margin);
fdlMessage.top = new FormAttachment(wLogSettings, margin);
fdlMessage.right = new FormAttachment(middle, -margin);
wlMessage.setLayoutData(fdlMessage);
wMessage = new StyledTextComp(jobEntry, wMessageGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wMessage);
wMessage.addModifyListener(lsMod);
fdMessage = new FormData();
fdMessage.left = new FormAttachment(middle, margin);
fdMessage.top = new FormAttachment(wDatePattern, margin);
fdMessage.right = new FormAttachment(100, -2 * margin);
fdMessage.bottom = new FormAttachment(100, -margin);
wMessage.setLayoutData(fdMessage);
fdMessageGroup = new FormData();
fdMessageGroup.left = new FormAttachment(0, margin);
fdMessageGroup.top = new FormAttachment(wLogSettings, margin);
fdMessageGroup.right = new FormAttachment(100, -margin);
fdMessageGroup.bottom = new FormAttachment(100, -margin);
wMessageGroup.setLayoutData(fdMessageGroup);
// ///////////////////////////////////////////////////////////
// / END OF MESSAGE GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activeAddTimestamp();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobEntrySyslogDialogSize");
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 XsltDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "XsltDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "XsltDialog.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, "XsltDialog.GeneralTab.TabTitle"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// FieldName to evaluate
wlField = new Label(wGeneralComp, SWT.RIGHT);
wlField.setText(BaseMessages.getString(PKG, "XsltDialog.Field.Label"));
props.setLook(wlField);
FormData fdlField = new FormData();
fdlField.left = new FormAttachment(0, 0);
fdlField.top = new FormAttachment(wStepname, 2 * margin);
fdlField.right = new FormAttachment(middle, -margin);
wlField.setLayoutData(fdlField);
wField = new CCombo(wGeneralComp, SWT.BORDER | SWT.READ_ONLY);
wField.setEditable(true);
props.setLook(wField);
wField.addModifyListener(lsMod);
FormData fdField = new FormData();
fdField.left = new FormAttachment(middle, margin);
fdField.top = new FormAttachment(wStepname, 2 * margin);
fdField.right = new FormAttachment(100, -margin);
wField.setLayoutData(fdField);
wField.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);
PopulateFields(wField);
shell.setCursor(null);
busy.dispose();
}
});
// Step Ouput field grouping?
// ////////////////////////
// START OF Output Field GROUP
//
wOutputField = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wOutputField);
wOutputField.setText(BaseMessages.getString(PKG, "XsltDialog.ResultField.Group.Label"));
FormLayout outputfieldgroupLayout = new FormLayout();
outputfieldgroupLayout.marginWidth = 10;
outputfieldgroupLayout.marginHeight = 10;
wOutputField.setLayout(outputfieldgroupLayout);
// Output Fieldame
wResultField = new LabelTextVar(transMeta, wOutputField, BaseMessages.getString(PKG, "XsltDialog.ResultField.Label"), BaseMessages.getString(PKG, "XsltDialog.ResultField.Tooltip"));
props.setLook(wResultField);
wResultField.addModifyListener(lsMod);
FormData fdResultField = new FormData();
fdResultField.left = new FormAttachment(0, 0);
fdResultField.top = new FormAttachment(wField, margin);
fdResultField.right = new FormAttachment(100, 0);
wResultField.setLayoutData(fdResultField);
fdOutputField = new FormData();
fdOutputField.left = new FormAttachment(0, margin);
fdOutputField.top = new FormAttachment(wField, margin);
fdOutputField.right = new FormAttachment(100, -margin);
wOutputField.setLayoutData(fdOutputField);
// ///////////////////////////////////////////////////////////
// / END OF Output Field GROUP
// ///////////////////////////////////////////////////////////
// XSL File grouping
// ////////////////////////
// START OF XSL File GROUP
//
wXSLFileGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wXSLFileGroup);
wXSLFileGroup.setText(BaseMessages.getString(PKG, "XsltDialog.XSL.Group.Label"));
FormLayout XSLFileGroupLayout = new FormLayout();
XSLFileGroupLayout.marginWidth = 10;
XSLFileGroupLayout.marginHeight = 10;
wXSLFileGroup.setLayout(XSLFileGroupLayout);
// Is XSL source defined in a Field?
wlXSLFileField = new Label(wXSLFileGroup, SWT.RIGHT);
wlXSLFileField.setText(BaseMessages.getString(PKG, "XsltDialog.XSLFilenameFileField.Label"));
props.setLook(wlXSLFileField);
fdlXSLFileField = new FormData();
fdlXSLFileField.left = new FormAttachment(0, 0);
fdlXSLFileField.top = new FormAttachment(wResultField, margin);
fdlXSLFileField.right = new FormAttachment(middle, -margin);
wlXSLFileField.setLayoutData(fdlXSLFileField);
wXSLFileField = new Button(wXSLFileGroup, SWT.CHECK);
props.setLook(wXSLFileField);
wXSLFileField.setToolTipText(BaseMessages.getString(PKG, "XsltDialog.XSLFilenameFileField.Tooltip"));
fdXSLFileField = new FormData();
fdXSLFileField.left = new FormAttachment(middle, margin);
fdXSLFileField.top = new FormAttachment(wResultField, margin);
wXSLFileField.setLayoutData(fdXSLFileField);
SelectionAdapter lsXslFile = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ActivewlXSLField();
input.setChanged();
}
};
wXSLFileField.addSelectionListener(lsXslFile);
// If XSL File name defined in a Field
wlXSLField = new Label(wXSLFileGroup, SWT.RIGHT);
wlXSLField.setText(BaseMessages.getString(PKG, "XsltDialog.XSLFilenameField.Label"));
props.setLook(wlXSLField);
FormData fdlXSLField = new FormData();
fdlXSLField.left = new FormAttachment(0, 0);
fdlXSLField.top = new FormAttachment(wXSLFileField, margin);
fdlXSLField.right = new FormAttachment(middle, -margin);
wlXSLField.setLayoutData(fdlXSLField);
wXSLField = new CCombo(wXSLFileGroup, SWT.BORDER | SWT.READ_ONLY);
wXSLField.setEditable(true);
props.setLook(wXSLField);
wXSLField.addModifyListener(lsMod);
FormData fdXSLField = new FormData();
fdXSLField.left = new FormAttachment(middle, margin);
fdXSLField.top = new FormAttachment(wXSLFileField, margin);
fdXSLField.right = new FormAttachment(100, -margin);
wXSLField.setLayoutData(fdXSLField);
wXSLField.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);
PopulateFields(wXSLField);
shell.setCursor(null);
busy.dispose();
}
});
// Is XSL field defined in a Field is a file?
wlXSLFieldIsAFile = new Label(wXSLFileGroup, SWT.RIGHT);
wlXSLFieldIsAFile.setText(BaseMessages.getString(PKG, "XsltDialog.XSLFieldIsAFile.Label"));
props.setLook(wlXSLFieldIsAFile);
fdlXSLFieldIsAFile = new FormData();
fdlXSLFieldIsAFile.left = new FormAttachment(0, 0);
fdlXSLFieldIsAFile.top = new FormAttachment(wXSLField, margin);
fdlXSLFieldIsAFile.right = new FormAttachment(middle, -margin);
wlXSLFieldIsAFile.setLayoutData(fdlXSLFieldIsAFile);
wXSLFieldIsAFile = new Button(wXSLFileGroup, SWT.CHECK);
props.setLook(wXSLFieldIsAFile);
wXSLFieldIsAFile.setToolTipText(BaseMessages.getString(PKG, "XsltDialog.XSLFieldIsAFile.Tooltip"));
fdXSLFieldIsAFile = new FormData();
fdXSLFieldIsAFile.left = new FormAttachment(middle, margin);
fdXSLFieldIsAFile.top = new FormAttachment(wXSLField, margin);
wXSLFieldIsAFile.setLayoutData(fdXSLFieldIsAFile);
wXSLFieldIsAFile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
input.setChanged();
}
});
// XSL Filename
wlFilename = new Label(wXSLFileGroup, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "XsltDialog.XSLFilename.Label"));
props.setLook(wlFilename);
FormData fdlXSLFilename = new FormData();
fdlXSLFilename.left = new FormAttachment(0, 0);
fdlXSLFilename.top = new FormAttachment(wXSLFieldIsAFile, 2 * margin);
fdlXSLFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlXSLFilename);
wbbFilename = new Button(wXSLFileGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbbFilename);
wbbFilename.setText(BaseMessages.getString(PKG, "XsltDialog.FilenameBrowse.Button"));
wbbFilename.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
FormData fdbXSLFilename = new FormData();
fdbXSLFilename.right = new FormAttachment(100, 0);
fdbXSLFilename.top = new FormAttachment(wXSLFieldIsAFile, 2 * margin);
wbbFilename.setLayoutData(fdbXSLFilename);
wXSLFilename = new TextVar(transMeta, wXSLFileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wXSLFilename);
wXSLFilename.addModifyListener(lsMod);
FormData fdXSLFilename = new FormData();
fdXSLFilename.left = new FormAttachment(middle, margin);
fdXSLFilename.right = new FormAttachment(wbbFilename, -margin);
fdXSLFilename.top = new FormAttachment(wXSLFieldIsAFile, 2 * margin);
wXSLFilename.setLayoutData(fdXSLFilename);
// XSLTFactory
wlXSLTFactory = new Label(wXSLFileGroup, SWT.RIGHT);
wlXSLTFactory.setText(BaseMessages.getString(PKG, "XsltDialog.XSLTFactory.Label"));
props.setLook(wlXSLTFactory);
fdlXSLTFactory = new FormData();
fdlXSLTFactory.left = new FormAttachment(0, 0);
fdlXSLTFactory.top = new FormAttachment(wXSLFilename, 2 * margin);
fdlXSLTFactory.right = new FormAttachment(middle, -margin);
wlXSLTFactory.setLayoutData(fdlXSLTFactory);
wXSLTFactory = new CCombo(wXSLFileGroup, SWT.BORDER | SWT.READ_ONLY);
wXSLTFactory.setEditable(true);
props.setLook(wXSLTFactory);
wXSLTFactory.addModifyListener(lsMod);
fdXSLTFactory = new FormData();
fdXSLTFactory.left = new FormAttachment(middle, margin);
fdXSLTFactory.top = new FormAttachment(wXSLFilename, 2 * margin);
fdXSLTFactory.right = new FormAttachment(100, 0);
wXSLTFactory.setLayoutData(fdXSLTFactory);
wXSLTFactory.add("JAXP");
wXSLTFactory.add("SAXON");
fdXSLFileGroup = new FormData();
fdXSLFileGroup.left = new FormAttachment(0, margin);
fdXSLFileGroup.top = new FormAttachment(wOutputField, margin);
fdXSLFileGroup.right = new FormAttachment(100, -margin);
wXSLFileGroup.setLayoutData(fdXSLFileGroup);
// ///////////////////////////////////////////////////////////
// / END OF XSL File GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wField, 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
// ///////////////////////////////////////////////////////////
// Additional tab...
//
wAdditionalTab = new CTabItem(wTabFolder, SWT.NONE);
wAdditionalTab.setText(BaseMessages.getString(PKG, "XsltDialog.AdvancedTab.Title"));
FormLayout addLayout = new FormLayout();
addLayout.marginWidth = Const.FORM_MARGIN;
addLayout.marginHeight = Const.FORM_MARGIN;
wAdditionalComp = new Composite(wTabFolder, SWT.NONE);
wAdditionalComp.setLayout(addLayout);
props.setLook(wAdditionalComp);
// Output properties
wlOutputProperties = new Label(wAdditionalComp, SWT.NONE);
wlOutputProperties.setText(BaseMessages.getString(PKG, "XsltDialog.OutputProperties.Label"));
props.setLook(wlOutputProperties);
fdlOutputProperties = new FormData();
fdlOutputProperties.left = new FormAttachment(0, 0);
fdlOutputProperties.top = new FormAttachment(0, margin);
wlOutputProperties.setLayoutData(fdlOutputProperties);
final int OutputPropertiesRows = input.getOutputPropertyName().length;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "XsltDialog.ColumnInfo.OutputProperties.Name"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "XsltDialog.ColumnInfo.OutputProperties.Value"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinf[0].setComboValues(XsltMeta.outputProperties);
colinf[1].setUsingVariables(true);
wOutputProperties = new TableView(transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, OutputPropertiesRows, lsMod, props);
fdOutputProperties = new FormData();
fdOutputProperties.left = new FormAttachment(0, 0);
fdOutputProperties.top = new FormAttachment(wlOutputProperties, margin);
fdOutputProperties.right = new FormAttachment(100, -margin);
fdOutputProperties.bottom = new FormAttachment(wlOutputProperties, 200);
wOutputProperties.setLayoutData(fdOutputProperties);
// Parameters
wlFields = new Label(wAdditionalComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "XsltDialog.Parameters.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(wOutputProperties, 2 * margin);
wlFields.setLayoutData(fdlFields);
wGet = new Button(wAdditionalComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "XsltDialog.GetFields.Button"));
FormData fdGet = new FormData();
fdGet.top = new FormAttachment(wlFields, margin);
fdGet.right = new FormAttachment(100, 0);
wGet.setLayoutData(fdGet);
final int FieldsRows = input.getParameterField().length;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "XsltDialog.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "XsltDialog.ColumnInfo.Parameter"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinf[1].setUsingVariables(true);
wFields = new TableView(transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(wGet, -margin);
fdFields.bottom = new FormAttachment(100, -margin);
wFields.setLayoutData(fdFields);
// Search the fields in the background
final Runnable runnable = new Runnable() {
public void run() {
StepMeta stepMeta = transMeta.findStep(stepname);
if (stepMeta != null) {
try {
RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
}
setComboBoxes();
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
fdAdditionalComp = new FormData();
fdAdditionalComp.left = new FormAttachment(0, 0);
fdAdditionalComp.top = new FormAttachment(wStepname, margin);
fdAdditionalComp.right = new FormAttachment(100, 0);
fdAdditionalComp.bottom = new FormAttachment(100, 0);
wAdditionalComp.setLayoutData(fdAdditionalComp);
wAdditionalComp.layout();
wAdditionalTab.setControl(wAdditionalComp);
// ////// END of Additional Tab
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wGet.addListener(SWT.Selection, lsGet);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Whenever something changes, set the tooltip to the expanded version
// of the filename:
wXSLFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wXSLFilename.setToolTipText(transMeta.environmentSubstitute(wXSLFilename.getText()));
}
});
// Listen to the Browse... button
wbbFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.xsl;*.XSL", "*.xslt;.*XSLT", "*" });
if (wXSLFilename.getText() != null) {
String fname = transMeta.environmentSubstitute(wXSLFilename.getText());
dialog.setFileName(fname);
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "XsltDialog.FileType"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
String str = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
wXSLFilename.setText(str);
}
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
ActivewlXSLField();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class JobEntryFTPDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
pwdFolder = null;
ftpclient = null;
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, "JobFTP.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobFTP.Name.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.Server.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.Port.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.User.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.Password.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.ProxyHost.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.ProxyPort.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobFTP.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.Timeout.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.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, "JobFTP.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);
// 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, "JobFTP.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, "JobFTP.ControlEncoding.Tooltip"));
wControlEncoding.setItems(encodings);
props.setLook(wControlEncoding);
fdControlEncoding = new FormData();
fdControlEncoding.left = new FormAttachment(middle, margin);
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, "JobFTP.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, "JobFTP.RemoteSettings.Group.Label"));
FormLayout RemoteSettinsgroupLayout = new FormLayout();
RemoteSettinsgroupLayout.marginWidth = 10;
RemoteSettinsgroupLayout.marginHeight = 10;
wRemoteSettings.setLayout(RemoteSettinsgroupLayout);
// Move to directory
wlFtpDirectory = new Label(wRemoteSettings, SWT.RIGHT);
wlFtpDirectory.setText(BaseMessages.getString(PKG, "JobFTP.RemoteDir.Label"));
props.setLook(wlFtpDirectory);
fdlFtpDirectory = new FormData();
fdlFtpDirectory.left = new FormAttachment(0, 0);
fdlFtpDirectory.top = new FormAttachment(0, margin);
fdlFtpDirectory.right = new FormAttachment(middle, 0);
wlFtpDirectory.setLayoutData(fdlFtpDirectory);
// Test remote folder button ...
wbTestChangeFolderExists = new Button(wRemoteSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestChangeFolderExists);
wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobFTP.TestFolderExists.Label"));
fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(0, margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
wFtpDirectory = new TextVar(jobMeta, wRemoteSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTP.RemoteDir.Tooltip"));
props.setLook(wFtpDirectory);
wFtpDirectory.addModifyListener(lsMod);
fdFtpDirectory = new FormData();
fdFtpDirectory.left = new FormAttachment(middle, margin);
fdFtpDirectory.top = new FormAttachment(0, margin);
fdFtpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wFtpDirectory.setLayoutData(fdFtpDirectory);
// Wildcard line
wWildcard = new LabelTextVar(jobMeta, wRemoteSettings, BaseMessages.getString(PKG, "JobFTP.Wildcard.Label"), BaseMessages.getString(PKG, "JobFTP.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(0, 0);
fdWildcard.top = new FormAttachment(wFtpDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
// Remove files after retrieval...
wlRemove = new Label(wRemoteSettings, SWT.RIGHT);
wlRemove.setText(BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, BaseMessages.getString(PKG, "JobFTP.MoveToDirectory.Tooltip"));
wMoveToDirectory.setToolTipText(BaseMessages.getString(PKG, "JobFTP.MoveFolder.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, BaseMessages.getString(PKG, "JobFTP.TargetDir.Tooltip"));
props.setLook(wTargetDirectory);
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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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 (String dat : dats) {
wDateTimeFormat.add(dat);
}
// Add Date before extension?
wlAddDateBeforeExtension = new Label(wLocalSettings, SWT.RIGHT);
wlAddDateBeforeExtension.setText(BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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();
}
});
// If File Exists
wlIfFileExists = new Label(wLocalSettings, SWT.RIGHT);
wlIfFileExists.setText(BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.Skip.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobFTP.Give_Unique_Name.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobFTP.Fail.Label"));
// +1: starts at -1
wIfFileExists.select(0);
props.setLook(wIfFileExists);
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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.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, "JobFTP.SuccessWhenAllWorksFine.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTP.SuccessWhenAtLeat.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.NrBadFormedLessThan.Label") + " ");
props.setLook(wlNrErrorsLessThan);
fdlNrErrorsLessThan = new FormData();
fdlNrErrorsLessThan.left = new FormAttachment(0, 0);
fdlNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
fdlNrErrorsLessThan.right = new FormAttachment(middle, -margin);
wlNrErrorsLessThan.setLayoutData(fdlNrErrorsLessThan);
wNrErrorsLessThan = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTP.NrBadFormedLessThan.Tooltip"));
props.setLook(wNrErrorsLessThan);
wNrErrorsLessThan.addModifyListener(lsMod);
fdNrErrorsLessThan = new FormData();
fdNrErrorsLessThan.left = new FormAttachment(middle, 0);
fdNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
fdNrErrorsLessThan.right = new FormAttachment(100, -margin);
wNrErrorsLessThan.setLayoutData(fdNrErrorsLessThan);
fdSuccessOn = new FormData();
fdSuccessOn.left = new FormAttachment(0, margin);
fdSuccessOn.top = new FormAttachment(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
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// Start of Socks Proxy Tab
// ///////////////////////////////////////////////////////////
wSocksProxyTab = new CTabItem(wTabFolder, SWT.NONE);
wSocksProxyTab.setText(BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.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, "JobFTP.SocksProxyHost.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.SocksProxyPort.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.SocksProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTP.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, "JobFTP.SocksProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTP.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();
}
};
lsCheckFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder(false, true, wMoveToDirectory.getText());
}
};
lsCheckChangeFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder(true, false, wFtpDirectory.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);
wFtpDirectory.addSelectionListener(lsDef);
wTargetDirectory.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wWildcard.addSelectionListener(lsDef);
wTimeout.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activateMoveTo();
setDateTimeFormat();
setAddDateBeforeExtension();
activeSuccessCondition();
activeIfExists();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobFTPDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
Aggregations