use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class SlaveServerDialog method addServiceTab.
private void addServiceTab() {
// ////////////////////////
// START OF DB TAB ///
// ////////////////////////
wServiceTab = new CTabItem(wTabFolder, SWT.NONE);
wServiceTab.setText(BaseMessages.getString(PKG, "SlaveServerDialog.USER_TAB_SERVICE"));
wServiceComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wServiceComp);
FormLayout GenLayout = new FormLayout();
GenLayout.marginWidth = Const.FORM_MARGIN;
GenLayout.marginHeight = Const.FORM_MARGIN;
wServiceComp.setLayout(GenLayout);
// What's the name
Label wlName = new Label(wServiceComp, SWT.RIGHT);
props.setLook(wlName);
wlName.setText(BaseMessages.getString(PKG, "SlaveServerDialog.ServerName.Label"));
FormData fdlName = new FormData();
fdlName.top = new FormAttachment(0, 0);
// First one in the left top corner
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
wlName.setLayoutData(fdlName);
wName = new Text(wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
FormData fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
// To the right of the label
fdName.left = new FormAttachment(middle, 0);
fdName.right = new FormAttachment(95, 0);
wName.setLayoutData(fdName);
// What's the hostname
Label wlHostname = new Label(wServiceComp, SWT.RIGHT);
props.setLook(wlHostname);
wlHostname.setText(BaseMessages.getString(PKG, "SlaveServerDialog.HostIP.Label"));
FormData fdlHostname = new FormData();
fdlHostname.top = new FormAttachment(wName, margin * 2);
// First one in the left top corner
fdlHostname.left = new FormAttachment(0, 0);
fdlHostname.right = new FormAttachment(middle, -margin);
wlHostname.setLayoutData(fdlHostname);
wHostname = new TextVar(slaveServer, wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wHostname);
wHostname.addModifyListener(lsMod);
FormData fdHostname = new FormData();
fdHostname.top = new FormAttachment(wName, margin * 2);
// To the right of the label
fdHostname.left = new FormAttachment(middle, 0);
fdHostname.right = new FormAttachment(95, 0);
wHostname.setLayoutData(fdHostname);
// What's the service URL?
Label wlPort = new Label(wServiceComp, SWT.RIGHT);
props.setLook(wlPort);
wlPort.setText(BaseMessages.getString(PKG, "SlaveServerDialog.Port.Label"));
FormData fdlPort = new FormData();
fdlPort.top = new FormAttachment(wHostname, margin);
// First one in the left top corner
fdlPort.left = new FormAttachment(0, 0);
fdlPort.right = new FormAttachment(middle, -margin);
wlPort.setLayoutData(fdlPort);
wPort = new TextVar(slaveServer, wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPort);
wPort.addModifyListener(lsMod);
FormData fdPort = new FormData();
fdPort.top = new FormAttachment(wHostname, margin);
// To the right of the label
fdPort.left = new FormAttachment(middle, 0);
fdPort.right = new FormAttachment(95, 0);
wPort.setLayoutData(fdPort);
// webapp name (optional)
Label wlWebAppName = new Label(wServiceComp, SWT.RIGHT);
wlWebAppName.setText(BaseMessages.getString(PKG, "SlaveServerDialog.WebAppName.Label"));
props.setLook(wlWebAppName);
FormData fdlWebAppName = new FormData();
fdlWebAppName.top = new FormAttachment(wPort, margin);
fdlWebAppName.left = new FormAttachment(0, 0);
fdlWebAppName.right = new FormAttachment(middle, -margin);
wlWebAppName.setLayoutData(fdlWebAppName);
wWebAppName = new TextVar(slaveServer, wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wWebAppName);
wWebAppName.addModifyListener(lsMod);
FormData fdWebAppName = new FormData();
fdWebAppName.top = new FormAttachment(wPort, margin);
fdWebAppName.left = new FormAttachment(middle, 0);
fdWebAppName.right = new FormAttachment(95, 0);
wWebAppName.setLayoutData(fdWebAppName);
// Username
Label wlUsername = new Label(wServiceComp, SWT.RIGHT);
wlUsername.setText(BaseMessages.getString(PKG, "SlaveServerDialog.UserName.Label"));
props.setLook(wlUsername);
FormData fdlUsername = new FormData();
fdlUsername.top = new FormAttachment(wWebAppName, margin);
fdlUsername.left = new FormAttachment(0, 0);
fdlUsername.right = new FormAttachment(middle, -margin);
wlUsername.setLayoutData(fdlUsername);
wUsername = new TextVar(slaveServer, wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUsername);
wUsername.addModifyListener(lsMod);
FormData fdUsername = new FormData();
fdUsername.top = new FormAttachment(wWebAppName, margin);
fdUsername.left = new FormAttachment(middle, 0);
fdUsername.right = new FormAttachment(95, 0);
wUsername.setLayoutData(fdUsername);
// Password
Label wlPassword = new Label(wServiceComp, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "SlaveServerDialog.Password.Label"));
props.setLook(wlPassword);
FormData fdlPassword = new FormData();
fdlPassword.top = new FormAttachment(wUsername, margin);
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(slaveServer, wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
FormData fdPassword = new FormData();
fdPassword.top = new FormAttachment(wUsername, margin);
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.right = new FormAttachment(95, 0);
wPassword.setLayoutData(fdPassword);
// Master
Label wlMaster = new Label(wServiceComp, SWT.RIGHT);
wlMaster.setText(BaseMessages.getString(PKG, "SlaveServerDialog.IsTheMaster.Label"));
props.setLook(wlMaster);
FormData fdlMaster = new FormData();
fdlMaster.top = new FormAttachment(wPassword, margin);
fdlMaster.left = new FormAttachment(0, 0);
fdlMaster.right = new FormAttachment(middle, -margin);
wlMaster.setLayoutData(fdlMaster);
wMaster = new Button(wServiceComp, SWT.CHECK);
props.setLook(wMaster);
FormData fdMaster = new FormData();
fdMaster.top = new FormAttachment(wPassword, margin);
fdMaster.left = new FormAttachment(middle, 0);
fdMaster.right = new FormAttachment(95, 0);
wMaster.setLayoutData(fdMaster);
// Https
Control lastControl = wMaster;
Label wlSSL = new Label(wServiceComp, SWT.RIGHT);
wlSSL.setText(BaseMessages.getString(PKG, "SlaveServerDialog.UseSsl.Label"));
props.setLook(wlSSL);
FormData fd = new FormData();
fd.top = new FormAttachment(lastControl, margin);
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(middle, -margin);
wlSSL.setLayoutData(fd);
// future functional
wlSSL.setVisible(false);
wSSL = new Button(wServiceComp, SWT.CHECK);
props.setLook(wSSL);
FormData bfd = new FormData();
bfd.top = new FormAttachment(lastControl, margin);
bfd.left = new FormAttachment(middle, 0);
bfd.right = new FormAttachment(95, 0);
wSSL.setLayoutData(bfd);
// future functional
wSSL.setVisible(false);
fdServiceComp = new FormData();
fdServiceComp.left = new FormAttachment(0, 0);
fdServiceComp.top = new FormAttachment(0, 0);
fdServiceComp.right = new FormAttachment(100, 0);
fdServiceComp.bottom = new FormAttachment(100, 0);
wServiceComp.setLayoutData(fdServiceComp);
wServiceComp.layout();
wServiceTab.setControl(wServiceComp);
// ///////////////////////////////////////////////////////////
// / END OF GEN TAB
// ///////////////////////////////////////////////////////////
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class ExtTextbox method createNewExtText.
private void createNewExtText(XulComponent parent) {
xulParent = parent;
if ((xulParent != null) && (xulParent instanceof XulTree)) {
variableSpace = (DatabaseMeta) ((XulTree) xulParent).getData();
} else {
variableSpace = new DatabaseMeta();
style = SWT.BORDER;
}
if (type == TextType.PASSWORD) {
extText = new PasswordTextVar(variableSpace, parentComposite, style);
} else {
extText = new TextVar(variableSpace, parentComposite, style);
}
textBox = extText.getTextWidget();
addKeyListener(textBox);
setManagedObject(extText);
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class S3CsvInputDialog 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, inputMeta);
ModifyListener lsMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
inputMeta.setChanged();
}
};
changed = inputMeta.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
// $NON-NLS-1$
shell.setText(Messages.getString("S3CsvInputDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Step name line
//
wlStepname = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlStepname.setText(Messages.getString("S3CsvInputDialog.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);
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);
Control lastControl = wStepname;
// Access key
Label wlAccessKey = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlAccessKey.setText(Messages.getString("S3CsvInputDialog.AccessKey.Label"));
props.setLook(wlAccessKey);
FormData fdlAccessKey = new FormData();
fdlAccessKey.top = new FormAttachment(lastControl, margin);
fdlAccessKey.left = new FormAttachment(0, 0);
fdlAccessKey.right = new FormAttachment(middle, -margin);
wlAccessKey.setLayoutData(fdlAccessKey);
wAccessKey = new PasswordTextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wAccessKey);
wAccessKey.addModifyListener(lsMod);
FormData fdAccessKey = new FormData();
fdAccessKey.top = new FormAttachment(lastControl, margin);
fdAccessKey.left = new FormAttachment(middle, 0);
fdAccessKey.right = new FormAttachment(100, 0);
wAccessKey.setLayoutData(fdAccessKey);
lastControl = wAccessKey;
// Secret key
Label wlSecretKey = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlSecretKey.setText(Messages.getString("S3CsvInputDialog.SecretKey.Label"));
props.setLook(wlSecretKey);
FormData fdlSecretKey = new FormData();
fdlSecretKey.top = new FormAttachment(lastControl, margin);
fdlSecretKey.left = new FormAttachment(0, 0);
fdlSecretKey.right = new FormAttachment(middle, -margin);
wlSecretKey.setLayoutData(fdlSecretKey);
wSecretKey = new PasswordTextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSecretKey);
wSecretKey.addModifyListener(lsMod);
FormData fdSecretKey = new FormData();
fdSecretKey.top = new FormAttachment(lastControl, margin);
fdSecretKey.left = new FormAttachment(middle, 0);
fdSecretKey.right = new FormAttachment(100, 0);
wSecretKey.setLayoutData(fdSecretKey);
lastControl = wSecretKey;
// Bucket name
Label wlBucket = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlBucket.setText(Messages.getString("S3CsvInputDialog.Bucket.Label"));
props.setLook(wlBucket);
FormData fdlBucket = new FormData();
fdlBucket.top = new FormAttachment(lastControl, margin);
fdlBucket.left = new FormAttachment(0, 0);
fdlBucket.right = new FormAttachment(middle, -margin);
wlBucket.setLayoutData(fdlBucket);
wbBucket = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbBucket);
wbBucket.setText(Messages.getString("S3CsvInputDialog.Bucket.Button"));
FormData fdbBucket = new FormData();
fdbBucket.top = new FormAttachment(lastControl, margin);
fdbBucket.right = new FormAttachment(100, 0);
wbBucket.setLayoutData(fdbBucket);
wBucket = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBucket);
wBucket.addModifyListener(lsMod);
FormData fdBucket = new FormData();
fdBucket.top = new FormAttachment(lastControl, margin);
fdBucket.left = new FormAttachment(middle, 0);
fdBucket.right = new FormAttachment(wbBucket, -margin);
wBucket.setLayoutData(fdBucket);
lastControl = wBucket;
// See if the step receives input. If so, we don't ask for the filename, but for the filename field.
//
isReceivingInput = transMeta.findNrPrevSteps(stepMeta) > 0;
if (isReceivingInput) {
RowMetaInterface previousFields;
try {
previousFields = transMeta.getPrevStepFields(stepMeta);
} catch (KettleStepException e) {
new ErrorDialog(shell, Messages.getString("S3CsvInputDialog.ErrorDialog.UnableToGetInputFields.Title"), Messages.getString("S3CsvInputDialog.ErrorDialog.UnableToGetInputFields.Message"), e);
previousFields = new RowMeta();
}
// The filename field ...
//
Label wlFilename = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlFilename.setText(Messages.getString("S3CsvInputDialog.FilenameField.Label"));
props.setLook(wlFilename);
FormData fdlFilename = new FormData();
fdlFilename.top = new FormAttachment(lastControl, margin);
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wFilenameField = new CCombo(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wFilenameField.setItems(previousFields.getFieldNames());
props.setLook(wFilenameField);
wFilenameField.addModifyListener(lsMod);
FormData fdFilename = new FormData();
fdFilename.top = new FormAttachment(lastControl, margin);
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.right = new FormAttachment(100, 0);
wFilenameField.setLayoutData(fdFilename);
lastControl = wFilenameField;
// Checkbox to include the filename in the output...
//
Label wlIncludeFilename = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlIncludeFilename.setText(Messages.getString("S3CsvInputDialog.IncludeFilenameField.Label"));
props.setLook(wlIncludeFilename);
FormData fdlIncludeFilename = new FormData();
fdlIncludeFilename.top = new FormAttachment(lastControl, margin);
fdlIncludeFilename.left = new FormAttachment(0, 0);
fdlIncludeFilename.right = new FormAttachment(middle, -margin);
wlIncludeFilename.setLayoutData(fdlIncludeFilename);
wIncludeFilename = new Button(shell, SWT.CHECK);
props.setLook(wIncludeFilename);
wFilenameField.addModifyListener(lsMod);
FormData fdIncludeFilename = new FormData();
fdIncludeFilename.top = new FormAttachment(lastControl, margin);
fdIncludeFilename.left = new FormAttachment(middle, 0);
fdIncludeFilename.right = new FormAttachment(100, 0);
wIncludeFilename.setLayoutData(fdIncludeFilename);
lastControl = wIncludeFilename;
} else {
// Filename...
//
// The filename browse button
//
wbbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbbFilename);
wbbFilename.setText(Messages.getString("System.Button.Browse"));
wbbFilename.setToolTipText(Messages.getString("System.Tooltip.BrowseForFileOrDirAndAdd"));
FormData fdbFilename = new FormData();
fdbFilename.top = new FormAttachment(lastControl, margin);
fdbFilename.right = new FormAttachment(100, 0);
wbbFilename.setLayoutData(fdbFilename);
// The field itself...
//
Label wlFilename = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlFilename.setText(Messages.getString("S3CsvInputDialog.Filename.Label"));
props.setLook(wlFilename);
FormData fdlFilename = new FormData();
fdlFilename.top = new FormAttachment(lastControl, margin);
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wFilename = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.addModifyListener(lsMod);
FormData fdFilename = new FormData();
fdFilename.top = new FormAttachment(lastControl, margin);
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.right = new FormAttachment(wbbFilename, -margin);
wFilename.setLayoutData(fdFilename);
lastControl = wFilename;
}
// delimiter
Label wlDelimiter = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlDelimiter.setText(Messages.getString("S3CsvInputDialog.Delimiter.Label"));
props.setLook(wlDelimiter);
FormData fdlDelimiter = new FormData();
fdlDelimiter.top = new FormAttachment(lastControl, margin);
fdlDelimiter.left = new FormAttachment(0, 0);
fdlDelimiter.right = new FormAttachment(middle, -margin);
wlDelimiter.setLayoutData(fdlDelimiter);
wbDelimiter = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbDelimiter);
wbDelimiter.setText(Messages.getString("S3CsvInputDialog.Delimiter.Button"));
FormData fdbDelimiter = new FormData();
fdbDelimiter.top = new FormAttachment(lastControl, margin);
fdbDelimiter.right = new FormAttachment(100, 0);
wbDelimiter.setLayoutData(fdbDelimiter);
wDelimiter = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wDelimiter);
wDelimiter.addModifyListener(lsMod);
FormData fdDelimiter = new FormData();
fdDelimiter.top = new FormAttachment(lastControl, margin);
fdDelimiter.left = new FormAttachment(middle, 0);
fdDelimiter.right = new FormAttachment(wbDelimiter, -margin);
wDelimiter.setLayoutData(fdDelimiter);
lastControl = wDelimiter;
// enclosure
Label wlEnclosure = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlEnclosure.setText(Messages.getString("S3CsvInputDialog.Enclosure.Label"));
props.setLook(wlEnclosure);
FormData fdlEnclosure = new FormData();
fdlEnclosure.top = new FormAttachment(lastControl, margin);
fdlEnclosure.left = new FormAttachment(0, 0);
fdlEnclosure.right = new FormAttachment(middle, -margin);
wlEnclosure.setLayoutData(fdlEnclosure);
wEnclosure = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wEnclosure);
wEnclosure.addModifyListener(lsMod);
FormData fdEnclosure = new FormData();
fdEnclosure.top = new FormAttachment(lastControl, margin);
fdEnclosure.left = new FormAttachment(middle, 0);
fdEnclosure.right = new FormAttachment(100, 0);
wEnclosure.setLayoutData(fdEnclosure);
lastControl = wEnclosure;
// Max line size
//
Label wlMaxLineSize = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlMaxLineSize.setText(Messages.getString("S3CsvInputDialog.MaxLineSize.Label"));
props.setLook(wlMaxLineSize);
FormData fdlMaxLineSize = new FormData();
fdlMaxLineSize.top = new FormAttachment(lastControl, margin);
fdlMaxLineSize.left = new FormAttachment(0, 0);
fdlMaxLineSize.right = new FormAttachment(middle, -margin);
wlMaxLineSize.setLayoutData(fdlMaxLineSize);
wMaxLineSize = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMaxLineSize);
wMaxLineSize.addModifyListener(lsMod);
FormData fdMaxLineSize = new FormData();
fdMaxLineSize.top = new FormAttachment(lastControl, margin);
fdMaxLineSize.left = new FormAttachment(middle, 0);
fdMaxLineSize.right = new FormAttachment(100, 0);
wMaxLineSize.setLayoutData(fdMaxLineSize);
lastControl = wMaxLineSize;
// performingLazyConversion?
//
Label wlLazyConversion = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlLazyConversion.setText(Messages.getString("S3CsvInputDialog.LazyConversion.Label"));
props.setLook(wlLazyConversion);
FormData fdlLazyConversion = new FormData();
fdlLazyConversion.top = new FormAttachment(lastControl, margin);
fdlLazyConversion.left = new FormAttachment(0, 0);
fdlLazyConversion.right = new FormAttachment(middle, -margin);
wlLazyConversion.setLayoutData(fdlLazyConversion);
wLazyConversion = new Button(shell, SWT.CHECK);
props.setLook(wLazyConversion);
FormData fdLazyConversion = new FormData();
fdLazyConversion.top = new FormAttachment(lastControl, margin);
fdLazyConversion.left = new FormAttachment(middle, 0);
fdLazyConversion.right = new FormAttachment(100, 0);
wLazyConversion.setLayoutData(fdLazyConversion);
lastControl = wLazyConversion;
// header row?
//
Label wlHeaderPresent = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlHeaderPresent.setText(Messages.getString("S3CsvInputDialog.HeaderPresent.Label"));
props.setLook(wlHeaderPresent);
FormData fdlHeaderPresent = new FormData();
fdlHeaderPresent.top = new FormAttachment(lastControl, margin);
fdlHeaderPresent.left = new FormAttachment(0, 0);
fdlHeaderPresent.right = new FormAttachment(middle, -margin);
wlHeaderPresent.setLayoutData(fdlHeaderPresent);
wHeaderPresent = new Button(shell, SWT.CHECK);
props.setLook(wHeaderPresent);
FormData fdHeaderPresent = new FormData();
fdHeaderPresent.top = new FormAttachment(lastControl, margin);
fdHeaderPresent.left = new FormAttachment(middle, 0);
fdHeaderPresent.right = new FormAttachment(100, 0);
wHeaderPresent.setLayoutData(fdHeaderPresent);
lastControl = wHeaderPresent;
// The field itself...
//
Label wlRowNumField = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlRowNumField.setText(Messages.getString("S3CsvInputDialog.RowNumField.Label"));
props.setLook(wlRowNumField);
FormData fdlRowNumField = new FormData();
fdlRowNumField.top = new FormAttachment(lastControl, margin);
fdlRowNumField.left = new FormAttachment(0, 0);
fdlRowNumField.right = new FormAttachment(middle, -margin);
wlRowNumField.setLayoutData(fdlRowNumField);
wRowNumField = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wRowNumField);
wRowNumField.addModifyListener(lsMod);
FormData fdRowNumField = new FormData();
fdRowNumField.top = new FormAttachment(lastControl, margin);
fdRowNumField.left = new FormAttachment(middle, 0);
fdRowNumField.right = new FormAttachment(100, 0);
wRowNumField.setLayoutData(fdRowNumField);
lastControl = wRowNumField;
// running in parallel?
//
Label wlRunningInParallel = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
wlRunningInParallel.setText(Messages.getString("S3CsvInputDialog.RunningInParallel.Label"));
props.setLook(wlRunningInParallel);
FormData fdlRunningInParallel = new FormData();
fdlRunningInParallel.top = new FormAttachment(lastControl, margin);
fdlRunningInParallel.left = new FormAttachment(0, 0);
fdlRunningInParallel.right = new FormAttachment(middle, -margin);
wlRunningInParallel.setLayoutData(fdlRunningInParallel);
wRunningInParallel = new Button(shell, SWT.CHECK);
props.setLook(wRunningInParallel);
FormData fdRunningInParallel = new FormData();
fdRunningInParallel.top = new FormAttachment(lastControl, margin);
fdRunningInParallel.left = new FormAttachment(middle, 0);
wRunningInParallel.setLayoutData(fdRunningInParallel);
lastControl = wRunningInParallel;
// Some buttons first, so that the dialog scales nicely...
//
wOK = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wOK.setText(Messages.getString("System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wCancel.setText(Messages.getString("System.Button.Cancel"));
wPreview = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wPreview.setText(Messages.getString("System.Button.Preview"));
wPreview.setEnabled(!isReceivingInput);
wGet = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wGet.setText(Messages.getString("System.Button.GetFields"));
wGet.setEnabled(!isReceivingInput);
setButtonPositions(new Button[] { wOK, wCancel, wPreview, wGet }, margin, null);
// Fields
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(Messages.getString("S3CsvInputDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(Messages.getString("S3CsvInputDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMeta.getTypes(), true), new ColumnInfo(Messages.getString("S3CsvInputDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, Const.getConversionFormats()), new ColumnInfo(Messages.getString("S3CsvInputDialog.LengthColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(Messages.getString("S3CsvInputDialog.PrecisionColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(Messages.getString("S3CsvInputDialog.CurrencyColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(Messages.getString("S3CsvInputDialog.DecimalColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(Messages.getString("S3CsvInputDialog.GroupColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(Messages.getString("S3CsvInputDialog.TrimTypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMeta.trimTypeDesc) };
colinf[2].setComboValuesSelectionListener(new ComboValuesSelectionListener() {
@Override
public String[] getComboValues(TableItem tableItem, int rowNr, int colNr) {
String[] comboValues = new String[] {};
int type = ValueMeta.getType(tableItem.getText(colNr - 1));
switch(type) {
case ValueMetaInterface.TYPE_DATE:
comboValues = Const.getDateFormats();
break;
case ValueMetaInterface.TYPE_INTEGER:
case ValueMetaInterface.TYPE_BIGNUMBER:
case ValueMetaInterface.TYPE_NUMBER:
comboValues = Const.getNumberFormats();
break;
default:
break;
}
return comboValues;
}
});
wFields = new TableView(transMeta, shell, SWT.FULL_SELECTION | SWT.MULTI, colinf, 1, lsMod, props);
FormData fdFields = new FormData();
fdFields.top = new FormAttachment(lastControl, margin * 2);
fdFields.bottom = new FormAttachment(wOK, -margin * 2);
fdFields.left = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
wFields.setLayoutData(fdFields);
// Add listeners
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsPreview = new Listener() {
@Override
public void handleEvent(Event e) {
preview();
}
};
lsGet = new Listener() {
@Override
public void handleEvent(Event e) {
getCSV();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wPreview.addListener(SWT.Selection, lsPreview);
wGet.addListener(SWT.Selection, lsGet);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
if (wFilename != null) {
wFilename.addSelectionListener(lsDef);
}
if (wFilenameField != null) {
wFilenameField.addSelectionListener(lsDef);
}
wDelimiter.addSelectionListener(lsDef);
wEnclosure.addSelectionListener(lsDef);
wMaxLineSize.addSelectionListener(lsDef);
wRowNumField.addSelectionListener(lsDef);
// Allow the insertion of tabs as separator...
wbDelimiter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent se) {
Text t = wDelimiter.getTextWidget();
if (t != null) {
t.insert("\t");
}
}
});
wbBucket.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
//
try {
S3CsvInputMeta meta = new S3CsvInputMeta();
getInfo(meta);
S3ObjectsProvider s3ObjProvider = new S3ObjectsProvider(meta.getS3Service(transMeta));
EnterSelectionDialog dialog = new EnterSelectionDialog(shell, s3ObjProvider.getBucketsNames(), Messages.getString("S3CsvInputDialog.Exception.SelectBucket.Title"), Messages.getString("S3CsvInputDialog.Exception.SelectBucket.Message"));
dialog.setMulti(false);
String bucketname = dialog.open();
if (bucketname != null) {
wBucket.setText(bucketname);
}
} catch (Exception e) {
new ErrorDialog(shell, Messages.getString("S3CsvInputDialog.Exception.UnableToGetBuckets.Title"), Messages.getString("S3CsvInputDialog.Exception.UnableToGetBuckets.Message"), e);
}
}
});
if (wbbFilename != null) {
// Listen to the browse button next to the file name
wbbFilename.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
try {
S3CsvInputMeta meta = new S3CsvInputMeta();
getInfo(meta);
S3ObjectsProvider s3ObjProvider = new S3ObjectsProvider(meta.getS3Service(transMeta));
String[] objectnames = s3ObjProvider.getS3ObjectsNames(meta.getBucket());
EnterSelectionDialog dialog = new EnterSelectionDialog(shell, objectnames, Messages.getString("S3CsvInputDialog.Exception.SelectObject.Title"), Messages.getString("S3CsvInputDialog.Exception.SelectObject.Message"));
dialog.setMulti(false);
if (!Utils.isEmpty(wFilename.getText())) {
int index = Const.indexOfString(wFilename.getText(), objectnames);
if (index >= 0) {
dialog.setSelectedNrs(new int[] { index });
}
}
String objectname = dialog.open();
if (objectname != null) {
wFilename.setText(objectname);
}
} catch (Exception e) {
new ErrorDialog(shell, Messages.getString("S3CsvInputDialog.Exception.UnableToGetFiles.Title"), Messages.getString("S3CsvInputDialog.Exception.UnableToGetFiles.Message"), e);
}
}
});
}
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
// Set the shell size, based upon previous time...
setSize();
getData();
inputMeta.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class ConnectionForm method layoutActiveMqConnectionFields.
private void layoutActiveMqConnectionFields(Control leftOf) {
wlActiveUrl = new Label(wConnectionGroup, SWT.LEFT);
props.setLook(wlActiveUrl);
wlActiveUrl.setText(getString(PKG, "JmsDialog.JmsUrl"));
FormData fdlJmsUrl = new FormData();
fdlJmsUrl.left = new FormAttachment(leftOf, 15);
fdlJmsUrl.top = new FormAttachment(0, 0);
wlActiveUrl.setLayoutData(fdlJmsUrl);
wActiveUrl = new TextVar(transMeta, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wActiveUrl.setToolTipText(JmsProvider.ConnectionType.ACTIVEMQ.getUrlHint());
props.setLook(wActiveUrl);
wActiveUrl.addModifyListener(lsMod);
FormData fdJmsUrl = new FormData();
fdJmsUrl.left = new FormAttachment(leftOf, 15);
fdJmsUrl.top = new FormAttachment(wlActiveUrl, 5);
fdJmsUrl.right = new FormAttachment(100, 0);
wActiveUrl.setLayoutData(fdJmsUrl);
wlActiveUser = new Label(wConnectionGroup, SWT.LEFT);
props.setLook(wlActiveUser);
wlActiveUser.setText(getString(PKG, "JmsDialog.JmsUser"));
FormData fdlUser = new FormData();
fdlUser.left = new FormAttachment(leftOf, 15);
fdlUser.top = new FormAttachment(wActiveUrl, 10);
wlActiveUser.setLayoutData(fdlUser);
wActiveUser = new TextVar(transMeta, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wActiveUser);
wActiveUser.addModifyListener(lsMod);
FormData fdUser = new FormData();
fdUser.left = new FormAttachment(leftOf, 15);
fdUser.top = new FormAttachment(wlActiveUser, 5);
fdUser.right = new FormAttachment(100, 0);
wActiveUser.setLayoutData(fdUser);
wlActivePassword = new Label(wConnectionGroup, SWT.LEFT);
props.setLook(wlActivePassword);
wlActivePassword.setText(getString(PKG, "JmsDialog.JmsPassword"));
FormData fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(leftOf, 15);
fdlPassword.top = new FormAttachment(wActiveUser, 10);
wlActivePassword.setLayoutData(fdlPassword);
wActivePassword = new PasswordTextVar(transMeta, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wActivePassword);
wActivePassword.addModifyListener(lsMod);
FormData fdPassword = new FormData();
fdPassword.left = new FormAttachment(leftOf, 15);
fdPassword.top = new FormAttachment(wlActivePassword, 5);
fdPassword.right = new FormAttachment(100, 0);
wActivePassword.setLayoutData(fdPassword);
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class ConnectionForm method layoutIbmMqConnectionFields.
private void layoutIbmMqConnectionFields(Control leftOf) {
wlIbmUrl = new Label(wConnectionGroup, SWT.LEFT);
props.setLook(wlIbmUrl);
wlIbmUrl.setText(getString(PKG, "JmsDialog.JmsUrl"));
FormData fdlJmsUrl = new FormData();
fdlJmsUrl.left = new FormAttachment(leftOf, 15);
fdlJmsUrl.top = new FormAttachment(0, 0);
wlIbmUrl.setLayoutData(fdlJmsUrl);
wIbmUrl = new TextVar(transMeta, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wIbmUrl.setToolTipText(JmsProvider.ConnectionType.WEBSPHERE.getUrlHint());
props.setLook(wIbmUrl);
wIbmUrl.addModifyListener(lsMod);
FormData fdUrl = new FormData();
fdUrl.left = new FormAttachment(leftOf, 15);
fdUrl.top = new FormAttachment(wlIbmUrl, 5);
fdUrl.right = new FormAttachment(100, 0);
wIbmUrl.setLayoutData(fdUrl);
wlIbmUser = new Label(wConnectionGroup, SWT.LEFT);
props.setLook(wlIbmUser);
wlIbmUser.setText(getString(PKG, "JmsDialog.JmsUser"));
FormData fdlUser = new FormData();
fdlUser.left = new FormAttachment(leftOf, 15);
fdlUser.top = new FormAttachment(wIbmUrl, 10);
wlIbmUser.setLayoutData(fdlUser);
wIbmUser = new TextVar(transMeta, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIbmUser);
wIbmUser.addModifyListener(lsMod);
FormData fdUser = new FormData();
fdUser.left = new FormAttachment(leftOf, 15);
fdUser.top = new FormAttachment(wlIbmUser, 5);
fdUser.right = new FormAttachment(100, 0);
wIbmUser.setLayoutData(fdUser);
wlIbmPassword = new Label(wConnectionGroup, SWT.LEFT);
props.setLook(wlIbmPassword);
wlIbmPassword.setText(getString(PKG, "JmsDialog.JmsPassword"));
FormData fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(leftOf, 15);
fdlPassword.top = new FormAttachment(wIbmUser, 10);
wlIbmPassword.setLayoutData(fdlPassword);
wIbmPassword = new PasswordTextVar(transMeta, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIbmPassword);
wIbmPassword.addModifyListener(lsMod);
FormData fdPassword = new FormData();
fdPassword.left = new FormAttachment(leftOf, 15);
fdPassword.top = new FormAttachment(wlIbmPassword, 5);
fdPassword.right = new FormAttachment(100, 0);
wIbmPassword.setLayoutData(fdPassword);
}
Aggregations