use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-kettle by pentaho.
the class LDAPInputDialog 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, "LDAPInputDialog.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);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "LDAPInputDialog.General.Tab"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wGeneralComp.setLayout(fileLayout);
// /////////////////////////////////
// START OF Host GROUP
// /////////////////////////////////
wHostGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wHostGroup);
wHostGroup.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Group.HostGroup.Label"));
FormLayout HostGroupLayout = new FormLayout();
HostGroupLayout.marginWidth = 10;
HostGroupLayout.marginHeight = 10;
wHostGroup.setLayout(HostGroupLayout);
// Host line
wlHost = new Label(wHostGroup, SWT.RIGHT);
wlHost.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Host.Label"));
props.setLook(wlHost);
fdlHost = new FormData();
fdlHost.left = new FormAttachment(0, 0);
fdlHost.top = new FormAttachment(wStepname, margin);
fdlHost.right = new FormAttachment(middle, -margin);
wlHost.setLayoutData(fdlHost);
wHost = new TextVar(transMeta, wHostGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wHost.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.Host.Tooltip"));
props.setLook(wHost);
wHost.addModifyListener(lsMod);
fdHost = new FormData();
fdHost.left = new FormAttachment(middle, 0);
fdHost.top = new FormAttachment(wStepname, margin);
fdHost.right = new FormAttachment(100, 0);
wHost.setLayoutData(fdHost);
// Port line
wlPort = new Label(wHostGroup, SWT.RIGHT);
wlPort.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Port.Label"));
props.setLook(wlPort);
fdlPort = new FormData();
fdlPort.left = new FormAttachment(0, 0);
fdlPort.top = new FormAttachment(wHost, margin);
fdlPort.right = new FormAttachment(middle, -margin);
wlPort.setLayoutData(fdlPort);
wPort = new TextVar(transMeta, wHostGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPort);
wPort.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.Port.Tooltip"));
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(middle, 0);
fdPort.top = new FormAttachment(wHost, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// Protocol Line
wlProtocol = new Label(wHostGroup, SWT.RIGHT);
wlProtocol.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Protocol.Label"));
props.setLook(wlProtocol);
fdlProtocol = new FormData();
fdlProtocol.left = new FormAttachment(0, 0);
fdlProtocol.right = new FormAttachment(middle, -margin);
fdlProtocol.top = new FormAttachment(wPort, margin);
wlProtocol.setLayoutData(fdlProtocol);
wProtocol = new ComboVar(transMeta, wHostGroup, SWT.BORDER | SWT.READ_ONLY);
wProtocol.setEditable(true);
props.setLook(wProtocol);
wProtocol.addModifyListener(lsMod);
fdProtocol = new FormData();
fdProtocol.left = new FormAttachment(middle, 0);
fdProtocol.top = new FormAttachment(wPort, margin);
fdProtocol.right = new FormAttachment(100, -margin);
wProtocol.setLayoutData(fdProtocol);
wProtocol.setItems(LdapProtocolFactory.getConnectionTypes(log).toArray(new String[] {}));
wProtocol.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setProtocol();
}
});
fdHostGroup = new FormData();
fdHostGroup.left = new FormAttachment(0, margin);
fdHostGroup.top = new FormAttachment(0, margin);
fdHostGroup.right = new FormAttachment(100, -margin);
wHostGroup.setLayoutData(fdHostGroup);
// ///////////////////////////////////////////////////////////
// / END OF Host GROUP
// ///////////////////////////////////////////////////////////
// /////////////////////////////////
// START OF Authentication GROUP
// /////////////////////////////////
wAuthenticationGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wAuthenticationGroup);
wAuthenticationGroup.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Group.AuthenticationGroup.Label"));
FormLayout AuthenticationGroupLayout = new FormLayout();
AuthenticationGroupLayout.marginWidth = 10;
AuthenticationGroupLayout.marginHeight = 10;
wAuthenticationGroup.setLayout(AuthenticationGroupLayout);
// using authentication ?
wlusingAuthentication = new Label(wAuthenticationGroup, SWT.RIGHT);
wlusingAuthentication.setText(BaseMessages.getString(PKG, "LDAPInputDialog.usingAuthentication.Label"));
props.setLook(wlusingAuthentication);
fdlusingAuthentication = new FormData();
fdlusingAuthentication.left = new FormAttachment(0, 0);
fdlusingAuthentication.top = new FormAttachment(wHostGroup, margin);
fdlusingAuthentication.right = new FormAttachment(middle, -margin);
wlusingAuthentication.setLayoutData(fdlusingAuthentication);
wusingAuthentication = new Button(wAuthenticationGroup, SWT.CHECK);
props.setLook(wusingAuthentication);
wusingAuthentication.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.usingAuthentication.Tooltip"));
FormData fdusingAuthentication = new FormData();
fdusingAuthentication.left = new FormAttachment(middle, 0);
fdusingAuthentication.top = new FormAttachment(wHostGroup, margin);
wusingAuthentication.setLayoutData(fdusingAuthentication);
wusingAuthentication.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
useAuthentication();
input.setChanged();
}
});
// UserName line
wlUserName = new Label(wAuthenticationGroup, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Username.Label"));
props.setLook(wlUserName);
fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wusingAuthentication, margin);
fdlUserName.right = new FormAttachment(middle, -margin);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(transMeta, wAuthenticationGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.Username.Tooltip"));
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, 0);
fdUserName.top = new FormAttachment(wusingAuthentication, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wlPassword = new Label(wAuthenticationGroup, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(transMeta, wAuthenticationGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wPassword.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.Password.Tooltip"));
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
fdAuthenticationGroup = new FormData();
fdAuthenticationGroup.left = new FormAttachment(0, margin);
fdAuthenticationGroup.top = new FormAttachment(wHostGroup, margin);
fdAuthenticationGroup.right = new FormAttachment(100, -margin);
wAuthenticationGroup.setLayoutData(fdAuthenticationGroup);
// ///////////////////////////////////////////////////////////
// / END OF Authentication GROUP
// ///////////////////////////////////////////////////////////
// /////////////////////////////////
// START OF Certificate GROUP
// /////////////////////////////////
wCertificateGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wCertificateGroup);
wCertificateGroup.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Group.CertificateGroup.Label"));
FormLayout CertificateGroupLayout = new FormLayout();
CertificateGroupLayout.marginWidth = 10;
CertificateGroupLayout.marginHeight = 10;
wCertificateGroup.setLayout(CertificateGroupLayout);
// set TrustStore?
wlsetTrustStore = new Label(wCertificateGroup, SWT.RIGHT);
wlsetTrustStore.setText(BaseMessages.getString(PKG, "LDAPInputDialog.setTrustStore.Label"));
props.setLook(wlsetTrustStore);
fdlsetTrustStore = new FormData();
fdlsetTrustStore.left = new FormAttachment(0, 0);
fdlsetTrustStore.top = new FormAttachment(wAuthenticationGroup, margin);
fdlsetTrustStore.right = new FormAttachment(middle, -margin);
wlsetTrustStore.setLayoutData(fdlsetTrustStore);
wsetTrustStore = new Button(wCertificateGroup, SWT.CHECK);
props.setLook(wsetTrustStore);
wsetTrustStore.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.setTrustStore.Tooltip"));
fdsetTrustStore = new FormData();
fdsetTrustStore.left = new FormAttachment(middle, 0);
fdsetTrustStore.top = new FormAttachment(wAuthenticationGroup, margin);
wsetTrustStore.setLayoutData(fdsetTrustStore);
wsetTrustStore.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setTrustStore();
}
});
// TrustStorePath line
wlTrustStorePath = new Label(wCertificateGroup, SWT.RIGHT);
wlTrustStorePath.setText(BaseMessages.getString(PKG, "LDAPInputDialog.TrustStorePath.Label"));
props.setLook(wlTrustStorePath);
fdlTrustStorePath = new FormData();
fdlTrustStorePath.left = new FormAttachment(0, -margin);
fdlTrustStorePath.top = new FormAttachment(wsetTrustStore, margin);
fdlTrustStorePath.right = new FormAttachment(middle, -margin);
wlTrustStorePath.setLayoutData(fdlTrustStorePath);
wbbFilename = new Button(wCertificateGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbbFilename);
wbbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
wbbFilename.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(wsetTrustStore, margin);
wbbFilename.setLayoutData(fdbFilename);
// Listen to the Browse... button
wbbFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
if (wTrustStorePath.getText() != null) {
String fpath = transMeta.environmentSubstitute(wTrustStorePath.getText());
dialog.setFileName(fpath);
}
if (dialog.open() != null) {
String str = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
wTrustStorePath.setText(str);
}
}
});
wTrustStorePath = new TextVar(transMeta, wCertificateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTrustStorePath);
wTrustStorePath.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.TrustStorePath.Tooltip"));
wTrustStorePath.addModifyListener(lsMod);
fdTrustStorePath = new FormData();
fdTrustStorePath.left = new FormAttachment(middle, 0);
fdTrustStorePath.top = new FormAttachment(wsetTrustStore, margin);
fdTrustStorePath.right = new FormAttachment(wbbFilename, -margin);
wTrustStorePath.setLayoutData(fdTrustStorePath);
// TrustStorePassword line
wlTrustStorePassword = new Label(wCertificateGroup, SWT.RIGHT);
wlTrustStorePassword.setText(BaseMessages.getString(PKG, "LDAPInputDialog.TrustStorePassword.Label"));
props.setLook(wlTrustStorePassword);
fdlTrustStorePassword = new FormData();
fdlTrustStorePassword.left = new FormAttachment(0, -margin);
fdlTrustStorePassword.top = new FormAttachment(wbbFilename, margin);
fdlTrustStorePassword.right = new FormAttachment(middle, -margin);
wlTrustStorePassword.setLayoutData(fdlTrustStorePassword);
wTrustStorePassword = new PasswordTextVar(transMeta, wCertificateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTrustStorePassword);
wTrustStorePassword.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.TrustStorePassword.Tooltip"));
wTrustStorePassword.addModifyListener(lsMod);
fdTrustStorePassword = new FormData();
fdTrustStorePassword.left = new FormAttachment(middle, 0);
fdTrustStorePassword.top = new FormAttachment(wbbFilename, margin);
fdTrustStorePassword.right = new FormAttachment(100, -margin);
wTrustStorePassword.setLayoutData(fdTrustStorePassword);
// Trust all certificate?
wlTrustAll = new Label(wCertificateGroup, SWT.RIGHT);
wlTrustAll.setText(BaseMessages.getString(PKG, "LDAPInputDialog.TrustAll.Label"));
props.setLook(wlTrustAll);
fdlTrustAll = new FormData();
fdlTrustAll.left = new FormAttachment(0, 0);
fdlTrustAll.top = new FormAttachment(wTrustStorePassword, margin);
fdlTrustAll.right = new FormAttachment(middle, -margin);
wlTrustAll.setLayoutData(fdlTrustAll);
wTrustAll = new Button(wCertificateGroup, SWT.CHECK);
props.setLook(wTrustAll);
wTrustAll.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.TrustAll.Tooltip"));
fdTrustAll = new FormData();
fdTrustAll.left = new FormAttachment(middle, 0);
fdTrustAll.top = new FormAttachment(wTrustStorePassword, margin);
wTrustAll.setLayoutData(fdTrustAll);
wTrustAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
trustAll();
}
});
fdCertificateGroup = new FormData();
fdCertificateGroup.left = new FormAttachment(0, margin);
fdCertificateGroup.top = new FormAttachment(wAuthenticationGroup, margin);
fdCertificateGroup.right = new FormAttachment(100, -margin);
wCertificateGroup.setLayoutData(fdCertificateGroup);
// ///////////////////////////////////////////////////////////
// / END OF Certificate GROUP
// ///////////////////////////////////////////////////////////
// Test LDAP connection button
wTest = new Button(wGeneralComp, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "LDAPInputDialog.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wCertificateGroup, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Search TAB///
// /
wSearchTab = new CTabItem(wTabFolder, SWT.NONE);
wSearchTab.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Search.Tab"));
FormLayout SearchLayout = new FormLayout();
SearchLayout.marginWidth = 3;
SearchLayout.marginHeight = 3;
wSearchComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSearchComp);
wSearchComp.setLayout(SearchLayout);
// /////////////////////////////////
// START OF Search GROUP
// /////////////////////////////////
wSearchGroup = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wSearchGroup);
wSearchGroup.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Group.SearchGroup.Label"));
FormLayout searchgroupLayout = new FormLayout();
searchgroupLayout.marginWidth = 10;
searchgroupLayout.marginHeight = 10;
wSearchGroup.setLayout(searchgroupLayout);
// Is base defined in a Field
wldynamicBase = new Label(wSearchGroup, SWT.RIGHT);
wldynamicBase.setText(BaseMessages.getString(PKG, "LDAPInputDialog.dynamicBase.Label"));
props.setLook(wldynamicBase);
fdlynamicBase = new FormData();
fdlynamicBase.left = new FormAttachment(0, -margin);
fdlynamicBase.top = new FormAttachment(wStepname, margin);
fdlynamicBase.right = new FormAttachment(middle, -2 * margin);
wldynamicBase.setLayoutData(fdlynamicBase);
wdynamicBase = new Button(wSearchGroup, SWT.CHECK);
props.setLook(wdynamicBase);
wdynamicBase.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.dynamicBase.Tooltip"));
fdynamicBase = new FormData();
fdynamicBase.left = new FormAttachment(middle, -margin);
fdynamicBase.top = new FormAttachment(wStepname, margin);
wdynamicBase.setLayoutData(fdynamicBase);
SelectionAdapter ldynamicBase = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ActiveDynamicBase();
input.setChanged();
}
};
wdynamicBase.addSelectionListener(ldynamicBase);
// dynamic search base field
wlsearchBaseField = new Label(wSearchGroup, SWT.RIGHT);
wlsearchBaseField.setText(BaseMessages.getString(PKG, "LDAPInputDialog.wsearchBaseField.Label"));
props.setLook(wlsearchBaseField);
fdlsearchBaseField = new FormData();
fdlsearchBaseField.left = new FormAttachment(0, -margin);
fdlsearchBaseField.top = new FormAttachment(wdynamicBase, margin);
fdlsearchBaseField.right = new FormAttachment(middle, -2 * margin);
wlsearchBaseField.setLayoutData(fdlsearchBaseField);
wsearchBaseField = new CCombo(wSearchGroup, SWT.BORDER | SWT.READ_ONLY);
wsearchBaseField.setEditable(true);
props.setLook(wsearchBaseField);
wsearchBaseField.addModifyListener(lsMod);
fdsearchBaseField = new FormData();
fdsearchBaseField.left = new FormAttachment(middle, -margin);
fdsearchBaseField.top = new FormAttachment(wdynamicBase, margin);
fdsearchBaseField.right = new FormAttachment(100, -2 * margin);
wsearchBaseField.setLayoutData(fdsearchBaseField);
wsearchBaseField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
setSearchBaseField();
}
});
// SearchBase line
wlSearchBase = new Label(wSearchGroup, SWT.RIGHT);
wlSearchBase.setText(BaseMessages.getString(PKG, "LDAPInputDialog.SearchBase.Label"));
props.setLook(wlSearchBase);
fdlSearchBase = new FormData();
fdlSearchBase.left = new FormAttachment(0, -margin);
fdlSearchBase.top = new FormAttachment(wsearchBaseField, margin);
fdlSearchBase.right = new FormAttachment(middle, -2 * margin);
wlSearchBase.setLayoutData(fdlSearchBase);
wSearchBase = new TextVar(transMeta, wSearchGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSearchBase);
wSearchBase.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.SearchBase.Tooltip"));
wSearchBase.addModifyListener(lsMod);
fdSearchBase = new FormData();
fdSearchBase.left = new FormAttachment(middle, -margin);
fdSearchBase.top = new FormAttachment(wsearchBaseField, margin);
fdSearchBase.right = new FormAttachment(100, -2 * margin);
wSearchBase.setLayoutData(fdSearchBase);
// Is filter defined in a Field
wldynamicFilter = new Label(wSearchGroup, SWT.RIGHT);
wldynamicFilter.setText(BaseMessages.getString(PKG, "LDAPInputDialog.dynamicFilter.Label"));
props.setLook(wldynamicFilter);
fdldynamicFilter = new FormData();
fdldynamicFilter.left = new FormAttachment(0, -margin);
fdldynamicFilter.top = new FormAttachment(wSearchBase, margin);
fdldynamicFilter.right = new FormAttachment(middle, -2 * margin);
wldynamicFilter.setLayoutData(fdldynamicFilter);
wdynamicFilter = new Button(wSearchGroup, SWT.CHECK);
props.setLook(wdynamicFilter);
wdynamicFilter.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.dynamicFilter.Tooltip"));
fdynamicFilter = new FormData();
fdynamicFilter.left = new FormAttachment(middle, -margin);
fdynamicFilter.top = new FormAttachment(wSearchBase, margin);
wdynamicFilter.setLayoutData(fdynamicFilter);
SelectionAdapter ldynamicFilter = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ActivedynamicFilter();
input.setChanged();
}
};
wdynamicFilter.addSelectionListener(ldynamicFilter);
// dynamic search base field
wlfilterField = new Label(wSearchGroup, SWT.RIGHT);
wlfilterField.setText(BaseMessages.getString(PKG, "LDAPInputDialog.filterField.Label"));
props.setLook(wlfilterField);
fdlfilterField = new FormData();
fdlfilterField.left = new FormAttachment(0, -margin);
fdlfilterField.top = new FormAttachment(wdynamicFilter, margin);
fdlfilterField.right = new FormAttachment(middle, -2 * margin);
wlfilterField.setLayoutData(fdlfilterField);
wfilterField = new CCombo(wSearchGroup, SWT.BORDER | SWT.READ_ONLY);
wfilterField.setEditable(true);
props.setLook(wfilterField);
wfilterField.addModifyListener(lsMod);
fdfilterField = new FormData();
fdfilterField.left = new FormAttachment(middle, -margin);
fdfilterField.top = new FormAttachment(wdynamicFilter, margin);
fdfilterField.right = new FormAttachment(100, -2 * margin);
wfilterField.setLayoutData(fdfilterField);
wfilterField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
setSearchBaseField();
}
});
// Filter String
wlFilterString = new Label(wSearchGroup, SWT.RIGHT);
wlFilterString.setText(BaseMessages.getString(PKG, "LDAPInputDialog.FilterString.Label"));
props.setLook(wlFilterString);
fdlFilterString = new FormData();
fdlFilterString.left = new FormAttachment(0, 0);
fdlFilterString.top = new FormAttachment(wfilterField, margin);
fdlFilterString.right = new FormAttachment(middle, -2 * margin);
wlFilterString.setLayoutData(fdlFilterString);
wFilterString = new StyledTextComp(transMeta, wSearchGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
wFilterString.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.FilterString.Tooltip"));
props.setLook(wFilterString);
wFilterString.addModifyListener(lsMod);
fdFilterString = new FormData();
fdFilterString.left = new FormAttachment(middle, -margin);
fdFilterString.top = new FormAttachment(wfilterField, margin);
fdFilterString.right = new FormAttachment(100, -2 * margin);
fdFilterString.bottom = new FormAttachment(100, -margin);
wFilterString.setLayoutData(fdFilterString);
wFilterString.addKeyListener(new ControlSpaceKeyAdapter(transMeta, wFilterString));
fdSearchGroup = new FormData();
fdSearchGroup.left = new FormAttachment(0, margin);
fdSearchGroup.top = new FormAttachment(wStepname, margin);
fdSearchGroup.right = new FormAttachment(100, -margin);
fdSearchGroup.bottom = new FormAttachment(100, -margin);
wSearchGroup.setLayoutData(fdSearchGroup);
// ///////////////////////////////////////////////////////////
// / END OF Search GROUP
// ///////////////////////////////////////////////////////////
fdSearchComp = new FormData();
fdSearchComp.left = new FormAttachment(0, 0);
fdSearchComp.top = new FormAttachment(0, 0);
fdSearchComp.right = new FormAttachment(100, 0);
fdSearchComp.bottom = new FormAttachment(100, 0);
wSearchComp.setLayoutData(fdSearchComp);
wSearchComp.layout();
wSearchTab.setControl(wSearchComp);
// ///////////////////////////////////////////////////////////
// / END OF Search TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Content.Tab"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// /////////////////////////////////
// START OF Additional Fields GROUP
// /////////////////////////////////
wAdditionalGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wAdditionalGroup);
wAdditionalGroup.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Group.AdditionalGroup.Label"));
FormLayout additionalgroupLayout = new FormLayout();
additionalgroupLayout.marginWidth = 10;
additionalgroupLayout.marginHeight = 10;
wAdditionalGroup.setLayout(additionalgroupLayout);
wlInclRownum = new Label(wAdditionalGroup, SWT.RIGHT);
wlInclRownum.setText(BaseMessages.getString(PKG, "LDAPInputDialog.InclRownum.Label"));
props.setLook(wlInclRownum);
fdlInclRownum = new FormData();
fdlInclRownum.left = new FormAttachment(0, 0);
fdlInclRownum.top = new FormAttachment(0, margin);
fdlInclRownum.right = new FormAttachment(middle, -margin);
wlInclRownum.setLayoutData(fdlInclRownum);
wInclRownum = new Button(wAdditionalGroup, SWT.CHECK);
props.setLook(wInclRownum);
wInclRownum.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.InclRownum.Tooltip"));
fdRownum = new FormData();
fdRownum.left = new FormAttachment(middle, 0);
fdRownum.top = new FormAttachment(0, margin);
wInclRownum.setLayoutData(fdRownum);
wInclRownum.addSelectionListener(new ComponentSelectionListener(input));
wlInclRownumField = new Label(wAdditionalGroup, SWT.RIGHT);
wlInclRownumField.setText(BaseMessages.getString(PKG, "LDAPInputDialog.InclRownumField.Label"));
props.setLook(wlInclRownumField);
fdlInclRownumField = new FormData();
fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
fdlInclRownumField.top = new FormAttachment(0, margin);
wlInclRownumField.setLayoutData(fdlInclRownumField);
wInclRownumField = new TextVar(transMeta, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclRownumField);
wInclRownumField.addModifyListener(lsMod);
fdInclRownumField = new FormData();
fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
fdInclRownumField.top = new FormAttachment(0, margin);
fdInclRownumField.right = new FormAttachment(100, 0);
wInclRownumField.setLayoutData(fdInclRownumField);
fdAdditionalGroup = new FormData();
fdAdditionalGroup.left = new FormAttachment(0, margin);
fdAdditionalGroup.top = new FormAttachment(0, margin);
fdAdditionalGroup.right = new FormAttachment(100, -margin);
wAdditionalGroup.setLayoutData(fdAdditionalGroup);
// ///////////////////////////////////////////////////////////
// / END OF DESTINATION ADDRESS GROUP
// ///////////////////////////////////////////////////////////
wlLimit = new Label(wContentComp, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Limit.Label"));
props.setLook(wlLimit);
fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.top = new FormAttachment(wAdditionalGroup, 2 * margin);
fdlLimit.right = new FormAttachment(middle, -margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLimit);
wLimit.addModifyListener(lsMod);
fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.top = new FormAttachment(wAdditionalGroup, 2 * margin);
fdLimit.right = new FormAttachment(100, 0);
wLimit.setLayoutData(fdLimit);
// TimeLimit
wlTimeLimit = new Label(wContentComp, SWT.RIGHT);
wlTimeLimit.setText(BaseMessages.getString(PKG, "LDAPInputDialog.TimeLimit.Label"));
props.setLook(wlTimeLimit);
fdlTimeLimit = new FormData();
fdlTimeLimit.left = new FormAttachment(0, 0);
fdlTimeLimit.top = new FormAttachment(wLimit, margin);
fdlTimeLimit.right = new FormAttachment(middle, -margin);
wlTimeLimit.setLayoutData(fdlTimeLimit);
wTimeLimit = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTimeLimit);
wTimeLimit.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.TimeLimit.Tooltip"));
wTimeLimit.addModifyListener(lsMod);
fdTimeLimit = new FormData();
fdTimeLimit.left = new FormAttachment(middle, 0);
fdTimeLimit.top = new FormAttachment(wLimit, margin);
fdTimeLimit.right = new FormAttachment(100, 0);
wTimeLimit.setLayoutData(fdTimeLimit);
// Multi valued field separator
wlMultiValuedSeparator = new Label(wContentComp, SWT.RIGHT);
wlMultiValuedSeparator.setText(BaseMessages.getString(PKG, "LDAPInputDialog.MultiValuedSeparator.Label"));
props.setLook(wlMultiValuedSeparator);
fdlMultiValuedSeparator = new FormData();
fdlMultiValuedSeparator.left = new FormAttachment(0, 0);
fdlMultiValuedSeparator.top = new FormAttachment(wTimeLimit, margin);
fdlMultiValuedSeparator.right = new FormAttachment(middle, -margin);
wlMultiValuedSeparator.setLayoutData(fdlMultiValuedSeparator);
wMultiValuedSeparator = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMultiValuedSeparator);
wMultiValuedSeparator.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.MultiValuedSeparator.Tooltip"));
wMultiValuedSeparator.addModifyListener(lsMod);
fdMultiValuedSeparator = new FormData();
fdMultiValuedSeparator.left = new FormAttachment(middle, 0);
fdMultiValuedSeparator.top = new FormAttachment(wTimeLimit, margin);
fdMultiValuedSeparator.right = new FormAttachment(100, 0);
wMultiValuedSeparator.setLayoutData(fdMultiValuedSeparator);
// Use page ranging?
wlsetPaging = new Label(wContentComp, SWT.RIGHT);
wlsetPaging.setText(BaseMessages.getString(PKG, "LDAPInputDialog.setPaging.Label"));
props.setLook(wlsetPaging);
fdlsetPaging = new FormData();
fdlsetPaging.left = new FormAttachment(0, 0);
fdlsetPaging.top = new FormAttachment(wMultiValuedSeparator, margin);
fdlsetPaging.right = new FormAttachment(middle, -margin);
wlsetPaging.setLayoutData(fdlsetPaging);
wsetPaging = new Button(wContentComp, SWT.CHECK);
props.setLook(wsetPaging);
wsetPaging.setToolTipText(BaseMessages.getString(PKG, "LDAPInputDialog.setPaging.Tooltip"));
fdsetPaging = new FormData();
fdsetPaging.left = new FormAttachment(middle, 0);
fdsetPaging.top = new FormAttachment(wMultiValuedSeparator, margin);
wsetPaging.setLayoutData(fdsetPaging);
wsetPaging.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setPaging();
input.setChanged();
}
});
wlPageSize = new Label(wContentComp, SWT.RIGHT);
wlPageSize.setText(BaseMessages.getString(PKG, "LDAPInputDialog.PageSize.Label"));
props.setLook(wlPageSize);
fdlPageSize = new FormData();
fdlPageSize.left = new FormAttachment(wsetPaging, margin);
fdlPageSize.top = new FormAttachment(wMultiValuedSeparator, margin);
wlPageSize.setLayoutData(fdlPageSize);
wPageSize = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPageSize);
wPageSize.addModifyListener(lsMod);
fdPageSize = new FormData();
fdPageSize.left = new FormAttachment(wlPageSize, margin);
fdPageSize.top = new FormAttachment(wMultiValuedSeparator, margin);
fdPageSize.right = new FormAttachment(100, 0);
wPageSize.setLayoutData(fdPageSize);
// searchScope
wlsearchScope = new Label(wContentComp, SWT.RIGHT);
wlsearchScope.setText(BaseMessages.getString(PKG, "LDAPInputDialog.SearchScope.Label"));
props.setLook(wlsearchScope);
fdlsearchScope = new FormData();
fdlsearchScope.left = new FormAttachment(0, 0);
fdlsearchScope.right = new FormAttachment(middle, -margin);
fdlsearchScope.top = new FormAttachment(wPageSize, margin);
wlsearchScope.setLayoutData(fdlsearchScope);
wsearchScope = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wsearchScope);
wsearchScope.addModifyListener(lsMod);
fdsearchScope = new FormData();
fdsearchScope.left = new FormAttachment(middle, 0);
fdsearchScope.top = new FormAttachment(wPageSize, margin);
fdsearchScope.right = new FormAttachment(100, -margin);
wsearchScope.setLayoutData(fdsearchScope);
wsearchScope.setItems(LDAPInputMeta.searchScopeDesc);
wsearchScope.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
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);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
// Fields tab...
//
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Fields.Tab"));
FormLayout fieldsLayout = new FormLayout();
fieldsLayout.marginWidth = Const.FORM_MARGIN;
fieldsLayout.marginHeight = Const.FORM_MARGIN;
wFieldsComp = new Composite(wTabFolder, SWT.NONE);
wFieldsComp.setLayout(fieldsLayout);
props.setLook(wFieldsComp);
wGet = new Button(wFieldsComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "LDAPInputDialog.GetFields.Button"));
fdGet = new FormData();
fdGet.left = new FormAttachment(50, 0);
fdGet.bottom = new FormAttachment(100, 0);
wGet.setLayoutData(fdGet);
final int FieldsRows = input.getInputFields().length;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Attribute.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.FetchAttributeAs.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, LDAPInputField.FetchAttributeAsDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.IsSortedKey.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Type.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Format.Column"), ColumnInfo.COLUMN_TYPE_FORMAT, 3), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Length.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Precision.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Currency.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Decimal.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Group.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.TrimType.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, LDAPInputField.trimTypeDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Repeat.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true) };
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Name.Column.Tooltip"));
colinf[1].setUsingVariables(true);
colinf[1].setToolTip(BaseMessages.getString(PKG, "LDAPInputDialog.FieldsTable.Attribute.Column.Tooltip"));
wFields = new TableView(transMeta, wFieldsComp, 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);
fdFieldsComp = new FormData();
fdFieldsComp.left = new FormAttachment(0, 0);
fdFieldsComp.top = new FormAttachment(0, 0);
fdFieldsComp.right = new FormAttachment(100, 0);
fdFieldsComp.bottom = new FormAttachment(100, 0);
wFieldsComp.setLayoutData(fdFieldsComp);
wFieldsComp.layout();
wFieldsTab.setControl(wFieldsComp);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wPreview = new Button(shell, SWT.PUSH);
wPreview.setText(BaseMessages.getString(PKG, "LDAPInputDialog.Button.PreviewRows"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsPreview = new Listener() {
public void handleEvent(Event e) {
preview();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wTest.addListener(SWT.Selection, lsTest);
wPreview.addListener(SWT.Selection, lsPreview);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wLimit.addSelectionListener(lsDef);
wInclRownumField.addSelectionListener(lsDef);
// Enable/disable the right fields to allow a row number to be added to each row...
wInclRownum.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setIncludeRownum();
}
});
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData(input);
setProtocol();
setTrustStore();
useAuthentication();
setPaging();
ActiveDynamicBase();
ActivedynamicFilter();
input.setChanged(changed);
wFields.optWidth(true);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-kettle by pentaho.
the class JobEntrySendNagiosPassiveCheckDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Name.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, PropsUI.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ServerSettings.General"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Server.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Server port line
wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Port.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(wServerName, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// Password String line
wPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Password.Label"), BaseMessages.getString("JobSendNagiosPassiveCheck.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wPort, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Server wConnectionTimeOut line
wConnectionTimeOut = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ConnectionTimeOut.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ConnectionTimeOut.Tooltip"));
props.setLook(wConnectionTimeOut);
wConnectionTimeOut.addModifyListener(lsMod);
fdwConnectionTimeOut = new FormData();
fdwConnectionTimeOut.left = new FormAttachment(0, 0);
fdwConnectionTimeOut.top = new FormAttachment(wPassword, margin);
fdwConnectionTimeOut.right = new FormAttachment(100, 0);
wConnectionTimeOut.setLayoutData(fdwConnectionTimeOut);
// ResponseTimeOut line
wResponseTimeOut = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ResponseTimeOut.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ResponseTimeOut.Tooltip"));
props.setLook(wResponseTimeOut);
wResponseTimeOut.addModifyListener(lsMod);
fdResponseTimeOut = new FormData();
fdResponseTimeOut.left = new FormAttachment(0, 0);
fdResponseTimeOut.top = new FormAttachment(wConnectionTimeOut, margin);
fdResponseTimeOut.right = new FormAttachment(100, 0);
wResponseTimeOut.setLayoutData(fdResponseTimeOut);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wResponseTimeOut, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wName, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Advanced SETTINGS GROUP///
// /
wSenderSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSenderSettings);
wSenderSettings.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderSettings.Group.Label"));
FormLayout SenderSettingsgroupLayout = new FormLayout();
SenderSettingsgroupLayout.marginWidth = 10;
SenderSettingsgroupLayout.marginHeight = 10;
wSenderSettings.setLayout(SenderSettingsgroupLayout);
// SenderServerName line
wSenderServerName = new LabelTextVar(jobMeta, wSenderSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServerName.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServerName.Tooltip"));
props.setLook(wSenderServerName);
wSenderServerName.addModifyListener(lsMod);
fdSenderServerName = new FormData();
fdSenderServerName.left = new FormAttachment(0, 0);
fdSenderServerName.top = new FormAttachment(wServerSettings, margin);
fdSenderServerName.right = new FormAttachment(100, 0);
wSenderServerName.setLayoutData(fdSenderServerName);
// SenderServiceName line
wSenderServiceName = new LabelTextVar(jobMeta, wSenderSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServiceName.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServiceName.Tooltip"));
props.setLook(wSenderServiceName);
wSenderServiceName.addModifyListener(lsMod);
fdSenderServiceName = new FormData();
fdSenderServiceName.left = new FormAttachment(0, 0);
fdSenderServiceName.top = new FormAttachment(wSenderServerName, margin);
fdSenderServiceName.right = new FormAttachment(100, 0);
wSenderServiceName.setLayoutData(fdSenderServiceName);
// Encryption mode
wlEncryptionMode = new Label(wSenderSettings, SWT.RIGHT);
wlEncryptionMode.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.EncryptionMode.Label"));
props.setLook(wlEncryptionMode);
fdlEncryptionMode = new FormData();
fdlEncryptionMode.left = new FormAttachment(0, margin);
fdlEncryptionMode.right = new FormAttachment(middle, -margin);
fdlEncryptionMode.top = new FormAttachment(wSenderServiceName, margin);
wlEncryptionMode.setLayoutData(fdlEncryptionMode);
wEncryptionMode = new CCombo(wSenderSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wEncryptionMode.setItems(JobEntrySendNagiosPassiveCheck.encryption_mode_Desc);
props.setLook(wEncryptionMode);
fdEncryptionMode = new FormData();
fdEncryptionMode.left = new FormAttachment(middle, margin);
fdEncryptionMode.top = new FormAttachment(wSenderServiceName, margin);
fdEncryptionMode.right = new FormAttachment(100, 0);
wEncryptionMode.setLayoutData(fdEncryptionMode);
wEncryptionMode.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Level mode
wlLevelMode = new Label(wSenderSettings, SWT.RIGHT);
wlLevelMode.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.LevelMode.Label"));
props.setLook(wlLevelMode);
fdlLevelMode = new FormData();
fdlLevelMode.left = new FormAttachment(0, margin);
fdlLevelMode.right = new FormAttachment(middle, -margin);
fdlLevelMode.top = new FormAttachment(wEncryptionMode, margin);
wlLevelMode.setLayoutData(fdlLevelMode);
wLevelMode = new CCombo(wSenderSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wLevelMode.setItems(JobEntrySendNagiosPassiveCheck.level_type_Desc);
props.setLook(wLevelMode);
fdLevelMode = new FormData();
fdLevelMode.left = new FormAttachment(middle, margin);
fdLevelMode.top = new FormAttachment(wEncryptionMode, margin);
fdLevelMode.right = new FormAttachment(100, 0);
wLevelMode.setLayoutData(fdLevelMode);
wLevelMode.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
fdSenderSettings = new FormData();
fdSenderSettings.left = new FormAttachment(0, margin);
fdSenderSettings.top = new FormAttachment(wServerSettings, margin);
fdSenderSettings.right = new FormAttachment(100, -margin);
wSenderSettings.setLayoutData(fdSenderSettings);
// ///////////////////////////////////////////////////////////
// / END OF Advanced SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF MESSAGE GROUP///
// /
wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wMessageGroup);
wMessageGroup.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.MessageGroup.Group.Label"));
FormLayout MessageGroupgroupLayout = new FormLayout();
MessageGroupgroupLayout.marginWidth = 10;
MessageGroupgroupLayout.marginHeight = 10;
wMessageGroup.setLayout(MessageGroupgroupLayout);
// Message line
wlMessage = new Label(wMessageGroup, SWT.RIGHT);
wlMessage.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Message.Label"));
props.setLook(wlMessage);
fdlMessage = new FormData();
fdlMessage.left = new FormAttachment(0, 0);
fdlMessage.top = new FormAttachment(wSenderSettings, margin);
fdlMessage.right = new FormAttachment(middle, -margin);
wlMessage.setLayoutData(fdlMessage);
wMessage = new StyledTextComp(jobMeta, wMessageGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wMessage);
wMessage.addModifyListener(lsMod);
fdMessage = new FormData();
fdMessage.left = new FormAttachment(middle, 0);
fdMessage.top = new FormAttachment(wSenderSettings, margin);
fdMessage.right = new FormAttachment(100, -2 * margin);
fdMessage.bottom = new FormAttachment(100, -margin);
wMessage.setLayoutData(fdMessage);
fdMessageGroup = new FormData();
fdMessageGroup.left = new FormAttachment(0, margin);
fdMessageGroup.top = new FormAttachment(wSenderSettings, margin);
fdMessageGroup.right = new FormAttachment(100, -margin);
fdMessageGroup.bottom = new FormAttachment(100, -margin);
wMessageGroup.setLayoutData(fdMessageGroup);
// ///////////////////////////////////////////////////////////
// / END OF MESSAGE GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wResponseTimeOut.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobSendNagiosPassiveCheckDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-kettle by pentaho.
the class JobEntrySyslogDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobEntrySyslog.Name.Label"), BaseMessages.getString(PKG, "JobEntrySyslog.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobEntrySyslog.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// Server port line
wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobEntrySyslog.Server.Label"), BaseMessages.getString(PKG, "JobEntrySyslog.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Server port line
wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobEntrySyslog.Port.Label"), BaseMessages.getString(PKG, "JobEntrySyslog.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(wServerName, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobEntrySyslog.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobEntrySyslog.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wPort, 2 * margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wName, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Log SETTINGS GROUP///
// /
wLogSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wLogSettings);
wLogSettings.setText(BaseMessages.getString(PKG, "JobEntrySyslog.LogSettings.Group.Label"));
FormLayout LogSettingsgroupLayout = new FormLayout();
LogSettingsgroupLayout.marginWidth = 10;
LogSettingsgroupLayout.marginHeight = 10;
wLogSettings.setLayout(LogSettingsgroupLayout);
// Facility type
wlFacility = new Label(wLogSettings, SWT.RIGHT);
wlFacility.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Facility.Label"));
props.setLook(wlFacility);
fdlFacility = new FormData();
fdlFacility.left = new FormAttachment(0, margin);
fdlFacility.right = new FormAttachment(middle, -margin);
fdlFacility.top = new FormAttachment(wServerSettings, margin);
wlFacility.setLayoutData(fdlFacility);
wFacility = new CCombo(wLogSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wFacility.setItems(SyslogDefs.FACILITYS);
props.setLook(wFacility);
fdFacility = new FormData();
fdFacility.left = new FormAttachment(middle, margin);
fdFacility.top = new FormAttachment(wServerSettings, margin);
fdFacility.right = new FormAttachment(100, 0);
wFacility.setLayoutData(fdFacility);
wFacility.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Priority type
wlPriority = new Label(wLogSettings, SWT.RIGHT);
wlPriority.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Priority.Label"));
props.setLook(wlPriority);
fdlPriority = new FormData();
fdlPriority.left = new FormAttachment(0, margin);
fdlPriority.right = new FormAttachment(middle, -margin);
fdlPriority.top = new FormAttachment(wFacility, margin);
wlPriority.setLayoutData(fdlPriority);
wPriority = new CCombo(wLogSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wPriority.setItems(SyslogDefs.PRIORITYS);
props.setLook(wPriority);
fdPriority = new FormData();
fdPriority.left = new FormAttachment(middle, margin);
fdPriority.top = new FormAttachment(wFacility, margin);
fdPriority.right = new FormAttachment(100, 0);
wPriority.setLayoutData(fdPriority);
wPriority.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
fdLogSettings = new FormData();
fdLogSettings.left = new FormAttachment(0, margin);
fdLogSettings.top = new FormAttachment(wServerSettings, margin);
fdLogSettings.right = new FormAttachment(100, -margin);
wLogSettings.setLayoutData(fdLogSettings);
// ///////////////////////////////////////////////////////////
// / END OF Log SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF MESSAGE GROUP///
// /
wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wMessageGroup);
wMessageGroup.setText(BaseMessages.getString(PKG, "JobEntrySyslog.MessageGroup.Group.Label"));
FormLayout MessageGroupgroupLayout = new FormLayout();
MessageGroupgroupLayout.marginWidth = 10;
MessageGroupgroupLayout.marginHeight = 10;
wMessageGroup.setLayout(MessageGroupgroupLayout);
// Add HostName?
wlAddHostName = new Label(wMessageGroup, SWT.RIGHT);
wlAddHostName.setText(BaseMessages.getString(PKG, "JobEntrySyslog.AddHostName.Label"));
props.setLook(wlAddHostName);
fdlAddHostName = new FormData();
fdlAddHostName.left = new FormAttachment(0, 0);
fdlAddHostName.top = new FormAttachment(wLogSettings, margin);
fdlAddHostName.right = new FormAttachment(middle, -margin);
wlAddHostName.setLayoutData(fdlAddHostName);
wAddHostName = new Button(wMessageGroup, SWT.CHECK);
props.setLook(wAddHostName);
wAddHostName.setToolTipText(BaseMessages.getString(PKG, "JobEntrySyslog.AddHostName.Tooltip"));
fdAddHostName = new FormData();
fdAddHostName.left = new FormAttachment(middle, margin);
fdAddHostName.top = new FormAttachment(wLogSettings, margin);
fdAddHostName.right = new FormAttachment(100, 0);
wAddHostName.setLayoutData(fdAddHostName);
wAddHostName.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Add timestamp?
wlAddTimestamp = new Label(wMessageGroup, SWT.RIGHT);
wlAddTimestamp.setText(BaseMessages.getString(PKG, "JobEntrySyslog.AddTimestamp.Label"));
props.setLook(wlAddTimestamp);
fdlAddTimestamp = new FormData();
fdlAddTimestamp.left = new FormAttachment(0, 0);
fdlAddTimestamp.top = new FormAttachment(wAddHostName, margin);
fdlAddTimestamp.right = new FormAttachment(middle, -margin);
wlAddTimestamp.setLayoutData(fdlAddTimestamp);
wAddTimestamp = new Button(wMessageGroup, SWT.CHECK);
props.setLook(wAddTimestamp);
wAddTimestamp.setToolTipText(BaseMessages.getString(PKG, "JobEntrySyslog.AddTimestamp.Tooltip"));
fdAddTimestamp = new FormData();
fdAddTimestamp.left = new FormAttachment(middle, margin);
fdAddTimestamp.top = new FormAttachment(wAddHostName, margin);
fdAddTimestamp.right = new FormAttachment(100, 0);
wAddTimestamp.setLayoutData(fdAddTimestamp);
wAddTimestamp.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeAddTimestamp();
jobEntry.setChanged();
}
});
// DatePattern type
wlDatePattern = new Label(wMessageGroup, SWT.RIGHT);
wlDatePattern.setText(BaseMessages.getString(PKG, "JobEntrySyslog.DatePattern.Label"));
props.setLook(wlDatePattern);
fdlDatePattern = new FormData();
fdlDatePattern.left = new FormAttachment(0, margin);
fdlDatePattern.right = new FormAttachment(middle, -margin);
fdlDatePattern.top = new FormAttachment(wAddTimestamp, margin);
wlDatePattern.setLayoutData(fdlDatePattern);
wDatePattern = new ComboVar(jobMeta, wMessageGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wDatePattern.setItems(Const.getDateFormats());
props.setLook(wDatePattern);
fdDatePattern = new FormData();
fdDatePattern.left = new FormAttachment(middle, margin);
fdDatePattern.top = new FormAttachment(wAddTimestamp, margin);
fdDatePattern.right = new FormAttachment(100, 0);
wDatePattern.setLayoutData(fdDatePattern);
wDatePattern.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Message line
wlMessage = new Label(wMessageGroup, SWT.RIGHT);
wlMessage.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Message.Label"));
props.setLook(wlMessage);
fdlMessage = new FormData();
fdlMessage.left = new FormAttachment(0, margin);
fdlMessage.top = new FormAttachment(wLogSettings, margin);
fdlMessage.right = new FormAttachment(middle, -margin);
wlMessage.setLayoutData(fdlMessage);
wMessage = new StyledTextComp(jobEntry, wMessageGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wMessage);
wMessage.addModifyListener(lsMod);
fdMessage = new FormData();
fdMessage.left = new FormAttachment(middle, margin);
fdMessage.top = new FormAttachment(wDatePattern, margin);
fdMessage.right = new FormAttachment(100, -2 * margin);
fdMessage.bottom = new FormAttachment(100, -margin);
wMessage.setLayoutData(fdMessage);
fdMessageGroup = new FormData();
fdMessageGroup.left = new FormAttachment(0, margin);
fdMessageGroup.top = new FormAttachment(wLogSettings, margin);
fdMessageGroup.right = new FormAttachment(100, -margin);
fdMessageGroup.bottom = new FormAttachment(100, -margin);
wMessageGroup.setLayoutData(fdMessageGroup);
// ///////////////////////////////////////////////////////////
// / END OF MESSAGE GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activeAddTimestamp();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobEntrySyslogDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-kettle by pentaho.
the class DatabaseJoinDialog 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();
}
};
backupChanged = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.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);
// Connection line
wConnection = addConnectionLine(shell, wStepname, middle, margin);
if (input.getDatabaseMeta() == null && transMeta.nrDatabases() == 1) {
wConnection.select(0);
}
wConnection.addModifyListener(lsMod);
// SQL editor...
wlSQL = new Label(shell, SWT.NONE);
wlSQL.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.SQL.Label"));
props.setLook(wlSQL);
fdlSQL = new FormData();
fdlSQL.left = new FormAttachment(0, 0);
fdlSQL.top = new FormAttachment(wConnection, margin * 2);
wlSQL.setLayoutData(fdlSQL);
wSQL = new StyledTextComp(transMeta, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wSQL, Props.WIDGET_STYLE_FIXED);
wSQL.addModifyListener(lsMod);
fdSQL = new FormData();
fdSQL.left = new FormAttachment(0, 0);
fdSQL.top = new FormAttachment(wlSQL, margin);
fdSQL.right = new FormAttachment(100, -2 * margin);
fdSQL.bottom = new FormAttachment(60, 0);
wSQL.setLayoutData(fdSQL);
wSQL.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
setPosition();
}
});
wSQL.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
setPosition();
}
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wSQL.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
setPosition();
}
public void focusLost(FocusEvent e) {
setPosition();
}
});
wSQL.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
public void mouseDown(MouseEvent e) {
setPosition();
}
public void mouseUp(MouseEvent e) {
setPosition();
}
});
// SQL Higlighting
wSQL.addLineStyleListener(new SQLValuesHighlight());
wlPosition = new Label(shell, SWT.NONE);
props.setLook(wlPosition);
fdlPosition = new FormData();
fdlPosition.left = new FormAttachment(0, 0);
fdlPosition.top = new FormAttachment(wSQL, margin);
fdlPosition.right = new FormAttachment(100, 0);
wlPosition.setLayoutData(fdlPosition);
// Limit the number of lines returns
wlLimit = new Label(shell, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Limit.Label"));
props.setLook(wlLimit);
fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.right = new FormAttachment(middle, -margin);
fdlLimit.top = new FormAttachment(wlPosition, margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLimit);
wLimit.addModifyListener(lsMod);
fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.right = new FormAttachment(100, 0);
fdLimit.top = new FormAttachment(wlPosition, margin);
wLimit.setLayoutData(fdLimit);
// Outer join?
wlOuter = new Label(shell, SWT.RIGHT);
wlOuter.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Outerjoin.Label"));
wlOuter.setToolTipText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Outerjoin.Tooltip"));
props.setLook(wlOuter);
fdlOuter = new FormData();
fdlOuter.left = new FormAttachment(0, 0);
fdlOuter.right = new FormAttachment(middle, -margin);
fdlOuter.top = new FormAttachment(wLimit, margin);
wlOuter.setLayoutData(fdlOuter);
wOuter = new Button(shell, SWT.CHECK);
props.setLook(wOuter);
wOuter.setToolTipText(wlOuter.getToolTipText());
fdOuter = new FormData();
fdOuter.left = new FormAttachment(middle, 0);
fdOuter.top = new FormAttachment(wLimit, margin);
wOuter.setLayoutData(fdOuter);
wOuter.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// useVars ?
wluseVars = new Label(shell, SWT.RIGHT);
wluseVars.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.useVarsjoin.Label"));
wluseVars.setToolTipText(BaseMessages.getString(PKG, "DatabaseJoinDialog.useVarsjoin.Tooltip"));
props.setLook(wluseVars);
fdluseVars = new FormData();
fdluseVars.left = new FormAttachment(0, 0);
fdluseVars.right = new FormAttachment(middle, -margin);
fdluseVars.top = new FormAttachment(wOuter, margin);
wluseVars.setLayoutData(fdluseVars);
wuseVars = new Button(shell, SWT.CHECK);
props.setLook(wuseVars);
wuseVars.setToolTipText(wluseVars.getToolTipText());
fduseVars = new FormData();
fduseVars.left = new FormAttachment(middle, 0);
fduseVars.top = new FormAttachment(wOuter, margin);
wuseVars.setLayoutData(fduseVars);
wuseVars.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.GetFields.Button"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel, wGet }, margin, null);
// The parameters
wlParam = new Label(shell, SWT.NONE);
wlParam.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Param.Label"));
props.setLook(wlParam);
fdlParam = new FormData();
fdlParam.left = new FormAttachment(0, 0);
fdlParam.top = new FormAttachment(wuseVars, margin);
wlParam.setLayoutData(fdlParam);
int nrKeyCols = 2;
int nrKeyRows = (input.getParameterField() != null ? input.getParameterField().length : 1);
ciKey = new ColumnInfo[nrKeyCols];
ciKey[0] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseJoinDialog.ColumnInfo.ParameterFieldname"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciKey[1] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseJoinDialog.ColumnInfo.ParameterType"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames());
wParam = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciKey, nrKeyRows, lsMod, props);
fdParam = new FormData();
fdParam.left = new FormAttachment(0, 0);
fdParam.top = new FormAttachment(wlParam, margin);
fdParam.right = new FormAttachment(100, 0);
fdParam.bottom = new FormAttachment(wOK, -2 * margin);
wParam.setLayoutData(fdParam);
//
// 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();
// 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();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wLimit.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();
input.setChanged(backupChanged);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-kettle by pentaho.
the class JobEntryEvalDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobEval.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
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"));
// at the bottom
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, null);
// Filename line
wlName = new Label(shell, SWT.NONE);
wlName.setText(BaseMessages.getString(PKG, "JobEval.Jobname.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wlPosition = new Label(shell, SWT.NONE);
wlPosition.setText(BaseMessages.getString(PKG, "JobEval.LineNr.Label", "0"));
props.setLook(wlPosition);
fdlPosition = new FormData();
fdlPosition.left = new FormAttachment(0, 0);
fdlPosition.bottom = new FormAttachment(wOK, -margin);
wlPosition.setLayoutData(fdlPosition);
// Script line
wlScript = new Label(shell, SWT.NONE);
wlScript.setText(BaseMessages.getString(PKG, "JobEval.Script.Label"));
props.setLook(wlScript);
fdlScript = new FormData();
fdlScript.left = new FormAttachment(0, 0);
fdlScript.top = new FormAttachment(wName, margin);
wlScript.setLayoutData(fdlScript);
wScript = new StyledTextComp(jobEntry, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
wScript.setText(BaseMessages.getString(PKG, "JobEval.Script.Default"));
props.setLook(wScript, Props.WIDGET_STYLE_FIXED);
wScript.addModifyListener(lsMod);
fdScript = new FormData();
fdScript.left = new FormAttachment(0, 0);
fdScript.top = new FormAttachment(wlScript, margin);
fdScript.right = new FormAttachment(100, -10);
fdScript.bottom = new FormAttachment(wlPosition, -margin);
wScript.setLayoutData(fdScript);
wScript.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
setPosition();
}
});
wScript.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
setPosition();
}
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wScript.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
setPosition();
}
public void focusLost(FocusEvent e) {
setPosition();
}
});
wScript.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
public void mouseDown(MouseEvent e) {
setPosition();
}
public void mouseUp(MouseEvent e) {
setPosition();
}
});
wScript.addModifyListener(lsMod);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
BaseStepDialog.setSize(shell, 250, 250, false);
shell.open();
props.setDialogSize(shell, "JobEvalDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
Aggregations