use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class MqttDialogSecurityLayout method buildSecurityTab.
void buildSecurityTab() {
CTabItem wSecurityTab = new CTabItem(wTabFolder, SWT.NONE, 1);
wSecurityTab.setText(BaseMessages.getString(PKG, "MQTTDialog.Security.Tab"));
Composite wSecurityComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSecurityComp);
FormLayout securityLayout = new FormLayout();
securityLayout.marginHeight = 15;
securityLayout.marginWidth = 15;
wSecurityComp.setLayout(securityLayout);
// Authentication group
Group wAuthenticationGroup = new Group(wSecurityComp, SWT.SHADOW_ETCHED_IN);
props.setLook(wAuthenticationGroup);
wAuthenticationGroup.setText(BaseMessages.getString(PKG, "MQTTDialog.Security.Authentication"));
FormLayout flAuthentication = new FormLayout();
flAuthentication.marginHeight = 15;
flAuthentication.marginWidth = 15;
wAuthenticationGroup.setLayout(flAuthentication);
FormData fdAuthenticationGroup = new FormData();
fdAuthenticationGroup.left = new FormAttachment(0, 0);
fdAuthenticationGroup.top = new FormAttachment(0, 0);
fdAuthenticationGroup.right = new FormAttachment(100, 0);
fdAuthenticationGroup.width = INPUT_WIDTH;
wAuthenticationGroup.setLayoutData(fdAuthenticationGroup);
Label wlUsername = new Label(wAuthenticationGroup, SWT.LEFT);
props.setLook(wlUsername);
wlUsername.setText(BaseMessages.getString(PKG, "MQTTDialog.Security.Username"));
FormData fdlUsername = new FormData();
fdlUsername.left = new FormAttachment(0, 0);
fdlUsername.top = new FormAttachment(0, 0);
fdlUsername.right = new FormAttachment(0, INPUT_WIDTH);
wlUsername.setLayoutData(fdlUsername);
wUsername = new TextVar(transMeta, wAuthenticationGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUsername);
wUsername.addModifyListener(lsMod);
FormData fdUsername = new FormData();
fdUsername.left = new FormAttachment(0, 0);
fdUsername.top = new FormAttachment(wlUsername, 5);
fdUsername.right = new FormAttachment(0, INPUT_WIDTH);
wUsername.setLayoutData(fdUsername);
Label wlPassword = new Label(wAuthenticationGroup, SWT.LEFT);
props.setLook(wlPassword);
wlPassword.setText(BaseMessages.getString(PKG, "MQTTDialog.Security.Password"));
FormData fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUsername, 10);
fdlPassword.right = new FormAttachment(0, INPUT_WIDTH);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(transMeta, wAuthenticationGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
FormData fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wlPassword, 5);
fdPassword.right = new FormAttachment(0, INPUT_WIDTH);
wPassword.setLayoutData(fdPassword);
wUseSSL = new Button(wSecurityComp, SWT.CHECK);
wUseSSL.setText(BaseMessages.getString(PKG, "MQTTDialog.Security.UseSSL"));
props.setLook(wUseSSL);
FormData fdUseSSL = new FormData();
fdUseSSL.top = new FormAttachment(wAuthenticationGroup, 15);
fdUseSSL.left = new FormAttachment(0, 0);
wUseSSL.setLayoutData(fdUseSSL);
wUseSSL.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent selectionEvent) {
boolean selection = ((Button) selectionEvent.getSource()).getSelection();
sslTable.setEnabled(selection);
sslTable.table.setEnabled(selection);
}
@Override
public void widgetDefaultSelected(SelectionEvent selectionEvent) {
boolean selection = ((Button) selectionEvent.getSource()).getSelection();
sslTable.setEnabled(selection);
sslTable.table.setEnabled(selection);
}
});
Label wlSSLProperties = new Label(wSecurityComp, SWT.LEFT);
wlSSLProperties.setText(BaseMessages.getString(PKG, "MQTTDialog.Security.SSLProperties"));
props.setLook(wlSSLProperties);
FormData fdlSSLProperties = new FormData();
fdlSSLProperties.top = new FormAttachment(wUseSSL, 10);
fdlSSLProperties.left = new FormAttachment(0, 0);
wlSSLProperties.setLayoutData(fdlSSLProperties);
FormData fdSecurityComp = new FormData();
fdSecurityComp.left = new FormAttachment(0, 0);
fdSecurityComp.top = new FormAttachment(0, 0);
fdSecurityComp.right = new FormAttachment(100, 0);
fdSecurityComp.bottom = new FormAttachment(100, 0);
wSecurityComp.setLayoutData(fdSecurityComp);
buildSSLTable(wSecurityComp, wlSSLProperties);
wSecurityComp.layout();
wSecurityTab.setControl(wSecurityComp);
}
use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.
the class HTTPDialog 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, "HTTPDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
//
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "HTTPDialog.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);
Control lastControl = wStepname;
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, "HTTPDialog.GeneralTab.Title"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wGeneralComp.setLayout(fileLayout);
// ////////////////////////
// START Settings GROUP
Group gSettings = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gSettings.setText(BaseMessages.getString(PKG, "HTTPDialog.SettingsGroup.Label"));
FormLayout SettingsLayout = new FormLayout();
SettingsLayout.marginWidth = 3;
SettingsLayout.marginHeight = 3;
gSettings.setLayout(SettingsLayout);
props.setLook(gSettings);
// The URL to use
//
wlUrl = new Label(gSettings, SWT.RIGHT);
wlUrl.setText(BaseMessages.getString(PKG, "HTTPDialog.URL.Label"));
props.setLook(wlUrl);
fdlUrl = new FormData();
fdlUrl.left = new FormAttachment(0, 0);
fdlUrl.right = new FormAttachment(middle, -margin);
fdlUrl.top = new FormAttachment(lastControl, margin);
wlUrl.setLayoutData(fdlUrl);
wUrl = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUrl);
wUrl.addModifyListener(lsMod);
fdUrl = new FormData();
fdUrl.left = new FormAttachment(middle, 0);
fdUrl.top = new FormAttachment(lastControl, margin);
fdUrl.right = new FormAttachment(100, 0);
wUrl.setLayoutData(fdUrl);
lastControl = wUrl;
// UrlInField line
//
wlUrlInField = new Label(gSettings, SWT.RIGHT);
wlUrlInField.setText(BaseMessages.getString(PKG, "HTTPDialog.UrlInField.Label"));
props.setLook(wlUrlInField);
fdlUrlInField = new FormData();
fdlUrlInField.left = new FormAttachment(0, 0);
fdlUrlInField.top = new FormAttachment(lastControl, margin);
fdlUrlInField.right = new FormAttachment(middle, -margin);
wlUrlInField.setLayoutData(fdlUrlInField);
wUrlInField = new Button(gSettings, SWT.CHECK);
props.setLook(wUrlInField);
fdUrlInField = new FormData();
fdUrlInField.left = new FormAttachment(middle, 0);
fdUrlInField.top = new FormAttachment(lastControl, margin);
fdUrlInField.right = new FormAttachment(100, 0);
wUrlInField.setLayoutData(fdUrlInField);
wUrlInField.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
activeUrlInfield();
}
});
lastControl = wUrlInField;
// UrlField Line
//
wlUrlField = new Label(gSettings, SWT.RIGHT);
wlUrlField.setText(BaseMessages.getString(PKG, "HTTPDialog.UrlField.Label"));
props.setLook(wlUrlField);
fdlUrlField = new FormData();
fdlUrlField.left = new FormAttachment(0, 0);
fdlUrlField.right = new FormAttachment(middle, -margin);
fdlUrlField.top = new FormAttachment(lastControl, margin);
wlUrlField.setLayoutData(fdlUrlField);
wUrlField = new ComboVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wUrlField.setToolTipText(BaseMessages.getString(PKG, "HTTPDialog.UrlField.Tooltip"));
props.setLook(wUrlField);
wUrlField.addModifyListener(lsMod);
fdUrlField = new FormData();
fdUrlField.left = new FormAttachment(middle, 0);
fdUrlField.top = new FormAttachment(lastControl, margin);
fdUrlField.right = new FormAttachment(100, 0);
wUrlField.setLayoutData(fdUrlField);
wUrlField.setEnabled(false);
wUrlField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
BaseStepDialog.getFieldsFromPrevious(wUrlField, transMeta, stepMeta);
shell.setCursor(null);
busy.dispose();
}
});
lastControl = wUrlField;
// Encoding
//
Label wlEncoding = new Label(gSettings, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "HTTPDialog.Encoding.Label"));
props.setLook(wlEncoding);
FormData fdlEncoding = new FormData();
fdlEncoding.top = new FormAttachment(lastControl, margin);
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.right = new FormAttachment(middle, -margin);
wlEncoding.setLayoutData(fdlEncoding);
wEncoding = new ComboVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wEncoding);
wEncoding.addModifyListener(lsMod);
FormData fdEncoding = new FormData();
fdEncoding.top = new FormAttachment(lastControl, margin);
fdEncoding.left = new FormAttachment(middle, 0);
fdEncoding.right = new FormAttachment(100, 0);
wEncoding.setLayoutData(fdEncoding);
lastControl = wEncoding;
wEncoding.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
setEncodings();
shell.setCursor(null);
busy.dispose();
}
});
wlConnectionTimeOut = new Label(gSettings, SWT.RIGHT);
wlConnectionTimeOut.setText(BaseMessages.getString(PKG, "HTTPDialog.ConnectionTimeOut.Label"));
props.setLook(wlConnectionTimeOut);
FormData fdlConnectionTimeOut = new FormData();
fdlConnectionTimeOut.top = new FormAttachment(wEncoding, margin);
fdlConnectionTimeOut.left = new FormAttachment(0, 0);
fdlConnectionTimeOut.right = new FormAttachment(middle, -margin);
wlConnectionTimeOut.setLayoutData(fdlConnectionTimeOut);
wConnectionTimeOut = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wConnectionTimeOut.addModifyListener(lsMod);
wConnectionTimeOut.setToolTipText(BaseMessages.getString(PKG, "HTTPDialog.ConnectionTimeOut.Tooltip"));
props.setLook(wConnectionTimeOut);
FormData fdConnectionTimeOut = new FormData();
fdConnectionTimeOut.top = new FormAttachment(wEncoding, margin);
fdConnectionTimeOut.left = new FormAttachment(middle, 0);
fdConnectionTimeOut.right = new FormAttachment(100, 0);
wConnectionTimeOut.setLayoutData(fdConnectionTimeOut);
wlSocketTimeOut = new Label(gSettings, SWT.RIGHT);
wlSocketTimeOut.setText(BaseMessages.getString(PKG, "HTTPDialog.SocketTimeOut.Label"));
props.setLook(wlSocketTimeOut);
FormData fdlSocketTimeOut = new FormData();
fdlSocketTimeOut.top = new FormAttachment(wConnectionTimeOut, margin);
fdlSocketTimeOut.left = new FormAttachment(0, 0);
fdlSocketTimeOut.right = new FormAttachment(middle, -margin);
wlSocketTimeOut.setLayoutData(fdlSocketTimeOut);
wSocketTimeOut = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wSocketTimeOut.addModifyListener(lsMod);
wSocketTimeOut.setToolTipText(BaseMessages.getString(PKG, "HTTPDialog.SocketTimeOut.Tooltip"));
props.setLook(wSocketTimeOut);
FormData fdSocketTimeOut = new FormData();
fdSocketTimeOut.top = new FormAttachment(wConnectionTimeOut, margin);
fdSocketTimeOut.left = new FormAttachment(middle, 0);
fdSocketTimeOut.right = new FormAttachment(100, 0);
wSocketTimeOut.setLayoutData(fdSocketTimeOut);
wlCloseIdleConnectionsTime = new Label(gSettings, SWT.RIGHT);
wlCloseIdleConnectionsTime.setText(BaseMessages.getString(PKG, "HTTPDialog.CloseIdleConnectionsTime.Label"));
props.setLook(wlCloseIdleConnectionsTime);
FormData fdlCloseIdleConnectionsTime = new FormData();
fdlCloseIdleConnectionsTime.top = new FormAttachment(wSocketTimeOut, margin);
fdlCloseIdleConnectionsTime.left = new FormAttachment(0, 0);
fdlCloseIdleConnectionsTime.right = new FormAttachment(middle, -margin);
wlCloseIdleConnectionsTime.setLayoutData(fdlCloseIdleConnectionsTime);
wCloseIdleConnectionsTime = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wCloseIdleConnectionsTime.addModifyListener(lsMod);
wCloseIdleConnectionsTime.setToolTipText(BaseMessages.getString(PKG, "HTTPDialog.CloseIdleConnectionsTime.Tooltip"));
props.setLook(wCloseIdleConnectionsTime);
FormData fdCloseIdleConnectionsTime = new FormData();
fdCloseIdleConnectionsTime.top = new FormAttachment(wSocketTimeOut, margin);
fdCloseIdleConnectionsTime.left = new FormAttachment(middle, 0);
fdCloseIdleConnectionsTime.right = new FormAttachment(100, 0);
wCloseIdleConnectionsTime.setLayoutData(fdCloseIdleConnectionsTime);
FormData fdSettings = new FormData();
fdSettings.left = new FormAttachment(0, 0);
fdSettings.right = new FormAttachment(100, 0);
fdSettings.top = new FormAttachment(lastControl, margin);
gSettings.setLayoutData(fdSettings);
// END Output Settings GROUP
// ////////////////////////
lastControl = gSettings;
// ////////////////////////
// START Output Fields GROUP
Group gOutputFields = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gOutputFields.setText(BaseMessages.getString(PKG, "HTTPDialog.OutputFieldsGroup.Label"));
FormLayout OutputFieldsLayout = new FormLayout();
OutputFieldsLayout.marginWidth = 3;
OutputFieldsLayout.marginHeight = 3;
gOutputFields.setLayout(OutputFieldsLayout);
props.setLook(gOutputFields);
// Result line...
//
wlResult = new Label(gOutputFields, SWT.RIGHT);
wlResult.setText(BaseMessages.getString(PKG, "HTTPDialog.Result.Label"));
props.setLook(wlResult);
fdlResult = new FormData();
fdlResult.left = new FormAttachment(0, 0);
fdlResult.right = new FormAttachment(middle, -margin);
fdlResult.top = new FormAttachment(lastControl, margin);
wlResult.setLayoutData(fdlResult);
wResult = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResult);
wResult.addModifyListener(lsMod);
fdResult = new FormData();
fdResult.left = new FormAttachment(middle, 0);
fdResult.top = new FormAttachment(lastControl, margin);
fdResult.right = new FormAttachment(100, 0);
wResult.setLayoutData(fdResult);
// Resultcode line...
wlResultCode = new Label(gOutputFields, SWT.RIGHT);
wlResultCode.setText(BaseMessages.getString(PKG, "HTTPDialog.ResultCode.Label"));
props.setLook(wlResultCode);
fdlResultCode = new FormData();
fdlResultCode.left = new FormAttachment(0, 0);
fdlResultCode.right = new FormAttachment(middle, -margin);
fdlResultCode.top = new FormAttachment(wResult, margin);
wlResultCode.setLayoutData(fdlResultCode);
wResultCode = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResultCode);
wResultCode.addModifyListener(lsMod);
fdResultCode = new FormData();
fdResultCode.left = new FormAttachment(middle, 0);
fdResultCode.top = new FormAttachment(wResult, margin);
fdResultCode.right = new FormAttachment(100, 0);
wResultCode.setLayoutData(fdResultCode);
// Response time line...
wlResponseTime = new Label(gOutputFields, SWT.RIGHT);
wlResponseTime.setText(BaseMessages.getString(PKG, "HTTPDialog.ResponseTime.Label"));
props.setLook(wlResponseTime);
fdlResponseTime = new FormData();
fdlResponseTime.left = new FormAttachment(0, 0);
fdlResponseTime.right = new FormAttachment(middle, -margin);
fdlResponseTime.top = new FormAttachment(wResultCode, margin);
wlResponseTime.setLayoutData(fdlResponseTime);
wResponseTime = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResponseTime);
wResponseTime.addModifyListener(lsMod);
fdResponseTime = new FormData();
fdResponseTime.left = new FormAttachment(middle, 0);
fdResponseTime.top = new FormAttachment(wResultCode, margin);
fdResponseTime.right = new FormAttachment(100, 0);
wResponseTime.setLayoutData(fdResponseTime);
// Response header line...
wlResponseHeader = new Label(gOutputFields, SWT.RIGHT);
wlResponseHeader.setText(BaseMessages.getString(PKG, "HTTPDialog.ResponseHeader.Label"));
props.setLook(wlResponseHeader);
fdlResponseHeader = new FormData();
fdlResponseHeader.left = new FormAttachment(0, 0);
fdlResponseHeader.right = new FormAttachment(middle, -margin);
fdlResponseHeader.top = new FormAttachment(wResponseTime, margin);
wlResponseHeader.setLayoutData(fdlResponseHeader);
wResponseHeader = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResponseHeader);
wResponseHeader.addModifyListener(lsMod);
fdResponseHeader = new FormData();
fdResponseHeader.left = new FormAttachment(middle, 0);
fdResponseHeader.top = new FormAttachment(wResponseTime, margin);
fdResponseHeader.right = new FormAttachment(100, 0);
wResponseHeader.setLayoutData(fdResponseHeader);
FormData fdOutputFields = new FormData();
fdOutputFields.left = new FormAttachment(0, 0);
fdOutputFields.right = new FormAttachment(100, 0);
fdOutputFields.top = new FormAttachment(lastControl, margin);
gOutputFields.setLayoutData(fdOutputFields);
// END Output Fields GROUP
// ////////////////////////
lastControl = gOutputFields;
// ////////////////////////
// START HTTP AUTH GROUP
Group gHttpAuth = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gHttpAuth.setText(BaseMessages.getString(PKG, "HTTPDialog.HttpAuthGroup.Label"));
FormLayout httpAuthLayout = new FormLayout();
httpAuthLayout.marginWidth = 3;
httpAuthLayout.marginHeight = 3;
gHttpAuth.setLayout(httpAuthLayout);
props.setLook(gHttpAuth);
// HTTP Login
wlHttpLogin = new Label(gHttpAuth, SWT.RIGHT);
wlHttpLogin.setText(BaseMessages.getString(PKG, "HTTPDialog.HttpLogin.Label"));
props.setLook(wlHttpLogin);
FormData fdlHttpLogin = new FormData();
fdlHttpLogin.top = new FormAttachment(0, margin);
fdlHttpLogin.left = new FormAttachment(0, 0);
fdlHttpLogin.right = new FormAttachment(middle, -margin);
wlHttpLogin.setLayoutData(fdlHttpLogin);
wHttpLogin = new TextVar(transMeta, gHttpAuth, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wHttpLogin.addModifyListener(lsMod);
wHttpLogin.setToolTipText(BaseMessages.getString(PKG, "HTTPDialog.HttpLogin.Tooltip"));
props.setLook(wHttpLogin);
FormData fdHttpLogin = new FormData();
fdHttpLogin.top = new FormAttachment(0, margin);
fdHttpLogin.left = new FormAttachment(middle, 0);
fdHttpLogin.right = new FormAttachment(100, 0);
wHttpLogin.setLayoutData(fdHttpLogin);
// HTTP Password
wlHttpPassword = new Label(gHttpAuth, SWT.RIGHT);
wlHttpPassword.setText(BaseMessages.getString(PKG, "HTTPDialog.HttpPassword.Label"));
props.setLook(wlHttpPassword);
FormData fdlHttpPassword = new FormData();
fdlHttpPassword.top = new FormAttachment(wHttpLogin, margin);
fdlHttpPassword.left = new FormAttachment(0, 0);
fdlHttpPassword.right = new FormAttachment(middle, -margin);
wlHttpPassword.setLayoutData(fdlHttpPassword);
wHttpPassword = new PasswordTextVar(transMeta, gHttpAuth, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wHttpPassword.addModifyListener(lsMod);
wHttpPassword.setToolTipText(BaseMessages.getString(PKG, "HTTPDialog.HttpPassword.Tooltip"));
props.setLook(wHttpPassword);
FormData fdHttpPassword = new FormData();
fdHttpPassword.top = new FormAttachment(wHttpLogin, margin);
fdHttpPassword.left = new FormAttachment(middle, 0);
fdHttpPassword.right = new FormAttachment(100, 0);
wHttpPassword.setLayoutData(fdHttpPassword);
FormData fdHttpAuth = new FormData();
fdHttpAuth.left = new FormAttachment(0, 0);
fdHttpAuth.right = new FormAttachment(100, 0);
fdHttpAuth.top = new FormAttachment(lastControl, margin);
gHttpAuth.setLayoutData(fdHttpAuth);
// END HTTP AUTH GROUP
// ////////////////////////
lastControl = gHttpAuth;
// ////////////////////////
// START PROXY GROUP
Group gProxy = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gProxy.setText(BaseMessages.getString(PKG, "HTTPDialog.ProxyGroup.Label"));
FormLayout proxyLayout = new FormLayout();
proxyLayout.marginWidth = 3;
proxyLayout.marginHeight = 3;
gProxy.setLayout(proxyLayout);
props.setLook(gProxy);
// HTTP Login
wlProxyHost = new Label(gProxy, SWT.RIGHT);
wlProxyHost.setText(BaseMessages.getString(PKG, "HTTPDialog.ProxyHost.Label"));
props.setLook(wlProxyHost);
FormData fdlProxyHost = new FormData();
fdlProxyHost.top = new FormAttachment(0, margin);
fdlProxyHost.left = new FormAttachment(0, 0);
fdlProxyHost.right = new FormAttachment(middle, -margin);
wlProxyHost.setLayoutData(fdlProxyHost);
wProxyHost = new TextVar(transMeta, gProxy, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProxyHost.addModifyListener(lsMod);
wProxyHost.setToolTipText(BaseMessages.getString(PKG, "HTTPDialog.ProxyHost.Tooltip"));
props.setLook(wProxyHost);
FormData fdProxyHost = new FormData();
fdProxyHost.top = new FormAttachment(0, margin);
fdProxyHost.left = new FormAttachment(middle, 0);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// HTTP Password
wlProxyPort = new Label(gProxy, SWT.RIGHT);
wlProxyPort.setText(BaseMessages.getString(PKG, "HTTPDialog.ProxyPort.Label"));
props.setLook(wlProxyPort);
FormData fdlProxyPort = new FormData();
fdlProxyPort.top = new FormAttachment(wProxyHost, margin);
fdlProxyPort.left = new FormAttachment(0, 0);
fdlProxyPort.right = new FormAttachment(middle, -margin);
wlProxyPort.setLayoutData(fdlProxyPort);
wProxyPort = new TextVar(transMeta, gProxy, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProxyPort.addModifyListener(lsMod);
wProxyPort.setToolTipText(BaseMessages.getString(PKG, "HTTPDialog.ProxyPort.Tooltip"));
props.setLook(wProxyPort);
FormData fdProxyPort = new FormData();
fdProxyPort.top = new FormAttachment(wProxyHost, margin);
fdProxyPort.left = new FormAttachment(middle, 0);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
FormData fdProxy = new FormData();
fdProxy.left = new FormAttachment(0, 0);
fdProxy.right = new FormAttachment(100, 0);
fdProxy.top = new FormAttachment(lastControl, margin);
gProxy.setLayoutData(fdProxy);
// END HTTP Proxy GROUP
// ////////////////////////
lastControl = gProxy;
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wStepname, margin);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// Additional tab...
//
wAdditionalTab = new CTabItem(wTabFolder, SWT.NONE);
wAdditionalTab.setText(BaseMessages.getString(PKG, "HTTPDialog.FieldsTab.Title"));
FormLayout addLayout = new FormLayout();
addLayout.marginWidth = Const.FORM_MARGIN;
addLayout.marginHeight = Const.FORM_MARGIN;
wAdditionalComp = new Composite(wTabFolder, SWT.NONE);
wAdditionalComp.setLayout(addLayout);
props.setLook(wAdditionalComp);
wlFields = new Label(wAdditionalComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "HTTPDialog.Parameters.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(lastControl, margin);
wlFields.setLayoutData(fdlFields);
lastControl = wlFields;
wGet = new Button(wAdditionalComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "HTTPDialog.GetFields.Button"));
FormData fdGet = new FormData();
fdGet.top = new FormAttachment(wlFields, margin);
fdGet.right = new FormAttachment(100, 0);
wGet.setLayoutData(fdGet);
final int FieldsRows = input.getArgumentField().length;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "HTTPDialog.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "HTTPDialog.ColumnInfo.Parameter"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
wFields = new TableView(transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(wGet, -margin);
fdFields.bottom = new FormAttachment(wlFields, 200);
wFields.setLayoutData(fdFields);
wlHeaders = new Label(wAdditionalComp, SWT.NONE);
wlHeaders.setText(BaseMessages.getString(PKG, "HTTPDialog.Headers.Label"));
props.setLook(wlHeaders);
fdlHeaders = new FormData();
fdlHeaders.left = new FormAttachment(0, 0);
fdlHeaders.top = new FormAttachment(wFields, margin);
wlHeaders.setLayoutData(fdlHeaders);
final int HeadersRows = input.getHeaderParameter().length;
colinfHeaders = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "HTTPDialog.ColumnInfo.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "HTTPDialog.ColumnInfo.Header"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinfHeaders[1].setUsingVariables(true);
wHeaders = new TableView(transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinfHeaders, HeadersRows, lsMod, props);
wGetHeaders = new Button(wAdditionalComp, SWT.PUSH);
wGetHeaders.setText(BaseMessages.getString(PKG, "HTTPDialog.GetHeaders.Button"));
FormData fdGetHeaders = new FormData();
fdGetHeaders.top = new FormAttachment(wlHeaders, margin);
fdGetHeaders.right = new FormAttachment(100, 0);
wGetHeaders.setLayoutData(fdGetHeaders);
fdHeaders = new FormData();
fdHeaders.left = new FormAttachment(0, 0);
fdHeaders.top = new FormAttachment(wlHeaders, margin);
fdHeaders.right = new FormAttachment(wGetHeaders, -margin);
fdHeaders.bottom = new FormAttachment(100, -margin);
wHeaders.setLayoutData(fdHeaders);
//
// Search the fields in the background
final Runnable runnable = new Runnable() {
public void run() {
StepMeta stepMeta = transMeta.findStep(stepname);
if (stepMeta != null) {
try {
RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
}
setComboBoxes();
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
fdAdditionalComp = new FormData();
fdAdditionalComp.left = new FormAttachment(0, 0);
fdAdditionalComp.top = new FormAttachment(wStepname, margin);
fdAdditionalComp.right = new FormAttachment(100, 0);
fdAdditionalComp.bottom = new FormAttachment(100, 0);
wAdditionalComp.setLayoutData(fdAdditionalComp);
wAdditionalComp.layout();
wAdditionalTab.setControl(wAdditionalComp);
// ////// END of Additional Tab
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"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsGetHeaders = new Listener() {
public void handleEvent(Event e) {
getHeadersFields();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wCancel.addListener(SWT.Selection, lsCancel);
wGetHeaders.addListener(SWT.Selection, lsGetHeaders);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wUrl.addSelectionListener(lsDef);
wResult.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
lsResize = new Listener() {
public void handleEvent(Event event) {
Point size = shell.getSize();
wFields.setSize(size.x - 10, size.y - 50);
wFields.table.setSize(size.x - 10, size.y - 50);
wFields.redraw();
}
};
shell.addListener(SWT.Resize, lsResize);
// Set the shell size, based upon previous time...
setSize();
getData();
wTabFolder.setSelection(0);
activeUrlInfield();
input.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 HTTPPOSTDialog 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, "HTTPPOSTDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.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, "HTTPPOSTDialog.GeneralTab.Title"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wGeneralComp.setLayout(fileLayout);
// ////////////////////////
// START Settings GROUP
Group gSettings = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gSettings.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.SettingsGroup.Label"));
FormLayout SettingsLayout = new FormLayout();
SettingsLayout.marginWidth = 3;
SettingsLayout.marginHeight = 3;
gSettings.setLayout(SettingsLayout);
props.setLook(gSettings);
wlUrl = new Label(gSettings, SWT.RIGHT);
wlUrl.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.URL.Label"));
props.setLook(wlUrl);
fdlUrl = new FormData();
fdlUrl.left = new FormAttachment(0, 0);
fdlUrl.right = new FormAttachment(middle, -margin);
fdlUrl.top = new FormAttachment(wStepname, margin);
wlUrl.setLayoutData(fdlUrl);
wUrl = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUrl);
wUrl.addModifyListener(lsMod);
fdUrl = new FormData();
fdUrl.left = new FormAttachment(middle, 0);
fdUrl.top = new FormAttachment(wStepname, margin);
fdUrl.right = new FormAttachment(100, 0);
wUrl.setLayoutData(fdUrl);
// UrlInField line
wlUrlInField = new Label(gSettings, SWT.RIGHT);
wlUrlInField.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.UrlInField.Label"));
props.setLook(wlUrlInField);
fdlUrlInField = new FormData();
fdlUrlInField.left = new FormAttachment(0, 0);
fdlUrlInField.top = new FormAttachment(wUrl, margin);
fdlUrlInField.right = new FormAttachment(middle, -margin);
wlUrlInField.setLayoutData(fdlUrlInField);
wUrlInField = new Button(gSettings, SWT.CHECK);
props.setLook(wUrlInField);
fdUrlInField = new FormData();
fdUrlInField.left = new FormAttachment(middle, 0);
fdUrlInField.top = new FormAttachment(wUrl, margin);
fdUrlInField.right = new FormAttachment(100, 0);
wUrlInField.setLayoutData(fdUrlInField);
wUrlInField.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
activeUrlInfield();
}
});
// UrlField Line
wlUrlField = new Label(gSettings, SWT.RIGHT);
wlUrlField.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.UrlField.Label"));
props.setLook(wlUrlField);
fdlUrlField = new FormData();
fdlUrlField.left = new FormAttachment(0, 0);
fdlUrlField.right = new FormAttachment(middle, -margin);
fdlUrlField.top = new FormAttachment(wUrlInField, margin);
wlUrlField.setLayoutData(fdlUrlField);
wUrlField = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY);
wUrlField.setEditable(true);
props.setLook(wUrlField);
wUrlField.addModifyListener(lsMod);
fdUrlField = new FormData();
fdUrlField.left = new FormAttachment(middle, 0);
fdUrlField.top = new FormAttachment(wUrlInField, margin);
fdUrlField.right = new FormAttachment(100, -margin);
wUrlField.setLayoutData(fdUrlField);
wUrlField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
setStreamFields();
shell.setCursor(null);
busy.dispose();
}
});
wlEncoding = new Label(gSettings, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.Encoding.Label"));
props.setLook(wlEncoding);
fdlEncoding = new FormData();
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.top = new FormAttachment(wUrlField, margin);
fdlEncoding.right = new FormAttachment(middle, -margin);
wlEncoding.setLayoutData(fdlEncoding);
wEncoding = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY);
wEncoding.setEditable(true);
props.setLook(wEncoding);
wEncoding.addModifyListener(lsMod);
fdEncoding = new FormData();
fdEncoding.left = new FormAttachment(middle, 0);
fdEncoding.top = new FormAttachment(wUrlField, margin);
fdEncoding.right = new FormAttachment(100, -margin);
wEncoding.setLayoutData(fdEncoding);
wEncoding.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
setEncodings();
shell.setCursor(null);
busy.dispose();
}
});
// requestEntity Line
wlrequestEntity = new Label(gSettings, SWT.RIGHT);
wlrequestEntity.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.requestEntity.Label"));
props.setLook(wlrequestEntity);
fdlrequestEntity = new FormData();
fdlrequestEntity.left = new FormAttachment(0, 0);
fdlrequestEntity.right = new FormAttachment(middle, -margin);
fdlrequestEntity.top = new FormAttachment(wEncoding, margin);
wlrequestEntity.setLayoutData(fdlrequestEntity);
wrequestEntity = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY);
wrequestEntity.setEditable(true);
props.setLook(wrequestEntity);
wrequestEntity.addModifyListener(lsMod);
fdrequestEntity = new FormData();
fdrequestEntity.left = new FormAttachment(middle, 0);
fdrequestEntity.top = new FormAttachment(wEncoding, margin);
fdrequestEntity.right = new FormAttachment(100, -margin);
wrequestEntity.setLayoutData(fdrequestEntity);
wrequestEntity.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
setStreamFields();
shell.setCursor(null);
busy.dispose();
}
});
// Post file?
wlPostAFile = new Label(gSettings, SWT.RIGHT);
wlPostAFile.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.postAFile.Label"));
props.setLook(wlPostAFile);
FormData fdlPostAFile = new FormData();
fdlPostAFile.left = new FormAttachment(0, 0);
fdlPostAFile.right = new FormAttachment(middle, -margin);
fdlPostAFile.top = new FormAttachment(wrequestEntity, margin);
wlPostAFile.setLayoutData(fdlPostAFile);
wPostAFile = new Button(gSettings, SWT.CHECK);
wPostAFile.setToolTipText(BaseMessages.getString(PKG, "HTTPPOSTDialog.postAFile.Tooltip"));
props.setLook(wPostAFile);
FormData fdPostAFile = new FormData();
fdPostAFile.left = new FormAttachment(middle, 0);
fdPostAFile.top = new FormAttachment(wrequestEntity, margin);
fdPostAFile.right = new FormAttachment(100, 0);
wPostAFile.setLayoutData(fdPostAFile);
wPostAFile.addSelectionListener(new ComponentSelectionListener(input));
wlConnectionTimeOut = new Label(gSettings, SWT.RIGHT);
wlConnectionTimeOut.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ConnectionTimeOut.Label"));
props.setLook(wlConnectionTimeOut);
FormData fdlConnectionTimeOut = new FormData();
fdlConnectionTimeOut.top = new FormAttachment(wPostAFile, margin);
fdlConnectionTimeOut.left = new FormAttachment(0, 0);
fdlConnectionTimeOut.right = new FormAttachment(middle, -margin);
wlConnectionTimeOut.setLayoutData(fdlConnectionTimeOut);
wConnectionTimeOut = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wConnectionTimeOut.addModifyListener(lsMod);
wConnectionTimeOut.setToolTipText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ConnectionTimeOut.Tooltip"));
props.setLook(wConnectionTimeOut);
FormData fdConnectionTimeOut = new FormData();
fdConnectionTimeOut.top = new FormAttachment(wPostAFile, margin);
fdConnectionTimeOut.left = new FormAttachment(middle, 0);
fdConnectionTimeOut.right = new FormAttachment(100, 0);
wConnectionTimeOut.setLayoutData(fdConnectionTimeOut);
wlSocketTimeOut = new Label(gSettings, SWT.RIGHT);
wlSocketTimeOut.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.SocketTimeOut.Label"));
props.setLook(wlSocketTimeOut);
FormData fdlSocketTimeOut = new FormData();
fdlSocketTimeOut.top = new FormAttachment(wConnectionTimeOut, margin);
fdlSocketTimeOut.left = new FormAttachment(0, 0);
fdlSocketTimeOut.right = new FormAttachment(middle, -margin);
wlSocketTimeOut.setLayoutData(fdlSocketTimeOut);
wSocketTimeOut = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wSocketTimeOut.addModifyListener(lsMod);
wSocketTimeOut.setToolTipText(BaseMessages.getString(PKG, "HTTPPOSTDialog.SocketTimeOut.Tooltip"));
props.setLook(wSocketTimeOut);
FormData fdSocketTimeOut = new FormData();
fdSocketTimeOut.top = new FormAttachment(wConnectionTimeOut, margin);
fdSocketTimeOut.left = new FormAttachment(middle, 0);
fdSocketTimeOut.right = new FormAttachment(100, 0);
wSocketTimeOut.setLayoutData(fdSocketTimeOut);
wlCloseIdleConnectionsTime = new Label(gSettings, SWT.RIGHT);
wlCloseIdleConnectionsTime.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.CloseIdleConnectionsTime.Label"));
props.setLook(wlCloseIdleConnectionsTime);
FormData fdlCloseIdleConnectionsTime = new FormData();
fdlCloseIdleConnectionsTime.top = new FormAttachment(wSocketTimeOut, margin);
fdlCloseIdleConnectionsTime.left = new FormAttachment(0, 0);
fdlCloseIdleConnectionsTime.right = new FormAttachment(middle, -margin);
wlCloseIdleConnectionsTime.setLayoutData(fdlCloseIdleConnectionsTime);
wCloseIdleConnectionsTime = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wCloseIdleConnectionsTime.addModifyListener(lsMod);
wCloseIdleConnectionsTime.setToolTipText(BaseMessages.getString(PKG, "HTTPPOSTDialog.CloseIdleConnectionsTime.Tooltip"));
props.setLook(wCloseIdleConnectionsTime);
FormData fdCloseIdleConnectionsTime = new FormData();
fdCloseIdleConnectionsTime.top = new FormAttachment(wSocketTimeOut, margin);
fdCloseIdleConnectionsTime.left = new FormAttachment(middle, 0);
fdCloseIdleConnectionsTime.right = new FormAttachment(100, 0);
wCloseIdleConnectionsTime.setLayoutData(fdCloseIdleConnectionsTime);
FormData fdSettings = new FormData();
fdSettings.left = new FormAttachment(0, 0);
fdSettings.right = new FormAttachment(100, 0);
fdSettings.top = new FormAttachment(wStepname, margin);
gSettings.setLayoutData(fdSettings);
// END Output Settings GROUP
// ////////////////////////
// ////////////////////////
// START Output Fields GROUP
Group gOutputFields = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gOutputFields.setText(BaseMessages.getString(PKG, "HTTPDialog.OutputFieldsGroup.Label"));
FormLayout OutputFieldsLayout = new FormLayout();
OutputFieldsLayout.marginWidth = 3;
OutputFieldsLayout.marginHeight = 3;
gOutputFields.setLayout(OutputFieldsLayout);
props.setLook(gOutputFields);
// Result line...
wlResult = new Label(gOutputFields, SWT.RIGHT);
wlResult.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.Result.Label"));
props.setLook(wlResult);
fdlResult = new FormData();
fdlResult.left = new FormAttachment(0, 0);
fdlResult.right = new FormAttachment(middle, -margin);
fdlResult.top = new FormAttachment(wPostAFile, margin);
wlResult.setLayoutData(fdlResult);
wResult = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResult);
wResult.addModifyListener(lsMod);
fdResult = new FormData();
fdResult.left = new FormAttachment(middle, 0);
fdResult.top = new FormAttachment(wPostAFile, margin);
fdResult.right = new FormAttachment(100, -margin);
wResult.setLayoutData(fdResult);
// Resultcode line...
wlResultCode = new Label(gOutputFields, SWT.RIGHT);
wlResultCode.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ResultCode.Label"));
props.setLook(wlResultCode);
fdlResultCode = new FormData();
fdlResultCode.left = new FormAttachment(0, 0);
fdlResultCode.right = new FormAttachment(middle, -margin);
fdlResultCode.top = new FormAttachment(wResult, margin);
wlResultCode.setLayoutData(fdlResultCode);
wResultCode = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResultCode);
wResultCode.addModifyListener(lsMod);
fdResultCode = new FormData();
fdResultCode.left = new FormAttachment(middle, 0);
fdResultCode.top = new FormAttachment(wResult, margin);
fdResultCode.right = new FormAttachment(100, -margin);
wResultCode.setLayoutData(fdResultCode);
// Response time line...
wlResponseTime = new Label(gOutputFields, SWT.RIGHT);
wlResponseTime.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ResponseTime.Label"));
props.setLook(wlResponseTime);
fdlResponseTime = new FormData();
fdlResponseTime.left = new FormAttachment(0, 0);
fdlResponseTime.right = new FormAttachment(middle, -margin);
fdlResponseTime.top = new FormAttachment(wResultCode, margin);
wlResponseTime.setLayoutData(fdlResponseTime);
wResponseTime = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResponseTime);
wResponseTime.addModifyListener(lsMod);
fdResponseTime = new FormData();
fdResponseTime.left = new FormAttachment(middle, 0);
fdResponseTime.top = new FormAttachment(wResultCode, margin);
fdResponseTime.right = new FormAttachment(100, 0);
wResponseTime.setLayoutData(fdResponseTime);
// Response header line...
wlResponseHeader = new Label(gOutputFields, SWT.RIGHT);
wlResponseHeader.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ResponseHeader.Label"));
props.setLook(wlResponseHeader);
fdlResponseHeader = new FormData();
fdlResponseHeader.left = new FormAttachment(0, 0);
fdlResponseHeader.right = new FormAttachment(middle, -margin);
fdlResponseHeader.top = new FormAttachment(wResponseTime, margin);
wlResponseHeader.setLayoutData(fdlResponseHeader);
wResponseHeader = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResponseHeader);
wResponseHeader.addModifyListener(lsMod);
fdResponseHeader = new FormData();
fdResponseHeader.left = new FormAttachment(middle, 0);
fdResponseHeader.top = new FormAttachment(wResponseTime, margin);
fdResponseHeader.right = new FormAttachment(100, 0);
wResponseHeader.setLayoutData(fdResponseHeader);
FormData fdOutputFields = new FormData();
fdOutputFields.left = new FormAttachment(0, 0);
fdOutputFields.right = new FormAttachment(100, 0);
fdOutputFields.top = new FormAttachment(gSettings, margin);
gOutputFields.setLayoutData(fdOutputFields);
// END Output Fields GROUP
// ////////////////////////
// ////////////////////////
// START HTTP AUTH GROUP
Group gHttpAuth = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gHttpAuth.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.HttpAuthGroup.Label"));
FormLayout httpAuthLayout = new FormLayout();
httpAuthLayout.marginWidth = 3;
httpAuthLayout.marginHeight = 3;
gHttpAuth.setLayout(httpAuthLayout);
props.setLook(gHttpAuth);
// HTTP Login
wlHttpLogin = new Label(gHttpAuth, SWT.RIGHT);
wlHttpLogin.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.HttpLogin.Label"));
props.setLook(wlHttpLogin);
FormData fdlHttpLogin = new FormData();
fdlHttpLogin.top = new FormAttachment(0, margin);
fdlHttpLogin.left = new FormAttachment(0, 0);
fdlHttpLogin.right = new FormAttachment(middle, -margin);
wlHttpLogin.setLayoutData(fdlHttpLogin);
wHttpLogin = new TextVar(transMeta, gHttpAuth, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wHttpLogin.addModifyListener(lsMod);
wHttpLogin.setToolTipText(BaseMessages.getString(PKG, "HTTPPOSTDialog.HttpLogin.Tooltip"));
props.setLook(wHttpLogin);
FormData fdHttpLogin = new FormData();
fdHttpLogin.top = new FormAttachment(0, margin);
fdHttpLogin.left = new FormAttachment(middle, 0);
fdHttpLogin.right = new FormAttachment(100, 0);
wHttpLogin.setLayoutData(fdHttpLogin);
// HTTP Password
wlHttpPassword = new Label(gHttpAuth, SWT.RIGHT);
wlHttpPassword.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.HttpPassword.Label"));
props.setLook(wlHttpPassword);
FormData fdlHttpPassword = new FormData();
fdlHttpPassword.top = new FormAttachment(wHttpLogin, margin);
fdlHttpPassword.left = new FormAttachment(0, 0);
fdlHttpPassword.right = new FormAttachment(middle, -margin);
wlHttpPassword.setLayoutData(fdlHttpPassword);
wHttpPassword = new PasswordTextVar(transMeta, gHttpAuth, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wHttpPassword.addModifyListener(lsMod);
wHttpPassword.setToolTipText(BaseMessages.getString(PKG, "HTTPPOSTDialog.HttpPassword.Tooltip"));
props.setLook(wHttpPassword);
FormData fdHttpPassword = new FormData();
fdHttpPassword.top = new FormAttachment(wHttpLogin, margin);
fdHttpPassword.left = new FormAttachment(middle, 0);
fdHttpPassword.right = new FormAttachment(100, 0);
wHttpPassword.setLayoutData(fdHttpPassword);
FormData fdHttpAuth = new FormData();
fdHttpAuth.left = new FormAttachment(0, 0);
fdHttpAuth.right = new FormAttachment(100, 0);
fdHttpAuth.top = new FormAttachment(gOutputFields, margin);
gHttpAuth.setLayoutData(fdHttpAuth);
// END HTTP AUTH GROUP
// ////////////////////////
// ////////////////////////
// START PROXY GROUP
Group gProxy = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gProxy.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ProxyGroup.Label"));
FormLayout proxyLayout = new FormLayout();
proxyLayout.marginWidth = 3;
proxyLayout.marginHeight = 3;
gProxy.setLayout(proxyLayout);
props.setLook(gProxy);
// HTTP Login
wlProxyHost = new Label(gProxy, SWT.RIGHT);
wlProxyHost.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ProxyHost.Label"));
props.setLook(wlProxyHost);
FormData fdlProxyHost = new FormData();
fdlProxyHost.top = new FormAttachment(0, margin);
fdlProxyHost.left = new FormAttachment(0, 0);
fdlProxyHost.right = new FormAttachment(middle, -margin);
wlProxyHost.setLayoutData(fdlProxyHost);
wProxyHost = new TextVar(transMeta, gProxy, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProxyHost.addModifyListener(lsMod);
wProxyHost.setToolTipText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ProxyHost.Tooltip"));
props.setLook(wProxyHost);
FormData fdProxyHost = new FormData();
fdProxyHost.top = new FormAttachment(0, margin);
fdProxyHost.left = new FormAttachment(middle, 0);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// HTTP Password
wlProxyPort = new Label(gProxy, SWT.RIGHT);
wlProxyPort.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ProxyPort.Label"));
props.setLook(wlProxyPort);
FormData fdlProxyPort = new FormData();
fdlProxyPort.top = new FormAttachment(wProxyHost, margin);
fdlProxyPort.left = new FormAttachment(0, 0);
fdlProxyPort.right = new FormAttachment(middle, -margin);
wlProxyPort.setLayoutData(fdlProxyPort);
wProxyPort = new TextVar(transMeta, gProxy, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProxyPort.addModifyListener(lsMod);
wProxyPort.setToolTipText(BaseMessages.getString(PKG, "HTTPPOSTDialog.ProxyPort.Tooltip"));
props.setLook(wProxyPort);
FormData fdProxyPort = new FormData();
fdProxyPort.top = new FormAttachment(wProxyHost, margin);
fdProxyPort.left = new FormAttachment(middle, 0);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
FormData fdProxy = new FormData();
fdProxy.left = new FormAttachment(0, 0);
fdProxy.right = new FormAttachment(100, 0);
fdProxy.top = new FormAttachment(gHttpAuth, margin);
gProxy.setLayoutData(fdProxy);
// END HTTP AUTH GROUP
// ////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wStepname, margin);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// Additional tab...
//
wAdditionalTab = new CTabItem(wTabFolder, SWT.NONE);
wAdditionalTab.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.FieldsTab.Title"));
FormLayout addLayout = new FormLayout();
addLayout.marginWidth = Const.FORM_MARGIN;
addLayout.marginHeight = Const.FORM_MARGIN;
wAdditionalComp = new Composite(wTabFolder, SWT.NONE);
wAdditionalComp.setLayout(addLayout);
props.setLook(wAdditionalComp);
wlFields = new Label(wAdditionalComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.Parameters.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(gProxy, margin);
wlFields.setLayoutData(fdlFields);
final int FieldsRows = input.getArgumentField().length;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "HTTPPOSTDialog.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "HTTPPOSTDialog.ColumnInfo.Parameter"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "HTTPPOSTDialog.ColumnInfo.Header"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO) };
colinf[1].setUsingVariables(true);
wFields = new TableView(transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
wGetBodyParam = new Button(wAdditionalComp, SWT.PUSH);
wGetBodyParam.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.GetFields.Button"));
fdGetBodyParam = new FormData();
fdGetBodyParam.top = new FormAttachment(wlFields, margin);
fdGetBodyParam.right = new FormAttachment(100, 0);
wGetBodyParam.setLayoutData(fdGetBodyParam);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(wGetBodyParam, -margin);
fdFields.bottom = new FormAttachment(wlFields, 200);
wFields.setLayoutData(fdFields);
wlQuery = new Label(wAdditionalComp, SWT.NONE);
wlQuery.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.QueryParameters.Label"));
props.setLook(wlQuery);
fdlQuery = new FormData();
fdlQuery.left = new FormAttachment(0, 0);
fdlQuery.top = new FormAttachment(wFields, margin);
wlQuery.setLayoutData(fdlQuery);
final int QueryRows = input.getQueryParameter().length;
colinfquery = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "HTTPPOSTDialog.ColumnInfo.QueryName"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "HTTPPOSTDialog.ColumnInfo.QueryParameter"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinfquery[1].setUsingVariables(true);
wQuery = new TableView(transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinfquery, QueryRows, lsMod, props);
wGet = new Button(wAdditionalComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.GetFields.Button"));
fdGet = new FormData();
fdGet.top = new FormAttachment(wlQuery, margin);
fdGet.right = new FormAttachment(100, 0);
wGet.setLayoutData(fdGet);
fdQuery = new FormData();
fdQuery.left = new FormAttachment(0, 0);
fdQuery.top = new FormAttachment(wlQuery, margin);
fdQuery.right = new FormAttachment(wGet, -margin);
fdQuery.bottom = new FormAttachment(100, -margin);
wQuery.setLayoutData(fdQuery);
//
// Search the fields in the background
//
final Runnable runnable = new Runnable() {
public void run() {
StepMeta stepMeta = transMeta.findStep(stepname);
if (stepMeta != null) {
try {
RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
}
setComboBoxes();
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
fdAdditionalComp = new FormData();
fdAdditionalComp.left = new FormAttachment(0, 0);
fdAdditionalComp.top = new FormAttachment(wStepname, margin);
fdAdditionalComp.right = new FormAttachment(100, 0);
fdAdditionalComp.bottom = new FormAttachment(100, 0);
wAdditionalComp.setLayoutData(fdAdditionalComp);
wAdditionalComp.layout();
wAdditionalTab.setControl(wAdditionalComp);
// ////// END of Additional Tab
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"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
getQueryFields();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsGetBodyParam = new Listener() {
public void handleEvent(Event e) {
get();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wCancel.addListener(SWT.Selection, lsCancel);
wGetBodyParam.addListener(SWT.Selection, lsGetBodyParam);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wUrl.addSelectionListener(lsDef);
wResult.addSelectionListener(lsDef);
wResultCode.addSelectionListener(lsDef);
wResponseTime.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
lsResize = new Listener() {
public void handleEvent(Event event) {
Point size = shell.getSize();
wFields.setSize(size.x - 10, size.y - 50);
wFields.table.setSize(size.x - 10, size.y - 50);
wFields.redraw();
}
};
shell.addListener(SWT.Resize, lsResize);
// Set the shell size, based upon previous time...
setSize();
wTabFolder.setSelection(0);
getData();
activeUrlInfield();
input.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 ExcelWriterStepDialog 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);
SelectionAdapter lsSel = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
};
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, "ExcelWriterDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -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);
ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);
wTabFolder = new CTabFolder(sc, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF FILE TAB///
// /
wFileTab = new CTabItem(wTabFolder, SWT.NONE);
wFileTab.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.FileTab.TabTitle"));
Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFileComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wFileComp.setLayout(fileLayout);
Group fileGroup = new Group(wFileComp, SWT.SHADOW_NONE);
props.setLook(fileGroup);
fileGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.fileGroup.Label"));
FormLayout fileGroupgroupLayout = new FormLayout();
fileGroupgroupLayout.marginWidth = 10;
fileGroupgroupLayout.marginHeight = 10;
fileGroup.setLayout(fileGroupgroupLayout);
// Filename line
wlFilename = new Label(fileGroup, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(0, margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wbFilename = new Button(fileGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(0, 0);
wbFilename.setLayoutData(fdbFilename);
wFilename = new TextVar(transMeta, fileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.addModifyListener(lsMod);
wFilename.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Filename.Tooltip"));
fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.top = new FormAttachment(0, margin);
fdFilename.right = new FormAttachment(wbFilename, -margin);
wFilename.setLayoutData(fdFilename);
// Extension line
wlExtension = new Label(fileGroup, SWT.RIGHT);
wlExtension.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
props.setLook(wlExtension);
fdlExtension = new FormData();
fdlExtension.left = new FormAttachment(0, 0);
fdlExtension.top = new FormAttachment(wFilename, margin);
fdlExtension.right = new FormAttachment(middle, -margin);
wlExtension.setLayoutData(fdlExtension);
wExtension = new CCombo(fileGroup, SWT.LEFT | SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
String xlsLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLS.Label");
String xlsxLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLSX.Label");
wExtension.setItems(new String[] { xlsLabel, xlsxLabel });
wExtension.setData(xlsLabel, "xls");
wExtension.setData(xlsxLabel, "xlsx");
props.setLook(wExtension);
wExtension.addModifyListener(lsMod);
wExtension.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enableExtension();
}
});
wExtension.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Extension.Tooltip"));
fdExtension = new FormData();
fdExtension.left = new FormAttachment(middle, 0);
fdExtension.top = new FormAttachment(wFilename, margin);
fdExtension.right = new FormAttachment(wbFilename, -margin);
wExtension.setLayoutData(fdExtension);
wlStreamData = new Label(fileGroup, SWT.RIGHT);
wlStreamData.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.StreamData.Label"));
props.setLook(wlStreamData);
fdlStreamData = new FormData();
fdlStreamData.left = new FormAttachment(0, 0);
fdlStreamData.top = new FormAttachment(wExtension, margin);
fdlStreamData.right = new FormAttachment(middle, -margin);
wlStreamData.setLayoutData(fdlStreamData);
wStreamData = new Button(fileGroup, SWT.CHECK);
props.setLook(wStreamData);
fdStreamData = new FormData();
fdStreamData.left = new FormAttachment(middle, 0);
fdStreamData.top = new FormAttachment(wExtension, margin);
fdStreamData.right = new FormAttachment(100, 0);
wStreamData.setLayoutData(fdStreamData);
wStreamData.addSelectionListener(lsSel);
// split every x rows
wlSplitEvery = new Label(fileGroup, SWT.RIGHT);
wlSplitEvery.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.SplitEvery.Label"));
props.setLook(wlSplitEvery);
fdlSplitEvery = new FormData();
fdlSplitEvery.left = new FormAttachment(0, 0);
fdlSplitEvery.top = new FormAttachment(wStreamData, margin);
fdlSplitEvery.right = new FormAttachment(middle, -margin);
wlSplitEvery.setLayoutData(fdlSplitEvery);
wSplitEvery = new Text(fileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSplitEvery);
wSplitEvery.addModifyListener(lsMod);
wSplitEvery.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.SplitEvery.Tooltip"));
fdSplitEvery = new FormData();
fdSplitEvery.left = new FormAttachment(middle, 0);
fdSplitEvery.top = new FormAttachment(wStreamData, margin);
fdSplitEvery.right = new FormAttachment(100, 0);
wSplitEvery.setLayoutData(fdSplitEvery);
// Create multi-part file?
wlAddStepnr = new Label(fileGroup, SWT.RIGHT);
wlAddStepnr.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddStepnr.Label"));
props.setLook(wlAddStepnr);
fdlAddStepnr = new FormData();
fdlAddStepnr.left = new FormAttachment(0, 0);
fdlAddStepnr.top = new FormAttachment(wSplitEvery, margin);
fdlAddStepnr.right = new FormAttachment(middle, -margin);
wlAddStepnr.setLayoutData(fdlAddStepnr);
wAddStepnr = new Button(fileGroup, SWT.CHECK);
props.setLook(wAddStepnr);
fdAddStepnr = new FormData();
fdAddStepnr.left = new FormAttachment(middle, 0);
fdAddStepnr.top = new FormAttachment(wSplitEvery, margin);
fdAddStepnr.right = new FormAttachment(100, 0);
wAddStepnr.setLayoutData(fdAddStepnr);
wAddStepnr.addSelectionListener(lsSel);
// Create multi-part file?
wlAddDate = new Label(fileGroup, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wAddStepnr, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(fileGroup, SWT.CHECK);
props.setLook(wAddDate);
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, 0);
fdAddDate.top = new FormAttachment(wAddStepnr, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(lsSel);
// Create multi-part file?
wlAddTime = new Label(fileGroup, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddTime.Label"));
props.setLook(wlAddTime);
fdlAddTime = new FormData();
fdlAddTime.left = new FormAttachment(0, 0);
fdlAddTime.top = new FormAttachment(wAddDate, margin);
fdlAddTime.right = new FormAttachment(middle, -margin);
wlAddTime.setLayoutData(fdlAddTime);
wAddTime = new Button(fileGroup, SWT.CHECK);
props.setLook(wAddTime);
fdAddTime = new FormData();
fdAddTime.left = new FormAttachment(middle, 0);
fdAddTime.top = new FormAttachment(wAddDate, margin);
fdAddTime.right = new FormAttachment(100, 0);
wAddTime.setLayoutData(fdAddTime);
wAddTime.addSelectionListener(lsSel);
// Specify date time format?
wlSpecifyFormat = new Label(fileGroup, SWT.RIGHT);
wlSpecifyFormat.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.SpecifyFormat.Label"));
props.setLook(wlSpecifyFormat);
fdlSpecifyFormat = new FormData();
fdlSpecifyFormat.left = new FormAttachment(0, 0);
fdlSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdlSpecifyFormat.right = new FormAttachment(middle, -margin);
wlSpecifyFormat.setLayoutData(fdlSpecifyFormat);
wSpecifyFormat = new Button(fileGroup, SWT.CHECK);
props.setLook(wSpecifyFormat);
wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.SpecifyFormat.Tooltip"));
fdSpecifyFormat = new FormData();
fdSpecifyFormat.left = new FormAttachment(middle, 0);
fdSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdSpecifyFormat.right = new FormAttachment(100, 0);
wSpecifyFormat.setLayoutData(fdSpecifyFormat);
wSpecifyFormat.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setDateTimeFormat();
}
});
// Prepare a list of possible DateTimeFormats...
String[] dats = Const.getDateFormats();
// DateTimeFormat
wlDateTimeFormat = new Label(fileGroup, SWT.RIGHT);
wlDateTimeFormat.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.DateTimeFormat.Label"));
props.setLook(wlDateTimeFormat);
fdlDateTimeFormat = new FormData();
fdlDateTimeFormat.left = new FormAttachment(0, 0);
fdlDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdlDateTimeFormat.right = new FormAttachment(middle, -margin);
wlDateTimeFormat.setLayoutData(fdlDateTimeFormat);
wDateTimeFormat = new CCombo(fileGroup, SWT.BORDER | SWT.READ_ONLY);
wDateTimeFormat.setEditable(true);
props.setLook(wDateTimeFormat);
wDateTimeFormat.addModifyListener(lsMod);
fdDateTimeFormat = new FormData();
fdDateTimeFormat.left = new FormAttachment(middle, 0);
fdDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdDateTimeFormat.right = new FormAttachment(100, 0);
wDateTimeFormat.setLayoutData(fdDateTimeFormat);
for (int x = 0; x < dats.length; x++) {
wDateTimeFormat.add(dats[x]);
}
wbShowFiles = new Button(fileGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbShowFiles);
wbShowFiles.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ShowFiles.Button"));
fdbShowFiles = new FormData();
fdbShowFiles.left = new FormAttachment(middle, 0);
fdbShowFiles.top = new FormAttachment(wDateTimeFormat, margin * 3);
wbShowFiles.setLayoutData(fdbShowFiles);
wbShowFiles.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ExcelWriterStepMeta tfoi = new ExcelWriterStepMeta();
getInfo(tfoi);
String[] files = tfoi.getFiles(transMeta);
if (files != null && files.length > 0) {
EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "ExcelWriterDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "ExcelWriterDialog.SelectOutputFiles.DialogMessage"));
esd.setViewOnly();
esd.open();
} else {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "ExcelWriterDialog.NoFilesFound.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
mb.open();
}
}
});
// If output file exists line
wlIfFileExists = new Label(fileGroup, SWT.RIGHT);
wlIfFileExists.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.IfFileExists.Label"));
props.setLook(wlIfFileExists);
fdlIfFileExists = new FormData();
fdlIfFileExists.left = new FormAttachment(0, 0);
fdlIfFileExists.top = new FormAttachment(wbShowFiles, 2 * margin, margin);
fdlIfFileExists.right = new FormAttachment(middle, -margin);
wlIfFileExists.setLayoutData(fdlIfFileExists);
// wIfFileExists=new TextVar(transMeta,wFileComp, SWT.SINGLE | SWT.LEFT |
// SWT.BORDER);
wIfFileExists = new CCombo(fileGroup, SWT.LEFT | SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
String createNewLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.IfFileExists.CreateNew.Label");
String reuseLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.IfFileExists.Reuse.Label");
wIfFileExists.setItems(new String[] { createNewLabel, reuseLabel });
wIfFileExists.setData(createNewLabel, ExcelWriterStepMeta.IF_FILE_EXISTS_CREATE_NEW);
wIfFileExists.setData(reuseLabel, ExcelWriterStepMeta.IF_FILE_EXISTS_REUSE);
props.setLook(wIfFileExists);
wIfFileExists.addModifyListener(lsMod);
wIfFileExists.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.IfFileExists.Tooltip"));
FormData fdIfFileExists = new FormData();
fdIfFileExists.left = new FormAttachment(middle, 0);
fdIfFileExists.top = new FormAttachment(wbShowFiles, 2 * margin, margin);
fdIfFileExists.right = new FormAttachment(100, 0);
wIfFileExists.setLayoutData(fdIfFileExists);
// Open new File at Init
wlDoNotOpenNewFileInit = new Label(fileGroup, SWT.RIGHT);
wlDoNotOpenNewFileInit.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.DoNotOpenNewFileInit.Label"));
props.setLook(wlDoNotOpenNewFileInit);
fdlDoNotOpenNewFileInit = new FormData();
fdlDoNotOpenNewFileInit.left = new FormAttachment(0, 0);
fdlDoNotOpenNewFileInit.top = new FormAttachment(wIfFileExists, 2 * margin, margin);
fdlDoNotOpenNewFileInit.right = new FormAttachment(middle, -margin);
wlDoNotOpenNewFileInit.setLayoutData(fdlDoNotOpenNewFileInit);
wDoNotOpenNewFileInit = new Button(fileGroup, SWT.CHECK);
wDoNotOpenNewFileInit.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.DoNotOpenNewFileInit.Tooltip"));
props.setLook(wDoNotOpenNewFileInit);
fdDoNotOpenNewFileInit = new FormData();
fdDoNotOpenNewFileInit.left = new FormAttachment(middle, 0);
fdDoNotOpenNewFileInit.top = new FormAttachment(wIfFileExists, 2 * margin, margin);
fdDoNotOpenNewFileInit.right = new FormAttachment(100, 0);
wDoNotOpenNewFileInit.setLayoutData(fdDoNotOpenNewFileInit);
wDoNotOpenNewFileInit.addSelectionListener(lsSel);
// Add File to the result files name
wlAddToResult = new Label(fileGroup, SWT.RIGHT);
wlAddToResult.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddFileToResult.Label"));
props.setLook(wlAddToResult);
fdlAddToResult = new FormData();
fdlAddToResult.left = new FormAttachment(0, 0);
fdlAddToResult.top = new FormAttachment(wDoNotOpenNewFileInit);
fdlAddToResult.right = new FormAttachment(middle, -margin);
wlAddToResult.setLayoutData(fdlAddToResult);
wAddToResult = new Button(fileGroup, SWT.CHECK);
wAddToResult.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddFileToResult.Tooltip"));
props.setLook(wAddToResult);
fdAddToResult = new FormData();
fdAddToResult.left = new FormAttachment(middle, 0);
fdAddToResult.top = new FormAttachment(wDoNotOpenNewFileInit);
fdAddToResult.right = new FormAttachment(100, 0);
wAddToResult.setLayoutData(fdAddToResult);
wAddToResult.addSelectionListener(lsSel);
FormData fsFileGroup = new FormData();
fsFileGroup.left = new FormAttachment(0, margin);
fsFileGroup.top = new FormAttachment(0, margin);
fsFileGroup.right = new FormAttachment(100, -margin);
fileGroup.setLayoutData(fsFileGroup);
// END OF FILE GROUP
Group sheetGroup = new Group(wFileComp, SWT.SHADOW_NONE);
props.setLook(sheetGroup);
sheetGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.sheetGroup.Label"));
FormLayout sheetGroupLayout = new FormLayout();
sheetGroupLayout.marginWidth = 10;
sheetGroupLayout.marginHeight = 10;
sheetGroup.setLayout(sheetGroupLayout);
// Sheet name line
wlSheetname = new Label(sheetGroup, SWT.RIGHT);
wlSheetname.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Sheetname.Label"));
props.setLook(wlSheetname);
fdlSheetname = new FormData();
fdlSheetname.left = new FormAttachment(0, 0);
fdlSheetname.top = new FormAttachment(0, margin);
fdlSheetname.right = new FormAttachment(middle, -margin);
wlSheetname.setLayoutData(fdlSheetname);
wSheetname = new TextVar(transMeta, sheetGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wSheetname.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Sheetname.Tooltip"));
props.setLook(wSheetname);
wSheetname.addModifyListener(lsMod);
fdSheetname = new FormData();
fdSheetname.left = new FormAttachment(middle, 0);
fdSheetname.top = new FormAttachment(0, margin);
fdSheetname.right = new FormAttachment(100, 0);
wSheetname.setLayoutData(fdSheetname);
// Make sheet active Sheet Line
Label wlMakeActiveSheet = new Label(sheetGroup, SWT.RIGHT);
wlMakeActiveSheet.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.MakeActiveSheet.Label"));
props.setLook(wlMakeActiveSheet);
FormData fdlMakeActiveSheet = new FormData();
fdlMakeActiveSheet.left = new FormAttachment(0, 0);
fdlMakeActiveSheet.top = new FormAttachment(wSheetname, margin);
fdlMakeActiveSheet.right = new FormAttachment(middle, -margin);
wlMakeActiveSheet.setLayoutData(fdlMakeActiveSheet);
wMakeActiveSheet = new Button(sheetGroup, SWT.CHECK);
wMakeActiveSheet.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.MakeActiveSheet.Tooltip"));
props.setLook(wMakeActiveSheet);
FormData fdMakeActiveSheet = new FormData();
fdMakeActiveSheet.left = new FormAttachment(middle, 0);
fdMakeActiveSheet.top = new FormAttachment(wSheetname, margin);
fdMakeActiveSheet.right = new FormAttachment(100, 0);
wMakeActiveSheet.setLayoutData(fdMakeActiveSheet);
wMakeActiveSheet.addSelectionListener(lsSel);
// If output sheet exists line
wlIfSheetExists = new Label(sheetGroup, SWT.RIGHT);
wlIfSheetExists.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.IfSheetExists.Label"));
props.setLook(wlIfSheetExists);
FormData fdlIfSheetExists = new FormData();
fdlIfSheetExists.left = new FormAttachment(0, 0);
fdlIfSheetExists.top = new FormAttachment(wMakeActiveSheet, margin);
fdlIfSheetExists.right = new FormAttachment(middle, -margin);
wlIfSheetExists.setLayoutData(fdlIfSheetExists);
wIfSheetExists = new CCombo(sheetGroup, SWT.LEFT | SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
String replaceSheetNewLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.IfSheetExists.CreateNew.Label");
String reuseSheetLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.IfSheetExists.Reuse.Label");
wIfSheetExists.setItems(new String[] { replaceSheetNewLabel, reuseSheetLabel });
wIfSheetExists.setData(replaceSheetNewLabel, ExcelWriterStepMeta.IF_SHEET_EXISTS_CREATE_NEW);
wIfSheetExists.setData(reuseSheetLabel, ExcelWriterStepMeta.IF_SHEET_EXISTS_REUSE);
props.setLook(wIfSheetExists);
wIfSheetExists.addModifyListener(lsMod);
wIfSheetExists.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.IfSheetExists.Tooltip"));
FormData fdIfSheetExists = new FormData();
fdIfSheetExists.left = new FormAttachment(middle, 0);
fdIfSheetExists.top = new FormAttachment(wMakeActiveSheet, margin);
fdIfSheetExists.right = new FormAttachment(100, 0);
wIfSheetExists.setLayoutData(fdIfSheetExists);
// Protect Sheet?
wlProtectSheet = new Label(sheetGroup, SWT.RIGHT);
wlProtectSheet.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectSheet.Label"));
props.setLook(wlProtectSheet);
fdlProtectSheet = new FormData();
fdlProtectSheet.left = new FormAttachment(0, 0);
fdlProtectSheet.top = new FormAttachment(wIfSheetExists, margin);
fdlProtectSheet.right = new FormAttachment(middle, -margin);
wlProtectSheet.setLayoutData(fdlProtectSheet);
wProtectSheet = new Button(sheetGroup, SWT.CHECK);
wProtectSheet.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectSheet.Tooltip"));
props.setLook(wProtectSheet);
fdProtectSheet = new FormData();
fdProtectSheet.left = new FormAttachment(middle, 0);
fdProtectSheet.top = new FormAttachment(wIfSheetExists, margin);
fdProtectSheet.right = new FormAttachment(100, 0);
wProtectSheet.setLayoutData(fdProtectSheet);
wProtectSheet.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enablePassword();
}
});
// Protected by line
Label wlProtectedBy = new Label(sheetGroup, SWT.RIGHT);
wlProtectedBy.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectedBy.Label"));
props.setLook(wlProtectedBy);
FormData fdlProtectedBy = new FormData();
fdlProtectedBy.left = new FormAttachment(0, 0);
fdlProtectedBy.top = new FormAttachment(wProtectSheet, margin);
fdlProtectedBy.right = new FormAttachment(middle, -margin);
wlProtectedBy.setLayoutData(fdlProtectedBy);
wProtectedBy = new TextVar(transMeta, sheetGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProtectedBy.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectedBy.Tooltip"));
props.setLook(wProtectedBy);
wProtectedBy.addModifyListener(lsMod);
FormData fdProtectedBy = new FormData();
fdProtectedBy.left = new FormAttachment(middle, 0);
fdProtectedBy.top = new FormAttachment(wProtectSheet, margin);
fdProtectedBy.right = new FormAttachment(100, 0);
wProtectedBy.setLayoutData(fdProtectedBy);
// Password line
wlPassword = new Label(sheetGroup, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wProtectedBy, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(transMeta, sheetGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wPassword.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Password.Tooltip"));
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wProtectedBy, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
FormData fsSheetGroup = new FormData();
fsSheetGroup.left = new FormAttachment(0, margin);
fsSheetGroup.top = new FormAttachment(fileGroup, margin);
fsSheetGroup.right = new FormAttachment(100, -margin);
sheetGroup.setLayoutData(fsSheetGroup);
// END OF SHEET GROUP
// ///////////////////////////////
// START OF Template Group GROUP //
// ///////////////////////////////
wTemplateGroup = new Group(wFileComp, SWT.SHADOW_NONE);
props.setLook(wTemplateGroup);
wTemplateGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateGroup.Label"));
FormLayout TemplateGroupgroupLayout = new FormLayout();
TemplateGroupgroupLayout.marginWidth = 10;
TemplateGroupgroupLayout.marginHeight = 10;
wTemplateGroup.setLayout(TemplateGroupgroupLayout);
// Use template
wlTemplate = new Label(wTemplateGroup, SWT.RIGHT);
wlTemplate.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Template.Label"));
props.setLook(wlTemplate);
fdlTemplate = new FormData();
fdlTemplate.left = new FormAttachment(0, 0);
fdlTemplate.top = new FormAttachment(0, margin);
fdlTemplate.right = new FormAttachment(middle, -margin);
wlTemplate.setLayoutData(fdlTemplate);
wTemplate = new Button(wTemplateGroup, SWT.CHECK);
props.setLook(wTemplate);
fdTemplate = new FormData();
fdTemplate.left = new FormAttachment(middle, 0);
fdTemplate.top = new FormAttachment(0, margin);
fdTemplate.right = new FormAttachment(100, 0);
wTemplate.setLayoutData(fdTemplate);
wTemplate.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enableTemplate();
}
});
wTemplate.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Template.Tooltip"));
// TemplateFilename line
wlTemplateFilename = new Label(wTemplateGroup, SWT.RIGHT);
wlTemplateFilename.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateFilename.Label"));
props.setLook(wlTemplateFilename);
fdlTemplateFilename = new FormData();
fdlTemplateFilename.left = new FormAttachment(0, 0);
fdlTemplateFilename.top = new FormAttachment(wTemplate, margin);
fdlTemplateFilename.right = new FormAttachment(middle, -margin);
wlTemplateFilename.setLayoutData(fdlTemplateFilename);
wbTemplateFilename = new Button(wTemplateGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbTemplateFilename);
wbTemplateFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbTemplateFilename = new FormData();
fdbTemplateFilename.right = new FormAttachment(100, 0);
fdbTemplateFilename.top = new FormAttachment(wTemplate, 0);
wbTemplateFilename.setLayoutData(fdbTemplateFilename);
wTemplateFilename = new TextVar(transMeta, wTemplateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTemplateFilename);
wTemplateFilename.addModifyListener(lsMod);
fdTemplateFilename = new FormData();
fdTemplateFilename.left = new FormAttachment(middle, 0);
fdTemplateFilename.top = new FormAttachment(wTemplate, margin);
fdTemplateFilename.right = new FormAttachment(wbTemplateFilename, -margin);
wTemplateFilename.setLayoutData(fdTemplateFilename);
// Use template sheet
wlTemplateSheet = new Label(wTemplateGroup, SWT.RIGHT);
wlTemplateSheet.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheet.Label"));
props.setLook(wlTemplateSheet);
FormData fdlTemplateSheet = new FormData();
fdlTemplateSheet.left = new FormAttachment(0, 0);
fdlTemplateSheet.top = new FormAttachment(wTemplateFilename, margin);
fdlTemplateSheet.right = new FormAttachment(middle, -margin);
wlTemplateSheet.setLayoutData(fdlTemplateSheet);
wTemplateSheet = new Button(wTemplateGroup, SWT.CHECK);
wTemplateSheet.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheet.Tooltip"));
props.setLook(wTemplateSheet);
FormData fdTemplateSheet = new FormData();
fdTemplateSheet.left = new FormAttachment(middle, 0);
fdTemplateSheet.top = new FormAttachment(wTemplateFilename, margin);
fdTemplateSheet.right = new FormAttachment(100, 0);
wTemplateSheet.setLayoutData(fdTemplateSheet);
wTemplateSheet.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enableTemplateSheet();
}
});
// TemplateSheetname line
wlTemplateSheetname = new Label(wTemplateGroup, SWT.RIGHT);
wlTemplateSheetname.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheetname.Label"));
props.setLook(wlTemplateSheetname);
FormData fdlTemplateSheetname = new FormData();
fdlTemplateSheetname.left = new FormAttachment(0, 0);
fdlTemplateSheetname.top = new FormAttachment(wTemplateSheet, margin);
fdlTemplateSheetname.right = new FormAttachment(middle, -margin);
wlTemplateSheetname.setLayoutData(fdlTemplateSheetname);
wTemplateSheetname = new TextVar(transMeta, wTemplateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTemplateSheetname);
wTemplateSheetname.addModifyListener(lsMod);
FormData fdTemplateSheetname = new FormData();
fdTemplateSheetname.left = new FormAttachment(middle, 0);
fdTemplateSheetname.top = new FormAttachment(wTemplateSheet, margin);
fdTemplateSheetname.right = new FormAttachment(wbTemplateFilename, -margin);
wTemplateSheetname.setLayoutData(fdTemplateSheetname);
// Hide Template Sheet
wlTemplateSheetHide = new Label(wTemplateGroup, SWT.RIGHT);
wlTemplateSheetHide.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheetHide.Label"));
props.setLook(wlTemplateSheetHide);
FormData fdlTemplateSheetHide = new FormData();
fdlTemplateSheetHide.left = new FormAttachment(0, 0);
fdlTemplateSheetHide.top = new FormAttachment(wTemplateSheetname, margin);
fdlTemplateSheetHide.right = new FormAttachment(middle, -margin);
wlTemplateSheetHide.setLayoutData(fdlTemplateSheetHide);
wTemplateSheetHide = new Button(wTemplateGroup, SWT.CHECK);
wTemplateSheetHide.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheetHide.Tooltip"));
props.setLook(wTemplateSheetHide);
FormData fdTemplateSheetHide = new FormData();
fdTemplateSheetHide.left = new FormAttachment(middle, 0);
fdTemplateSheetHide.top = new FormAttachment(wTemplateSheetname, margin);
fdTemplateSheetHide.right = new FormAttachment(100, 0);
wTemplateSheetHide.setLayoutData(fdTemplateSheetHide);
wTemplateSheetHide.addSelectionListener(lsSel);
fdTemplateGroup = new FormData();
fdTemplateGroup.left = new FormAttachment(0, margin);
fdTemplateGroup.top = new FormAttachment(sheetGroup, margin);
fdTemplateGroup.right = new FormAttachment(100, -margin);
wTemplateGroup.setLayoutData(fdTemplateGroup);
// ///////////////////////////////////////////////////////////
// / END OF Write to existing Group GROUP
// ///////////////////////////////////////////////////////////
fdFileComp = new FormData();
fdFileComp.left = new FormAttachment(0, 0);
fdFileComp.top = new FormAttachment(0, 0);
fdFileComp.right = new FormAttachment(100, 0);
fdFileComp.bottom = new FormAttachment(100, 0);
wFileComp.setLayoutData(fdFileComp);
wFileComp.layout();
wFileTab.setControl(wFileComp);
// ///////////////////////////////////////////////////////////
// / END OF FILE TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ContentTab.TabTitle"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
Group wContentGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wContentGroup);
wContentGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ContentGroup.Label"));
FormLayout ContentGroupgroupLayout = new FormLayout();
ContentGroupgroupLayout.marginWidth = 10;
ContentGroupgroupLayout.marginHeight = 10;
wContentGroup.setLayout(ContentGroupgroupLayout);
// starting cell
wlStartingCell = new Label(wContentGroup, SWT.RIGHT);
wlStartingCell.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.StartingCell.Label"));
props.setLook(wlStartingCell);
FormData fdlStartingCell = new FormData();
fdlStartingCell.left = new FormAttachment(0, 0);
fdlStartingCell.top = new FormAttachment(wIfSheetExists, margin);
fdlStartingCell.right = new FormAttachment(middle, -margin);
wlStartingCell.setLayoutData(fdlStartingCell);
wStartingCell = new TextVar(transMeta, wContentGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStartingCell.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.StartingCell.Tooltip"));
props.setLook(wStartingCell);
wStartingCell.addModifyListener(lsMod);
FormData fdStartingCell = new FormData();
fdStartingCell.left = new FormAttachment(middle, 0);
fdStartingCell.top = new FormAttachment(wIfSheetExists, margin);
fdStartingCell.right = new FormAttachment(100, 0);
wStartingCell.setLayoutData(fdStartingCell);
// row writing method line
wlRowWritingMethod = new Label(wContentGroup, SWT.RIGHT);
wlRowWritingMethod.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.RowWritingMethod.Label"));
props.setLook(wlRowWritingMethod);
FormData fdlRowWritingMethod = new FormData();
fdlRowWritingMethod.left = new FormAttachment(0, 0);
fdlRowWritingMethod.top = new FormAttachment(wStartingCell, margin);
fdlRowWritingMethod.right = new FormAttachment(middle, -margin);
wlRowWritingMethod.setLayoutData(fdlRowWritingMethod);
wRowWritingMethod = new CCombo(wContentGroup, SWT.LEFT | SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
String overwriteLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.RowWritingMethod.Overwrite.Label");
String pushDownLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.RowWritingMethod.PushDown.Label");
wRowWritingMethod.setItems(new String[] { overwriteLabel, pushDownLabel });
wRowWritingMethod.setData(overwriteLabel, ExcelWriterStepMeta.ROW_WRITE_OVERWRITE);
wRowWritingMethod.setData(pushDownLabel, ExcelWriterStepMeta.ROW_WRITE_PUSH_DOWN);
wRowWritingMethod.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.RowWritingMethod.Tooltip"));
props.setLook(wRowWritingMethod);
wRowWritingMethod.addModifyListener(lsMod);
// wRowWritingMethod.addSelectionListener(new SelectionAdapter() {
// public void widgetSelected(SelectionEvent e) {
// input.setChanged();
// EnableRowWritingMethod();
// }
// });
FormData fdRowWritingMethod = new FormData();
fdRowWritingMethod.left = new FormAttachment(middle, 0);
fdRowWritingMethod.top = new FormAttachment(wStartingCell, margin);
fdRowWritingMethod.right = new FormAttachment(100, 0);
wRowWritingMethod.setLayoutData(fdRowWritingMethod);
wlHeader = new Label(wContentGroup, SWT.RIGHT);
wlHeader.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Header.Label"));
props.setLook(wlHeader);
fdlHeader = new FormData();
fdlHeader.left = new FormAttachment(0, 0);
fdlHeader.top = new FormAttachment(wRowWritingMethod, margin);
fdlHeader.right = new FormAttachment(middle, -margin);
wlHeader.setLayoutData(fdlHeader);
wHeader = new Button(wContentGroup, SWT.CHECK);
props.setLook(wHeader);
fdHeader = new FormData();
fdHeader.left = new FormAttachment(middle, 0);
fdHeader.top = new FormAttachment(wRowWritingMethod, margin);
fdHeader.right = new FormAttachment(100, 0);
wHeader.setLayoutData(fdHeader);
wHeader.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Header.Tooltip"));
wHeader.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enableHeader();
}
});
wlFooter = new Label(wContentGroup, SWT.RIGHT);
wlFooter.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Footer.Label"));
props.setLook(wlFooter);
fdlFooter = new FormData();
fdlFooter.left = new FormAttachment(0, 0);
fdlFooter.top = new FormAttachment(wHeader, margin);
fdlFooter.right = new FormAttachment(middle, -margin);
wlFooter.setLayoutData(fdlFooter);
wFooter = new Button(wContentGroup, SWT.CHECK);
props.setLook(wFooter);
fdFooter = new FormData();
fdFooter.left = new FormAttachment(middle, 0);
fdFooter.top = new FormAttachment(wHeader, margin);
fdFooter.right = new FormAttachment(100, 0);
wFooter.setLayoutData(fdFooter);
wFooter.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Footer.Tooltip"));
wFooter.addSelectionListener(lsSel);
// auto size columns?
wlAutoSize = new Label(wContentGroup, SWT.RIGHT);
wlAutoSize.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AutoSize.Label"));
props.setLook(wlAutoSize);
fdlAutoSize = new FormData();
fdlAutoSize.left = new FormAttachment(0, 0);
fdlAutoSize.top = new FormAttachment(wFooter, margin);
fdlAutoSize.right = new FormAttachment(middle, -margin);
wlAutoSize.setLayoutData(fdlAutoSize);
wAutoSize = new Button(wContentGroup, SWT.CHECK);
props.setLook(wAutoSize);
wAutoSize.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.AutoSize.Tooltip"));
fdAutoSize = new FormData();
fdAutoSize.left = new FormAttachment(middle, 0);
fdAutoSize.top = new FormAttachment(wFooter, margin);
fdAutoSize.right = new FormAttachment(100, 0);
wAutoSize.setLayoutData(fdAutoSize);
wAutoSize.addSelectionListener(lsSel);
// force formula recalculation?
wlForceFormulaRecalculation = new Label(wContentGroup, SWT.RIGHT);
wlForceFormulaRecalculation.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ForceFormulaRecalculation.Label"));
props.setLook(wlForceFormulaRecalculation);
fdlForceFormulaRecalculation = new FormData();
fdlForceFormulaRecalculation.left = new FormAttachment(0, 0);
fdlForceFormulaRecalculation.top = new FormAttachment(wAutoSize, margin);
fdlForceFormulaRecalculation.right = new FormAttachment(middle, -margin);
wlForceFormulaRecalculation.setLayoutData(fdlForceFormulaRecalculation);
wForceFormulaRecalculation = new Button(wContentGroup, SWT.CHECK);
props.setLook(wForceFormulaRecalculation);
wForceFormulaRecalculation.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.ForceFormulaRecalculation.Tooltip"));
fdForceFormulaRecalculation = new FormData();
fdForceFormulaRecalculation.left = new FormAttachment(middle, 0);
fdForceFormulaRecalculation.top = new FormAttachment(wAutoSize, margin);
fdForceFormulaRecalculation.right = new FormAttachment(100, 0);
wForceFormulaRecalculation.setLayoutData(fdForceFormulaRecalculation);
wForceFormulaRecalculation.addSelectionListener(lsSel);
// leave existing styles alone?
wlLeaveExistingStylesUnchanged = new Label(wContentGroup, SWT.RIGHT);
wlLeaveExistingStylesUnchanged.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.LeaveExistingStylesUnchanged.Label"));
props.setLook(wlLeaveExistingStylesUnchanged);
fdlLeaveExistingStylesUnchanged = new FormData();
fdlLeaveExistingStylesUnchanged.left = new FormAttachment(0, 0);
fdlLeaveExistingStylesUnchanged.top = new FormAttachment(wForceFormulaRecalculation, margin);
fdlLeaveExistingStylesUnchanged.right = new FormAttachment(middle, -margin);
wlLeaveExistingStylesUnchanged.setLayoutData(fdlLeaveExistingStylesUnchanged);
wLeaveExistingStylesUnchanged = new Button(wContentGroup, SWT.CHECK);
props.setLook(wLeaveExistingStylesUnchanged);
wLeaveExistingStylesUnchanged.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.LeaveExistingStylesUnchanged.Tooltip"));
fdLeaveExistingStylesUnchanged = new FormData();
fdLeaveExistingStylesUnchanged.left = new FormAttachment(middle, 0);
fdLeaveExistingStylesUnchanged.top = new FormAttachment(wForceFormulaRecalculation, margin);
fdLeaveExistingStylesUnchanged.right = new FormAttachment(100, 0);
wLeaveExistingStylesUnchanged.setLayoutData(fdLeaveExistingStylesUnchanged);
wLeaveExistingStylesUnchanged.addSelectionListener(lsSel);
FormData fdContentGroup = new FormData();
fdContentGroup.left = new FormAttachment(0, margin);
fdContentGroup.top = new FormAttachment(0, margin);
fdContentGroup.right = new FormAttachment(100, -margin);
wContentGroup.setLayoutData(fdContentGroup);
// / END OF CONTENT GROUP
Group writeToExistingGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(writeToExistingGroup);
writeToExistingGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.writeToExistingGroup.Label"));
FormLayout writeToExistingGroupgroupLayout = new FormLayout();
writeToExistingGroupgroupLayout.marginWidth = 10;
writeToExistingGroupgroupLayout.marginHeight = 10;
writeToExistingGroup.setLayout(writeToExistingGroupgroupLayout);
// Use AppendLines
Label wlAppendLines = new Label(writeToExistingGroup, SWT.RIGHT);
wlAppendLines.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AppendLines.Label"));
props.setLook(wlAppendLines);
FormData fdlAppendLines = new FormData();
fdlAppendLines.left = new FormAttachment(0, 0);
fdlAppendLines.top = new FormAttachment(0, margin);
fdlAppendLines.right = new FormAttachment(middle, -margin);
wlAppendLines.setLayoutData(fdlAppendLines);
wAppendLines = new Button(writeToExistingGroup, SWT.CHECK);
wAppendLines.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.AppendLines.Tooltip"));
props.setLook(wAppendLines);
FormData fdAppendLines = new FormData();
fdAppendLines.left = new FormAttachment(middle, 0);
fdAppendLines.top = new FormAttachment(0, margin);
fdAppendLines.right = new FormAttachment(100, 0);
wAppendLines.setLayoutData(fdAppendLines);
// wAppendLines.addSelectionListener(lsMod);
wAppendLines.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
input.setChanged();
enableAppend();
}
});
// SkipRows line
Label wlSkipRows = new Label(writeToExistingGroup, SWT.RIGHT);
wlSkipRows.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.SkipRows.Label"));
props.setLook(wlSkipRows);
FormData fdlSkipRows = new FormData();
fdlSkipRows.left = new FormAttachment(0, 0);
fdlSkipRows.top = new FormAttachment(wAppendLines, margin);
fdlSkipRows.right = new FormAttachment(middle, -margin);
wlSkipRows.setLayoutData(fdlSkipRows);
wSkipRows = new Text(writeToExistingGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wSkipRows.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.SkipRows.Tooltip"));
props.setLook(wSkipRows);
wSkipRows.addModifyListener(lsMod);
FormData fdSkipRows = new FormData();
fdSkipRows.left = new FormAttachment(middle, 0);
fdSkipRows.top = new FormAttachment(wAppendLines, margin);
fdSkipRows.right = new FormAttachment(100, 0);
wSkipRows.setLayoutData(fdSkipRows);
// EmptyRows line
Label wlEmptyRows = new Label(writeToExistingGroup, SWT.RIGHT);
wlEmptyRows.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.EmptyRows.Label"));
props.setLook(wlEmptyRows);
FormData fdlEmptyRows = new FormData();
fdlEmptyRows.left = new FormAttachment(0, 0);
fdlEmptyRows.top = new FormAttachment(wSkipRows, margin);
fdlEmptyRows.right = new FormAttachment(middle, -margin);
wlEmptyRows.setLayoutData(fdlEmptyRows);
wEmptyRows = new Text(writeToExistingGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wEmptyRows.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.EmptyRows.Tooltip"));
props.setLook(wEmptyRows);
wEmptyRows.addModifyListener(lsMod);
FormData fdEmptyRows = new FormData();
fdEmptyRows.left = new FormAttachment(middle, 0);
fdEmptyRows.top = new FormAttachment(wSkipRows, margin);
fdEmptyRows.right = new FormAttachment(100, 0);
wEmptyRows.setLayoutData(fdEmptyRows);
// Use AppendLines
Label wlOmitHeader = new Label(writeToExistingGroup, SWT.RIGHT);
wlOmitHeader.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.OmitHeader.Label"));
props.setLook(wlOmitHeader);
FormData fdlOmitHeader = new FormData();
fdlOmitHeader.left = new FormAttachment(0, 0);
fdlOmitHeader.top = new FormAttachment(wEmptyRows, margin);
fdlOmitHeader.right = new FormAttachment(middle, -margin);
wlOmitHeader.setLayoutData(fdlOmitHeader);
wOmitHeader = new Button(writeToExistingGroup, SWT.CHECK);
wOmitHeader.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.OmitHeader.Tooltip"));
props.setLook(wOmitHeader);
FormData fdOmitHeader = new FormData();
fdOmitHeader.left = new FormAttachment(middle, 0);
fdOmitHeader.top = new FormAttachment(wEmptyRows, margin);
fdOmitHeader.right = new FormAttachment(100, 0);
wOmitHeader.setLayoutData(fdOmitHeader);
wOmitHeader.addSelectionListener(lsSel);
FormData fdWriteToExistingGroup = new FormData();
fdWriteToExistingGroup.left = new FormAttachment(0, margin);
fdWriteToExistingGroup.top = new FormAttachment(wContentGroup, margin);
fdWriteToExistingGroup.right = new FormAttachment(100, -margin);
writeToExistingGroup.setLayoutData(fdWriteToExistingGroup);
// ///////////////////////////////////////////////////////////
// / END OF Write to existing Group GROUP
// ///////////////////////////////////////////////////////////
Group fieldGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(fieldGroup);
fieldGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.fieldGroup.Label"));
FormLayout fieldGroupgroupLayout = new FormLayout();
fieldGroupgroupLayout.marginWidth = 10;
fieldGroupgroupLayout.marginHeight = 10;
fieldGroup.setLayout(fieldGroupgroupLayout);
wGet = new Button(fieldGroup, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
wGet.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.GetFields"));
wMinWidth = new Button(fieldGroup, SWT.PUSH);
wMinWidth.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.MinWidth.Button"));
wMinWidth.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.MinWidth.Tooltip"));
setButtonPositions(new Button[] { wGet, wMinWidth }, margin, null);
final int FieldsRows = input.getOutputFields().length;
// Prepare a list of possible formats, filtering reserved internal formats away
String[] formats = BuiltinFormats.getAll();
List<String> allFormats = Arrays.asList(BuiltinFormats.getAll());
List<String> nonReservedFormats = new ArrayList<String>(allFormats.size());
for (String format : allFormats) {
if (!format.startsWith("reserved")) {
nonReservedFormats.add(format);
}
}
Collections.sort(nonReservedFormats);
formats = nonReservedFormats.toArray(new String[0]);
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, formats), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.UseStyleCell.Column"), ColumnInfo.COLUMN_TYPE_TEXT), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.TitleColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.UseTitleStyleCell.Column"), ColumnInfo.COLUMN_TYPE_TEXT), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.FormulaField.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "N", "Y" }, true), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.HyperLinkField.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.CommentField.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.CommentAuthor.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false) };
wFields = new TableView(transMeta, fieldGroup, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(wGet, -margin);
wFields.setLayoutData(fdFields);
wFields.addModifyListener(lsMod);
// Search the fields in the background
final Runnable runnable = new Runnable() {
@Override
public void run() {
StepMeta stepMeta = transMeta.findStep(stepname);
if (stepMeta != null) {
try {
RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
}
setComboBoxes();
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
FormData fdFieldGroup = new FormData();
fdFieldGroup.left = new FormAttachment(0, margin);
fdFieldGroup.top = new FormAttachment(writeToExistingGroup, margin);
fdFieldGroup.bottom = new FormAttachment(100, 0);
fdFieldGroup.right = new FormAttachment(100, -margin);
fieldGroup.setLayoutData(fdFieldGroup);
fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(fdContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(0, 0);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, 0);
wTabFolder.setLayoutData(fdTabFolder);
FormData fdSc = new FormData();
fdSc.left = new FormAttachment(0, 0);
fdSc.top = new FormAttachment(wStepname, margin);
fdSc.right = new FormAttachment(100, 0);
fdSc.bottom = new FormAttachment(100, -50);
sc.setLayoutData(fdSc);
sc.setContent(wTabFolder);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
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, sc);
// Add listeners
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
@Override
public void handleEvent(Event e) {
get();
}
};
lsMinWidth = new Listener() {
@Override
public void handleEvent(Event e) {
setMinimalWidth();
}
};
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wMinWidth.addListener(SWT.Selection, lsMinWidth);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wFilename.addSelectionListener(lsDef);
wTemplateFilename.addSelectionListener(lsDef);
// Whenever something changes, set the tooltip to the expanded version:
wFilename.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
wFilename.setToolTipText(transMeta.environmentSubstitute(wFilename.getText()) + "\n\n" + BaseMessages.getString(PKG, "ExcelWriterDialog.Filename.Tooltip"));
}
});
wTemplateFilename.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
wTemplateFilename.setToolTipText(transMeta.environmentSubstitute(wTemplateFilename.getText()));
}
});
wSheetname.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
wSheetname.setToolTipText(transMeta.environmentSubstitute(wSheetname.getText()) + "\n\n" + BaseMessages.getString(PKG, "ExcelWriterDialog.Sheetname.Tooltip"));
}
});
wTemplateSheetname.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
wTemplateSheetname.setToolTipText(transMeta.environmentSubstitute(wTemplateSheetname.getText()));
}
});
wStartingCell.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
wStartingCell.setToolTipText(transMeta.environmentSubstitute(wStartingCell.getText()) + "\n\n" + BaseMessages.getString(PKG, "ExcelWriterDialog.StartingCell.Tooltip"));
}
});
wPassword.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
wPassword.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Password.Tooltip"));
}
});
wProtectedBy.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
wProtectedBy.setToolTipText(transMeta.environmentSubstitute(wProtectedBy.getText()) + "\n\n" + BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectedBy.Tooltip"));
}
});
wbFilename.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFilterExtensions(new String[] { "*.xls", "*.xlsx", "*.*" });
if (wFilename.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wFilename.getText()));
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLS.Label"), BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLSX.Label"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
}
}
});
wbTemplateFilename.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.xls", "*.xlsx", "*.*" });
if (wTemplateFilename.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wTemplateFilename.getText()));
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLS.Label"), BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLSX.Label"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
wTemplateFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
}
}
});
// 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);
getData();
setDateTimeFormat();
enableExtension();
enableAppend();
enableHeader();
enableTemplateSheet();
input.setChanged(changed);
// artificially reduce table size
for (int t = 0; t < wFields.table.getColumnCount(); t++) {
wFields.table.getColumn(t).setWidth(20);
}
wFields.layout();
wFields.pack();
// determine scrollable area
sc.setMinSize(wTabFolder.computeSize(SWT.DEFAULT, SWT.DEFAULT));
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
// set window size
setSize(shell, 600, 600, true);
// restore optimal column widths
wFields.optWidth(true);
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 PGPDecryptStreamDialog 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, "PGPDecryptStreamDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.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);
// ///////////////////////////////
// START OF GPG Fields GROUP //
// ///////////////////////////////
wGPGGroup = new Group(shell, SWT.SHADOW_NONE);
props.setLook(wGPGGroup);
wGPGGroup.setText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.GPGGroup.Label"));
FormLayout GPGGroupgroupLayout = new FormLayout();
GPGGroupgroupLayout.marginWidth = 10;
GPGGroupgroupLayout.marginHeight = 10;
wGPGGroup.setLayout(GPGGroupgroupLayout);
// GPGLocation fieldname ...
wlGPGLocation = new Label(wGPGGroup, SWT.RIGHT);
wlGPGLocation.setText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.GPGLocationField.Label"));
props.setLook(wlGPGLocation);
fdlGPGLocation = new FormData();
fdlGPGLocation.left = new FormAttachment(0, 0);
fdlGPGLocation.right = new FormAttachment(middle, -margin);
fdlGPGLocation.top = new FormAttachment(wStepname, margin * 2);
wlGPGLocation.setLayoutData(fdlGPGLocation);
// Browse Source files button ...
wbbGpgExe = new Button(wGPGGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbbGpgExe);
wbbGpgExe.setText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.BrowseFiles.Label"));
fdbbGpgExe = new FormData();
fdbbGpgExe.right = new FormAttachment(100, -margin);
fdbbGpgExe.top = new FormAttachment(wStepname, margin);
wbbGpgExe.setLayoutData(fdbbGpgExe);
wbbGpgExe.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*" });
if (wGPGLocation.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wGPGLocation.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wGPGLocation.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
wGPGLocation = new TextVar(transMeta, wGPGGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wGPGLocation.setToolTipText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.GPGLocationField.Tooltip"));
props.setLook(wGPGLocation);
wGPGLocation.addModifyListener(lsMod);
fdGPGLocation = new FormData();
fdGPGLocation.left = new FormAttachment(middle, 0);
fdGPGLocation.top = new FormAttachment(wStepname, margin * 2);
fdGPGLocation.right = new FormAttachment(wbbGpgExe, -margin);
wGPGLocation.setLayoutData(fdGPGLocation);
// Passphrase fieldname ...
wlPassphrase = new Label(wGPGGroup, SWT.RIGHT);
wlPassphrase.setText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.PassphraseField.Label"));
props.setLook(wlPassphrase);
fdlPassphrase = new FormData();
fdlPassphrase.left = new FormAttachment(0, 0);
fdlPassphrase.right = new FormAttachment(middle, -margin);
fdlPassphrase.top = new FormAttachment(wGPGLocation, margin);
wlPassphrase.setLayoutData(fdlPassphrase);
wPassphrase = new PasswordTextVar(transMeta, wGPGGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wPassphrase.setToolTipText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.PassphraseField.Tooltip"));
props.setLook(wPassphrase);
wPassphrase.addModifyListener(lsMod);
fdPassphrase = new FormData();
fdPassphrase.left = new FormAttachment(middle, 0);
fdPassphrase.top = new FormAttachment(wGPGLocation, margin);
fdPassphrase.right = new FormAttachment(100, 0);
wPassphrase.setLayoutData(fdPassphrase);
wlPassphraseFromField = new Label(wGPGGroup, SWT.RIGHT);
wlPassphraseFromField.setText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.PassphraseFromField.Label"));
props.setLook(wlPassphraseFromField);
fdlPassphraseFromField = new FormData();
fdlPassphraseFromField.left = new FormAttachment(0, 0);
fdlPassphraseFromField.top = new FormAttachment(wPassphrase, margin);
fdlPassphraseFromField.right = new FormAttachment(middle, -margin);
wlPassphraseFromField.setLayoutData(fdlPassphraseFromField);
wPassphraseFromField = new Button(wGPGGroup, SWT.CHECK);
props.setLook(wPassphraseFromField);
wPassphraseFromField.setToolTipText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.PassphraseFromField.Tooltip"));
fdPassphraseFromField = new FormData();
fdPassphraseFromField.left = new FormAttachment(middle, 0);
fdPassphraseFromField.top = new FormAttachment(wPassphrase, margin);
wPassphraseFromField.setLayoutData(fdPassphraseFromField);
wPassphraseFromField.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PassphraseFromField();
}
});
// Passphrase field
wlPassphraseFieldName = new Label(wGPGGroup, SWT.RIGHT);
wlPassphraseFieldName.setText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.PassphraseFieldName.Label"));
props.setLook(wlPassphraseFieldName);
fdlPassphraseFieldName = new FormData();
fdlPassphraseFieldName.left = new FormAttachment(0, 0);
fdlPassphraseFieldName.right = new FormAttachment(middle, -margin);
fdlPassphraseFieldName.top = new FormAttachment(wPassphraseFromField, margin);
wlPassphraseFieldName.setLayoutData(fdlPassphraseFieldName);
wPassphraseFieldName = new CCombo(wGPGGroup, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wPassphraseFieldName);
wPassphraseFieldName.addModifyListener(lsMod);
fdPassphraseFieldName = new FormData();
fdPassphraseFieldName.left = new FormAttachment(middle, 0);
fdPassphraseFieldName.top = new FormAttachment(wPassphraseFromField, margin);
fdPassphraseFieldName.right = new FormAttachment(100, -margin);
wPassphraseFieldName.setLayoutData(fdPassphraseFieldName);
wPassphraseFieldName.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
get();
shell.setCursor(null);
busy.dispose();
}
});
fdGPGGroup = new FormData();
fdGPGGroup.left = new FormAttachment(0, margin);
fdGPGGroup.top = new FormAttachment(wStepname, margin);
fdGPGGroup.right = new FormAttachment(100, -margin);
wGPGGroup.setLayoutData(fdGPGGroup);
// ///////////////////////////////
// END OF GPG GROUP //
// ///////////////////////////////
// Stream field
wlStreamFieldName = new Label(shell, SWT.RIGHT);
wlStreamFieldName.setText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.StreamFieldName.Label"));
props.setLook(wlStreamFieldName);
fdlStreamFieldName = new FormData();
fdlStreamFieldName.left = new FormAttachment(0, 0);
fdlStreamFieldName.right = new FormAttachment(middle, -margin);
fdlStreamFieldName.top = new FormAttachment(wGPGGroup, 2 * margin);
wlStreamFieldName.setLayoutData(fdlStreamFieldName);
wStreamFieldName = new CCombo(shell, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wStreamFieldName);
wStreamFieldName.addModifyListener(lsMod);
fdStreamFieldName = new FormData();
fdStreamFieldName.left = new FormAttachment(middle, 0);
fdStreamFieldName.top = new FormAttachment(wGPGGroup, 2 * margin);
fdStreamFieldName.right = new FormAttachment(100, -margin);
wStreamFieldName.setLayoutData(fdStreamFieldName);
wStreamFieldName.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
get();
shell.setCursor(null);
busy.dispose();
}
});
// Result fieldname ...
wlResult = new Label(shell, SWT.RIGHT);
wlResult.setText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.ResultField.Label"));
props.setLook(wlResult);
fdlResult = new FormData();
fdlResult.left = new FormAttachment(0, 0);
fdlResult.right = new FormAttachment(middle, -margin);
fdlResult.top = new FormAttachment(wStreamFieldName, margin * 2);
wlResult.setLayoutData(fdlResult);
wResult = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wResult.setToolTipText(BaseMessages.getString(PKG, "PGPDecryptStreamDialog.ResultField.Tooltip"));
props.setLook(wResult);
wResult.addModifyListener(lsMod);
fdResult = new FormData();
fdResult.left = new FormAttachment(middle, 0);
fdResult.top = new FormAttachment(wStreamFieldName, margin * 2);
fdResult.right = new FormAttachment(100, 0);
wResult.setLayoutData(fdResult);
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wResult);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
// Set the shell size, based upon previous time...
setSize();
getData();
PassphraseFromField();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations