Search in sources :

Example 21 with PasswordTextVar

use of org.pentaho.di.ui.core.widget.PasswordTextVar 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;
}
Also used : StyledTextComp(org.pentaho.di.ui.core.widget.StyledTextComp) Group(org.eclipse.swt.widgets.Group) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) CTabItem(org.eclipse.swt.custom.CTabItem) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) ControlSpaceKeyAdapter(org.pentaho.di.ui.core.widget.ControlSpaceKeyAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) CCombo(org.eclipse.swt.custom.CCombo) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileDialog(org.eclipse.swt.widgets.FileDialog) FocusListener(org.eclipse.swt.events.FocusListener) Display(org.eclipse.swt.widgets.Display)

Example 22 with PasswordTextVar

use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.

the class LDAPOutputDialog 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, "LDAPOutputDialog.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, "LDAPOutputDialog.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 Connection GROUP
    // /////////////////////////////////
    wConnectionGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wConnectionGroup);
    wConnectionGroup.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Group.ConnectionGroup.Label"));
    FormLayout connectiongroupLayout = new FormLayout();
    connectiongroupLayout.marginWidth = 10;
    connectiongroupLayout.marginHeight = 10;
    wConnectionGroup.setLayout(connectiongroupLayout);
    // Host line
    wlHost = new Label(wConnectionGroup, SWT.RIGHT);
    wlHost.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.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, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wHost.setToolTipText(BaseMessages.getString(PKG, "LDAPOutputDialog.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(wConnectionGroup, SWT.RIGHT);
    wlPort.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.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, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPort);
    wPort.setToolTipText(BaseMessages.getString(PKG, "LDAPOutputDialog.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);
    // Referral
    wlReferral = new Label(wConnectionGroup, SWT.RIGHT);
    wlReferral.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Referral.Label"));
    props.setLook(wlReferral);
    fdlReferral = new FormData();
    fdlReferral.left = new FormAttachment(0, 0);
    fdlReferral.right = new FormAttachment(middle, -margin);
    fdlReferral.top = new FormAttachment(wPort, margin);
    wlReferral.setLayoutData(fdlReferral);
    wReferral = new CCombo(wConnectionGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wReferral);
    wReferral.addModifyListener(lsMod);
    fdReferral = new FormData();
    fdReferral.left = new FormAttachment(middle, 0);
    fdReferral.top = new FormAttachment(wPort, margin);
    fdReferral.right = new FormAttachment(100, -margin);
    wReferral.setLayoutData(fdReferral);
    wReferral.setItems(LDAPOutputMeta.referralTypeDesc);
    wReferral.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // DerefAliases
    wlDerefAliases = new Label(wConnectionGroup, SWT.RIGHT);
    wlDerefAliases.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.DerefAliases.Label"));
    props.setLook(wlDerefAliases);
    fdlDerefAliases = new FormData();
    fdlDerefAliases.left = new FormAttachment(0, 0);
    fdlDerefAliases.right = new FormAttachment(middle, -margin);
    fdlDerefAliases.top = new FormAttachment(wReferral, margin);
    wlDerefAliases.setLayoutData(fdlDerefAliases);
    wDerefAliases = new CCombo(wConnectionGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wDerefAliases);
    wDerefAliases.addModifyListener(lsMod);
    fdDerefAliases = new FormData();
    fdDerefAliases.left = new FormAttachment(middle, 0);
    fdDerefAliases.top = new FormAttachment(wReferral, margin);
    fdDerefAliases.right = new FormAttachment(100, -margin);
    wDerefAliases.setLayoutData(fdDerefAliases);
    wDerefAliases.setItems(LDAPOutputMeta.derefAliasesTypeDesc);
    wDerefAliases.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Protocol Line
    wlProtocol = new Label(wConnectionGroup, SWT.RIGHT);
    wlProtocol.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Protocol.Label"));
    props.setLook(wlProtocol);
    fdlProtocol = new FormData();
    fdlProtocol.left = new FormAttachment(0, 0);
    fdlProtocol.right = new FormAttachment(middle, -margin);
    fdlProtocol.top = new FormAttachment(wDerefAliases, margin);
    wlProtocol.setLayoutData(fdlProtocol);
    wProtocol = new ComboVar(transMeta, wConnectionGroup, 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(wDerefAliases, 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();
        }
    });
    fdConnectionGroup = new FormData();
    fdConnectionGroup.left = new FormAttachment(0, margin);
    fdConnectionGroup.top = new FormAttachment(0, margin);
    fdConnectionGroup.right = new FormAttachment(100, -margin);
    wConnectionGroup.setLayoutData(fdConnectionGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF CONNECTION GROUP
    // ///////////////////////////////////////////////////////////
    // /////////////////////////////////
    // START OF Authentication GROUP
    // /////////////////////////////////
    wAuthenticationGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wAuthenticationGroup);
    wAuthenticationGroup.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.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, "LDAPOutputDialog.usingAuthentication.Label"));
    props.setLook(wlusingAuthentication);
    fdlusingAuthentication = new FormData();
    fdlusingAuthentication.left = new FormAttachment(0, 0);
    fdlusingAuthentication.top = new FormAttachment(wConnectionGroup, margin);
    fdlusingAuthentication.right = new FormAttachment(middle, -margin);
    wlusingAuthentication.setLayoutData(fdlusingAuthentication);
    wusingAuthentication = new Button(wAuthenticationGroup, SWT.CHECK);
    props.setLook(wusingAuthentication);
    wusingAuthentication.setToolTipText(BaseMessages.getString(PKG, "LDAPOutputDialog.usingAuthentication.Tooltip"));
    FormData fdusingAuthentication = new FormData();
    fdusingAuthentication.left = new FormAttachment(middle, 0);
    fdusingAuthentication.top = new FormAttachment(wConnectionGroup, 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, "LDAPOutputDialog.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, "LDAPOutputDialog.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, "LDAPOutputDialog.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, "LDAPOutputDialog.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(wConnectionGroup, 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, "LDAPOutputDialog.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, "LDAPOutputDialog.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, "LDAPOutputDialog.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, "LDAPOutputDialog.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) {
            DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wTrustStorePath.getText() != null) {
                String fpath = transMeta.environmentSubstitute(wTrustStorePath.getText());
                dialog.setFilterPath(fpath);
            }
            if (dialog.open() != null) {
                String str = dialog.getFilterPath();
                wTrustStorePath.setText(str);
            }
        }
    });
    wTrustStorePath = new TextVar(transMeta, wCertificateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTrustStorePath);
    wTrustStorePath.setToolTipText(BaseMessages.getString(PKG, "LDAPOutputDialog.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, "LDAPOutputDialog.TrustStorePassword.Label"));
    props.setLook(wlTrustStorePassword);
    fdlTrustStorePassword = new FormData();
    fdlTrustStorePassword.left = new FormAttachment(0, -margin);
    fdlTrustStorePassword.top = new FormAttachment(wTrustStorePath, 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, "LDAPOutputDialog.TrustStorePassword.Tooltip"));
    wTrustStorePassword.addModifyListener(lsMod);
    fdTrustStorePassword = new FormData();
    fdTrustStorePassword.left = new FormAttachment(middle, 0);
    fdTrustStorePassword.top = new FormAttachment(wTrustStorePath, margin);
    fdTrustStorePassword.right = new FormAttachment(100, -margin);
    wTrustStorePassword.setLayoutData(fdTrustStorePassword);
    // Trust all certificate?
    wlTrustAll = new Label(wCertificateGroup, SWT.RIGHT);
    wlTrustAll.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.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, "LDAPOutputDialog.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, "LDAPOutputDialog.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "LDAPOutputDialog.TestConnection.Tooltip"));
    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 Settings TAB ///
    // ////////////////////////
    wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
    wSettingsTab.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Settings.Tab"));
    wSettingsComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSettingsComp);
    FormLayout settLayout = new FormLayout();
    settLayout.marginWidth = 3;
    settLayout.marginHeight = 3;
    wSettingsComp.setLayout(settLayout);
    // /////////////////////////////////
    // START OF Search GROUP
    // /////////////////////////////////
    wSettings = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wSettings);
    wSettings.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Group.Settings.Label"));
    FormLayout SettingsLayout = new FormLayout();
    SettingsLayout.marginWidth = 10;
    SettingsLayout.marginHeight = 10;
    wSettings.setLayout(SettingsLayout);
    // Operation
    wlOperation = new Label(wSettings, SWT.RIGHT);
    wlOperation.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Operation.Label"));
    props.setLook(wlOperation);
    fdlOperation = new FormData();
    fdlOperation.left = new FormAttachment(0, 0);
    fdlOperation.right = new FormAttachment(middle, -margin);
    fdlOperation.top = new FormAttachment(wStepname, margin);
    wlOperation.setLayoutData(fdlOperation);
    wOperation = new CCombo(wSettings, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wOperation);
    wOperation.addModifyListener(lsMod);
    fdOperation = new FormData();
    fdOperation.left = new FormAttachment(middle, 0);
    fdOperation.top = new FormAttachment(wStepname, margin);
    fdOperation.right = new FormAttachment(100, -margin);
    wOperation.setLayoutData(fdOperation);
    wOperation.setItems(LDAPOutputMeta.operationTypeDesc);
    wOperation.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            updateOperation();
            input.setChanged();
        }
    });
    // Multi valued field separator
    wlMultiValuedSeparator = new Label(wSettings, SWT.RIGHT);
    wlMultiValuedSeparator.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.MultiValuedSeparator.Label"));
    props.setLook(wlMultiValuedSeparator);
    fdlMultiValuedSeparator = new FormData();
    fdlMultiValuedSeparator.left = new FormAttachment(0, 0);
    fdlMultiValuedSeparator.top = new FormAttachment(wOperation, margin);
    fdlMultiValuedSeparator.right = new FormAttachment(middle, -margin);
    wlMultiValuedSeparator.setLayoutData(fdlMultiValuedSeparator);
    wMultiValuedSeparator = new TextVar(transMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wMultiValuedSeparator);
    wMultiValuedSeparator.setToolTipText(BaseMessages.getString(PKG, "LDAPOutputDialog.MultiValuedSeparator.Tooltip"));
    wMultiValuedSeparator.addModifyListener(lsMod);
    fdMultiValuedSeparator = new FormData();
    fdMultiValuedSeparator.left = new FormAttachment(middle, 0);
    fdMultiValuedSeparator.top = new FormAttachment(wOperation, margin);
    fdMultiValuedSeparator.right = new FormAttachment(100, 0);
    wMultiValuedSeparator.setLayoutData(fdMultiValuedSeparator);
    // Fail id not exist
    wlFailIfNotExist = new Label(wSettings, SWT.RIGHT);
    wlFailIfNotExist.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.FailIfNotExist.Label"));
    props.setLook(wlFailIfNotExist);
    fdlFailIfNotExist = new FormData();
    fdlFailIfNotExist.left = new FormAttachment(0, 0);
    fdlFailIfNotExist.top = new FormAttachment(wMultiValuedSeparator, margin);
    fdlFailIfNotExist.right = new FormAttachment(middle, -margin);
    wlFailIfNotExist.setLayoutData(fdlFailIfNotExist);
    wFailIfNotExist = new Button(wSettings, SWT.CHECK);
    wFailIfNotExist.setToolTipText(BaseMessages.getString(PKG, "LDAPOutputDialog.FailIfNotExist.Tooltip"));
    props.setLook(wFailIfNotExist);
    fdFailIfNotExist = new FormData();
    fdFailIfNotExist.left = new FormAttachment(middle, 0);
    fdFailIfNotExist.top = new FormAttachment(wMultiValuedSeparator, margin);
    fdFailIfNotExist.right = new FormAttachment(100, 0);
    wFailIfNotExist.setLayoutData(fdFailIfNotExist);
    SelectionAdapter lsSelR = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
        }
    };
    wFailIfNotExist.addSelectionListener(lsSelR);
    // Dn fieldname
    wlDnField = new Label(wSettings, SWT.RIGHT);
    wlDnField.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.DnField.Label"));
    props.setLook(wlDnField);
    fdlDnField = new FormData();
    fdlDnField.left = new FormAttachment(0, 0);
    fdlDnField.top = new FormAttachment(wFailIfNotExist, margin);
    fdlDnField.right = new FormAttachment(middle, -margin);
    wlDnField.setLayoutData(fdlDnField);
    wDnField = new ComboVar(transMeta, wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wDnField.setEditable(true);
    props.setLook(wDnField);
    wDnField.addModifyListener(lsMod);
    fdDnField = new FormData();
    fdDnField.left = new FormAttachment(middle, 0);
    fdDnField.top = new FormAttachment(wFailIfNotExist, margin);
    fdDnField.right = new FormAttachment(100, -margin);
    wDnField.setLayoutData(fdDnField);
    wDnField.addFocusListener(new FocusListener() {

        public void focusLost(org.eclipse.swt.events.FocusEvent e) {
        }

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            getPreviousFields();
        }
    });
    fdSettings = new FormData();
    fdSettings.left = new FormAttachment(0, margin);
    fdSettings.top = new FormAttachment(wConnectionGroup, margin);
    fdSettings.right = new FormAttachment(100, -margin);
    wSettings.setLayoutData(fdSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Search GROUP
    // ///////////////////////////////////////////////////////////
    // /////////////////////////////////
    // START OF Rename GROUP
    // /////////////////////////////////
    wRenameGroup = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wRenameGroup);
    wRenameGroup.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Group.RenameGroup.Label"));
    FormLayout RenameGroupLayout = new FormLayout();
    RenameGroupLayout.marginWidth = 10;
    RenameGroupLayout.marginHeight = 10;
    wRenameGroup.setLayout(RenameGroupLayout);
    // OldDn fieldname
    wlOldDnField = new Label(wRenameGroup, SWT.RIGHT);
    wlOldDnField.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.OldDnField.Label"));
    props.setLook(wlOldDnField);
    fdlOldDnField = new FormData();
    fdlOldDnField.left = new FormAttachment(0, 0);
    fdlOldDnField.top = new FormAttachment(wSettings, margin);
    fdlOldDnField.right = new FormAttachment(middle, -margin);
    wlOldDnField.setLayoutData(fdlOldDnField);
    wOldDnField = new ComboVar(transMeta, wRenameGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wOldDnField.setEditable(true);
    props.setLook(wOldDnField);
    wOldDnField.addModifyListener(lsMod);
    fdOldDnField = new FormData();
    fdOldDnField.left = new FormAttachment(middle, 0);
    fdOldDnField.top = new FormAttachment(wSettings, margin);
    fdOldDnField.right = new FormAttachment(100, -margin);
    wOldDnField.setLayoutData(fdOldDnField);
    wOldDnField.addFocusListener(new FocusListener() {

        public void focusLost(org.eclipse.swt.events.FocusEvent e) {
        }

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            getPreviousFields();
        }
    });
    // NewDn fieldname
    wlNewDnField = new Label(wRenameGroup, SWT.RIGHT);
    wlNewDnField.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.NewDnField.Label"));
    props.setLook(wlNewDnField);
    fdlNewDnField = new FormData();
    fdlNewDnField.left = new FormAttachment(0, 0);
    fdlNewDnField.top = new FormAttachment(wOldDnField, margin);
    fdlNewDnField.right = new FormAttachment(middle, -margin);
    wlNewDnField.setLayoutData(fdlNewDnField);
    wNewDnField = new ComboVar(transMeta, wRenameGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wNewDnField.setEditable(true);
    props.setLook(wNewDnField);
    wNewDnField.addModifyListener(lsMod);
    fdNewDnField = new FormData();
    fdNewDnField.left = new FormAttachment(middle, 0);
    fdNewDnField.top = new FormAttachment(wOldDnField, margin);
    fdNewDnField.right = new FormAttachment(100, -margin);
    wNewDnField.setLayoutData(fdNewDnField);
    wNewDnField.addFocusListener(new FocusListener() {

        public void focusLost(org.eclipse.swt.events.FocusEvent e) {
        }

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            getPreviousFields();
        }
    });
    wlDeleteRDN = new Label(wRenameGroup, SWT.RIGHT);
    wlDeleteRDN.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.DeleteRDN.Label"));
    props.setLook(wlDeleteRDN);
    fdlDeleteRDN = new FormData();
    fdlDeleteRDN.left = new FormAttachment(0, 0);
    fdlDeleteRDN.top = new FormAttachment(wNewDnField, margin);
    fdlDeleteRDN.right = new FormAttachment(middle, -margin);
    wlDeleteRDN.setLayoutData(fdlDeleteRDN);
    wDeleteRDN = new Button(wRenameGroup, SWT.CHECK);
    wDeleteRDN.setToolTipText(BaseMessages.getString(PKG, "LDAPOutputDialog.DeleteRDN.Tooltip"));
    props.setLook(wDeleteRDN);
    fdDeleteRDN = new FormData();
    fdDeleteRDN.left = new FormAttachment(middle, 0);
    fdDeleteRDN.top = new FormAttachment(wNewDnField, margin);
    fdDeleteRDN.right = new FormAttachment(100, 0);
    wDeleteRDN.setLayoutData(fdDeleteRDN);
    SelectionAdapter lsSeld = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
        }
    };
    wDeleteRDN.addSelectionListener(lsSeld);
    fdRenameGroup = new FormData();
    fdRenameGroup.left = new FormAttachment(0, margin);
    fdRenameGroup.top = new FormAttachment(wSettings, margin);
    fdRenameGroup.right = new FormAttachment(100, -margin);
    wRenameGroup.setLayoutData(fdRenameGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Rename GROUP
    // ///////////////////////////////////////////////////////////
    fdSettingsComp = new FormData();
    fdSettingsComp.left = new FormAttachment(0, 0);
    fdSettingsComp.top = new FormAttachment(0, 0);
    fdSettingsComp.right = new FormAttachment(100, 0);
    fdSettingsComp.bottom = new FormAttachment(100, 0);
    wSettingsComp.setLayoutData(fdSettingsComp);
    wSettingsComp.layout();
    wSettingsTab.setControl(wSettingsComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Settings TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Fields TAB ///
    // ////////////////////////
    wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Fields.Tab"));
    wFieldsComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFieldsComp);
    FormLayout fieldsLayout = new FormLayout();
    fieldsLayout.marginWidth = 3;
    fieldsLayout.marginHeight = 3;
    wFieldsComp.setLayout(fieldsLayout);
    // /////////////////////////////////
    // START OF Fields GROUP
    // /////////////////////////////////
    wFields = new Group(wFieldsComp, SWT.SHADOW_NONE);
    props.setLook(wFields);
    wFields.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Group.Fields.Label"));
    FormLayout FieldsLayout = new FormLayout();
    FieldsLayout.marginWidth = 10;
    FieldsLayout.marginHeight = 10;
    wFields.setLayout(FieldsLayout);
    // Basedn line
    wlBaseDN = new Label(wFields, SWT.RIGHT);
    wlBaseDN.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.BaseDN.Label"));
    props.setLook(wlBaseDN);
    fdlBaseDN = new FormData();
    fdlBaseDN.left = new FormAttachment(0, 0);
    fdlBaseDN.top = new FormAttachment(wSettings, margin);
    fdlBaseDN.right = new FormAttachment(middle, -margin);
    wlBaseDN.setLayoutData(fdlBaseDN);
    wBaseDN = new TextVar(transMeta, wFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wBaseDN.setToolTipText(BaseMessages.getString(PKG, "LDAPOutputDialog.BaseDN.Tooltip"));
    props.setLook(wBaseDN);
    wBaseDN.addModifyListener(lsMod);
    fdBaseDN = new FormData();
    fdBaseDN.left = new FormAttachment(middle, 0);
    fdBaseDN.top = new FormAttachment(wSettings, margin);
    fdBaseDN.right = new FormAttachment(100, 0);
    wBaseDN.setLayoutData(fdBaseDN);
    wBaseDN.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            input.setChanged();
            if (Utils.isEmpty(wBaseDN.getText())) {
                wDoMapping.setEnabled(false);
            } else {
                setFieldsCombo();
                wDoMapping.setEnabled(true);
            }
        }
    });
    // THE UPDATE/INSERT TABLE
    wlReturn = new Label(wFields, SWT.NONE);
    wlReturn.setText(BaseMessages.getString(PKG, "LDAPOutputUpdateDialog.UpdateFields.Label"));
    props.setLook(wlReturn);
    fdlReturn = new FormData();
    fdlReturn.left = new FormAttachment(0, 0);
    fdlReturn.top = new FormAttachment(wBaseDN, margin);
    wlReturn.setLayoutData(fdlReturn);
    int UpInsCols = 3;
    int UpInsRows = (input.getUpdateLookup() != null ? input.getUpdateLookup().length : 1);
    ciReturn = new ColumnInfo[UpInsCols];
    ciReturn[0] = new ColumnInfo(BaseMessages.getString(PKG, "LDAPOutputUpdateDialog.ColumnInfo.TableField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    ciReturn[1] = new ColumnInfo(BaseMessages.getString(PKG, "LDAPOutputUpdateDialog.ColumnInfo.StreamField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    ciReturn[2] = new ColumnInfo(BaseMessages.getString(PKG, "LDAPOutputUpdateDialog.ColumnInfo.Update"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "Y", "N" });
    tableFieldColumns.add(ciReturn[0]);
    wReturn = new TableView(transMeta, wFields, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props);
    wGetLU = new Button(wFields, SWT.PUSH);
    wGetLU.setText(BaseMessages.getString(PKG, "LDAPOutputUpdateDialog.GetAndUpdateFields.Label"));
    fdGetLU = new FormData();
    fdGetLU.top = new FormAttachment(wlReturn, margin);
    fdGetLU.right = new FormAttachment(100, 0);
    wGetLU.setLayoutData(fdGetLU);
    wDoMapping = new Button(wFields, SWT.PUSH);
    wDoMapping.setText(BaseMessages.getString(PKG, "LDAPOutputUpdateDialog.EditMapping.Label"));
    fdDoMapping = new FormData();
    fdDoMapping.top = new FormAttachment(wGetLU, margin);
    fdDoMapping.right = new FormAttachment(100, 0);
    wDoMapping.setLayoutData(fdDoMapping);
    wDoMapping.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event arg0) {
            generateMappings();
        }
    });
    fdReturn = new FormData();
    fdReturn.left = new FormAttachment(0, 0);
    fdReturn.top = new FormAttachment(wlReturn, margin);
    fdReturn.right = new FormAttachment(wGetLU, -5 * margin);
    fdReturn.bottom = new FormAttachment(100, -2 * margin);
    wReturn.setLayoutData(fdReturn);
    // 
    // 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();
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, margin);
    fdFields.top = new FormAttachment(wSettings, margin);
    fdFields.right = new FormAttachment(100, -margin);
    fdFields.bottom = new FormAttachment(100, -margin);
    wFields.setLayoutData(fdFields);
    // ///////////////////////////////////////////////////////////
    // / END OF Fields GROUP
    // ///////////////////////////////////////////////////////////
    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);
    // ///////////////////////////////////////////////////////////
    // / END OF Fields 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);
    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();
        }
    };
    lsTest = new Listener() {

        public void handleEvent(Event e) {
            test();
        }
    };
    lsCancel = new Listener() {

        public void handleEvent(Event e) {
            cancel();
        }
    };
    lsGetLU = new Listener() {

        public void handleEvent(Event e) {
            getUpdate();
        }
    };
    wOK.addListener(SWT.Selection, lsOK);
    wTest.addListener(SWT.Selection, lsTest);
    wCancel.addListener(SWT.Selection, lsCancel);
    wGetLU.addListener(SWT.Selection, lsGetLU);
    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();
        }
    });
    wTabFolder.setSelection(0);
    // Set the shell size, based upon previous time...
    setSize();
    getData(input);
    useAuthentication();
    setProtocol();
    setTrustStore();
    updateOperation();
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) KettleException(org.pentaho.di.core.exception.KettleException) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) CCombo(org.eclipse.swt.custom.CCombo) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) Display(org.eclipse.swt.widgets.Display)

Example 23 with PasswordTextVar

use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.

the class JobEntrySFTPDialog 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) {
            sftpclient = null;
            jobEntry.setChanged();
        }
    };
    changed = jobEntry.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobSFTP.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobSFTP.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "JobSFTP.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, "JobSFTP.ServerSettings.Group.Label"));
    FormLayout ServerSettingsgroupLayout = new FormLayout();
    ServerSettingsgroupLayout.marginWidth = 10;
    ServerSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(ServerSettingsgroupLayout);
    // ServerName line
    wlServerName = new Label(wServerSettings, SWT.RIGHT);
    wlServerName.setText(BaseMessages.getString(PKG, "JobSFTP.Server.Label"));
    props.setLook(wlServerName);
    fdlServerName = new FormData();
    fdlServerName.left = new FormAttachment(0, 0);
    fdlServerName.top = new FormAttachment(wName, margin);
    fdlServerName.right = new FormAttachment(middle, -margin);
    wlServerName.setLayoutData(fdlServerName);
    wServerName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    fdServerName = new FormData();
    fdServerName.left = new FormAttachment(middle, 0);
    fdServerName.top = new FormAttachment(wName, margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // ServerPort line
    wlServerPort = new Label(wServerSettings, SWT.RIGHT);
    wlServerPort.setText(BaseMessages.getString(PKG, "JobSFTP.Port.Label"));
    props.setLook(wlServerPort);
    fdlServerPort = new FormData();
    fdlServerPort.left = new FormAttachment(0, 0);
    fdlServerPort.top = new FormAttachment(wServerName, margin);
    fdlServerPort.right = new FormAttachment(middle, -margin);
    wlServerPort.setLayoutData(fdlServerPort);
    wServerPort = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerPort);
    wServerPort.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.Port.Tooltip"));
    wServerPort.addModifyListener(lsMod);
    fdServerPort = new FormData();
    fdServerPort.left = new FormAttachment(middle, 0);
    fdServerPort.top = new FormAttachment(wServerName, margin);
    fdServerPort.right = new FormAttachment(100, 0);
    wServerPort.setLayoutData(fdServerPort);
    // UserName line
    wlUserName = new Label(wServerSettings, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "JobSFTP.Username.Label"));
    props.setLook(wlUserName);
    fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wServerPort, margin);
    fdlUserName.right = new FormAttachment(middle, -margin);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wServerPort, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wlPassword = new Label(wServerSettings, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "JobSFTP.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(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    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);
    // usePublicKey
    wlusePublicKey = new Label(wServerSettings, SWT.RIGHT);
    wlusePublicKey.setText(BaseMessages.getString(PKG, "JobSFTP.useKeyFile.Label"));
    props.setLook(wlusePublicKey);
    fdlusePublicKey = new FormData();
    fdlusePublicKey.left = new FormAttachment(0, 0);
    fdlusePublicKey.top = new FormAttachment(wPassword, margin);
    fdlusePublicKey.right = new FormAttachment(middle, -margin);
    wlusePublicKey.setLayoutData(fdlusePublicKey);
    wusePublicKey = new Button(wServerSettings, SWT.CHECK);
    wusePublicKey.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.useKeyFile.Tooltip"));
    props.setLook(wusePublicKey);
    fdusePublicKey = new FormData();
    fdusePublicKey.left = new FormAttachment(middle, 0);
    fdusePublicKey.top = new FormAttachment(wPassword, margin);
    fdusePublicKey.right = new FormAttachment(100, 0);
    wusePublicKey.setLayoutData(fdusePublicKey);
    wusePublicKey.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeUseKey();
            jobEntry.setChanged();
        }
    });
    // Key File
    wlKeyFilename = new Label(wServerSettings, SWT.RIGHT);
    wlKeyFilename.setText(BaseMessages.getString(PKG, "JobSFTP.KeyFilename.Label"));
    props.setLook(wlKeyFilename);
    fdlKeyFilename = new FormData();
    fdlKeyFilename.left = new FormAttachment(0, 0);
    fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
    fdlKeyFilename.right = new FormAttachment(middle, -margin);
    wlKeyFilename.setLayoutData(fdlKeyFilename);
    wbKeyFilename = new Button(wServerSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbKeyFilename);
    wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbKeyFilename = new FormData();
    fdbKeyFilename.right = new FormAttachment(100, 0);
    fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
    // fdbKeyFilename.height = 22;
    wbKeyFilename.setLayoutData(fdbKeyFilename);
    wKeyFilename = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.KeyFilename.Tooltip"));
    props.setLook(wKeyFilename);
    wKeyFilename.addModifyListener(lsMod);
    fdKeyFilename = new FormData();
    fdKeyFilename.left = new FormAttachment(middle, 0);
    fdKeyFilename.top = new FormAttachment(wusePublicKey, margin);
    fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
    wKeyFilename.setLayoutData(fdKeyFilename);
    // Whenever something changes, set the tooltip to the expanded version:
    wbKeyFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.pem", "*" });
            if (wKeyFilename.getText() != null) {
                dialog.setFileName(jobMeta.environmentSubstitute(wKeyFilename.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
                wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
        }
    });
    // keyfilePass line
    wkeyfilePass = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.keyfilePass.Label"), BaseMessages.getString(PKG, "JobSFTP.keyfilePass.Tooltip"), true);
    props.setLook(wkeyfilePass);
    wkeyfilePass.addModifyListener(lsMod);
    fdkeyfilePass = new FormData();
    fdkeyfilePass.left = new FormAttachment(0, -2 * margin);
    fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
    fdkeyfilePass.right = new FormAttachment(100, 0);
    wkeyfilePass.setLayoutData(fdkeyfilePass);
    wlProxyType = new Label(wServerSettings, SWT.RIGHT);
    wlProxyType.setText(BaseMessages.getString(PKG, "JobSFTP.ProxyType.Label"));
    props.setLook(wlProxyType);
    fdlProxyType = new FormData();
    fdlProxyType.left = new FormAttachment(0, 0);
    fdlProxyType.right = new FormAttachment(middle, -margin);
    fdlProxyType.top = new FormAttachment(wkeyfilePass, 2 * margin);
    wlProxyType.setLayoutData(fdlProxyType);
    wProxyType = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wProxyType.add(SFTPClient.PROXY_TYPE_HTTP);
    wProxyType.add(SFTPClient.PROXY_TYPE_SOCKS5);
    // +1: starts at -1
    wProxyType.select(0);
    props.setLook(wProxyType);
    fdProxyType = new FormData();
    fdProxyType.left = new FormAttachment(middle, 0);
    fdProxyType.top = new FormAttachment(wkeyfilePass, 2 * margin);
    fdProxyType.right = new FormAttachment(100, 0);
    wProxyType.setLayoutData(fdProxyType);
    wProxyType.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setDefaulProxyPort();
        }
    });
    // Proxy host line
    wProxyHost = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.ProxyHost.Label"), BaseMessages.getString(PKG, "JobSFTP.ProxyHost.Tooltip"));
    props.setLook(wProxyHost);
    wProxyHost.addModifyListener(lsMod);
    fdProxyHost = new FormData();
    fdProxyHost.left = new FormAttachment(0, -2 * margin);
    fdProxyHost.top = new FormAttachment(wProxyType, margin);
    fdProxyHost.right = new FormAttachment(100, 0);
    wProxyHost.setLayoutData(fdProxyHost);
    // Proxy port line
    wProxyPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.ProxyPort.Label"), BaseMessages.getString(PKG, "JobSFTP.ProxyPort.Tooltip"));
    props.setLook(wProxyPort);
    wProxyPort.addModifyListener(lsMod);
    fdProxyPort = new FormData();
    fdProxyPort.left = new FormAttachment(0, -2 * margin);
    fdProxyPort.top = new FormAttachment(wProxyHost, margin);
    fdProxyPort.right = new FormAttachment(100, 0);
    wProxyPort.setLayoutData(fdProxyPort);
    // Proxy username line
    wProxyUsername = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobSFTP.ProxyUsername.Tooltip"));
    props.setLook(wProxyUsername);
    wProxyUsername.addModifyListener(lsMod);
    fdProxyUsername = new FormData();
    fdProxyUsername.left = new FormAttachment(0, -2 * margin);
    fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
    fdProxyUsername.right = new FormAttachment(100, 0);
    wProxyUsername.setLayoutData(fdProxyUsername);
    // Proxy password line
    wProxyPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTP.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobSFTP.ProxyPassword.Tooltip"), true);
    props.setLook(wProxyPassword);
    wProxyPassword.addModifyListener(lsMod);
    fdProxyPasswd = new FormData();
    fdProxyPasswd.left = new FormAttachment(0, -2 * margin);
    fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
    fdProxyPasswd.right = new FormAttachment(100, 0);
    wProxyPassword.setLayoutData(fdProxyPasswd);
    // Test connection button
    wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "JobSFTP.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wProxyPassword, 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
    // ///////////////////////////////////////////////////////////
    wlCompression = new Label(wGeneralComp, SWT.RIGHT);
    wlCompression.setText(BaseMessages.getString(PKG, "JobSFTP.Compression.Label"));
    props.setLook(wlCompression);
    fdlCompression = new FormData();
    fdlCompression.left = new FormAttachment(0, -margin);
    fdlCompression.right = new FormAttachment(middle, 0);
    fdlCompression.top = new FormAttachment(wServerSettings, margin);
    wlCompression.setLayoutData(fdlCompression);
    wCompression = new CCombo(wGeneralComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wCompression.add("none");
    wCompression.add("zlib");
    // +1: starts at -1
    wCompression.select(0);
    props.setLook(wCompression);
    fdCompression = new FormData();
    fdCompression.left = new FormAttachment(middle, margin);
    fdCompression.top = new FormAttachment(wServerSettings, margin);
    fdCompression.right = new FormAttachment(100, 0);
    wCompression.setLayoutData(fdCompression);
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Files TAB ///
    // ////////////////////////
    wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
    wFilesTab.setText(BaseMessages.getString(PKG, "JobSFTP.Tab.Files.Label"));
    wFilesComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFilesComp);
    FormLayout FilesLayout = new FormLayout();
    FilesLayout.marginWidth = 3;
    FilesLayout.marginHeight = 3;
    wFilesComp.setLayout(FilesLayout);
    // ////////////////////////
    // START OF Source files GROUP///
    // /
    wSourceFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wSourceFiles);
    wSourceFiles.setText(BaseMessages.getString(PKG, "JobSFTP.SourceFiles.Group.Label"));
    FormLayout SourceFilesgroupLayout = new FormLayout();
    SourceFilesgroupLayout.marginWidth = 10;
    SourceFilesgroupLayout.marginHeight = 10;
    wSourceFiles.setLayout(SourceFilesgroupLayout);
    // Get arguments from previous result...
    wlgetPrevious = new Label(wSourceFiles, SWT.RIGHT);
    wlgetPrevious.setText(BaseMessages.getString(PKG, "JobSFTP.getPrevious.Label"));
    props.setLook(wlgetPrevious);
    fdlgetPrevious = new FormData();
    fdlgetPrevious.left = new FormAttachment(0, 0);
    fdlgetPrevious.top = new FormAttachment(wServerSettings, 2 * margin);
    fdlgetPrevious.right = new FormAttachment(middle, -margin);
    wlgetPrevious.setLayoutData(fdlgetPrevious);
    wgetPrevious = new Button(wSourceFiles, SWT.CHECK);
    props.setLook(wgetPrevious);
    wgetPrevious.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.getPrevious.Tooltip"));
    fdgetPrevious = new FormData();
    fdgetPrevious.left = new FormAttachment(middle, 0);
    fdgetPrevious.top = new FormAttachment(wServerSettings, 2 * margin);
    fdgetPrevious.right = new FormAttachment(100, 0);
    wgetPrevious.setLayoutData(fdgetPrevious);
    wgetPrevious.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeCopyFromPrevious();
            jobEntry.setChanged();
        }
    });
    // FtpDirectory line
    wlScpDirectory = new Label(wSourceFiles, SWT.RIGHT);
    wlScpDirectory.setText(BaseMessages.getString(PKG, "JobSFTP.RemoteDir.Label"));
    props.setLook(wlScpDirectory);
    fdlScpDirectory = new FormData();
    fdlScpDirectory.left = new FormAttachment(0, 0);
    fdlScpDirectory.top = new FormAttachment(wgetPrevious, 2 * margin);
    fdlScpDirectory.right = new FormAttachment(middle, -margin);
    wlScpDirectory.setLayoutData(fdlScpDirectory);
    // Test remote folder button ...
    wbTestChangeFolderExists = new Button(wSourceFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTestChangeFolderExists);
    wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobSFTP.TestFolderExists.Label"));
    fdbTestChangeFolderExists = new FormData();
    fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
    fdbTestChangeFolderExists.top = new FormAttachment(wgetPrevious, 2 * margin);
    wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
    wScpDirectory = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSFTP.RemoteDir.Tooltip"));
    props.setLook(wScpDirectory);
    wScpDirectory.addModifyListener(lsMod);
    fdScpDirectory = new FormData();
    fdScpDirectory.left = new FormAttachment(middle, 0);
    fdScpDirectory.top = new FormAttachment(wgetPrevious, 2 * margin);
    fdScpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
    wScpDirectory.setLayoutData(fdScpDirectory);
    // Wildcard line
    wlWildcard = new Label(wSourceFiles, SWT.RIGHT);
    wlWildcard.setText(BaseMessages.getString(PKG, "JobSFTP.Wildcard.Label"));
    props.setLook(wlWildcard);
    fdlWildcard = new FormData();
    fdlWildcard.left = new FormAttachment(0, 0);
    fdlWildcard.top = new FormAttachment(wScpDirectory, margin);
    fdlWildcard.right = new FormAttachment(middle, -margin);
    wlWildcard.setLayoutData(fdlWildcard);
    wWildcard = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSFTP.Wildcard.Tooltip"));
    props.setLook(wWildcard);
    wWildcard.addModifyListener(lsMod);
    fdWildcard = new FormData();
    fdWildcard.left = new FormAttachment(middle, 0);
    fdWildcard.top = new FormAttachment(wScpDirectory, margin);
    fdWildcard.right = new FormAttachment(100, 0);
    wWildcard.setLayoutData(fdWildcard);
    // Remove files after retrieval...
    wlRemove = new Label(wSourceFiles, SWT.RIGHT);
    wlRemove.setText(BaseMessages.getString(PKG, "JobSFTP.RemoveFiles.Label"));
    props.setLook(wlRemove);
    fdlRemove = new FormData();
    fdlRemove.left = new FormAttachment(0, 0);
    fdlRemove.top = new FormAttachment(wWildcard, margin);
    fdlRemove.right = new FormAttachment(middle, -margin);
    wlRemove.setLayoutData(fdlRemove);
    wRemove = new Button(wSourceFiles, SWT.CHECK);
    props.setLook(wRemove);
    wRemove.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.RemoveFiles.Tooltip"));
    fdRemove = new FormData();
    fdRemove.left = new FormAttachment(middle, 0);
    fdRemove.top = new FormAttachment(wWildcard, margin);
    fdRemove.right = new FormAttachment(100, 0);
    wRemove.setLayoutData(fdRemove);
    fdSourceFiles = new FormData();
    fdSourceFiles.left = new FormAttachment(0, margin);
    fdSourceFiles.top = new FormAttachment(wServerSettings, 2 * margin);
    fdSourceFiles.right = new FormAttachment(100, -margin);
    wSourceFiles.setLayoutData(fdSourceFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Source files GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Target files GROUP///
    // /
    wTargetFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wTargetFiles);
    wTargetFiles.setText(BaseMessages.getString(PKG, "JobSFTP.TargetFiles.Group.Label"));
    FormLayout TargetFilesgroupLayout = new FormLayout();
    TargetFilesgroupLayout.marginWidth = 10;
    TargetFilesgroupLayout.marginHeight = 10;
    wTargetFiles.setLayout(TargetFilesgroupLayout);
    // TargetDirectory line
    wlTargetDirectory = new Label(wTargetFiles, SWT.RIGHT);
    wlTargetDirectory.setText(BaseMessages.getString(PKG, "JobSFTP.TargetDir.Label"));
    props.setLook(wlTargetDirectory);
    fdlTargetDirectory = new FormData();
    fdlTargetDirectory.left = new FormAttachment(0, 0);
    fdlTargetDirectory.top = new FormAttachment(wSourceFiles, margin);
    fdlTargetDirectory.right = new FormAttachment(middle, -margin);
    wlTargetDirectory.setLayoutData(fdlTargetDirectory);
    // Browse folders button ...
    wbTargetDirectory = new Button(wTargetFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTargetDirectory);
    wbTargetDirectory.setText(BaseMessages.getString(PKG, "JobSFTP.BrowseFolders.Label"));
    fdbTargetDirectory = new FormData();
    fdbTargetDirectory.right = new FormAttachment(100, 0);
    fdbTargetDirectory.top = new FormAttachment(wSourceFiles, margin);
    wbTargetDirectory.setLayoutData(fdbTargetDirectory);
    wbTargetDirectory.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wTargetDirectory.getText() != null) {
                ddialog.setFilterPath(jobMeta.environmentSubstitute(wTargetDirectory.getText()));
            }
            // Calling open() will open and run the dialog.
            // It will return the selected directory, or
            // null if user cancels
            String dir = ddialog.open();
            if (dir != null) {
                // Set the text box to the new selection
                wTargetDirectory.setText(dir);
            }
        }
    });
    wTargetDirectory = new TextVar(jobMeta, wTargetFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSFTP.TargetDir.Tooltip"));
    props.setLook(wTargetDirectory);
    wTargetDirectory.addModifyListener(lsMod);
    fdTargetDirectory = new FormData();
    fdTargetDirectory.left = new FormAttachment(middle, 0);
    fdTargetDirectory.top = new FormAttachment(wSourceFiles, margin);
    fdTargetDirectory.right = new FormAttachment(wbTargetDirectory, -margin);
    wTargetDirectory.setLayoutData(fdTargetDirectory);
    // Create target folder if necessary...
    wlCreateTargetFolder = new Label(wTargetFiles, SWT.RIGHT);
    wlCreateTargetFolder.setText(BaseMessages.getString(PKG, "JobSFTP.CreateTargetFolder.Label"));
    props.setLook(wlCreateTargetFolder);
    fdlCreateTargetFolder = new FormData();
    fdlCreateTargetFolder.left = new FormAttachment(0, 0);
    fdlCreateTargetFolder.top = new FormAttachment(wTargetDirectory, margin);
    fdlCreateTargetFolder.right = new FormAttachment(middle, -margin);
    wlCreateTargetFolder.setLayoutData(fdlCreateTargetFolder);
    wCreateTargetFolder = new Button(wTargetFiles, SWT.CHECK);
    wCreateTargetFolder.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.CreateTargetFolder.Tooltip"));
    props.setLook(wCreateTargetFolder);
    fdCreateTargetFolder = new FormData();
    fdCreateTargetFolder.left = new FormAttachment(middle, 0);
    fdCreateTargetFolder.top = new FormAttachment(wTargetDirectory, margin);
    fdCreateTargetFolder.right = new FormAttachment(100, 0);
    wCreateTargetFolder.setLayoutData(fdCreateTargetFolder);
    // Add filenames to result filenames...
    wlAddFilenameToResult = new Label(wTargetFiles, SWT.RIGHT);
    wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "JobSFTP.AddfilenametoResult.Label"));
    props.setLook(wlAddFilenameToResult);
    fdlAddFilenameToResult = new FormData();
    fdlAddFilenameToResult.left = new FormAttachment(0, 0);
    fdlAddFilenameToResult.top = new FormAttachment(wCreateTargetFolder, margin);
    fdlAddFilenameToResult.right = new FormAttachment(middle, -margin);
    wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
    wAddFilenameToResult = new Button(wTargetFiles, SWT.CHECK);
    wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "JobSFTP.AddfilenametoResult.Tooltip"));
    props.setLook(wAddFilenameToResult);
    fdAddFilenameToResult = new FormData();
    fdAddFilenameToResult.left = new FormAttachment(middle, 0);
    fdAddFilenameToResult.top = new FormAttachment(wCreateTargetFolder, margin);
    fdAddFilenameToResult.right = new FormAttachment(100, 0);
    wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
    fdTargetFiles = new FormData();
    fdTargetFiles.left = new FormAttachment(0, margin);
    fdTargetFiles.top = new FormAttachment(wSourceFiles, margin);
    fdTargetFiles.right = new FormAttachment(100, -margin);
    wTargetFiles.setLayoutData(fdTargetFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Target files GROUP
    // ///////////////////////////////////////////////////////////
    fdFilesComp = new FormData();
    fdFilesComp.left = new FormAttachment(0, 0);
    fdFilesComp.top = new FormAttachment(0, 0);
    fdFilesComp.right = new FormAttachment(100, 0);
    fdFilesComp.bottom = new FormAttachment(100, 0);
    wFilesComp.setLayoutData(fdFilesComp);
    wFilesComp.layout();
    wFilesTab.setControl(wFilesComp);
    props.setLook(wFilesComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Files TAB
    // ///////////////////////////////////////////////////////////
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsCancel = new Listener() {

        public void handleEvent(Event e) {
            cancel();
        }
    };
    lsOK = new Listener() {

        public void handleEvent(Event e) {
            ok();
        }
    };
    lsTest = new Listener() {

        public void handleEvent(Event e) {
            test();
        }
    };
    lsCheckChangeFolder = new Listener() {

        public void handleEvent(Event e) {
            checkRemoteFolder();
        }
    };
    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);
    wTest.addListener(SWT.Selection, lsTest);
    wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckChangeFolder);
    lsDef = new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wName.addSelectionListener(lsDef);
    wServerName.addSelectionListener(lsDef);
    wUserName.addSelectionListener(lsDef);
    wPassword.addSelectionListener(lsDef);
    wScpDirectory.addSelectionListener(lsDef);
    wTargetDirectory.addSelectionListener(lsDef);
    wWildcard.addSelectionListener(lsDef);
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    activeCopyFromPrevious();
    activeUseKey();
    BaseStepDialog.setSize(shell);
    wTabFolder.setSelection(0);
    shell.open();
    props.setDialogSize(shell, "JobSFTPDialogSize");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) CCombo(org.eclipse.swt.custom.CCombo) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 24 with PasswordTextVar

use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.

the class JobEntrySFTPPUTDialog method open.

public JobEntryInterface open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);
    ModifyListener lsMod = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            sftpclient = null;
            jobEntry.setChanged();
        }
    };
    changed = jobEntry.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "JobSFTPPUT.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, "JobSFTPPUT.ServerSettings.Group.Label"));
    FormLayout ServerSettingsgroupLayout = new FormLayout();
    ServerSettingsgroupLayout.marginWidth = 10;
    ServerSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(ServerSettingsgroupLayout);
    // ServerName line
    wlServerName = new Label(wServerSettings, SWT.RIGHT);
    wlServerName.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Server.Label"));
    props.setLook(wlServerName);
    fdlServerName = new FormData();
    fdlServerName.left = new FormAttachment(0, 0);
    fdlServerName.top = new FormAttachment(wName, margin);
    fdlServerName.right = new FormAttachment(middle, -margin);
    wlServerName.setLayoutData(fdlServerName);
    wServerName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    fdServerName = new FormData();
    fdServerName.left = new FormAttachment(middle, 0);
    fdServerName.top = new FormAttachment(wName, margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // ServerPort line
    wlServerPort = new Label(wServerSettings, SWT.RIGHT);
    wlServerPort.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Port.Label"));
    props.setLook(wlServerPort);
    fdlServerPort = new FormData();
    fdlServerPort.left = new FormAttachment(0, 0);
    fdlServerPort.top = new FormAttachment(wServerName, margin);
    fdlServerPort.right = new FormAttachment(middle, -margin);
    wlServerPort.setLayoutData(fdlServerPort);
    wServerPort = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerPort);
    wServerPort.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.Port.Tooltip"));
    wServerPort.addModifyListener(lsMod);
    fdServerPort = new FormData();
    fdServerPort.left = new FormAttachment(middle, 0);
    fdServerPort.top = new FormAttachment(wServerName, margin);
    fdServerPort.right = new FormAttachment(100, 0);
    wServerPort.setLayoutData(fdServerPort);
    // UserName line
    wlUserName = new Label(wServerSettings, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Username.Label"));
    props.setLook(wlUserName);
    fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wServerPort, margin);
    fdlUserName.right = new FormAttachment(middle, -margin);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.Username.Tooltip"));
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wServerPort, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wlPassword = new Label(wServerSettings, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "JobSFTPPUT.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(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    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);
    // usePublicKey
    wlusePublicKey = new Label(wServerSettings, SWT.RIGHT);
    wlusePublicKey.setText(BaseMessages.getString(PKG, "JobSFTPPUT.useKeyFile.Label"));
    props.setLook(wlusePublicKey);
    fdlusePublicKey = new FormData();
    fdlusePublicKey.left = new FormAttachment(0, 0);
    fdlusePublicKey.top = new FormAttachment(wPassword, margin);
    fdlusePublicKey.right = new FormAttachment(middle, -margin);
    wlusePublicKey.setLayoutData(fdlusePublicKey);
    wusePublicKey = new Button(wServerSettings, SWT.CHECK);
    wusePublicKey.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.useKeyFile.Tooltip"));
    props.setLook(wusePublicKey);
    fdusePublicKey = new FormData();
    fdusePublicKey.left = new FormAttachment(middle, 0);
    fdusePublicKey.top = new FormAttachment(wPassword, margin);
    fdusePublicKey.right = new FormAttachment(100, 0);
    wusePublicKey.setLayoutData(fdusePublicKey);
    wusePublicKey.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeUseKey();
            jobEntry.setChanged();
        }
    });
    // Key File
    wlKeyFilename = new Label(wServerSettings, SWT.RIGHT);
    wlKeyFilename.setText(BaseMessages.getString(PKG, "JobSFTPPUT.KeyFilename.Label"));
    props.setLook(wlKeyFilename);
    fdlKeyFilename = new FormData();
    fdlKeyFilename.left = new FormAttachment(0, 0);
    fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
    fdlKeyFilename.right = new FormAttachment(middle, -margin);
    wlKeyFilename.setLayoutData(fdlKeyFilename);
    wbKeyFilename = new Button(wServerSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbKeyFilename);
    wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbKeyFilename = new FormData();
    fdbKeyFilename.right = new FormAttachment(100, 0);
    fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
    // fdbKeyFilename.height = 22;
    wbKeyFilename.setLayoutData(fdbKeyFilename);
    wKeyFilename = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.KeyFilename.Tooltip"));
    props.setLook(wKeyFilename);
    wKeyFilename.addModifyListener(lsMod);
    fdKeyFilename = new FormData();
    fdKeyFilename.left = new FormAttachment(middle, 0);
    fdKeyFilename.top = new FormAttachment(wusePublicKey, margin);
    fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
    wKeyFilename.setLayoutData(fdKeyFilename);
    wbKeyFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.pem", "*" });
            if (wKeyFilename.getText() != null) {
                dialog.setFileName(jobMeta.environmentSubstitute(wKeyFilename.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
                wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
        }
    });
    // keyfilePass line
    wkeyfilePass = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.keyfilePass.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.keyfilePass.Tooltip"), true);
    props.setLook(wkeyfilePass);
    wkeyfilePass.addModifyListener(lsMod);
    fdkeyfilePass = new FormData();
    fdkeyfilePass.left = new FormAttachment(0, -margin);
    fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
    fdkeyfilePass.right = new FormAttachment(100, 0);
    wkeyfilePass.setLayoutData(fdkeyfilePass);
    wlProxyType = new Label(wServerSettings, SWT.RIGHT);
    wlProxyType.setText(BaseMessages.getString(PKG, "JobSFTPPUT.ProxyType.Label"));
    props.setLook(wlProxyType);
    fdlProxyType = new FormData();
    fdlProxyType.left = new FormAttachment(0, 0);
    fdlProxyType.right = new FormAttachment(middle, -margin);
    fdlProxyType.top = new FormAttachment(wkeyfilePass, 2 * margin);
    wlProxyType.setLayoutData(fdlProxyType);
    wProxyType = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wProxyType.add(SFTPClient.PROXY_TYPE_HTTP);
    wProxyType.add(SFTPClient.PROXY_TYPE_SOCKS5);
    // +1: starts at -1
    wProxyType.select(0);
    props.setLook(wProxyType);
    fdProxyType = new FormData();
    fdProxyType.left = new FormAttachment(middle, 0);
    fdProxyType.top = new FormAttachment(wkeyfilePass, 2 * margin);
    fdProxyType.right = new FormAttachment(100, 0);
    wProxyType.setLayoutData(fdProxyType);
    wProxyType.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setDefaulProxyPort();
        }
    });
    // Proxy host line
    wProxyHost = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.ProxyHost.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.ProxyHost.Tooltip"));
    props.setLook(wProxyHost);
    wProxyHost.addModifyListener(lsMod);
    fdProxyHost = new FormData();
    fdProxyHost.left = new FormAttachment(0, -2 * margin);
    fdProxyHost.top = new FormAttachment(wProxyType, margin);
    fdProxyHost.right = new FormAttachment(100, 0);
    wProxyHost.setLayoutData(fdProxyHost);
    // Proxy port line
    wProxyPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.ProxyPort.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.ProxyPort.Tooltip"));
    props.setLook(wProxyPort);
    wProxyPort.addModifyListener(lsMod);
    fdProxyPort = new FormData();
    fdProxyPort.left = new FormAttachment(0, -2 * margin);
    fdProxyPort.top = new FormAttachment(wProxyHost, margin);
    fdProxyPort.right = new FormAttachment(100, 0);
    wProxyPort.setLayoutData(fdProxyPort);
    // Proxy username line
    wProxyUsername = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.ProxyUsername.Tooltip"));
    props.setLook(wProxyUsername);
    wProxyUsername.addModifyListener(lsMod);
    fdProxyUsername = new FormData();
    fdProxyUsername.left = new FormAttachment(0, -2 * margin);
    fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
    fdProxyUsername.right = new FormAttachment(100, 0);
    wProxyUsername.setLayoutData(fdProxyUsername);
    // Proxy password line
    wProxyPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSFTPPUT.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobSFTPPUT.ProxyPassword.Tooltip"), true);
    props.setLook(wProxyPassword);
    wProxyPassword.addModifyListener(lsMod);
    fdProxyPasswd = new FormData();
    fdProxyPasswd.left = new FormAttachment(0, -2 * margin);
    fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
    fdProxyPasswd.right = new FormAttachment(100, 0);
    wProxyPassword.setLayoutData(fdProxyPasswd);
    // Test connection button
    wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "JobSFTPPUT.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wProxyPassword, 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
    // ///////////////////////////////////////////////////////////
    wlCompression = new Label(wGeneralComp, SWT.RIGHT);
    wlCompression.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Compression.Label"));
    props.setLook(wlCompression);
    fdlCompression = new FormData();
    fdlCompression.left = new FormAttachment(0, -margin);
    fdlCompression.right = new FormAttachment(middle, 0);
    fdlCompression.top = new FormAttachment(wServerSettings, margin);
    wlCompression.setLayoutData(fdlCompression);
    wCompression = new CCombo(wGeneralComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wCompression.add("none");
    wCompression.add("zlib");
    // +1: starts at -1
    wCompression.select(0);
    props.setLook(wCompression);
    fdCompression = new FormData();
    fdCompression.left = new FormAttachment(middle, margin);
    fdCompression.top = new FormAttachment(wServerSettings, margin);
    fdCompression.right = new FormAttachment(100, 0);
    wCompression.setLayoutData(fdCompression);
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Files TAB ///
    // ////////////////////////
    wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
    wFilesTab.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Tab.Files.Label"));
    wFilesComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFilesComp);
    FormLayout FilesLayout = new FormLayout();
    FilesLayout.marginWidth = 3;
    FilesLayout.marginHeight = 3;
    wFilesComp.setLayout(FilesLayout);
    // ////////////////////////
    // START OF Source files GROUP///
    // /
    wSourceFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wSourceFiles);
    wSourceFiles.setText(BaseMessages.getString(PKG, "JobSFTPPUT.SourceFiles.Group.Label"));
    FormLayout SourceFilesgroupLayout = new FormLayout();
    SourceFilesgroupLayout.marginWidth = 10;
    SourceFilesgroupLayout.marginHeight = 10;
    wSourceFiles.setLayout(SourceFilesgroupLayout);
    // Get arguments from previous result...
    wlgetPrevious = new Label(wSourceFiles, SWT.RIGHT);
    wlgetPrevious.setText(BaseMessages.getString(PKG, "JobSFTPPUT.getPrevious.Label"));
    props.setLook(wlgetPrevious);
    fdlgetPrevious = new FormData();
    fdlgetPrevious.left = new FormAttachment(0, 0);
    fdlgetPrevious.top = new FormAttachment(wServerSettings, 2 * margin);
    fdlgetPrevious.right = new FormAttachment(middle, -margin);
    wlgetPrevious.setLayoutData(fdlgetPrevious);
    wgetPrevious = new Button(wSourceFiles, SWT.CHECK);
    props.setLook(wgetPrevious);
    wgetPrevious.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.getPrevious.Tooltip"));
    fdgetPrevious = new FormData();
    fdgetPrevious.left = new FormAttachment(middle, 0);
    fdgetPrevious.top = new FormAttachment(wServerSettings, 2 * margin);
    fdgetPrevious.right = new FormAttachment(100, 0);
    wgetPrevious.setLayoutData(fdgetPrevious);
    wgetPrevious.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (wgetPrevious.getSelection()) {
                // only one is allowed
                wgetPreviousFiles.setSelection(false);
            }
            activeCopyFromPrevious();
            jobEntry.setChanged();
        }
    });
    // Get arguments from previous files result...
    wlgetPreviousFiles = new Label(wSourceFiles, SWT.RIGHT);
    wlgetPreviousFiles.setText(BaseMessages.getString(PKG, "JobSFTPPUT.getPreviousFiles.Label"));
    props.setLook(wlgetPreviousFiles);
    fdlgetPreviousFiles = new FormData();
    fdlgetPreviousFiles.left = new FormAttachment(0, 0);
    fdlgetPreviousFiles.top = new FormAttachment(wgetPrevious, 2 * margin);
    fdlgetPreviousFiles.right = new FormAttachment(middle, -margin);
    wlgetPreviousFiles.setLayoutData(fdlgetPreviousFiles);
    wgetPreviousFiles = new Button(wSourceFiles, SWT.CHECK);
    props.setLook(wgetPreviousFiles);
    wgetPreviousFiles.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.getPreviousFiles.Tooltip"));
    fdgetPreviousFiles = new FormData();
    fdgetPreviousFiles.left = new FormAttachment(middle, 0);
    fdgetPreviousFiles.top = new FormAttachment(wgetPrevious, 2 * margin);
    fdgetPreviousFiles.right = new FormAttachment(100, 0);
    wgetPreviousFiles.setLayoutData(fdgetPreviousFiles);
    wgetPreviousFiles.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (wgetPreviousFiles.getSelection()) {
                // only one is allowed
                wgetPrevious.setSelection(false);
            }
            activeCopyFromPrevious();
            jobEntry.setChanged();
        }
    });
    // Local Directory line
    wlLocalDirectory = new Label(wSourceFiles, SWT.RIGHT);
    wlLocalDirectory.setText(BaseMessages.getString(PKG, "JobSFTPPUT.LocalDir.Label"));
    props.setLook(wlLocalDirectory);
    fdlLocalDirectory = new FormData();
    fdlLocalDirectory.left = new FormAttachment(0, 0);
    fdlLocalDirectory.top = new FormAttachment(wgetPreviousFiles, margin);
    fdlLocalDirectory.right = new FormAttachment(middle, -margin);
    wlLocalDirectory.setLayoutData(fdlLocalDirectory);
    // Browse folders button ...
    wbLocalDirectory = new Button(wSourceFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbLocalDirectory);
    wbLocalDirectory.setText(BaseMessages.getString(PKG, "JobSFTPPUT.BrowseFolders.Label"));
    fdbLocalDirectory = new FormData();
    fdbLocalDirectory.right = new FormAttachment(100, 0);
    fdbLocalDirectory.top = new FormAttachment(wgetPreviousFiles, margin);
    wbLocalDirectory.setLayoutData(fdbLocalDirectory);
    wbLocalDirectory.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wLocalDirectory.getText() != null) {
                ddialog.setFilterPath(jobMeta.environmentSubstitute(wLocalDirectory.getText()));
            }
            // Calling open() will open and run the dialog.
            // It will return the selected directory, or
            // null if user cancels
            String dir = ddialog.open();
            if (dir != null) {
                // Set the text box to the new selection
                wLocalDirectory.setText(dir);
            }
        }
    });
    wLocalDirectory = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLocalDirectory);
    wLocalDirectory.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.LocalDir.Tooltip"));
    wLocalDirectory.addModifyListener(lsMod);
    fdLocalDirectory = new FormData();
    fdLocalDirectory.left = new FormAttachment(middle, 0);
    fdLocalDirectory.top = new FormAttachment(wgetPreviousFiles, margin);
    fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, -margin);
    wLocalDirectory.setLayoutData(fdLocalDirectory);
    // Wildcard line
    wlWildcard = new Label(wSourceFiles, SWT.RIGHT);
    wlWildcard.setText(BaseMessages.getString(PKG, "JobSFTPPUT.Wildcard.Label"));
    props.setLook(wlWildcard);
    fdlWildcard = new FormData();
    fdlWildcard.left = new FormAttachment(0, 0);
    fdlWildcard.top = new FormAttachment(wbLocalDirectory, margin);
    fdlWildcard.right = new FormAttachment(middle, -margin);
    wlWildcard.setLayoutData(fdlWildcard);
    wWildcard = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wWildcard);
    wWildcard.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.Wildcard.Tooltip"));
    wWildcard.addModifyListener(lsMod);
    fdWildcard = new FormData();
    fdWildcard.left = new FormAttachment(middle, 0);
    fdWildcard.top = new FormAttachment(wbLocalDirectory, margin);
    fdWildcard.right = new FormAttachment(100, 0);
    wWildcard.setLayoutData(fdWildcard);
    // Success when there is no file...
    wlSuccessWhenNoFile = new Label(wSourceFiles, SWT.RIGHT);
    wlSuccessWhenNoFile.setText(BaseMessages.getString(PKG, "JobSFTPPUT.SuccessWhenNoFile.Label"));
    props.setLook(wlSuccessWhenNoFile);
    fdlSuccessWhenNoFile = new FormData();
    fdlSuccessWhenNoFile.left = new FormAttachment(0, 0);
    fdlSuccessWhenNoFile.top = new FormAttachment(wWildcard, margin);
    fdlSuccessWhenNoFile.right = new FormAttachment(middle, -margin);
    wlSuccessWhenNoFile.setLayoutData(fdlSuccessWhenNoFile);
    wSuccessWhenNoFile = new Button(wSourceFiles, SWT.CHECK);
    props.setLook(wSuccessWhenNoFile);
    wSuccessWhenNoFile.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.SuccessWhenNoFile.Tooltip"));
    fdSuccessWhenNoFile = new FormData();
    fdSuccessWhenNoFile.left = new FormAttachment(middle, 0);
    fdSuccessWhenNoFile.top = new FormAttachment(wWildcard, margin);
    fdSuccessWhenNoFile.right = new FormAttachment(100, 0);
    wSuccessWhenNoFile.setLayoutData(fdSuccessWhenNoFile);
    wSuccessWhenNoFile.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    // After FTP Put
    wlAfterFTPPut = new Label(wSourceFiles, SWT.RIGHT);
    wlAfterFTPPut.setText(BaseMessages.getString(PKG, "JobSFTPPUT.AfterFTPPut.Label"));
    props.setLook(wlAfterFTPPut);
    fdlAfterFTPPut = new FormData();
    fdlAfterFTPPut.left = new FormAttachment(0, 0);
    fdlAfterFTPPut.right = new FormAttachment(middle, -margin);
    fdlAfterFTPPut.top = new FormAttachment(wSuccessWhenNoFile, 2 * margin);
    wlAfterFTPPut.setLayoutData(fdlAfterFTPPut);
    wAfterFTPPut = new CCombo(wSourceFiles, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSFTPPUT.AfterSFTP.DoNothing.Label"));
    wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSFTPPUT.AfterSFTP.Delete.Label"));
    wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSFTPPUT.AfterSFTP.Move.Label"));
    // +1: starts at -1
    wAfterFTPPut.select(0);
    props.setLook(wAfterFTPPut);
    fdAfterFTPPut = new FormData();
    fdAfterFTPPut.left = new FormAttachment(middle, 0);
    fdAfterFTPPut.top = new FormAttachment(wSuccessWhenNoFile, 2 * margin);
    fdAfterFTPPut.right = new FormAttachment(100, -margin);
    wAfterFTPPut.setLayoutData(fdAfterFTPPut);
    wAfterFTPPut.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            AfterFTPPutActivate();
        }
    });
    // moveTo Directory
    wlDestinationFolder = new Label(wSourceFiles, SWT.RIGHT);
    wlDestinationFolder.setText(BaseMessages.getString(PKG, "JobSFTPPUT.DestinationFolder.Label"));
    props.setLook(wlDestinationFolder);
    fdlDestinationFolder = new FormData();
    fdlDestinationFolder.left = new FormAttachment(0, 0);
    fdlDestinationFolder.top = new FormAttachment(wAfterFTPPut, margin);
    fdlDestinationFolder.right = new FormAttachment(middle, -margin);
    wlDestinationFolder.setLayoutData(fdlDestinationFolder);
    // Browse folders button ...
    wbMovetoDirectory = new Button(wSourceFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbMovetoDirectory);
    wbMovetoDirectory.setText(BaseMessages.getString(PKG, "JobSFTPPUT.BrowseFolders.Label"));
    fdbMovetoDirectory = new FormData();
    fdbMovetoDirectory.right = new FormAttachment(100, 0);
    fdbMovetoDirectory.top = new FormAttachment(wAfterFTPPut, margin);
    wbMovetoDirectory.setLayoutData(fdbMovetoDirectory);
    wbMovetoDirectory.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wDestinationFolder.getText() != null) {
                ddialog.setFilterPath(jobMeta.environmentSubstitute(wDestinationFolder.getText()));
            }
            // Calling open() will open and run the dialog.
            // It will return the selected directory, or
            // null if user cancels
            String dir = ddialog.open();
            if (dir != null) {
                // Set the text box to the new selection
                wDestinationFolder.setText(dir);
            }
        }
    });
    wDestinationFolder = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSFTPPUT.DestinationFolder.Tooltip"));
    props.setLook(wDestinationFolder);
    wDestinationFolder.addModifyListener(lsMod);
    fdDestinationFolder = new FormData();
    fdDestinationFolder.left = new FormAttachment(middle, 0);
    fdDestinationFolder.top = new FormAttachment(wAfterFTPPut, margin);
    fdDestinationFolder.right = new FormAttachment(wbMovetoDirectory, -margin);
    wDestinationFolder.setLayoutData(fdDestinationFolder);
    // Whenever something changes, set the tooltip to the expanded version:
    wDestinationFolder.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            wDestinationFolder.setToolTipText(jobMeta.environmentSubstitute(wDestinationFolder.getText()));
        }
    });
    // Create destination folder if necessary ...
    wlCreateDestinationFolder = new Label(wSourceFiles, SWT.RIGHT);
    wlCreateDestinationFolder.setText(BaseMessages.getString(PKG, "JobSFTPPUT.CreateDestinationFolder.Label"));
    props.setLook(wlCreateDestinationFolder);
    fdlCreateDestinationFolder = new FormData();
    fdlCreateDestinationFolder.left = new FormAttachment(0, 0);
    fdlCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
    fdlCreateDestinationFolder.right = new FormAttachment(middle, -margin);
    wlCreateDestinationFolder.setLayoutData(fdlCreateDestinationFolder);
    wCreateDestinationFolder = new Button(wSourceFiles, SWT.CHECK);
    wCreateDestinationFolder.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.CreateDestinationFolder.Tooltip"));
    props.setLook(wCreateDestinationFolder);
    fdCreateDestinationFolder = new FormData();
    fdCreateDestinationFolder.left = new FormAttachment(middle, 0);
    fdCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
    fdCreateDestinationFolder.right = new FormAttachment(100, 0);
    wCreateDestinationFolder.setLayoutData(fdCreateDestinationFolder);
    // Add filenames to result filenames...
    wlAddFilenameToResult = new Label(wSourceFiles, SWT.RIGHT);
    wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "JobSFTPPUT.AddfilenametoResult.Label"));
    props.setLook(wlAddFilenameToResult);
    fdlAddFilenameToResult = new FormData();
    fdlAddFilenameToResult.left = new FormAttachment(0, 0);
    fdlAddFilenameToResult.top = new FormAttachment(wCreateDestinationFolder, margin);
    fdlAddFilenameToResult.right = new FormAttachment(middle, -margin);
    wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
    wAddFilenameToResult = new Button(wSourceFiles, SWT.CHECK);
    wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.AddfilenametoResult.Tooltip"));
    props.setLook(wAddFilenameToResult);
    fdAddFilenameToResult = new FormData();
    fdAddFilenameToResult.left = new FormAttachment(middle, 0);
    fdAddFilenameToResult.top = new FormAttachment(wCreateDestinationFolder, margin);
    fdAddFilenameToResult.right = new FormAttachment(100, 0);
    wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
    fdSourceFiles = new FormData();
    fdSourceFiles.left = new FormAttachment(0, margin);
    fdSourceFiles.top = new FormAttachment(wServerSettings, 2 * margin);
    fdSourceFiles.right = new FormAttachment(100, -margin);
    wSourceFiles.setLayoutData(fdSourceFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Source files GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Target files GROUP///
    // /
    wTargetFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wTargetFiles);
    wTargetFiles.setText(BaseMessages.getString(PKG, "JobSFTPPUT.TargetFiles.Group.Label"));
    FormLayout TargetFilesgroupLayout = new FormLayout();
    TargetFilesgroupLayout.marginWidth = 10;
    TargetFilesgroupLayout.marginHeight = 10;
    wTargetFiles.setLayout(TargetFilesgroupLayout);
    // FtpDirectory line
    wlScpDirectory = new Label(wTargetFiles, SWT.RIGHT);
    wlScpDirectory.setText(BaseMessages.getString(PKG, "JobSFTPPUT.RemoteDir.Label"));
    props.setLook(wlScpDirectory);
    fdlScpDirectory = new FormData();
    fdlScpDirectory.left = new FormAttachment(0, 0);
    fdlScpDirectory.top = new FormAttachment(wSourceFiles, margin);
    fdlScpDirectory.right = new FormAttachment(middle, -margin);
    wlScpDirectory.setLayoutData(fdlScpDirectory);
    // Test remote folder button ...
    wbTestChangeFolderExists = new Button(wTargetFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTestChangeFolderExists);
    wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobSFTPPUT.TestFolderExists.Label"));
    fdbTestChangeFolderExists = new FormData();
    fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
    fdbTestChangeFolderExists.top = new FormAttachment(wSourceFiles, margin);
    wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
    // Target (remote) folder
    wScpDirectory = new TextVar(jobMeta, wTargetFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wScpDirectory);
    wScpDirectory.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.RemoteDir.Tooltip"));
    wScpDirectory.addModifyListener(lsMod);
    fdScpDirectory = new FormData();
    fdScpDirectory.left = new FormAttachment(middle, 0);
    fdScpDirectory.top = new FormAttachment(wSourceFiles, margin);
    fdScpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
    wScpDirectory.setLayoutData(fdScpDirectory);
    // CreateRemoteFolder files after retrieval...
    wlCreateRemoteFolder = new Label(wTargetFiles, SWT.RIGHT);
    wlCreateRemoteFolder.setText(BaseMessages.getString(PKG, "JobSFTPPUT.CreateRemoteFolderFiles.Label"));
    props.setLook(wlCreateRemoteFolder);
    fdlCreateRemoteFolder = new FormData();
    fdlCreateRemoteFolder.left = new FormAttachment(0, 0);
    fdlCreateRemoteFolder.top = new FormAttachment(wScpDirectory, margin);
    fdlCreateRemoteFolder.right = new FormAttachment(middle, -margin);
    wlCreateRemoteFolder.setLayoutData(fdlCreateRemoteFolder);
    wCreateRemoteFolder = new Button(wTargetFiles, SWT.CHECK);
    props.setLook(wCreateRemoteFolder);
    fdCreateRemoteFolder = new FormData();
    wCreateRemoteFolder.setToolTipText(BaseMessages.getString(PKG, "JobSFTPPUT.CreateRemoteFolderFiles.Tooltip"));
    fdCreateRemoteFolder.left = new FormAttachment(middle, 0);
    fdCreateRemoteFolder.top = new FormAttachment(wScpDirectory, margin);
    fdCreateRemoteFolder.right = new FormAttachment(100, 0);
    wCreateRemoteFolder.setLayoutData(fdCreateRemoteFolder);
    wCreateRemoteFolder.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    fdTargetFiles = new FormData();
    fdTargetFiles.left = new FormAttachment(0, margin);
    fdTargetFiles.top = new FormAttachment(wSourceFiles, margin);
    fdTargetFiles.right = new FormAttachment(100, -margin);
    wTargetFiles.setLayoutData(fdTargetFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Target files GROUP
    // ///////////////////////////////////////////////////////////
    fdFilesComp = new FormData();
    fdFilesComp.left = new FormAttachment(0, 0);
    fdFilesComp.top = new FormAttachment(0, 0);
    fdFilesComp.right = new FormAttachment(100, 0);
    fdFilesComp.bottom = new FormAttachment(100, 0);
    wFilesComp.setLayoutData(fdFilesComp);
    wFilesComp.layout();
    wFilesTab.setControl(wFilesComp);
    props.setLook(wFilesComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Files TAB
    // ///////////////////////////////////////////////////////////
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsCancel = new Listener() {

        public void handleEvent(Event e) {
            cancel();
        }
    };
    lsOK = new Listener() {

        public void handleEvent(Event e) {
            ok();
        }
    };
    lsTest = new Listener() {

        public void handleEvent(Event e) {
            test();
        }
    };
    lsCheckChangeFolder = new Listener() {

        public void handleEvent(Event e) {
            checkRemoteFolder();
        }
    };
    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);
    wTest.addListener(SWT.Selection, lsTest);
    wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckChangeFolder);
    lsDef = new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    lsDef = new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wName.addSelectionListener(lsDef);
    wServerName.addSelectionListener(lsDef);
    wUserName.addSelectionListener(lsDef);
    wPassword.addSelectionListener(lsDef);
    wScpDirectory.addSelectionListener(lsDef);
    wLocalDirectory.addSelectionListener(lsDef);
    wWildcard.addSelectionListener(lsDef);
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    wTabFolder.setSelection(0);
    getData();
    activeCopyFromPrevious();
    activeUseKey();
    AfterFTPPutActivate();
    BaseStepDialog.setSize(shell);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) CCombo(org.eclipse.swt.custom.CCombo) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 25 with PasswordTextVar

use of org.pentaho.di.ui.core.widget.PasswordTextVar in project pentaho-kettle by pentaho.

the class JobEntryHTTPDialog 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, "JobHTTP.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Job entry name line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobHTTP.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "JobHTTP.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);
    // URL line
    wlURL = new Label(wGeneralComp, SWT.RIGHT);
    wlURL.setText(BaseMessages.getString(PKG, "JobHTTP.URL.Label"));
    props.setLook(wlURL);
    fdlURL = new FormData();
    fdlURL.left = new FormAttachment(0, 0);
    fdlURL.top = new FormAttachment(wName, 2 * margin);
    fdlURL.right = new FormAttachment(middle, -margin);
    wlURL.setLayoutData(fdlURL);
    wURL = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobHTTP.URL.Tooltip"));
    props.setLook(wURL);
    wURL.addModifyListener(lsMod);
    fdURL = new FormData();
    fdURL.left = new FormAttachment(middle, 0);
    fdURL.top = new FormAttachment(wName, 2 * margin);
    fdURL.right = new FormAttachment(100, 0);
    wURL.setLayoutData(fdURL);
    // RunEveryRow line
    wlRunEveryRow = new Label(wGeneralComp, SWT.RIGHT);
    wlRunEveryRow.setText(BaseMessages.getString(PKG, "JobHTTP.RunForEveryRow.Label"));
    props.setLook(wlRunEveryRow);
    fdlRunEveryRow = new FormData();
    fdlRunEveryRow.left = new FormAttachment(0, 0);
    fdlRunEveryRow.top = new FormAttachment(wURL, margin);
    fdlRunEveryRow.right = new FormAttachment(middle, -margin);
    wlRunEveryRow.setLayoutData(fdlRunEveryRow);
    wRunEveryRow = new Button(wGeneralComp, SWT.CHECK);
    wRunEveryRow.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.RunForEveryRow.Tooltip"));
    props.setLook(wRunEveryRow);
    fdRunEveryRow = new FormData();
    fdRunEveryRow.left = new FormAttachment(middle, 0);
    fdRunEveryRow.top = new FormAttachment(wURL, margin);
    fdRunEveryRow.right = new FormAttachment(100, 0);
    wRunEveryRow.setLayoutData(fdRunEveryRow);
    wRunEveryRow.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setFlags();
        }
    });
    // FieldURL line
    wlFieldURL = new Label(wGeneralComp, SWT.RIGHT);
    wlFieldURL.setText(BaseMessages.getString(PKG, "JobHTTP.InputField.Label"));
    props.setLook(wlFieldURL);
    fdlFieldURL = new FormData();
    fdlFieldURL.left = new FormAttachment(0, 0);
    fdlFieldURL.top = new FormAttachment(wRunEveryRow, margin);
    fdlFieldURL.right = new FormAttachment(middle, -margin);
    wlFieldURL.setLayoutData(fdlFieldURL);
    wFieldURL = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFieldURL);
    wFieldURL.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.InputField.Tooltip"));
    wFieldURL.addModifyListener(lsMod);
    fdFieldURL = new FormData();
    fdFieldURL.left = new FormAttachment(middle, 0);
    fdFieldURL.top = new FormAttachment(wRunEveryRow, margin);
    fdFieldURL.right = new FormAttachment(100, 0);
    wFieldURL.setLayoutData(fdFieldURL);
    // FieldUpload line
    wlFieldUpload = new Label(wGeneralComp, SWT.RIGHT);
    wlFieldUpload.setText(BaseMessages.getString(PKG, "JobHTTP.InputFieldUpload.Label"));
    props.setLook(wlFieldUpload);
    fdlFieldUpload = new FormData();
    fdlFieldUpload.left = new FormAttachment(0, 0);
    fdlFieldUpload.top = new FormAttachment(wFieldURL, margin);
    fdlFieldUpload.right = new FormAttachment(middle, -margin);
    wlFieldUpload.setLayoutData(fdlFieldUpload);
    wFieldUpload = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFieldUpload);
    wFieldUpload.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.InputFieldUpload.Tooltip"));
    wFieldUpload.addModifyListener(lsMod);
    fdFieldUpload = new FormData();
    fdFieldUpload.left = new FormAttachment(middle, 0);
    fdFieldUpload.top = new FormAttachment(wFieldURL, margin);
    fdFieldUpload.right = new FormAttachment(100, 0);
    wFieldUpload.setLayoutData(fdFieldUpload);
    // FieldTarget line
    wlFieldTarget = new Label(wGeneralComp, SWT.RIGHT);
    wlFieldTarget.setText(BaseMessages.getString(PKG, "JobHTTP.InputFieldDest.Label"));
    props.setLook(wlFieldTarget);
    fdlFieldTarget = new FormData();
    fdlFieldTarget.left = new FormAttachment(0, 0);
    fdlFieldTarget.top = new FormAttachment(wFieldUpload, margin);
    fdlFieldTarget.right = new FormAttachment(middle, -margin);
    wlFieldTarget.setLayoutData(fdlFieldTarget);
    wFieldTarget = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFieldTarget);
    wFieldTarget.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.InputFieldDest.Tooltip"));
    wFieldTarget.addModifyListener(lsMod);
    fdFieldTarget = new FormData();
    fdFieldTarget.left = new FormAttachment(middle, 0);
    fdFieldTarget.top = new FormAttachment(wFieldUpload, margin);
    fdFieldTarget.right = new FormAttachment(100, 0);
    wFieldTarget.setLayoutData(fdFieldTarget);
    // ////////////////////////
    // START OF AuthenticationGROUP///
    // /
    wAuthentication = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wAuthentication);
    wAuthentication.setText(BaseMessages.getString(PKG, "JobHTTP.Authentication.Group.Label"));
    FormLayout AuthenticationgroupLayout = new FormLayout();
    AuthenticationgroupLayout.marginWidth = 10;
    AuthenticationgroupLayout.marginHeight = 10;
    wAuthentication.setLayout(AuthenticationgroupLayout);
    // UserName line
    wlUserName = new Label(wAuthentication, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "JobHTTP.UploadUser.Label"));
    props.setLook(wlUserName);
    fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wFieldTarget, margin);
    fdlUserName.right = new FormAttachment(middle, -margin);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(jobMeta, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.UploadUser.Tooltip"));
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wFieldTarget, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wlPassword = new Label(wAuthentication, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "JobHTTP.UploadPassword.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(jobMeta, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPassword);
    wPassword.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.UploadPassword.Tooltip"));
    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);
    // ProxyServer line
    wlProxyServer = new Label(wAuthentication, SWT.RIGHT);
    wlProxyServer.setText(BaseMessages.getString(PKG, "JobHTTP.ProxyHost.Label"));
    props.setLook(wlProxyServer);
    fdlProxyServer = new FormData();
    fdlProxyServer.left = new FormAttachment(0, 0);
    fdlProxyServer.top = new FormAttachment(wPassword, 3 * margin);
    fdlProxyServer.right = new FormAttachment(middle, -margin);
    wlProxyServer.setLayoutData(fdlProxyServer);
    wProxyServer = new TextVar(jobMeta, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wProxyServer);
    wProxyServer.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.ProxyHost.Tooltip"));
    wProxyServer.addModifyListener(lsMod);
    fdProxyServer = new FormData();
    fdProxyServer.left = new FormAttachment(middle, 0);
    fdProxyServer.top = new FormAttachment(wPassword, 3 * margin);
    fdProxyServer.right = new FormAttachment(100, 0);
    wProxyServer.setLayoutData(fdProxyServer);
    // ProxyPort line
    wlProxyPort = new Label(wAuthentication, SWT.RIGHT);
    wlProxyPort.setText(BaseMessages.getString(PKG, "JobHTTP.ProxyPort.Label"));
    props.setLook(wlProxyPort);
    fdlProxyPort = new FormData();
    fdlProxyPort.left = new FormAttachment(0, 0);
    fdlProxyPort.top = new FormAttachment(wProxyServer, margin);
    fdlProxyPort.right = new FormAttachment(middle, -margin);
    wlProxyPort.setLayoutData(fdlProxyPort);
    wProxyPort = new TextVar(jobMeta, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wProxyPort);
    wProxyPort.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.ProxyPort.Tooltip"));
    wProxyPort.addModifyListener(lsMod);
    fdProxyPort = new FormData();
    fdProxyPort.left = new FormAttachment(middle, 0);
    fdProxyPort.top = new FormAttachment(wProxyServer, margin);
    fdProxyPort.right = new FormAttachment(100, 0);
    wProxyPort.setLayoutData(fdProxyPort);
    // IgnoreHosts line
    wlNonProxyHosts = new Label(wAuthentication, SWT.RIGHT);
    wlNonProxyHosts.setText(BaseMessages.getString(PKG, "JobHTTP.ProxyIgnoreRegexp.Label"));
    props.setLook(wlNonProxyHosts);
    fdlNonProxyHosts = new FormData();
    fdlNonProxyHosts.left = new FormAttachment(0, 0);
    fdlNonProxyHosts.top = new FormAttachment(wProxyPort, margin);
    fdlNonProxyHosts.right = new FormAttachment(middle, -margin);
    wlNonProxyHosts.setLayoutData(fdlNonProxyHosts);
    wNonProxyHosts = new TextVar(jobMeta, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wNonProxyHosts);
    wNonProxyHosts.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.ProxyIgnoreRegexp.Tooltip"));
    wNonProxyHosts.addModifyListener(lsMod);
    fdNonProxyHosts = new FormData();
    fdNonProxyHosts.left = new FormAttachment(middle, 0);
    fdNonProxyHosts.top = new FormAttachment(wProxyPort, margin);
    fdNonProxyHosts.right = new FormAttachment(100, 0);
    wNonProxyHosts.setLayoutData(fdNonProxyHosts);
    fdAuthentication = new FormData();
    fdAuthentication.left = new FormAttachment(0, margin);
    fdAuthentication.top = new FormAttachment(wFieldTarget, margin);
    fdAuthentication.right = new FormAttachment(100, -margin);
    wAuthentication.setLayoutData(fdAuthentication);
    // ///////////////////////////////////////////////////////////
    // / END OF AuthenticationGROUP GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF UpLoadFileGROUP///
    // /
    wUpLoadFile = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wUpLoadFile);
    wUpLoadFile.setText(BaseMessages.getString(PKG, "JobHTTP.UpLoadFile.Group.Label"));
    FormLayout UpLoadFilegroupLayout = new FormLayout();
    UpLoadFilegroupLayout.marginWidth = 10;
    UpLoadFilegroupLayout.marginHeight = 10;
    wUpLoadFile.setLayout(UpLoadFilegroupLayout);
    // UploadFile line
    wlUploadFile = new Label(wUpLoadFile, SWT.RIGHT);
    wlUploadFile.setText(BaseMessages.getString(PKG, "JobHTTP.UploadFile.Label"));
    props.setLook(wlUploadFile);
    fdlUploadFile = new FormData();
    fdlUploadFile.left = new FormAttachment(0, 0);
    fdlUploadFile.top = new FormAttachment(wAuthentication, margin);
    fdlUploadFile.right = new FormAttachment(middle, -margin);
    wlUploadFile.setLayoutData(fdlUploadFile);
    wbUploadFile = new Button(wUpLoadFile, SWT.PUSH | SWT.CENTER);
    props.setLook(wbUploadFile);
    wbUploadFile.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbUploadFile = new FormData();
    fdbUploadFile.right = new FormAttachment(100, 0);
    fdbUploadFile.top = new FormAttachment(wAuthentication, margin);
    wbUploadFile.setLayoutData(fdbUploadFile);
    wUploadFile = new TextVar(jobMeta, wUpLoadFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUploadFile);
    wUploadFile.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.UploadFile.Tooltip"));
    wUploadFile.addModifyListener(lsMod);
    fdUploadFile = new FormData();
    fdUploadFile.left = new FormAttachment(middle, 0);
    fdUploadFile.top = new FormAttachment(wAuthentication, margin);
    fdUploadFile.right = new FormAttachment(wbUploadFile, -margin);
    wUploadFile.setLayoutData(fdUploadFile);
    // Whenever something changes, set the tooltip to the expanded version:
    wUploadFile.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            wUploadFile.setToolTipText(jobMeta.environmentSubstitute(wUploadFile.getText()));
        }
    });
    wbUploadFile.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*" });
            if (wUploadFile.getText() != null) {
                dialog.setFileName(jobMeta.environmentSubstitute(wUploadFile.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
                wUploadFile.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
        }
    });
    fdUpLoadFile = new FormData();
    fdUpLoadFile.left = new FormAttachment(0, margin);
    fdUpLoadFile.top = new FormAttachment(wAuthentication, margin);
    fdUpLoadFile.right = new FormAttachment(100, -margin);
    wUpLoadFile.setLayoutData(fdUpLoadFile);
    // ///////////////////////////////////////////////////////////
    // / END OF UpLoadFileGROUP GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF TargetFileGroupGROUP///
    // /
    wTargetFileGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wTargetFileGroup);
    wTargetFileGroup.setText(BaseMessages.getString(PKG, "JobHTTP.TargetFileGroup.Group.Label"));
    FormLayout TargetFileGroupgroupLayout = new FormLayout();
    TargetFileGroupgroupLayout.marginWidth = 10;
    TargetFileGroupgroupLayout.marginHeight = 10;
    wTargetFileGroup.setLayout(TargetFileGroupgroupLayout);
    // TargetFile line
    wlTargetFile = new Label(wTargetFileGroup, SWT.RIGHT);
    wlTargetFile.setText(BaseMessages.getString(PKG, "JobHTTP.TargetFile.Label"));
    props.setLook(wlTargetFile);
    fdlTargetFile = new FormData();
    fdlTargetFile.left = new FormAttachment(0, 0);
    fdlTargetFile.top = new FormAttachment(wUploadFile, margin);
    fdlTargetFile.right = new FormAttachment(middle, -margin);
    wlTargetFile.setLayoutData(fdlTargetFile);
    wbTargetFile = new Button(wTargetFileGroup, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTargetFile);
    wbTargetFile.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbTargetFile = new FormData();
    fdbTargetFile.right = new FormAttachment(100, 0);
    fdbTargetFile.top = new FormAttachment(wUploadFile, margin);
    wbTargetFile.setLayoutData(fdbTargetFile);
    wTargetFile = new TextVar(jobMeta, wTargetFileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTargetFile);
    wTargetFile.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.TargetFile.Tooltip"));
    wTargetFile.addModifyListener(lsMod);
    fdTargetFile = new FormData();
    fdTargetFile.left = new FormAttachment(middle, 0);
    fdTargetFile.top = new FormAttachment(wUploadFile, margin);
    fdTargetFile.right = new FormAttachment(wbTargetFile, -margin);
    wTargetFile.setLayoutData(fdTargetFile);
    wbTargetFile.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.SAVE);
            dialog.setFilterExtensions(new String[] { "*" });
            if (wTargetFile.getText() != null) {
                dialog.setFileName(jobMeta.environmentSubstitute(wTargetFile.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
                wTargetFile.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
        }
    });
    // Append line
    wlAppend = new Label(wTargetFileGroup, SWT.RIGHT);
    wlAppend.setText(BaseMessages.getString(PKG, "JobHTTP.TargetFileAppend.Label"));
    props.setLook(wlAppend);
    fdlAppend = new FormData();
    fdlAppend.left = new FormAttachment(0, 0);
    fdlAppend.top = new FormAttachment(wTargetFile, margin);
    fdlAppend.right = new FormAttachment(middle, -margin);
    wlAppend.setLayoutData(fdlAppend);
    wAppend = new Button(wTargetFileGroup, SWT.CHECK);
    props.setLook(wAppend);
    wAppend.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.TargetFileAppend.Tooltip"));
    fdAppend = new FormData();
    fdAppend.left = new FormAttachment(middle, 0);
    fdAppend.top = new FormAttachment(wTargetFile, margin);
    fdAppend.right = new FormAttachment(100, 0);
    wAppend.setLayoutData(fdAppend);
    // DateTimeAdded line
    wlDateTimeAdded = new Label(wTargetFileGroup, SWT.RIGHT);
    wlDateTimeAdded.setText(BaseMessages.getString(PKG, "JobHTTP.TargetFilenameAddDate.Label"));
    props.setLook(wlDateTimeAdded);
    fdlDateTimeAdded = new FormData();
    fdlDateTimeAdded.left = new FormAttachment(0, 0);
    fdlDateTimeAdded.top = new FormAttachment(wAppend, margin);
    fdlDateTimeAdded.right = new FormAttachment(middle, -margin);
    wlDateTimeAdded.setLayoutData(fdlDateTimeAdded);
    wDateTimeAdded = new Button(wTargetFileGroup, SWT.CHECK);
    props.setLook(wDateTimeAdded);
    wDateTimeAdded.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.TargetFilenameAddDate.Tooltip"));
    fdDateTimeAdded = new FormData();
    fdDateTimeAdded.left = new FormAttachment(middle, 0);
    fdDateTimeAdded.top = new FormAttachment(wAppend, margin);
    fdDateTimeAdded.right = new FormAttachment(100, 0);
    wDateTimeAdded.setLayoutData(fdDateTimeAdded);
    wDateTimeAdded.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setFlags();
        }
    });
    // TargetExt line
    wlTargetExt = new Label(wTargetFileGroup, SWT.RIGHT);
    wlTargetExt.setText(BaseMessages.getString(PKG, "JobHTTP.TargetFileExt.Label"));
    props.setLook(wlTargetExt);
    fdlTargetExt = new FormData();
    fdlTargetExt.left = new FormAttachment(0, 0);
    fdlTargetExt.top = new FormAttachment(wDateTimeAdded, margin);
    fdlTargetExt.right = new FormAttachment(middle, -margin);
    wlTargetExt.setLayoutData(fdlTargetExt);
    wTargetExt = new TextVar(jobMeta, wTargetFileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTargetExt);
    wTargetExt.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.TargetFileExt.Tooltip"));
    wTargetExt.addModifyListener(lsMod);
    fdTargetExt = new FormData();
    fdTargetExt.left = new FormAttachment(middle, 0);
    fdTargetExt.top = new FormAttachment(wDateTimeAdded, margin);
    fdTargetExt.right = new FormAttachment(100, 0);
    wTargetExt.setLayoutData(fdTargetExt);
    // Add filenames to result filenames...
    wlAddFilenameToResult = new Label(wTargetFileGroup, SWT.RIGHT);
    wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "JobHTTP.AddFilenameToResult.Label"));
    props.setLook(wlAddFilenameToResult);
    fdlAddFilenameToResult = new FormData();
    fdlAddFilenameToResult.left = new FormAttachment(0, 0);
    fdlAddFilenameToResult.top = new FormAttachment(wTargetExt, margin);
    fdlAddFilenameToResult.right = new FormAttachment(middle, -margin);
    wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
    wAddFilenameToResult = new Button(wTargetFileGroup, SWT.CHECK);
    wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "JobHTTP.AddFilenameToResult.Tooltip"));
    props.setLook(wAddFilenameToResult);
    fdAddFilenameToResult = new FormData();
    fdAddFilenameToResult.left = new FormAttachment(middle, 0);
    fdAddFilenameToResult.top = new FormAttachment(wTargetExt, margin);
    fdAddFilenameToResult.right = new FormAttachment(100, 0);
    wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
    fdTargetFileGroup = new FormData();
    fdTargetFileGroup.left = new FormAttachment(0, margin);
    fdTargetFileGroup.top = new FormAttachment(wUpLoadFile, margin);
    fdTargetFileGroup.right = new FormAttachment(100, -margin);
    wTargetFileGroup.setLayoutData(fdTargetFileGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF TargetFileGroupGROUP GROUP
    // ///////////////////////////////////////////////////////////
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(wName, 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 Headers TAB ///
    // ////////////////////////
    wHeadersTab = new CTabItem(wTabFolder, SWT.NONE);
    wHeadersTab.setText(BaseMessages.getString(PKG, "JobHTTP.Tab.Headers.Label"));
    wHeadersComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wHeadersComp);
    FormLayout HeadersLayout = new FormLayout();
    HeadersLayout.marginWidth = 3;
    HeadersLayout.marginHeight = 3;
    wHeadersComp.setLayout(HeadersLayout);
    int rows = jobEntry.getHeaderName() == null ? 1 : (jobEntry.getHeaderName().length == 0 ? 0 : jobEntry.getHeaderName().length);
    colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobHTTP.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_CCOMBO, HTTPProtocol.getRequestHeaders(), false), new ColumnInfo(BaseMessages.getString(PKG, "JobHTTP.ColumnInfo.Value"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
    colinf[0].setUsingVariables(true);
    colinf[1].setUsingVariables(true);
    wHeaders = new TableView(jobMeta, wHeadersComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, rows, lsMod, props);
    fdHeaders = new FormData();
    fdHeaders.left = new FormAttachment(0, margin);
    fdHeaders.top = new FormAttachment(wName, margin);
    fdHeaders.right = new FormAttachment(100, -margin);
    fdHeaders.bottom = new FormAttachment(100, -margin);
    wHeaders.setLayoutData(fdHeaders);
    fdHeadersComp = new FormData();
    fdHeadersComp.left = new FormAttachment(0, 0);
    fdHeadersComp.top = new FormAttachment(0, 0);
    fdHeadersComp.right = new FormAttachment(100, 0);
    fdHeadersComp.bottom = new FormAttachment(100, 0);
    wHeadersComp.setLayoutData(fdHeadersComp);
    wHeadersComp.layout();
    wHeadersTab.setControl(wHeadersComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Headers 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();
        }
    };
    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);
    lsDef = new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wName.addSelectionListener(lsDef);
    wURL.addSelectionListener(lsDef);
    wTargetFile.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, "JobHTTPDialogSize");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Aggregations

PasswordTextVar (org.pentaho.di.ui.core.widget.PasswordTextVar)27 TextVar (org.pentaho.di.ui.core.widget.TextVar)27 FormAttachment (org.eclipse.swt.layout.FormAttachment)26 FormData (org.eclipse.swt.layout.FormData)26 Label (org.eclipse.swt.widgets.Label)26 FormLayout (org.eclipse.swt.layout.FormLayout)24 Button (org.eclipse.swt.widgets.Button)24 SelectionEvent (org.eclipse.swt.events.SelectionEvent)23 Text (org.eclipse.swt.widgets.Text)23 ModifyEvent (org.eclipse.swt.events.ModifyEvent)22 ModifyListener (org.eclipse.swt.events.ModifyListener)22 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)22 Display (org.eclipse.swt.widgets.Display)22 Event (org.eclipse.swt.widgets.Event)22 Listener (org.eclipse.swt.widgets.Listener)22 Shell (org.eclipse.swt.widgets.Shell)22 ShellAdapter (org.eclipse.swt.events.ShellAdapter)21 ShellEvent (org.eclipse.swt.events.ShellEvent)21 CTabItem (org.eclipse.swt.custom.CTabItem)20 Composite (org.eclipse.swt.widgets.Composite)20