use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class JobEntryFTPSPUTDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
connection = null;
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobFTPSPUT.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wlServerName = new Label(wServerSettings, SWT.RIGHT);
wlServerName.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Server.Label"));
props.setLook(wlServerName);
fdlServerName = new FormData();
fdlServerName.left = new FormAttachment(0, 0);
fdlServerName.top = new FormAttachment(wName, margin);
fdlServerName.right = new FormAttachment(middle, 0);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, margin);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// ServerPort line
wlServerPort = new Label(wServerSettings, SWT.RIGHT);
wlServerPort.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Port.Label"));
props.setLook(wlServerPort);
fdlServerPort = new FormData();
fdlServerPort.left = new FormAttachment(0, 0);
fdlServerPort.top = new FormAttachment(wServerName, margin);
fdlServerPort.right = new FormAttachment(middle, 0);
wlServerPort.setLayoutData(fdlServerPort);
wServerPort = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerPort);
wServerPort.setToolTipText(BaseMessages.getString(PKG, "JobFTPSPUT.Port.Tooltip"));
wServerPort.addModifyListener(lsMod);
fdServerPort = new FormData();
fdServerPort.left = new FormAttachment(middle, margin);
fdServerPort.top = new FormAttachment(wServerName, margin);
fdServerPort.right = new FormAttachment(100, 0);
wServerPort.setLayoutData(fdServerPort);
// UserName line
wlUserName = new Label(wServerSettings, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Username.Label"));
props.setLook(wlUserName);
fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wServerPort, margin);
fdlUserName.right = new FormAttachment(middle, 0);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, margin);
fdUserName.top = new FormAttachment(wServerPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wlPassword = new Label(wServerSettings, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, 0);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, margin);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Proxy host line
wProxyHost = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPSPUT.ProxyHost.Label"), BaseMessages.getString(PKG, "JobFTPSPUT.ProxyHost.Tooltip"));
props.setLook(wProxyHost);
wProxyHost.addModifyListener(lsMod);
fdProxyHost = new FormData();
fdProxyHost.left = new FormAttachment(0, 0);
fdProxyHost.top = new FormAttachment(wPassword, 2 * margin);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// Proxy port line
wProxyPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPSPUT.ProxyPort.Label"), BaseMessages.getString(PKG, "JobFTPSPUT.ProxyPort.Tooltip"));
props.setLook(wProxyPort);
wProxyPort.addModifyListener(lsMod);
fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(0, 0);
fdProxyPort.top = new FormAttachment(wProxyHost, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
// Proxy username line
wProxyUsername = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPSPUT.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTPSPUT.ProxyUsername.Tooltip"));
props.setLook(wProxyUsername);
wProxyUsername.addModifyListener(lsMod);
fdProxyUsername = new FormData();
fdProxyUsername.left = new FormAttachment(0, 0);
fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
fdProxyUsername.right = new FormAttachment(100, 0);
wProxyUsername.setLayoutData(fdProxyUsername);
// Proxy password line
wProxyPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPSPUT.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTPSPUT.ProxyPassword.Tooltip"), true);
props.setLook(wProxyPassword);
wProxyPassword.addModifyListener(lsMod);
fdProxyPasswd = new FormData();
fdProxyPasswd.left = new FormAttachment(0, 0);
fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
fdProxyPasswd.right = new FormAttachment(100, 0);
wProxyPassword.setLayoutData(fdProxyPasswd);
wlConnectionType = new Label(wServerSettings, SWT.RIGHT);
wlConnectionType.setText(BaseMessages.getString(PKG, "JobFTPSPUT.ConnectionType.Label"));
props.setLook(wlConnectionType);
fdlConnectionType = new FormData();
fdlConnectionType.left = new FormAttachment(0, 0);
fdlConnectionType.right = new FormAttachment(middle, 0);
fdlConnectionType.top = new FormAttachment(wProxyPassword, 2 * margin);
wlConnectionType.setLayoutData(fdlConnectionType);
wConnectionType = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wConnectionType.setItems(FTPSConnection.connection_type_Desc);
props.setLook(wConnectionType);
fdConnectionType = new FormData();
fdConnectionType.left = new FormAttachment(middle, margin);
fdConnectionType.top = new FormAttachment(wProxyPassword, 2 * margin);
fdConnectionType.right = new FormAttachment(100, 0);
wConnectionType.setLayoutData(fdConnectionType);
wConnectionType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobFTPSPUT.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobFTPSPUT.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wConnectionType, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wName, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Advanced SETTINGS GROUP///
// /
wAdvancedSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedSettings);
wAdvancedSettings.setText(BaseMessages.getString(PKG, "JobFTPSPUT.AdvancedSettings.Group.Label"));
FormLayout AdvancedSettingsgroupLayout = new FormLayout();
AdvancedSettingsgroupLayout.marginWidth = 10;
AdvancedSettingsgroupLayout.marginHeight = 10;
wAdvancedSettings.setLayout(AdvancedSettingsgroupLayout);
// Binary mode selection...
wlBinaryMode = new Label(wAdvancedSettings, SWT.RIGHT);
wlBinaryMode.setText(BaseMessages.getString(PKG, "JobFTPSPUT.BinaryMode.Label"));
props.setLook(wlBinaryMode);
fdlBinaryMode = new FormData();
fdlBinaryMode.left = new FormAttachment(0, 0);
fdlBinaryMode.top = new FormAttachment(wServerSettings, margin);
fdlBinaryMode.right = new FormAttachment(middle, 0);
wlBinaryMode.setLayoutData(fdlBinaryMode);
wBinaryMode = new Button(wAdvancedSettings, SWT.CHECK);
props.setLook(wBinaryMode);
wBinaryMode.setToolTipText(BaseMessages.getString(PKG, "JobFTPSPUT.BinaryMode.Tooltip"));
fdBinaryMode = new FormData();
fdBinaryMode.left = new FormAttachment(middle, 0);
fdBinaryMode.top = new FormAttachment(wServerSettings, margin);
fdBinaryMode.right = new FormAttachment(100, 0);
wBinaryMode.setLayoutData(fdBinaryMode);
// TimeOut...
wlTimeout = new Label(wAdvancedSettings, SWT.RIGHT);
wlTimeout.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Timeout.Label"));
props.setLook(wlTimeout);
fdlTimeout = new FormData();
fdlTimeout.left = new FormAttachment(0, 0);
fdlTimeout.top = new FormAttachment(wBinaryMode, margin);
fdlTimeout.right = new FormAttachment(middle, 0);
wlTimeout.setLayoutData(fdlTimeout);
wTimeout = new TextVar(jobMeta, wAdvancedSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPSPUT.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.setToolTipText(BaseMessages.getString(PKG, "JobFTPSPUT.Timeout.Tooltip"));
fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(middle, 0);
fdTimeout.top = new FormAttachment(wBinaryMode, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// active connection?
wlActive = new Label(wAdvancedSettings, SWT.RIGHT);
wlActive.setText(BaseMessages.getString(PKG, "JobFTPSPUT.ActiveConns.Label"));
props.setLook(wlActive);
fdlActive = new FormData();
fdlActive.left = new FormAttachment(0, 0);
fdlActive.top = new FormAttachment(wTimeout, margin);
fdlActive.right = new FormAttachment(middle, 0);
wlActive.setLayoutData(fdlActive);
wActive = new Button(wAdvancedSettings, SWT.CHECK);
wActive.setToolTipText(BaseMessages.getString(PKG, "JobFTPSPUT.ActiveConns.Tooltip"));
props.setLook(wActive);
fdActive = new FormData();
fdActive.left = new FormAttachment(middle, 0);
fdActive.top = new FormAttachment(wTimeout, margin);
fdActive.right = new FormAttachment(100, 0);
wActive.setLayoutData(fdActive);
fdAdvancedSettings = new FormData();
fdAdvancedSettings.left = new FormAttachment(0, margin);
fdAdvancedSettings.top = new FormAttachment(wServerSettings, margin);
fdAdvancedSettings.right = new FormAttachment(100, -margin);
wAdvancedSettings.setLayoutData(fdAdvancedSettings);
// ///////////////////////////////////////////////////////////
// / END OF Advanced SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Files TAB ///
// ////////////////////////
wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Tab.Files.Label"));
wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout FilesLayout = new FormLayout();
FilesLayout.marginWidth = 3;
FilesLayout.marginHeight = 3;
wFilesComp.setLayout(FilesLayout);
// ////////////////////////
// START OF Source SETTINGS GROUP///
// /
wSourceSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wSourceSettings);
wSourceSettings.setText(BaseMessages.getString(PKG, "JobFTPSPUT.SourceSettings.Group.Label"));
FormLayout SourceSettinsgroupLayout = new FormLayout();
SourceSettinsgroupLayout.marginWidth = 10;
SourceSettinsgroupLayout.marginHeight = 10;
wSourceSettings.setLayout(SourceSettinsgroupLayout);
// Local (source) directory line
wlLocalDirectory = new Label(wSourceSettings, SWT.RIGHT);
wlLocalDirectory.setText(BaseMessages.getString(PKG, "JobFTPSPUT.LocalDir.Label"));
props.setLook(wlLocalDirectory);
fdlLocalDirectory = new FormData();
fdlLocalDirectory.left = new FormAttachment(0, 0);
fdlLocalDirectory.top = new FormAttachment(0, margin);
fdlLocalDirectory.right = new FormAttachment(middle, -margin);
wlLocalDirectory.setLayoutData(fdlLocalDirectory);
// Browse folders button ...
wbLocalDirectory = new Button(wSourceSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbLocalDirectory);
wbLocalDirectory.setText(BaseMessages.getString(PKG, "JobFTPSPUT.BrowseFolders.Label"));
fdbLocalDirectory = new FormData();
fdbLocalDirectory.right = new FormAttachment(100, 0);
fdbLocalDirectory.top = new FormAttachment(0, margin);
wbLocalDirectory.setLayoutData(fdbLocalDirectory);
wLocalDirectory = new TextVar(jobMeta, wSourceSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPSPUT.LocalDir.Tooltip"));
props.setLook(wLocalDirectory);
wLocalDirectory.addModifyListener(lsMod);
fdLocalDirectory = new FormData();
fdLocalDirectory.left = new FormAttachment(middle, 0);
fdLocalDirectory.top = new FormAttachment(0, margin);
fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, -margin);
wLocalDirectory.setLayoutData(fdLocalDirectory);
// Wildcard line
wlWildcard = new Label(wSourceSettings, SWT.RIGHT);
wlWildcard.setText(BaseMessages.getString(PKG, "JobFTPSPUT.Wildcard.Label"));
props.setLook(wlWildcard);
fdlWildcard = new FormData();
fdlWildcard.left = new FormAttachment(0, 0);
fdlWildcard.top = new FormAttachment(wLocalDirectory, margin);
fdlWildcard.right = new FormAttachment(middle, -margin);
wlWildcard.setLayoutData(fdlWildcard);
wWildcard = new TextVar(jobMeta, wSourceSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPSPUT.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(middle, 0);
fdWildcard.top = new FormAttachment(wLocalDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
// Remove files after retrieval...
wlRemove = new Label(wSourceSettings, SWT.RIGHT);
wlRemove.setText(BaseMessages.getString(PKG, "JobFTPSPUT.RemoveFiles.Label"));
props.setLook(wlRemove);
fdlRemove = new FormData();
fdlRemove.left = new FormAttachment(0, 0);
fdlRemove.top = new FormAttachment(wWildcard, 2 * margin);
fdlRemove.right = new FormAttachment(middle, -margin);
wlRemove.setLayoutData(fdlRemove);
wRemove = new Button(wSourceSettings, SWT.CHECK);
props.setLook(wRemove);
wRemove.setToolTipText(BaseMessages.getString(PKG, "JobFTPSPUT.RemoveFiles.Tooltip"));
fdRemove = new FormData();
fdRemove.left = new FormAttachment(middle, 0);
fdRemove.top = new FormAttachment(wWildcard, 2 * margin);
fdRemove.right = new FormAttachment(100, 0);
wRemove.setLayoutData(fdRemove);
// OnlyNew files after retrieval...
wlOnlyNew = new Label(wSourceSettings, SWT.RIGHT);
wlOnlyNew.setText(BaseMessages.getString(PKG, "JobFTPSPUT.DontOverwrite.Label"));
props.setLook(wlOnlyNew);
fdlOnlyNew = new FormData();
fdlOnlyNew.left = new FormAttachment(0, 0);
fdlOnlyNew.top = new FormAttachment(wRemove, margin);
fdlOnlyNew.right = new FormAttachment(middle, 0);
wlOnlyNew.setLayoutData(fdlOnlyNew);
wOnlyNew = new Button(wSourceSettings, SWT.CHECK);
wOnlyNew.setToolTipText(BaseMessages.getString(PKG, "JobFTPSPUT.DontOverwrite.Tooltip"));
props.setLook(wOnlyNew);
fdOnlyNew = new FormData();
fdOnlyNew.left = new FormAttachment(middle, 0);
fdOnlyNew.top = new FormAttachment(wRemove, margin);
fdOnlyNew.right = new FormAttachment(100, 0);
wOnlyNew.setLayoutData(fdOnlyNew);
fdSourceSettings = new FormData();
fdSourceSettings.left = new FormAttachment(0, margin);
fdSourceSettings.top = new FormAttachment(0, 2 * margin);
fdSourceSettings.right = new FormAttachment(100, -margin);
wSourceSettings.setLayoutData(fdSourceSettings);
// ///////////////////////////////////////////////////////////
// / END OF Source SETTINGSGROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Target SETTINGS GROUP///
// /
wTargetSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wTargetSettings);
wTargetSettings.setText(BaseMessages.getString(PKG, "JobFTPSPUT.TargetSettings.Group.Label"));
FormLayout TargetSettinsgroupLayout = new FormLayout();
TargetSettinsgroupLayout.marginWidth = 10;
TargetSettinsgroupLayout.marginHeight = 10;
wTargetSettings.setLayout(TargetSettinsgroupLayout);
// Remote Directory line
wlRemoteDirectory = new Label(wTargetSettings, SWT.RIGHT);
wlRemoteDirectory.setText(BaseMessages.getString(PKG, "JobFTPSPUT.RemoteDir.Label"));
props.setLook(wlRemoteDirectory);
fdlRemoteDirectory = new FormData();
fdlRemoteDirectory.left = new FormAttachment(0, 0);
fdlRemoteDirectory.top = new FormAttachment(wSourceSettings, margin);
fdlRemoteDirectory.right = new FormAttachment(middle, -margin);
wlRemoteDirectory.setLayoutData(fdlRemoteDirectory);
// Test remote folder button ...
wbTestRemoteDirectoryExists = new Button(wTargetSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestRemoteDirectoryExists);
wbTestRemoteDirectoryExists.setText(BaseMessages.getString(PKG, "JobFTPSPUT.TestFolderExists.Label"));
fdbTestRemoteDirectoryExists = new FormData();
fdbTestRemoteDirectoryExists.right = new FormAttachment(100, 0);
fdbTestRemoteDirectoryExists.top = new FormAttachment(wSourceSettings, margin);
wbTestRemoteDirectoryExists.setLayoutData(fdbTestRemoteDirectoryExists);
wRemoteDirectory = new TextVar(jobMeta, wTargetSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPSPUT.RemoteDir.Tooltip"));
props.setLook(wRemoteDirectory);
wRemoteDirectory.addModifyListener(lsMod);
fdRemoteDirectory = new FormData();
fdRemoteDirectory.left = new FormAttachment(middle, 0);
fdRemoteDirectory.top = new FormAttachment(wSourceSettings, margin);
fdRemoteDirectory.right = new FormAttachment(wbTestRemoteDirectoryExists, -margin);
wRemoteDirectory.setLayoutData(fdRemoteDirectory);
fdTargetSettings = new FormData();
fdTargetSettings.left = new FormAttachment(0, margin);
fdTargetSettings.top = new FormAttachment(wSourceSettings, margin);
fdTargetSettings.right = new FormAttachment(100, -margin);
wTargetSettings.setLayoutData(fdTargetSettings);
// ///////////////////////////////////////////////////////////
// / END OF Target SETTINGSGROUP
// ///////////////////////////////////////////////////////////
fdFilesComp = new FormData();
fdFilesComp.left = new FormAttachment(0, 0);
fdFilesComp.top = new FormAttachment(0, 0);
fdFilesComp.right = new FormAttachment(100, 0);
fdFilesComp.bottom = new FormAttachment(100, 0);
wFilesComp.setLayoutData(fdFilesComp);
wFilesComp.layout();
wFilesTab.setControl(wFilesComp);
props.setLook(wFilesComp);
// ///////////////////////////////////////////////////////////
// / END OF Files TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsCheckRemoteFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder(jobMeta.environmentSubstitute(wRemoteDirectory.getText()));
}
};
wbLocalDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wLocalDirectory.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wLocalDirectory.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wLocalDirectory.setText(dir);
}
}
});
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wbTestRemoteDirectoryExists.addListener(SWT.Selection, lsCheckRemoteFolder);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wRemoteDirectory.addSelectionListener(lsDef);
wLocalDirectory.addSelectionListener(lsDef);
wWildcard.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobSFTPDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-cassandra-plugin by pentaho.
the class CassandraOutputDialog method open.
@Override
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
setShellImage(shell, m_currentMeta);
// used to listen to a text field (m_wStepname)
final ModifyListener lsMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_currentMeta.setChanged();
}
};
changed = m_currentMeta.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
// $NON-NLS-1$
shell.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
m_stepnameLabel = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
m_stepnameLabel.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.StepName.Label"));
props.setLook(m_stepnameLabel);
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(middle, -margin);
fd.top = new FormAttachment(0, margin);
m_stepnameLabel.setLayoutData(fd);
m_stepnameText = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
m_stepnameText.setText(stepname);
props.setLook(m_stepnameText);
m_stepnameText.addModifyListener(lsMod);
// format the text field
fd = new FormData();
fd.left = new FormAttachment(middle, 0);
fd.top = new FormAttachment(0, margin);
fd.right = new FormAttachment(100, 0);
m_stepnameText.setLayoutData(fd);
m_wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(m_wTabFolder, Props.WIDGET_STYLE_TAB);
m_wTabFolder.setSimple(false);
// start of the connection tab
m_connectionTab = new CTabItem(m_wTabFolder, SWT.BORDER);
// $NON-NLS-1$
m_connectionTab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Tab.Connection"));
Composite wConnectionComp = new Composite(m_wTabFolder, SWT.NONE);
props.setLook(wConnectionComp);
FormLayout connectionLayout = new FormLayout();
connectionLayout.marginWidth = 3;
connectionLayout.marginHeight = 3;
wConnectionComp.setLayout(connectionLayout);
// host line
m_hostLab = new Label(wConnectionComp, SWT.RIGHT);
props.setLook(m_hostLab);
// $NON-NLS-1$
m_hostLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Hostname.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_stepnameText, margin);
fd.right = new FormAttachment(middle, -margin);
m_hostLab.setLayoutData(fd);
m_hostText = new TextVar(transMeta, wConnectionComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_hostText);
m_hostText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_hostText.setToolTipText(transMeta.environmentSubstitute(m_hostText.getText()));
}
});
m_hostText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_stepnameText, margin);
fd.left = new FormAttachment(middle, 0);
m_hostText.setLayoutData(fd);
// port line
m_portLab = new Label(wConnectionComp, SWT.RIGHT);
props.setLook(m_portLab);
// $NON-NLS-1$
m_portLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Port.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_hostText, margin);
fd.right = new FormAttachment(middle, -margin);
m_portLab.setLayoutData(fd);
m_portText = new TextVar(transMeta, wConnectionComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_portText);
m_portText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_portText.setToolTipText(transMeta.environmentSubstitute(m_portText.getText()));
}
});
m_portText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_hostText, margin);
fd.left = new FormAttachment(middle, 0);
m_portText.setLayoutData(fd);
// socket timeout line
m_socketTimeoutLab = new Label(wConnectionComp, SWT.RIGHT);
props.setLook(m_socketTimeoutLab);
// $NON-NLS-1$
m_socketTimeoutLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.SocketTimeout.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_portText, margin);
fd.right = new FormAttachment(middle, -margin);
m_socketTimeoutLab.setLayoutData(fd);
m_socketTimeoutText = new TextVar(transMeta, wConnectionComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_socketTimeoutText);
m_socketTimeoutText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_socketTimeoutText.setToolTipText(transMeta.environmentSubstitute(m_socketTimeoutText.getText()));
}
});
m_socketTimeoutText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_portText, margin);
fd.left = new FormAttachment(middle, 0);
m_socketTimeoutText.setLayoutData(fd);
// username line
m_userLab = new Label(wConnectionComp, SWT.RIGHT);
props.setLook(m_userLab);
// $NON-NLS-1$
m_userLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.User.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_socketTimeoutText, margin);
fd.right = new FormAttachment(middle, -margin);
m_userLab.setLayoutData(fd);
m_userText = new TextVar(transMeta, wConnectionComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_userText);
m_userText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_socketTimeoutText, margin);
fd.left = new FormAttachment(middle, 0);
m_userText.setLayoutData(fd);
// password line
m_passLab = new Label(wConnectionComp, SWT.RIGHT);
props.setLook(m_passLab);
// $NON-NLS-1$
m_passLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Password.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_userText, margin);
fd.right = new FormAttachment(middle, -margin);
m_passLab.setLayoutData(fd);
m_passText = new PasswordTextVar(transMeta, wConnectionComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_passText);
m_passText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_userText, margin);
fd.left = new FormAttachment(middle, 0);
m_passText.setLayoutData(fd);
// keyspace line
m_keyspaceLab = new Label(wConnectionComp, SWT.RIGHT);
props.setLook(m_keyspaceLab);
// $NON-NLS-1$
m_keyspaceLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Keyspace.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_passText, margin);
fd.right = new FormAttachment(middle, -margin);
m_keyspaceLab.setLayoutData(fd);
m_keyspaceText = new TextVar(transMeta, wConnectionComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_keyspaceText);
m_keyspaceText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_keyspaceText.setToolTipText(transMeta.environmentSubstitute(m_keyspaceText.getText()));
}
});
m_keyspaceText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_passText, margin);
fd.left = new FormAttachment(middle, 0);
m_keyspaceText.setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, 0);
wConnectionComp.setLayoutData(fd);
wConnectionComp.layout();
m_connectionTab.setControl(wConnectionComp);
// --- start of the write tab ---
m_writeTab = new CTabItem(m_wTabFolder, SWT.NONE);
// $NON-NLS-1$
m_writeTab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Tab.Write"));
Composite wWriteComp = new Composite(m_wTabFolder, SWT.NONE);
props.setLook(wWriteComp);
FormLayout writeLayout = new FormLayout();
writeLayout.marginWidth = 3;
writeLayout.marginHeight = 3;
wWriteComp.setLayout(writeLayout);
// table line
m_tableLab = new Label(wWriteComp, SWT.RIGHT);
props.setLook(m_tableLab);
// $NON-NLS-1$
m_tableLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Table.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(middle, -margin);
m_tableLab.setLayoutData(fd);
m_getTablesBut = new Button(wWriteComp, SWT.PUSH | SWT.CENTER);
props.setLook(m_getTablesBut);
// $NON-NLS-1$
m_getTablesBut.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.GetTable.Button"));
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(0, 0);
m_getTablesBut.setLayoutData(fd);
m_getTablesBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setupTablesCombo();
}
});
m_tableCombo = new CCombo(wWriteComp, SWT.BORDER);
props.setLook(m_tableCombo);
m_tableCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_tableCombo.setToolTipText(transMeta.environmentSubstitute(m_tableCombo.getText()));
}
});
m_tableCombo.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(m_getTablesBut, -margin);
fd.top = new FormAttachment(0, margin);
fd.left = new FormAttachment(middle, 0);
m_tableCombo.setLayoutData(fd);
// consistency line
m_consistencyLab = new Label(wWriteComp, SWT.RIGHT);
props.setLook(m_consistencyLab);
// $NON-NLS-1$
m_consistencyLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Consistency.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_tableCombo, margin);
fd.right = new FormAttachment(middle, -margin);
m_consistencyLab.setLayoutData(fd);
// $NON-NLS-1$
m_consistencyLab.setToolTipText(BaseMessages.getString(PKG, "CassandraOutputDialog.Consistency.Label.TipText"));
m_consistencyText = new TextVar(transMeta, wWriteComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_consistencyText);
m_consistencyText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_consistencyText.setToolTipText(transMeta.environmentSubstitute(m_consistencyText.getText()));
}
});
m_consistencyText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_tableCombo, margin);
fd.left = new FormAttachment(middle, 0);
m_consistencyText.setLayoutData(fd);
// batch size line
m_batchSizeLab = new Label(wWriteComp, SWT.RIGHT);
props.setLook(m_batchSizeLab);
// $NON-NLS-1$
m_batchSizeLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.BatchSize.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_consistencyText, margin);
fd.right = new FormAttachment(middle, -margin);
m_batchSizeLab.setLayoutData(fd);
// $NON-NLS-1$
m_batchSizeLab.setToolTipText(BaseMessages.getString(PKG, "CassandraOutputDialog.BatchSize.TipText"));
m_batchSizeText = new TextVar(transMeta, wWriteComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_batchSizeText);
m_batchSizeText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_batchSizeText.setToolTipText(transMeta.environmentSubstitute(m_batchSizeText.getText()));
}
});
m_batchSizeText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_consistencyText, margin);
fd.left = new FormAttachment(middle, 0);
m_batchSizeText.setLayoutData(fd);
// batch insert timeout
m_batchInsertTimeoutLab = new Label(wWriteComp, SWT.RIGHT);
props.setLook(m_batchInsertTimeoutLab);
// $NON-NLS-1$
m_batchInsertTimeoutLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.BatchInsertTimeout.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_batchSizeText, margin);
fd.right = new FormAttachment(middle, -margin);
m_batchInsertTimeoutLab.setLayoutData(fd);
m_batchInsertTimeoutLab.setToolTipText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.BatchInsertTimeout.TipText"));
m_batchInsertTimeoutText = new TextVar(transMeta, wWriteComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_batchInsertTimeoutText);
m_batchInsertTimeoutText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_batchInsertTimeoutText.setToolTipText(transMeta.environmentSubstitute(m_batchInsertTimeoutText.getText()));
}
});
m_batchInsertTimeoutText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_batchSizeText, margin);
fd.left = new FormAttachment(middle, 0);
m_batchInsertTimeoutText.setLayoutData(fd);
// sub-batch size
m_subBatchSizeLab = new Label(wWriteComp, SWT.RIGHT);
props.setLook(m_subBatchSizeLab);
// $NON-NLS-1$
m_subBatchSizeLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.SubBatchSize.Label"));
// $NON-NLS-1$
m_subBatchSizeLab.setToolTipText(BaseMessages.getString(PKG, "CassandraOutputDialog.SubBatchSize.TipText"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_batchInsertTimeoutText, margin);
fd.right = new FormAttachment(middle, -margin);
m_subBatchSizeLab.setLayoutData(fd);
m_subBatchSizeText = new TextVar(transMeta, wWriteComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_subBatchSizeText);
m_subBatchSizeText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_subBatchSizeText.setToolTipText(transMeta.environmentSubstitute(m_subBatchSizeText.getText()));
}
});
m_subBatchSizeText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_batchInsertTimeoutText, margin);
fd.left = new FormAttachment(middle, 0);
m_subBatchSizeText.setLayoutData(fd);
// unlogged batch line
m_unloggedBatchLab = new Label(wWriteComp, SWT.RIGHT);
// $NON-NLS-1$
m_unloggedBatchLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.UnloggedBatch.Label"));
// $NON-NLS-1$
m_unloggedBatchLab.setToolTipText(BaseMessages.getString(PKG, "CassandraOutputDialog.UnloggedBatch.TipText"));
props.setLook(m_unloggedBatchLab);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_subBatchSizeText, margin);
fd.right = new FormAttachment(middle, -margin);
m_unloggedBatchLab.setLayoutData(fd);
m_unloggedBatchBut = new Button(wWriteComp, SWT.CHECK);
props.setLook(m_unloggedBatchBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_subBatchSizeText, margin);
fd.left = new FormAttachment(middle, 0);
m_unloggedBatchBut.setLayoutData(fd);
// TTL line
Label ttlLab = new Label(wWriteComp, SWT.RIGHT);
props.setLook(ttlLab);
// $NON-NLS-1$
ttlLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.TTL.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_unloggedBatchBut, margin);
fd.right = new FormAttachment(middle, -margin);
ttlLab.setLayoutData(fd);
m_ttlUnitsCombo = new CCombo(wWriteComp, SWT.BORDER);
m_ttlUnitsCombo.setEditable(false);
props.setLook(m_ttlUnitsCombo);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_unloggedBatchBut, margin);
m_ttlUnitsCombo.setLayoutData(fd);
for (CassandraOutputMeta.TTLUnits u : CassandraOutputMeta.TTLUnits.values()) {
m_ttlUnitsCombo.add(u.toString());
}
m_ttlUnitsCombo.select(0);
m_ttlUnitsCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (m_ttlUnitsCombo.getSelectionIndex() == 0) {
m_ttlValueText.setEnabled(false);
// $NON-NLS-1$
m_ttlValueText.setText("");
} else {
m_ttlValueText.setEnabled(true);
}
}
});
m_ttlValueText = new TextVar(transMeta, wWriteComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_ttlValueText);
fd = new FormData();
fd.right = new FormAttachment(m_ttlUnitsCombo, -margin);
fd.top = new FormAttachment(m_unloggedBatchBut, margin);
fd.left = new FormAttachment(middle, 0);
m_ttlValueText.setLayoutData(fd);
m_ttlValueText.setEnabled(false);
m_ttlValueText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_ttlValueText.setToolTipText(transMeta.environmentSubstitute(m_ttlValueText.getText()));
}
});
// key field line
m_keyFieldLab = new Label(wWriteComp, SWT.RIGHT);
props.setLook(m_keyFieldLab);
// $NON-NLS-1$
m_keyFieldLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.KeyField.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_ttlValueText, margin);
fd.right = new FormAttachment(middle, -margin);
m_keyFieldLab.setLayoutData(fd);
m_getFieldsBut = new Button(wWriteComp, SWT.PUSH | SWT.CENTER);
props.setLook(m_getFieldsBut);
m_getFieldsBut.setText(// $NON-NLS-1$
" " + // $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraOutputDialog.GetFields.Button") + // $NON-NLS-1$
" ");
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_ttlValueText, margin);
m_getFieldsBut.setLayoutData(fd);
m_getFieldsBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
showEnterSelectionDialog();
}
});
m_keyFieldCombo = new CCombo(wWriteComp, SWT.BORDER);
m_keyFieldCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_keyFieldCombo.setToolTipText(transMeta.environmentSubstitute(m_keyFieldCombo.getText()));
}
});
m_keyFieldCombo.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(m_getFieldsBut, -margin);
fd.top = new FormAttachment(m_ttlValueText, margin);
fd.left = new FormAttachment(middle, 0);
m_keyFieldCombo.setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, 0);
wWriteComp.setLayoutData(fd);
wWriteComp.layout();
m_writeTab.setControl(wWriteComp);
// show schema button
m_showSchemaBut = new Button(wWriteComp, SWT.PUSH);
// $NON-NLS-1$
m_showSchemaBut.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.Schema.Button"));
props.setLook(m_showSchemaBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, -margin * 2);
m_showSchemaBut.setLayoutData(fd);
m_showSchemaBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
popupSchemaInfo();
}
});
// ---- start of the schema options tab ----
m_schemaTab = new CTabItem(m_wTabFolder, SWT.NONE);
// $NON-NLS-1$
m_schemaTab.setText(BaseMessages.getString(PKG, "CassandraOutputData.Tab.Schema"));
Composite wSchemaComp = new Composite(m_wTabFolder, SWT.NONE);
props.setLook(wSchemaComp);
FormLayout schemaLayout = new FormLayout();
schemaLayout.marginWidth = 3;
schemaLayout.marginHeight = 3;
wSchemaComp.setLayout(schemaLayout);
// schema host line
m_schemaHostLab = new Label(wSchemaComp, SWT.RIGHT);
props.setLook(m_schemaHostLab);
// $NON-NLS-1$
m_schemaHostLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.SchemaHostname.Label"));
// $NON-NLS-1$
m_schemaHostLab.setToolTipText(BaseMessages.getString(PKG, "CassandraOutputDialog.SchemaHostname.TipText"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, margin);
fd.right = new FormAttachment(middle, -margin);
m_schemaHostLab.setLayoutData(fd);
m_schemaHostText = new TextVar(transMeta, wSchemaComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_schemaHostText);
m_schemaHostText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_schemaHostText.setToolTipText(transMeta.environmentSubstitute(m_schemaHostText.getText()));
}
});
m_schemaHostText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(0, margin);
fd.left = new FormAttachment(middle, 0);
m_schemaHostText.setLayoutData(fd);
// schema port line
m_schemaPortLab = new Label(wSchemaComp, SWT.RIGHT);
props.setLook(m_schemaPortLab);
// $NON-NLS-1$
m_schemaPortLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.SchemaPort.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_schemaHostText, margin);
fd.right = new FormAttachment(middle, -margin);
m_schemaPortLab.setLayoutData(fd);
m_schemaPortText = new TextVar(transMeta, wSchemaComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_schemaPortText);
m_schemaPortText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_schemaPortText.setToolTipText(transMeta.environmentSubstitute(m_schemaPortText.getText()));
}
});
m_schemaPortText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_schemaHostText, margin);
fd.left = new FormAttachment(middle, 0);
m_schemaPortText.setLayoutData(fd);
// create table line
m_createTableLab = new Label(wSchemaComp, SWT.RIGHT);
props.setLook(m_createTableLab);
// $NON-NLS-1$
m_createTableLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.CreateTable.Label"));
m_createTableLab.setToolTipText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.CreateTable.TipText"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_schemaPortText, margin);
fd.right = new FormAttachment(middle, -margin);
m_createTableLab.setLayoutData(fd);
m_createTableBut = new Button(wSchemaComp, SWT.CHECK);
m_createTableBut.setToolTipText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.CreateTable.TipText"));
props.setLook(m_createTableBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_schemaPortText, margin);
fd.left = new FormAttachment(middle, 0);
m_createTableBut.setLayoutData(fd);
m_createTableBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
m_currentMeta.setChanged();
}
});
// table creation with clause line
m_withClauseLab = new Label(wSchemaComp, SWT.RIGHT);
// $NON-NLS-1$
m_withClauseLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.CreateTableWithClause.Label"));
m_withClauseLab.setToolTipText(// $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraOutputDialog.CreateTableWithClause.TipText"));
props.setLook(m_withClauseLab);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_createTableBut, margin);
fd.right = new FormAttachment(middle, -margin);
m_withClauseLab.setLayoutData(fd);
m_withClauseText = new TextVar(transMeta, wSchemaComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_withClauseText);
m_withClauseText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_withClauseText.setToolTipText(transMeta.environmentSubstitute(m_withClauseText.getText()));
}
});
m_withClauseText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_createTableBut, margin);
fd.left = new FormAttachment(middle, 0);
m_withClauseText.setLayoutData(fd);
// truncate table line
m_truncateTableLab = new Label(wSchemaComp, SWT.RIGHT);
props.setLook(m_truncateTableLab);
m_truncateTableLab.setText(// $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraOutputDialog.TruncateTable.Label"));
m_truncateTableLab.setToolTipText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.TruncateTable.TipText"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_withClauseText, margin);
fd.right = new FormAttachment(middle, -margin);
m_truncateTableLab.setLayoutData(fd);
m_truncateTableBut = new Button(wSchemaComp, SWT.CHECK);
m_truncateTableBut.setToolTipText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.TruncateTable.TipText"));
props.setLook(m_truncateTableBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_withClauseText, margin);
fd.left = new FormAttachment(middle, 0);
m_truncateTableBut.setLayoutData(fd);
m_truncateTableBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
m_currentMeta.setChanged();
}
});
// update table meta data line
m_updateTableMetaDataLab = new Label(wSchemaComp, SWT.RIGHT);
props.setLook(m_updateTableMetaDataLab);
m_updateTableMetaDataLab.setText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.UpdateTableMetaData.Label"));
m_updateTableMetaDataLab.setToolTipText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.UpdateTableMetaData.TipText"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_truncateTableBut, margin);
fd.right = new FormAttachment(middle, -margin);
m_updateTableMetaDataLab.setLayoutData(fd);
m_updateTableMetaDataBut = new Button(wSchemaComp, SWT.CHECK);
m_updateTableMetaDataBut.setToolTipText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.UpdateTableMetaData.TipText"));
props.setLook(m_updateTableMetaDataBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_truncateTableBut, margin);
fd.left = new FormAttachment(middle, 0);
m_updateTableMetaDataBut.setLayoutData(fd);
m_updateTableMetaDataBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
m_currentMeta.setChanged();
}
});
// insert fields not in meta line
m_insertFieldsNotInTableMetaLab = new Label(wSchemaComp, SWT.RIGHT);
props.setLook(m_insertFieldsNotInTableMetaLab);
m_insertFieldsNotInTableMetaLab.setText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.InsertFieldsNotInTableMetaData.Label"));
m_insertFieldsNotInTableMetaLab.setToolTipText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.InsertFieldsNotInTableMetaData.TipText"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_updateTableMetaDataBut, margin);
fd.right = new FormAttachment(middle, -margin);
m_insertFieldsNotInTableMetaLab.setLayoutData(fd);
m_insertFieldsNotInTableMetaBut = new Button(wSchemaComp, SWT.CHECK);
m_insertFieldsNotInTableMetaBut.setToolTipText(BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraOutputDialog.InsertFieldsNotInTableMetaData.TipText"));
props.setLook(m_insertFieldsNotInTableMetaBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_updateTableMetaDataBut, margin);
fd.left = new FormAttachment(middle, 0);
m_insertFieldsNotInTableMetaBut.setLayoutData(fd);
m_insertFieldsNotInTableMetaBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
m_currentMeta.setChanged();
}
});
// compression check box
m_compressionLab = new Label(wSchemaComp, SWT.RIGHT);
props.setLook(m_compressionLab);
// $NON-NLS-1$
m_compressionLab.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.UseCompression.Label"));
// $NON-NLS-1$
m_compressionLab.setToolTipText(BaseMessages.getString(PKG, "CassandraOutputDialog.UseCompression.TipText"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_insertFieldsNotInTableMetaBut, margin);
fd.right = new FormAttachment(middle, -margin);
m_compressionLab.setLayoutData(fd);
m_useCompressionBut = new Button(wSchemaComp, SWT.CHECK);
props.setLook(m_useCompressionBut);
// $NON-NLS-1$
m_useCompressionBut.setToolTipText(BaseMessages.getString(PKG, "CassandraOutputDialog.UseCompression.TipText"));
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.left = new FormAttachment(middle, 0);
fd.top = new FormAttachment(m_insertFieldsNotInTableMetaBut, margin);
m_useCompressionBut.setLayoutData(fd);
m_useCompressionBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
m_currentMeta.setChanged();
}
});
// Apriori CQL button
m_aprioriCQLBut = new Button(wSchemaComp, SWT.PUSH | SWT.CENTER);
props.setLook(m_aprioriCQLBut);
// $NON-NLS-1$
m_aprioriCQLBut.setText(BaseMessages.getString(PKG, "CassandraOutputDialog.CQL.Button"));
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, -margin * 2);
m_aprioriCQLBut.setLayoutData(fd);
m_aprioriCQLBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
popupCQLEditor(lsMod);
}
});
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, 0);
wSchemaComp.setLayoutData(fd);
wSchemaComp.layout();
m_schemaTab.setControl(wSchemaComp);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_stepnameText, margin);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, -50);
m_wTabFolder.setLayoutData(fd);
// Buttons inherited from BaseStepDialog
wOK = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, m_wTabFolder);
// Add listeners
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
m_stepnameText.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
m_wTabFolder.setSelection(0);
setSize();
getData();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations