use of org.pentaho.di.ui.core.widget.LabelTextVar in project pentaho-kettle by pentaho.
the class SSHDialog method open.
@Override
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() {
@Override
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, "SSHDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "SSHDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, PropsUI.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "SSHDialog.General.Tab"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wGeneralComp.setLayout(fileLayout);
// ///////////////////////////////
// START OF Settings GROUP //
// ///////////////////////////////
wSettingsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSettingsGroup);
wSettingsGroup.setText(BaseMessages.getString(PKG, "SSHDialog.wSettingsGroup.Label"));
FormLayout settingGroupLayout = new FormLayout();
settingGroupLayout.marginWidth = 10;
settingGroupLayout.marginHeight = 10;
wSettingsGroup.setLayout(settingGroupLayout);
// Server port line
wServerName = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.Server.Label"), BaseMessages.getString(PKG, "SSHDialog.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wStepname, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Server port line
wPort = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.Port.Label"), BaseMessages.getString(PKG, "SSHDialog.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);
// Server TimeOut line
wTimeOut = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.TimeOut.Label"), BaseMessages.getString(PKG, "SSHDialog.TimeOut.Tooltip"));
props.setLook(wTimeOut);
wTimeOut.addModifyListener(lsMod);
fdTimeOut = new FormData();
fdTimeOut.left = new FormAttachment(0, 0);
fdTimeOut.top = new FormAttachment(wPort, margin);
fdTimeOut.right = new FormAttachment(100, 0);
wTimeOut.setLayoutData(fdTimeOut);
// Usernameline
wUserName = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.UserName.Label"), BaseMessages.getString(PKG, "SSHDialog.UserName.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wTimeOut, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Passwordline
wPassword = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.Password.Label"), BaseMessages.getString(PKG, "SSHDialog.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);
// Use key?
wlUseKey = new Label(wSettingsGroup, SWT.RIGHT);
wlUseKey.setText(BaseMessages.getString(PKG, "SSHDialog.UseKey.Label"));
props.setLook(wlUseKey);
fdlUseKey = new FormData();
fdlUseKey.left = new FormAttachment(0, 0);
fdlUseKey.top = new FormAttachment(wPassword, margin);
fdlUseKey.right = new FormAttachment(middle, -margin);
wlUseKey.setLayoutData(fdlUseKey);
wUseKey = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wUseKey);
wUseKey.setToolTipText(BaseMessages.getString(PKG, "SSHDialog.UseKey.Tooltip"));
fdUseKey = new FormData();
fdUseKey.left = new FormAttachment(middle, margin);
fdUseKey.top = new FormAttachment(wPassword, margin);
fdUseKey.right = new FormAttachment(100, 0);
wUseKey.setLayoutData(fdUseKey);
wUseKey.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
activateKey();
}
});
wbFilename = new Button(wSettingsGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, -margin);
fdbFilename.top = new FormAttachment(wUseKey, margin);
wbFilename.setLayoutData(fdbFilename);
wbFilename.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFilterExtensions(new String[] { "*.pem", "*" });
if (wPrivateKey.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wPrivateKey.getText()));
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.PEMFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
wPrivateKey.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
}
}
});
// Private key
wPrivateKey = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.PrivateKey.Label"), BaseMessages.getString(PKG, "SSHDialog.PrivateKey.Tooltip"));
props.setLook(wPassword);
wPrivateKey.addModifyListener(lsMod);
fdPrivateKey = new FormData();
fdPrivateKey.left = new FormAttachment(0, 5 * margin);
fdPrivateKey.top = new FormAttachment(wUseKey, margin);
fdPrivateKey.right = new FormAttachment(wbFilename, -margin);
wPrivateKey.setLayoutData(fdPrivateKey);
// Passphraseline
wPassphrase = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.Passphrase.Label"), BaseMessages.getString(PKG, "SSHDialog.Passphrase.Tooltip"), true);
props.setLook(wPassphrase);
wPassphrase.addModifyListener(lsMod);
fdPassphrase = new FormData();
fdPassphrase.left = new FormAttachment(0, 0);
fdPassphrase.top = new FormAttachment(wbFilename, margin);
fdPassphrase.right = new FormAttachment(100, 0);
wPassphrase.setLayoutData(fdPassphrase);
// ProxyHostline
wProxyHost = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.ProxyHost.Label"), BaseMessages.getString(PKG, "SSHDialog.ProxyHost.Tooltip"));
props.setLook(wProxyHost);
wProxyHost.addModifyListener(lsMod);
fdProxyHost = new FormData();
fdProxyHost.left = new FormAttachment(0, 0);
fdProxyHost.top = new FormAttachment(wPassphrase, 2 * margin);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// ProxyPortline
wProxyPort = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.ProxyPort.Label"), BaseMessages.getString(PKG, "SSHDialog.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);
// ProxyUsernameline
wProxyUsername = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.ProxyUsername.Label"), BaseMessages.getString(PKG, "SSHDialog.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);
// ProxyUsernameline
wProxyPassword = new LabelTextVar(transMeta, wSettingsGroup, BaseMessages.getString(PKG, "SSHDialog.ProxyPassword.Label"), BaseMessages.getString(PKG, "SSHDialog.ProxyPassword.Tooltip"), true);
props.setLook(wProxyUsername);
wProxyPassword.addModifyListener(lsMod);
fdProxyPassword = new FormData();
fdProxyPassword.left = new FormAttachment(0, 0);
fdProxyPassword.top = new FormAttachment(wProxyUsername, margin);
fdProxyPassword.right = new FormAttachment(100, 0);
wProxyPassword.setLayoutData(fdProxyPassword);
// Test connection button
wTest = new Button(wSettingsGroup, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "SSHDialog.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "SSHDialog.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wProxyPassword, 2 * margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, margin);
fdSettingsGroup.top = new FormAttachment(wStepname, margin);
fdSettingsGroup.right = new FormAttachment(100, -margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// ///////////////////////////////
// END OF Settings Fields 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);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Settings TAB///
// /
wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
wSettingsTab.setText(BaseMessages.getString(PKG, "SSHDialog.Settings.Tab"));
FormLayout SettingsLayout = new FormLayout();
SettingsLayout.marginWidth = 3;
SettingsLayout.marginHeight = 3;
wSettingsComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSettingsComp);
wSettingsComp.setLayout(SettingsLayout);
// ///////////////////////////////
// START OF Output GROUP //
// ///////////////////////////////
wOutput = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wOutput);
wOutput.setText(BaseMessages.getString(PKG, "SSHDialog.wOutput.Label"));
FormLayout outputGroupLayout = new FormLayout();
outputGroupLayout.marginWidth = 10;
outputGroupLayout.marginHeight = 10;
wOutput.setLayout(outputGroupLayout);
// ResultOutFieldNameline
wResultOutFieldName = new LabelTextVar(transMeta, wOutput, BaseMessages.getString(PKG, "SSHDialog.ResultOutFieldName.Label"), BaseMessages.getString(PKG, "SSHDialog.ResultOutFieldName.Tooltip"));
props.setLook(wResultOutFieldName);
wResultOutFieldName.addModifyListener(lsMod);
fdResultOutFieldName = new FormData();
fdResultOutFieldName.left = new FormAttachment(0, 0);
fdResultOutFieldName.top = new FormAttachment(wStepname, margin);
fdResultOutFieldName.right = new FormAttachment(100, 0);
wResultOutFieldName.setLayoutData(fdResultOutFieldName);
// ResultErrFieldNameline
wResultErrFieldName = new LabelTextVar(transMeta, wOutput, BaseMessages.getString(PKG, "SSHDialog.ResultErrFieldName.Label"), BaseMessages.getString(PKG, "SSHDialog.ResultErrFieldName.Tooltip"));
props.setLook(wResultErrFieldName);
wResultErrFieldName.addModifyListener(lsMod);
fdResultErrFieldName = new FormData();
fdResultErrFieldName.left = new FormAttachment(0, 0);
fdResultErrFieldName.top = new FormAttachment(wResultOutFieldName, margin);
fdResultErrFieldName.right = new FormAttachment(100, 0);
wResultErrFieldName.setLayoutData(fdResultErrFieldName);
fdOutput = new FormData();
fdOutput.left = new FormAttachment(0, margin);
fdOutput.top = new FormAttachment(wStepname, margin);
fdOutput.right = new FormAttachment(100, -margin);
wOutput.setLayoutData(fdOutput);
// ///////////////////////////////
// END OF Output Fields GROUP //
// ////////////////////////
// START OF Commands SETTINGS GROUP///
// /
wCommands = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wCommands);
wCommands.setText(BaseMessages.getString(PKG, "SSHDialog.LogSettings.Group.Label"));
FormLayout LogSettingsgroupLayout = new FormLayout();
LogSettingsgroupLayout.marginWidth = 10;
LogSettingsgroupLayout.marginHeight = 10;
wCommands.setLayout(LogSettingsgroupLayout);
// Is command defined in a Field
wldynamicCommand = new Label(wCommands, SWT.RIGHT);
wldynamicCommand.setText(BaseMessages.getString(PKG, "SSHDialog.dynamicCommand.Label"));
props.setLook(wldynamicCommand);
fdlynamicBase = new FormData();
fdlynamicBase.left = new FormAttachment(0, margin);
fdlynamicBase.top = new FormAttachment(wOutput, margin);
fdlynamicBase.right = new FormAttachment(middle, -margin);
wldynamicCommand.setLayoutData(fdlynamicBase);
wdynamicCommand = new Button(wCommands, SWT.CHECK);
props.setLook(wdynamicCommand);
wdynamicCommand.setToolTipText(BaseMessages.getString(PKG, "SSHDialog.dynamicCommand.Tooltip"));
fdynamicCommand = new FormData();
fdynamicCommand.left = new FormAttachment(middle, margin);
fdynamicCommand.top = new FormAttachment(wOutput, margin);
wdynamicCommand.setLayoutData(fdynamicCommand);
SelectionAdapter ldynamicCommand = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
activateDynamicCommand();
input.setChanged();
}
};
wdynamicCommand.addSelectionListener(ldynamicCommand);
// CommandField field
wlCommandField = new Label(wCommands, SWT.RIGHT);
wlCommandField.setText(BaseMessages.getString(PKG, "SSHDialog.MessageNameField.Label"));
props.setLook(wlCommandField);
fdlCommandField = new FormData();
fdlCommandField.left = new FormAttachment(0, margin);
fdlCommandField.right = new FormAttachment(middle, -margin);
fdlCommandField.top = new FormAttachment(wdynamicCommand, margin);
wlCommandField.setLayoutData(fdlCommandField);
wCommandField = new CCombo(wCommands, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wCommandField);
wCommandField.setEditable(true);
wCommandField.addModifyListener(lsMod);
fdCommandField = new FormData();
fdCommandField.left = new FormAttachment(middle, margin);
fdCommandField.top = new FormAttachment(wdynamicCommand, margin);
fdCommandField.right = new FormAttachment(100, 0);
wCommandField.setLayoutData(fdCommandField);
wCommandField.addFocusListener(new FocusListener() {
@Override
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
@Override
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
get();
}
});
// Command String
wlCommand = new Label(wCommands, SWT.RIGHT);
wlCommand.setText(BaseMessages.getString(PKG, "SSHDialog.Command.Label"));
props.setLook(wlCommand);
fdlCommand = new FormData();
fdlCommand.left = new FormAttachment(0, margin);
fdlCommand.top = new FormAttachment(wCommandField, margin);
fdlCommand.right = new FormAttachment(middle, -2 * margin);
wlCommand.setLayoutData(fdlCommand);
wCommand = new StyledTextComp(transMeta, wCommands, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
wCommand.setToolTipText(BaseMessages.getString(PKG, "SSHDialog.Command.Tooltip"));
props.setLook(wCommand);
wCommand.addModifyListener(lsMod);
fdCommand = new FormData();
fdCommand.left = new FormAttachment(middle, margin);
fdCommand.top = new FormAttachment(wCommandField, margin);
fdCommand.right = new FormAttachment(100, -2 * margin);
fdCommand.bottom = new FormAttachment(100, -margin);
wCommand.setLayoutData(fdCommand);
fdLogSettings = new FormData();
fdLogSettings.left = new FormAttachment(0, margin);
fdLogSettings.top = new FormAttachment(wOutput, margin);
fdLogSettings.right = new FormAttachment(100, -margin);
fdLogSettings.bottom = new FormAttachment(100, -margin);
wCommands.setLayoutData(fdLogSettings);
// ///////////////////////////////////////////////////////////
// / END OF Log SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdSettingsComp = new FormData();
fdSettingsComp.left = new FormAttachment(0, 0);
fdSettingsComp.top = new FormAttachment(0, 0);
fdSettingsComp.right = new FormAttachment(100, 0);
fdSettingsComp.bottom = new FormAttachment(100, 0);
wSettingsComp.setLayoutData(fdSettingsComp);
wSettingsComp.layout();
wSettingsTab.setControl(wSettingsComp);
// ///////////////////////////////////////////////////////////
// / END OF Settings TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wPreview = new Button(shell, SWT.PUSH);
wPreview.setText(BaseMessages.getString(PKG, "SSHDialog.Button.PreviewRows"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsPreview = new Listener() {
@Override
public void handleEvent(Event e) {
preview();
}
};
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
lsTest = new Listener() {
@Override
public void handleEvent(Event e) {
test();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
wPreview.addListener(SWT.Selection, lsPreview);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
activateKey();
activateDynamicCommand();
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 SymmetricCryptoTransDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// SecretKey line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, PropsUI.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.GeneralTab.TabTitle"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF Crypto settings GROUP
//
wCryptoSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wCryptoSettings);
wCryptoSettings.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.CryptoSettings.Group.Label"));
FormLayout CryptoSettingsgroupLayout = new FormLayout();
CryptoSettingsgroupLayout.marginWidth = 10;
CryptoSettingsgroupLayout.marginHeight = 10;
wCryptoSettings.setLayout(CryptoSettingsgroupLayout);
// Operation
wlOperation = new Label(wCryptoSettings, SWT.RIGHT);
wlOperation.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Operation.Label"));
props.setLook(wlOperation);
fdlOperation = new FormData();
fdlOperation.left = new FormAttachment(0, 0);
fdlOperation.right = new FormAttachment(middle, -margin);
fdlOperation.top = new FormAttachment(wStepname, margin);
wlOperation.setLayoutData(fdlOperation);
wOperation = new CCombo(wCryptoSettings, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wOperation);
wOperation.addModifyListener(lsMod);
fdOperation = new FormData();
fdOperation.left = new FormAttachment(middle, margin);
fdOperation.top = new FormAttachment(wStepname, margin);
fdOperation.right = new FormAttachment(100, -margin);
wOperation.setLayoutData(fdOperation);
wOperation.setItems(SymmetricCryptoTransMeta.operationTypeDesc);
wOperation.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Algorithm
wlAlgorithm = new Label(wCryptoSettings, SWT.RIGHT);
wlAlgorithm.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Algorithm.Label"));
props.setLook(wlAlgorithm);
fdlAlgorithm = new FormData();
fdlAlgorithm.left = new FormAttachment(0, 0);
fdlAlgorithm.right = new FormAttachment(middle, -margin);
fdlAlgorithm.top = new FormAttachment(wOperation, margin);
wlAlgorithm.setLayoutData(fdlAlgorithm);
wAlgorithm = new CCombo(wCryptoSettings, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wAlgorithm);
wAlgorithm.addModifyListener(lsMod);
fdAlgorithm = new FormData();
fdAlgorithm.left = new FormAttachment(middle, margin);
fdAlgorithm.top = new FormAttachment(wOperation, margin);
fdAlgorithm.right = new FormAttachment(100, -margin);
wAlgorithm.setLayoutData(fdAlgorithm);
wAlgorithm.setItems(SymmetricCryptoMeta.TYPE_ALGORYTHM_CODE);
wAlgorithm.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Scheme
wlScheme = new Label(wCryptoSettings, SWT.RIGHT);
wlScheme.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Scheme.Label"));
props.setLook(wlScheme);
fdlScheme = new FormData();
fdlScheme.left = new FormAttachment(0, 0);
fdlScheme.top = new FormAttachment(wAlgorithm, margin);
fdlScheme.right = new FormAttachment(middle, -margin);
wlScheme.setLayoutData(fdlScheme);
wScheme = new TextVar(transMeta, wCryptoSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wScheme);
wScheme.addModifyListener(lsMod);
fdScheme = new FormData();
fdScheme.left = new FormAttachment(middle, margin);
fdScheme.right = new FormAttachment(100, -margin);
fdScheme.top = new FormAttachment(wAlgorithm, margin);
wScheme.setLayoutData(fdScheme);
// SecretKey
wlSecretKey = new Label(wCryptoSettings, SWT.RIGHT);
wlSecretKey.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKey.Label"));
props.setLook(wlSecretKey);
FormData fdlSecretKey = new FormData();
fdlSecretKey.left = new FormAttachment(0, 0);
fdlSecretKey.top = new FormAttachment(wScheme, 2 * margin);
fdlSecretKey.right = new FormAttachment(middle, -margin);
wlSecretKey.setLayoutData(fdlSecretKey);
wSecretKey = new PasswordTextVar(transMeta, wCryptoSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKey.Tooltip"));
props.setLook(wSecretKey);
wSecretKey.addModifyListener(lsMod);
FormData fdSecretKey = new FormData();
fdSecretKey.left = new FormAttachment(middle, margin);
fdSecretKey.right = new FormAttachment(100, -margin);
fdSecretKey.top = new FormAttachment(wScheme, 2 * margin);
wSecretKey.setLayoutData(fdSecretKey);
// Is secret key extracted from a field?
wlSecretKeyInField = new Label(wCryptoSettings, SWT.RIGHT);
wlSecretKeyInField.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKeyFileField.Label"));
props.setLook(wlSecretKeyInField);
fdlSecretKeyInField = new FormData();
fdlSecretKeyInField.left = new FormAttachment(0, 0);
fdlSecretKeyInField.top = new FormAttachment(wSecretKey, margin);
fdlSecretKeyInField.right = new FormAttachment(middle, -margin);
wlSecretKeyInField.setLayoutData(fdlSecretKeyInField);
wSecretKeyInField = new Button(wCryptoSettings, SWT.CHECK);
props.setLook(wSecretKeyInField);
wSecretKeyInField.setToolTipText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKeyFileField.Tooltip"));
fdSecretKeyInField = new FormData();
fdSecretKeyInField.left = new FormAttachment(middle, margin);
fdSecretKeyInField.top = new FormAttachment(wSecretKey, margin);
wSecretKeyInField.setLayoutData(fdSecretKeyInField);
SelectionAdapter lsXslFile = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ActivewlSecretKeyField();
input.setChanged();
}
};
wSecretKeyInField.addSelectionListener(lsXslFile);
// If secret key defined in a Field
wlSecretKeyField = new Label(wCryptoSettings, SWT.RIGHT);
wlSecretKeyField.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.SecretKeyField.Label"));
props.setLook(wlSecretKeyField);
FormData fdlSecretKeyField = new FormData();
fdlSecretKeyField.left = new FormAttachment(0, 0);
fdlSecretKeyField.top = new FormAttachment(wSecretKeyInField, margin);
fdlSecretKeyField.right = new FormAttachment(middle, -margin);
wlSecretKeyField.setLayoutData(fdlSecretKeyField);
wSecretKeyField = new CCombo(wCryptoSettings, SWT.BORDER | SWT.READ_ONLY);
wSecretKeyField.setEditable(true);
props.setLook(wSecretKeyField);
wSecretKeyField.addModifyListener(lsMod);
FormData fdSecretKeyField = new FormData();
fdSecretKeyField.left = new FormAttachment(middle, margin);
fdSecretKeyField.top = new FormAttachment(wSecretKeyInField, margin);
fdSecretKeyField.right = new FormAttachment(100, -margin);
wSecretKeyField.setLayoutData(fdSecretKeyField);
wSecretKeyField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
setSecretKeyFieldname();
}
});
wlReadKeyAsBinary = new Label(wCryptoSettings, SWT.RIGHT);
wlReadKeyAsBinary.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ReadKeyAsBinary.Label"));
props.setLook(wlReadKeyAsBinary);
fdlReadKeyAsBinary = new FormData();
fdlReadKeyAsBinary.left = new FormAttachment(0, 0);
fdlReadKeyAsBinary.top = new FormAttachment(wSecretKeyField, margin);
fdlReadKeyAsBinary.right = new FormAttachment(middle, -margin);
wlReadKeyAsBinary.setLayoutData(fdlReadKeyAsBinary);
wReadKeyAsBinary = new Button(wCryptoSettings, SWT.CHECK);
wReadKeyAsBinary.setToolTipText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ReadKeyAsBinary.Tooltip"));
props.setLook(wReadKeyAsBinary);
fdReadKeyAsBinary = new FormData();
fdReadKeyAsBinary.left = new FormAttachment(middle, margin);
fdReadKeyAsBinary.top = new FormAttachment(wSecretKeyField, margin);
fdReadKeyAsBinary.right = new FormAttachment(100, -margin);
wReadKeyAsBinary.setLayoutData(fdReadKeyAsBinary);
wReadKeyAsBinary.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
fdCryptoSettings = new FormData();
fdCryptoSettings.left = new FormAttachment(0, margin);
fdCryptoSettings.top = new FormAttachment(wStepname, margin);
fdCryptoSettings.right = new FormAttachment(100, -margin);
wCryptoSettings.setLayoutData(fdCryptoSettings);
// ///////////////////////////////////////////////////////////
// / END OF Crypto settings GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Crypto settings GROUP
//
wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wMessageGroup);
wMessageGroup.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Message.Group.Label"));
FormLayout MessageGroupgroupLayout = new FormLayout();
MessageGroupgroupLayout.marginWidth = 10;
MessageGroupgroupLayout.marginHeight = 10;
wMessageGroup.setLayout(MessageGroupgroupLayout);
// FieldName to evaluate
wlMessage = new Label(wMessageGroup, SWT.RIGHT);
wlMessage.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.Field.Label"));
props.setLook(wlMessage);
FormData fdlMessage = new FormData();
fdlMessage.left = new FormAttachment(0, 0);
fdlMessage.top = new FormAttachment(wCryptoSettings, margin);
fdlMessage.right = new FormAttachment(middle, -margin);
wlMessage.setLayoutData(fdlMessage);
wMessage = new CCombo(wMessageGroup, SWT.BORDER | SWT.READ_ONLY);
wMessage.setEditable(true);
props.setLook(wMessage);
wMessage.addModifyListener(lsMod);
FormData fdField = new FormData();
fdField.left = new FormAttachment(middle, margin);
fdField.top = new FormAttachment(wCryptoSettings, margin);
fdField.right = new FormAttachment(100, -margin);
wMessage.setLayoutData(fdField);
wMessage.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
setFieldname();
}
});
fdMessageGroup = new FormData();
fdMessageGroup.left = new FormAttachment(0, margin);
fdMessageGroup.top = new FormAttachment(wCryptoSettings, margin);
fdMessageGroup.right = new FormAttachment(100, -margin);
wMessageGroup.setLayoutData(fdMessageGroup);
// ///////////////////////////////////////////////////////////
// / END OF Crypto settings GROUP
// ///////////////////////////////////////////////////////////
// Step Output field grouping?
// ////////////////////////
// START OF Output Field GROUP
//
wOutputField = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wOutputField);
wOutputField.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ResultField.Group.Label"));
FormLayout outputfieldgroupLayout = new FormLayout();
outputfieldgroupLayout.marginWidth = 10;
outputfieldgroupLayout.marginHeight = 10;
wOutputField.setLayout(outputfieldgroupLayout);
// Output Fieldame
wResultField = new LabelTextVar(transMeta, wOutputField, BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ResultField.Label"), BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.ResultField.Tooltip"));
props.setLook(wResultField);
wResultField.addModifyListener(lsMod);
FormData fdResultField = new FormData();
fdResultField.left = new FormAttachment(0, 0);
fdResultField.top = new FormAttachment(wMessageGroup, margin);
fdResultField.right = new FormAttachment(100, 0);
wResultField.setLayoutData(fdResultField);
wlOutputAsBinary = new Label(wOutputField, SWT.RIGHT);
wlOutputAsBinary.setText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.OutputAsBinary.Label"));
props.setLook(wlOutputAsBinary);
fdlOutputAsBinary = new FormData();
fdlOutputAsBinary.left = new FormAttachment(0, 0);
fdlOutputAsBinary.top = new FormAttachment(wResultField, margin);
fdlOutputAsBinary.right = new FormAttachment(middle, -margin);
wlOutputAsBinary.setLayoutData(fdlOutputAsBinary);
wOutputAsBinary = new Button(wOutputField, SWT.CHECK);
wOutputAsBinary.setToolTipText(BaseMessages.getString(PKG, "SymmetricCryptoTransDialog.OutputAsBinary.Tooltip"));
props.setLook(wOutputAsBinary);
fdOutputAsBinary = new FormData();
fdOutputAsBinary.left = new FormAttachment(middle, margin);
fdOutputAsBinary.top = new FormAttachment(wResultField, margin);
fdOutputAsBinary.right = new FormAttachment(100, 0);
wOutputAsBinary.setLayoutData(fdOutputAsBinary);
wOutputAsBinary.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
fdOutputField = new FormData();
fdOutputField.left = new FormAttachment(0, margin);
fdOutputField.top = new FormAttachment(wMessageGroup, margin);
fdOutputField.right = new FormAttachment(100, -margin);
wOutputField.setLayoutData(fdOutputField);
// ///////////////////////////////////////////////////////////
// / END OF Output Field GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wOutputField, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
ActivewlSecretKeyField();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations