Search in sources :

Example 36 with ComboVar

use of org.pentaho.di.ui.core.widget.ComboVar 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 37 with ComboVar

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

the class JobEntrySimpleEvalDialog 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, "JobSimpleEval.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobSimpleEval.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, "JobSimpleEval.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);
    // SuccessOngrouping?
    // ////////////////////////
    // START OF SUCCESS ON GROUP///
    // /
    wSource = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wSource);
    wSource.setText(BaseMessages.getString(PKG, "JobSimpleEval.Source.Group.Label"));
    FormLayout sourcegroupLayout = new FormLayout();
    sourcegroupLayout.marginWidth = 10;
    sourcegroupLayout.marginHeight = 10;
    wSource.setLayout(sourcegroupLayout);
    // Evaluate value (variable ou field from previous result entry)?
    wlValueType = new Label(wSource, SWT.RIGHT);
    wlValueType.setText(BaseMessages.getString(PKG, "JobSimpleEval.ValueType.Label"));
    props.setLook(wlValueType);
    FormData fdlValueType = new FormData();
    fdlValueType.left = new FormAttachment(0, -margin);
    fdlValueType.right = new FormAttachment(middle, -margin);
    fdlValueType.top = new FormAttachment(0, margin);
    wlValueType.setLayoutData(fdlValueType);
    wValueType = new CCombo(wSource, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wValueType.setItems(JobEntrySimpleEval.valueTypeDesc);
    props.setLook(wValueType);
    FormData fdValueType = new FormData();
    fdValueType.left = new FormAttachment(middle, 0);
    fdValueType.top = new FormAttachment(0, margin);
    fdValueType.right = new FormAttachment(100, 0);
    wValueType.setLayoutData(fdValueType);
    wValueType.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            refresh();
        }
    });
    // Name of the field to evaluate
    wlFieldName = new Label(wSource, SWT.RIGHT);
    wlFieldName.setText(BaseMessages.getString(PKG, "JobSimpleEval.FieldName.Label"));
    props.setLook(wlFieldName);
    fdlFieldName = new FormData();
    fdlFieldName.left = new FormAttachment(0, 0);
    fdlFieldName.top = new FormAttachment(wValueType, margin);
    fdlFieldName.right = new FormAttachment(middle, -margin);
    wlFieldName.setLayoutData(fdlFieldName);
    wFieldName = new TextVar(jobMeta, wSource, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSimpleEval.FieldName.Tooltip"));
    props.setLook(wFieldName);
    wFieldName.addModifyListener(lsMod);
    fdFieldName = new FormData();
    fdFieldName.left = new FormAttachment(middle, 0);
    fdFieldName.top = new FormAttachment(wValueType, margin);
    fdFieldName.right = new FormAttachment(100, -margin);
    wFieldName.setLayoutData(fdFieldName);
    // Name of the variable to evaluate
    wlVariableName = new Label(wSource, SWT.RIGHT);
    wlVariableName.setText(BaseMessages.getString(PKG, "JobSimpleEval.Variable.Label"));
    props.setLook(wlVariableName);
    fdlVariableName = new FormData();
    fdlVariableName.left = new FormAttachment(0, 0);
    fdlVariableName.top = new FormAttachment(wValueType, margin);
    fdlVariableName.right = new FormAttachment(middle, -margin);
    wlVariableName.setLayoutData(fdlVariableName);
    wVariableName = new TextVar(jobMeta, wSource, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSimpleEval.Variable.Tooltip"));
    props.setLook(wVariableName);
    wVariableName.addModifyListener(lsMod);
    fdVariableName = new FormData();
    fdVariableName.left = new FormAttachment(middle, 0);
    fdVariableName.top = new FormAttachment(wValueType, margin);
    fdVariableName.right = new FormAttachment(100, -margin);
    wVariableName.setLayoutData(fdVariableName);
    // Field type
    wlFieldType = new Label(wSource, SWT.RIGHT);
    wlFieldType.setText(BaseMessages.getString(PKG, "JobSimpleEval.FieldType.Label"));
    props.setLook(wlFieldType);
    FormData fdlFieldType = new FormData();
    fdlFieldType.left = new FormAttachment(0, 0);
    fdlFieldType.right = new FormAttachment(middle, -margin);
    fdlFieldType.top = new FormAttachment(wVariableName, margin);
    wlFieldType.setLayoutData(fdlFieldType);
    wFieldType = new CCombo(wSource, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wFieldType.setItems(JobEntrySimpleEval.fieldTypeDesc);
    props.setLook(wFieldType);
    FormData fdFieldType = new FormData();
    fdFieldType.left = new FormAttachment(middle, 0);
    fdFieldType.top = new FormAttachment(wVariableName, margin);
    fdFieldType.right = new FormAttachment(100, 0);
    wFieldType.setLayoutData(fdFieldType);
    wFieldType.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            refresh();
        }
    });
    // Mask
    wlMask = new Label(wSource, SWT.RIGHT);
    wlMask.setText(BaseMessages.getString(PKG, "JobSimpleEval.Mask.Label"));
    props.setLook(wlMask);
    FormData fdlMask = new FormData();
    fdlMask.left = new FormAttachment(0, 0);
    fdlMask.right = new FormAttachment(middle, -margin);
    fdlMask.top = new FormAttachment(wFieldType, margin);
    wlMask.setLayoutData(fdlMask);
    wMask = new ComboVar(jobMeta, wSource, SWT.BORDER | SWT.READ_ONLY);
    wMask.setItems(Const.getDateFormats());
    wMask.setEditable(true);
    props.setLook(wMask);
    FormData fdMask = new FormData();
    fdMask.left = new FormAttachment(middle, 0);
    fdMask.top = new FormAttachment(wFieldType, margin);
    fdMask.right = new FormAttachment(100, 0);
    wMask.setLayoutData(fdMask);
    wMask.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
        }
    });
    fdSource = new FormData();
    fdSource.left = new FormAttachment(0, margin);
    fdSource.top = new FormAttachment(wName, margin);
    fdSource.right = new FormAttachment(100, -margin);
    wSource.setLayoutData(fdSource);
    // ///////////////////////////////////////////////////////////
    // / END OF Success ON GROUP
    // ///////////////////////////////////////////////////////////
    // SuccessOngrouping?
    // ////////////////////////
    // START OF SUCCESS ON GROUP///
    // /
    wSuccessOn = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wSuccessOn);
    wSuccessOn.setText(BaseMessages.getString(PKG, "JobSimpleEval.SuccessOn.Group.Label"));
    FormLayout successongroupLayout = new FormLayout();
    successongroupLayout.marginWidth = 10;
    successongroupLayout.marginHeight = 10;
    wSuccessOn.setLayout(successongroupLayout);
    // Success when variable is not set?
    wlsuccessWhenSet = new Label(wSuccessOn, SWT.RIGHT);
    wlsuccessWhenSet.setText(BaseMessages.getString(PKG, "JobSimpleEval.SuccessWhenSet.Label"));
    props.setLook(wlsuccessWhenSet);
    fdlsuccessWhenSet = new FormData();
    fdlsuccessWhenSet.left = new FormAttachment(0, 0);
    fdlsuccessWhenSet.top = new FormAttachment(wVariableName, margin);
    fdlsuccessWhenSet.right = new FormAttachment(middle, -margin);
    wlsuccessWhenSet.setLayoutData(fdlsuccessWhenSet);
    wSuccessWhenSet = new Button(wSuccessOn, SWT.CHECK);
    wSuccessWhenSet.setToolTipText(BaseMessages.getString(PKG, "JobSimpleEval.SuccessWhenSet.Tooltip"));
    props.setLook(wSuccessWhenSet);
    fdSuccessWhenSet = new FormData();
    fdSuccessWhenSet.left = new FormAttachment(middle, 0);
    fdSuccessWhenSet.top = new FormAttachment(wVariableName, margin);
    fdSuccessWhenSet.right = new FormAttachment(100, 0);
    wSuccessWhenSet.setLayoutData(fdSuccessWhenSet);
    wSuccessWhenSet.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            refresh();
            jobEntry.setChanged();
        }
    });
    // Success Condition
    wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT);
    wlSuccessCondition.setText(BaseMessages.getString(PKG, "JobSimpleEval.SuccessCondition.Label"));
    props.setLook(wlSuccessCondition);
    FormData fdlSuccessCondition = new FormData();
    fdlSuccessCondition.left = new FormAttachment(0, 0);
    fdlSuccessCondition.right = new FormAttachment(middle, 0);
    fdlSuccessCondition.top = new FormAttachment(wSuccessWhenSet, margin);
    wlSuccessCondition.setLayoutData(fdlSuccessCondition);
    wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wSuccessCondition.setItems(JobEntrySimpleEval.successConditionDesc);
    // +1: starts at -1
    wSuccessCondition.select(0);
    props.setLook(wSuccessCondition);
    FormData fdSuccessCondition = new FormData();
    fdSuccessCondition.left = new FormAttachment(middle, 0);
    fdSuccessCondition.top = new FormAttachment(wSuccessWhenSet, margin);
    fdSuccessCondition.right = new FormAttachment(100, 0);
    wSuccessCondition.setLayoutData(fdSuccessCondition);
    wSuccessCondition.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
        }
    });
    // Success number(date) Condition
    wlSuccessNumberCondition = new Label(wSuccessOn, SWT.RIGHT);
    wlSuccessNumberCondition.setText(BaseMessages.getString(PKG, "JobSimpleEval.SuccessNumberCondition.Label"));
    props.setLook(wlSuccessNumberCondition);
    fdlSuccessNumberCondition = new FormData();
    fdlSuccessNumberCondition.left = new FormAttachment(0, 0);
    fdlSuccessNumberCondition.right = new FormAttachment(middle, -margin);
    fdlSuccessNumberCondition.top = new FormAttachment(wSuccessWhenSet, margin);
    wlSuccessNumberCondition.setLayoutData(fdlSuccessNumberCondition);
    wSuccessNumberCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wSuccessNumberCondition.setItems(JobEntrySimpleEval.successNumberConditionDesc);
    // +1: starts at -1
    wSuccessNumberCondition.select(0);
    props.setLook(wSuccessNumberCondition);
    fdSuccessNumberCondition = new FormData();
    fdSuccessNumberCondition.left = new FormAttachment(middle, 0);
    fdSuccessNumberCondition.top = new FormAttachment(wSuccessWhenSet, margin);
    fdSuccessNumberCondition.right = new FormAttachment(100, 0);
    wSuccessNumberCondition.setLayoutData(fdSuccessNumberCondition);
    wSuccessNumberCondition.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            refresh();
        }
    });
    // Success Boolean Condition
    wlSuccessBooleanCondition = new Label(wSuccessOn, SWT.RIGHT);
    wlSuccessBooleanCondition.setText(BaseMessages.getString(PKG, "JobSimpleEval.SuccessBooleanCondition.Label"));
    props.setLook(wlSuccessBooleanCondition);
    fdlSuccessBooleanCondition = new FormData();
    fdlSuccessBooleanCondition.left = new FormAttachment(0, 0);
    fdlSuccessBooleanCondition.right = new FormAttachment(middle, -margin);
    fdlSuccessBooleanCondition.top = new FormAttachment(wSuccessWhenSet, margin);
    wlSuccessBooleanCondition.setLayoutData(fdlSuccessBooleanCondition);
    wSuccessBooleanCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wSuccessBooleanCondition.setItems(JobEntrySimpleEval.successBooleanConditionDesc);
    // +1: starts at -1
    wSuccessBooleanCondition.select(0);
    props.setLook(wSuccessBooleanCondition);
    fdSuccessBooleanCondition = new FormData();
    fdSuccessBooleanCondition.left = new FormAttachment(middle, 0);
    fdSuccessBooleanCondition.top = new FormAttachment(wSuccessWhenSet, margin);
    fdSuccessBooleanCondition.right = new FormAttachment(100, 0);
    wSuccessBooleanCondition.setLayoutData(fdSuccessBooleanCondition);
    wSuccessBooleanCondition.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            refresh();
        }
    });
    // Compare with value
    wlCompareValue = new Label(wSuccessOn, SWT.RIGHT);
    wlCompareValue.setText(BaseMessages.getString(PKG, "JobSimpleEval.CompareValue.Label"));
    props.setLook(wlCompareValue);
    fdlCompareValue = new FormData();
    fdlCompareValue.left = new FormAttachment(0, 0);
    fdlCompareValue.top = new FormAttachment(wSuccessNumberCondition, margin);
    fdlCompareValue.right = new FormAttachment(middle, -margin);
    wlCompareValue.setLayoutData(fdlCompareValue);
    wCompareValue = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSimpleEval.CompareValue.Tooltip"));
    props.setLook(wCompareValue);
    wCompareValue.addModifyListener(lsMod);
    fdCompareValue = new FormData();
    fdCompareValue.left = new FormAttachment(middle, 0);
    fdCompareValue.top = new FormAttachment(wSuccessNumberCondition, margin);
    fdCompareValue.right = new FormAttachment(100, -margin);
    wCompareValue.setLayoutData(fdCompareValue);
    // Min value
    wlMinValue = new Label(wSuccessOn, SWT.RIGHT);
    wlMinValue.setText(BaseMessages.getString(PKG, "JobSimpleEval.MinValue.Label"));
    props.setLook(wlMinValue);
    fdlMinValue = new FormData();
    fdlMinValue.left = new FormAttachment(0, 0);
    fdlMinValue.top = new FormAttachment(wSuccessNumberCondition, margin);
    fdlMinValue.right = new FormAttachment(middle, -margin);
    wlMinValue.setLayoutData(fdlMinValue);
    wMinValue = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSimpleEval.MinValue.Tooltip"));
    props.setLook(wMinValue);
    wMinValue.addModifyListener(lsMod);
    fdMinValue = new FormData();
    fdMinValue.left = new FormAttachment(middle, 0);
    fdMinValue.top = new FormAttachment(wSuccessNumberCondition, margin);
    fdMinValue.right = new FormAttachment(100, -margin);
    wMinValue.setLayoutData(fdMinValue);
    // Maximum value
    wlMaxValue = new Label(wSuccessOn, SWT.RIGHT);
    wlMaxValue.setText(BaseMessages.getString(PKG, "JobSimpleEval.MaxValue.Label"));
    props.setLook(wlMaxValue);
    fdlMaxValue = new FormData();
    fdlMaxValue.left = new FormAttachment(0, 0);
    fdlMaxValue.top = new FormAttachment(wMinValue, margin);
    fdlMaxValue.right = new FormAttachment(middle, -margin);
    wlMaxValue.setLayoutData(fdlMaxValue);
    wMaxValue = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSimpleEval.MaxValue.Tooltip"));
    props.setLook(wMaxValue);
    wMaxValue.addModifyListener(lsMod);
    fdMaxValue = new FormData();
    fdMaxValue.left = new FormAttachment(middle, 0);
    fdMaxValue.top = new FormAttachment(wMinValue, margin);
    fdMaxValue.right = new FormAttachment(100, -margin);
    wMaxValue.setLayoutData(fdMaxValue);
    fdSuccessOn = new FormData();
    fdSuccessOn.left = new FormAttachment(0, margin);
    fdSuccessOn.top = new FormAttachment(wSource, margin);
    fdSuccessOn.right = new FormAttachment(100, -margin);
    wSuccessOn.setLayoutData(fdSuccessOn);
    // ///////////////////////////////////////////////////////////
    // / END OF Success ON GROUP
    // ///////////////////////////////////////////////////////////
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsCancel = new Listener() {

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

        public void handleEvent(Event e) {
            ok();
        }
    };
    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);
    lsDef = new SelectionAdapter() {

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

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

Example 38 with ComboVar

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

the class JobEntrySyslogDialog method open.

public JobEntryInterface open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);
    ModifyListener lsMod = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
        }
    };
    changed = jobEntry.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Job entry name line
    wName = new LabelText(shell, BaseMessages.getString(PKG, "JobEntrySyslog.Name.Label"), BaseMessages.getString(PKG, "JobEntrySyslog.Name.Tooltip"));
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.top = new FormAttachment(0, 0);
    fdName.left = new FormAttachment(0, 0);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Tab.General.Label"));
    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wServerSettings);
    wServerSettings.setText(BaseMessages.getString(PKG, "JobEntrySyslog.ServerSettings.Group.Label"));
    FormLayout ServerSettingsgroupLayout = new FormLayout();
    ServerSettingsgroupLayout.marginWidth = 10;
    ServerSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(ServerSettingsgroupLayout);
    // Server port line
    wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobEntrySyslog.Server.Label"), BaseMessages.getString(PKG, "JobEntrySyslog.Server.Tooltip"));
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    fdServerName = new FormData();
    fdServerName.left = new FormAttachment(0, 0);
    fdServerName.top = new FormAttachment(wName, margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // Server port line
    wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobEntrySyslog.Port.Label"), BaseMessages.getString(PKG, "JobEntrySyslog.Port.Tooltip"));
    props.setLook(wPort);
    wPort.addModifyListener(lsMod);
    fdPort = new FormData();
    fdPort.left = new FormAttachment(0, 0);
    fdPort.top = new FormAttachment(wServerName, margin);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);
    // Test connection button
    wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "JobEntrySyslog.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "JobEntrySyslog.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wPort, 2 * margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wName, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Log SETTINGS GROUP///
    // /
    wLogSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wLogSettings);
    wLogSettings.setText(BaseMessages.getString(PKG, "JobEntrySyslog.LogSettings.Group.Label"));
    FormLayout LogSettingsgroupLayout = new FormLayout();
    LogSettingsgroupLayout.marginWidth = 10;
    LogSettingsgroupLayout.marginHeight = 10;
    wLogSettings.setLayout(LogSettingsgroupLayout);
    // Facility type
    wlFacility = new Label(wLogSettings, SWT.RIGHT);
    wlFacility.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Facility.Label"));
    props.setLook(wlFacility);
    fdlFacility = new FormData();
    fdlFacility.left = new FormAttachment(0, margin);
    fdlFacility.right = new FormAttachment(middle, -margin);
    fdlFacility.top = new FormAttachment(wServerSettings, margin);
    wlFacility.setLayoutData(fdlFacility);
    wFacility = new CCombo(wLogSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wFacility.setItems(SyslogDefs.FACILITYS);
    props.setLook(wFacility);
    fdFacility = new FormData();
    fdFacility.left = new FormAttachment(middle, margin);
    fdFacility.top = new FormAttachment(wServerSettings, margin);
    fdFacility.right = new FormAttachment(100, 0);
    wFacility.setLayoutData(fdFacility);
    wFacility.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
        }
    });
    // Priority type
    wlPriority = new Label(wLogSettings, SWT.RIGHT);
    wlPriority.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Priority.Label"));
    props.setLook(wlPriority);
    fdlPriority = new FormData();
    fdlPriority.left = new FormAttachment(0, margin);
    fdlPriority.right = new FormAttachment(middle, -margin);
    fdlPriority.top = new FormAttachment(wFacility, margin);
    wlPriority.setLayoutData(fdlPriority);
    wPriority = new CCombo(wLogSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wPriority.setItems(SyslogDefs.PRIORITYS);
    props.setLook(wPriority);
    fdPriority = new FormData();
    fdPriority.left = new FormAttachment(middle, margin);
    fdPriority.top = new FormAttachment(wFacility, margin);
    fdPriority.right = new FormAttachment(100, 0);
    wPriority.setLayoutData(fdPriority);
    wPriority.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
        }
    });
    fdLogSettings = new FormData();
    fdLogSettings.left = new FormAttachment(0, margin);
    fdLogSettings.top = new FormAttachment(wServerSettings, margin);
    fdLogSettings.right = new FormAttachment(100, -margin);
    wLogSettings.setLayoutData(fdLogSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Log SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF MESSAGE GROUP///
    // /
    wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wMessageGroup);
    wMessageGroup.setText(BaseMessages.getString(PKG, "JobEntrySyslog.MessageGroup.Group.Label"));
    FormLayout MessageGroupgroupLayout = new FormLayout();
    MessageGroupgroupLayout.marginWidth = 10;
    MessageGroupgroupLayout.marginHeight = 10;
    wMessageGroup.setLayout(MessageGroupgroupLayout);
    // Add HostName?
    wlAddHostName = new Label(wMessageGroup, SWT.RIGHT);
    wlAddHostName.setText(BaseMessages.getString(PKG, "JobEntrySyslog.AddHostName.Label"));
    props.setLook(wlAddHostName);
    fdlAddHostName = new FormData();
    fdlAddHostName.left = new FormAttachment(0, 0);
    fdlAddHostName.top = new FormAttachment(wLogSettings, margin);
    fdlAddHostName.right = new FormAttachment(middle, -margin);
    wlAddHostName.setLayoutData(fdlAddHostName);
    wAddHostName = new Button(wMessageGroup, SWT.CHECK);
    props.setLook(wAddHostName);
    wAddHostName.setToolTipText(BaseMessages.getString(PKG, "JobEntrySyslog.AddHostName.Tooltip"));
    fdAddHostName = new FormData();
    fdAddHostName.left = new FormAttachment(middle, margin);
    fdAddHostName.top = new FormAttachment(wLogSettings, margin);
    fdAddHostName.right = new FormAttachment(100, 0);
    wAddHostName.setLayoutData(fdAddHostName);
    wAddHostName.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    // Add timestamp?
    wlAddTimestamp = new Label(wMessageGroup, SWT.RIGHT);
    wlAddTimestamp.setText(BaseMessages.getString(PKG, "JobEntrySyslog.AddTimestamp.Label"));
    props.setLook(wlAddTimestamp);
    fdlAddTimestamp = new FormData();
    fdlAddTimestamp.left = new FormAttachment(0, 0);
    fdlAddTimestamp.top = new FormAttachment(wAddHostName, margin);
    fdlAddTimestamp.right = new FormAttachment(middle, -margin);
    wlAddTimestamp.setLayoutData(fdlAddTimestamp);
    wAddTimestamp = new Button(wMessageGroup, SWT.CHECK);
    props.setLook(wAddTimestamp);
    wAddTimestamp.setToolTipText(BaseMessages.getString(PKG, "JobEntrySyslog.AddTimestamp.Tooltip"));
    fdAddTimestamp = new FormData();
    fdAddTimestamp.left = new FormAttachment(middle, margin);
    fdAddTimestamp.top = new FormAttachment(wAddHostName, margin);
    fdAddTimestamp.right = new FormAttachment(100, 0);
    wAddTimestamp.setLayoutData(fdAddTimestamp);
    wAddTimestamp.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeAddTimestamp();
            jobEntry.setChanged();
        }
    });
    // DatePattern type
    wlDatePattern = new Label(wMessageGroup, SWT.RIGHT);
    wlDatePattern.setText(BaseMessages.getString(PKG, "JobEntrySyslog.DatePattern.Label"));
    props.setLook(wlDatePattern);
    fdlDatePattern = new FormData();
    fdlDatePattern.left = new FormAttachment(0, margin);
    fdlDatePattern.right = new FormAttachment(middle, -margin);
    fdlDatePattern.top = new FormAttachment(wAddTimestamp, margin);
    wlDatePattern.setLayoutData(fdlDatePattern);
    wDatePattern = new ComboVar(jobMeta, wMessageGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wDatePattern.setItems(Const.getDateFormats());
    props.setLook(wDatePattern);
    fdDatePattern = new FormData();
    fdDatePattern.left = new FormAttachment(middle, margin);
    fdDatePattern.top = new FormAttachment(wAddTimestamp, margin);
    fdDatePattern.right = new FormAttachment(100, 0);
    wDatePattern.setLayoutData(fdDatePattern);
    wDatePattern.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
        }
    });
    // Message line
    wlMessage = new Label(wMessageGroup, SWT.RIGHT);
    wlMessage.setText(BaseMessages.getString(PKG, "JobEntrySyslog.Message.Label"));
    props.setLook(wlMessage);
    fdlMessage = new FormData();
    fdlMessage.left = new FormAttachment(0, margin);
    fdlMessage.top = new FormAttachment(wLogSettings, margin);
    fdlMessage.right = new FormAttachment(middle, -margin);
    wlMessage.setLayoutData(fdlMessage);
    wMessage = new StyledTextComp(jobEntry, wMessageGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
    props.setLook(wMessage);
    wMessage.addModifyListener(lsMod);
    fdMessage = new FormData();
    fdMessage.left = new FormAttachment(middle, margin);
    fdMessage.top = new FormAttachment(wDatePattern, margin);
    fdMessage.right = new FormAttachment(100, -2 * margin);
    fdMessage.bottom = new FormAttachment(100, -margin);
    wMessage.setLayoutData(fdMessage);
    fdMessageGroup = new FormData();
    fdMessageGroup.left = new FormAttachment(0, margin);
    fdMessageGroup.top = new FormAttachment(wLogSettings, margin);
    fdMessageGroup.right = new FormAttachment(100, -margin);
    fdMessageGroup.bottom = new FormAttachment(100, -margin);
    wMessageGroup.setLayoutData(fdMessageGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF MESSAGE GROUP
    // ///////////////////////////////////////////////////////////
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsCancel = new Listener() {

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

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

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

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    activeAddTimestamp();
    wTabFolder.setSelection(0);
    BaseStepDialog.setSize(shell);
    shell.open();
    props.setDialogSize(shell, "JobEntrySyslogDialogSize");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
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) 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) LabelText(org.pentaho.di.ui.core.widget.LabelText) FormAttachment(org.eclipse.swt.layout.FormAttachment) 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) 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) Display(org.eclipse.swt.widgets.Display)

Example 39 with ComboVar

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

the class JobEntryJobDialog method createElements.

protected void createElements() {
    super.createElements();
    shell.setText(BaseMessages.getString(PKG, "JobJob.Header"));
    wlPath.setText(BaseMessages.getString(PKG, "JobJob.JobStep.Job.Label"));
    // wlDescription.setText( BaseMessages.getString( PKG, "JobJob.Local.Label" ) );
    wPassParams.setText(BaseMessages.getString(PKG, "JobJob.PassAllParameters.Label"));
    // Start Server Section
    wPassExport = new Button(gExecution, SWT.CHECK);
    wPassExport.setText(BaseMessages.getString(PKG, "JobJob.PassExportToSlave.Label"));
    props.setLook(wPassExport);
    FormData fdPassExport = new FormData();
    fdPassExport.left = new FormAttachment(0, 0);
    fdPassExport.top = new FormAttachment(wEveryRow, 10);
    fdPassExport.right = new FormAttachment(100, 0);
    wPassExport.setLayoutData(fdPassExport);
    wExpandRemote = new Button(gExecution, SWT.CHECK);
    wExpandRemote.setText(BaseMessages.getString(PKG, "JobEntryJobDialog.ExpandRemoteOnSlave.Label"));
    props.setLook(wExpandRemote);
    FormData fdExpandRemote = new FormData();
    fdExpandRemote.top = new FormAttachment(wPassExport, 10);
    fdExpandRemote.left = new FormAttachment(0, 0);
    wExpandRemote.setLayoutData(fdExpandRemote);
    wWaitingToFinish = new Button(gExecution, SWT.CHECK);
    props.setLook(wWaitingToFinish);
    wWaitingToFinish.setText(BaseMessages.getString(PKG, "JobJob.WaitToFinish.Label"));
    FormData fdWait = new FormData();
    fdWait.top = new FormAttachment(wExpandRemote, 10);
    fdWait.left = new FormAttachment(0, 0);
    wWaitingToFinish.setLayoutData(fdWait);
    wFollowingAbortRemotely = new Button(gExecution, SWT.CHECK);
    props.setLook(wFollowingAbortRemotely);
    wFollowingAbortRemotely.setText(BaseMessages.getString(PKG, "JobJob.AbortRemote.Label"));
    FormData fdFollow = new FormData();
    fdFollow.top = new FormAttachment(wWaitingToFinish, 10);
    fdFollow.left = new FormAttachment(0, 0);
    wFollowingAbortRemotely.setLayoutData(fdFollow);
    // End Server Section
    Composite cRunConfiguration = new Composite(wOptions, SWT.NONE);
    cRunConfiguration.setLayout(new FormLayout());
    props.setLook(cRunConfiguration);
    FormData fdLocal = new FormData();
    fdLocal.top = new FormAttachment(0);
    fdLocal.right = new FormAttachment(100);
    fdLocal.left = new FormAttachment(0);
    // the default looks ugly
    cRunConfiguration.setBackground(shell.getBackground());
    cRunConfiguration.setLayoutData(fdLocal);
    Label wlRunConfiguration = new Label(cRunConfiguration, SWT.LEFT);
    props.setLook(wlRunConfiguration);
    wlRunConfiguration.setText("Run configuration:");
    FormData fdlRunConfiguration = new FormData();
    fdlRunConfiguration.top = new FormAttachment(0);
    fdlRunConfiguration.left = new FormAttachment(0);
    wlRunConfiguration.setLayoutData(fdlRunConfiguration);
    wRunConfiguration = new ComboVar(jobMeta, cRunConfiguration, SWT.BORDER);
    props.setLook(wRunConfiguration);
    FormData fdRunConfiguration = new FormData();
    fdRunConfiguration.width = 200;
    fdRunConfiguration.top = new FormAttachment(wlRunConfiguration, 5);
    fdRunConfiguration.left = new FormAttachment(0);
    wRunConfiguration.setLayoutData(fdRunConfiguration);
    fdgExecution.top = new FormAttachment(cRunConfiguration, 10);
    wbGetParams.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            // force reload from file specification
            getParameters(null);
        }
    });
    wbBrowse.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (rep != null) {
                selectJob();
            } else {
                pickFileVFS();
            }
        }
    });
    wbLogFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            selectLogFile(FILE_FILTERLOGNAMES);
        }
    });
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormLayout(org.eclipse.swt.layout.FormLayout) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 40 with ComboVar

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

the class JobEntryZipFileDialog 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, "JobZipFiles.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // ZipFilename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobZipFiles.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, "JobZipFiles.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);
    // SourceFile grouping?
    // ////////////////////////
    // START OF SourceFile GROUP///
    // /
    wSourceFiles = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wSourceFiles);
    wSourceFiles.setText(BaseMessages.getString(PKG, "JobZipFiles.SourceFiles.Group.Label"));
    FormLayout groupLayout = new FormLayout();
    groupLayout.marginWidth = 10;
    groupLayout.marginHeight = 10;
    wSourceFiles.setLayout(groupLayout);
    // Get Result from previous?
    wlgetFromPrevious = new Label(wSourceFiles, SWT.RIGHT);
    wlgetFromPrevious.setText(BaseMessages.getString(PKG, "JobZipFiles.getFromPrevious.Label"));
    props.setLook(wlgetFromPrevious);
    fdlgetFromPrevious = new FormData();
    fdlgetFromPrevious.left = new FormAttachment(0, 0);
    fdlgetFromPrevious.top = new FormAttachment(wName, margin);
    fdlgetFromPrevious.right = new FormAttachment(middle, -margin);
    wlgetFromPrevious.setLayoutData(fdlgetFromPrevious);
    wgetFromPrevious = new Button(wSourceFiles, SWT.CHECK);
    props.setLook(wgetFromPrevious);
    wgetFromPrevious.setToolTipText(BaseMessages.getString(PKG, "JobZipFiles.getFromPrevious.Tooltip"));
    fdgetFromPrevious = new FormData();
    fdgetFromPrevious.left = new FormAttachment(middle, 0);
    fdgetFromPrevious.top = new FormAttachment(wName, margin);
    fdgetFromPrevious.right = new FormAttachment(100, 0);
    wgetFromPrevious.setLayoutData(fdgetFromPrevious);
    wgetFromPrevious.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
            setGetFromPrevious();
        }
    });
    // TargetDirectory line
    wlSourceDirectory = new Label(wSourceFiles, SWT.RIGHT);
    wlSourceDirectory.setText(BaseMessages.getString(PKG, "JobZipFiles.SourceDir.Label"));
    props.setLook(wlSourceDirectory);
    fdlSourceDirectory = new FormData();
    fdlSourceDirectory.left = new FormAttachment(0, 0);
    fdlSourceDirectory.top = new FormAttachment(wgetFromPrevious, margin);
    fdlSourceDirectory.right = new FormAttachment(middle, -margin);
    wlSourceDirectory.setLayoutData(fdlSourceDirectory);
    // Browse folders button ...
    wbSourceDirectory = new Button(wSourceFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbSourceDirectory);
    wbSourceDirectory.setText(BaseMessages.getString(PKG, "JobZipFiles.BrowseFolders.Label"));
    fdbSourceDirectory = new FormData();
    fdbSourceDirectory.right = new FormAttachment(100, 0);
    fdbSourceDirectory.top = new FormAttachment(wgetFromPrevious, margin);
    wbSourceDirectory.setLayoutData(fdbSourceDirectory);
    // Browse Destination file browse button ...
    wbSourceFile = new Button(wSourceFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbSourceFile);
    wbSourceFile.setText(BaseMessages.getString(PKG, "JobZipFiles.BrowseFiles.Label"));
    fdbSourceFile = new FormData();
    fdbSourceFile.right = new FormAttachment(wbSourceDirectory, -margin);
    fdbSourceFile.top = new FormAttachment(wgetFromPrevious, margin);
    wbSourceFile.setLayoutData(fdbSourceFile);
    wSourceDirectory = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobZipFiles.SourceDir.Tooltip"));
    props.setLook(wSourceDirectory);
    wSourceDirectory.addModifyListener(lsMod);
    fdSourceDirectory = new FormData();
    fdSourceDirectory.left = new FormAttachment(middle, 0);
    fdSourceDirectory.top = new FormAttachment(wgetFromPrevious, margin);
    fdSourceDirectory.right = new FormAttachment(wbSourceFile, -margin);
    wSourceDirectory.setLayoutData(fdSourceDirectory);
    // Wildcard line
    wlWildcard = new Label(wSourceFiles, SWT.RIGHT);
    wlWildcard.setText(BaseMessages.getString(PKG, "JobZipFiles.Wildcard.Label"));
    props.setLook(wlWildcard);
    fdlWildcard = new FormData();
    fdlWildcard.left = new FormAttachment(0, 0);
    fdlWildcard.top = new FormAttachment(wSourceDirectory, margin);
    fdlWildcard.right = new FormAttachment(middle, -margin);
    wlWildcard.setLayoutData(fdlWildcard);
    wWildcard = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobZipFiles.Wildcard.Tooltip"));
    props.setLook(wWildcard);
    wWildcard.addModifyListener(lsMod);
    fdWildcard = new FormData();
    fdWildcard.left = new FormAttachment(middle, 0);
    fdWildcard.top = new FormAttachment(wSourceDirectory, margin);
    fdWildcard.right = new FormAttachment(100, 0);
    wWildcard.setLayoutData(fdWildcard);
    // Wildcard to exclude
    wlWildcardExclude = new Label(wSourceFiles, SWT.RIGHT);
    wlWildcardExclude.setText(BaseMessages.getString(PKG, "JobZipFiles.WildcardExclude.Label"));
    props.setLook(wlWildcardExclude);
    fdlWildcardExclude = new FormData();
    fdlWildcardExclude.left = new FormAttachment(0, 0);
    fdlWildcardExclude.top = new FormAttachment(wWildcard, margin);
    fdlWildcardExclude.right = new FormAttachment(middle, -margin);
    wlWildcardExclude.setLayoutData(fdlWildcardExclude);
    wWildcardExclude = new TextVar(jobMeta, wSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobZipFiles.WildcardExclude.Tooltip"));
    props.setLook(wWildcardExclude);
    wWildcardExclude.addModifyListener(lsMod);
    fdWildcardExclude = new FormData();
    fdWildcardExclude.left = new FormAttachment(middle, 0);
    fdWildcardExclude.top = new FormAttachment(wWildcard, margin);
    fdWildcardExclude.right = new FormAttachment(100, 0);
    wWildcardExclude.setLayoutData(fdWildcardExclude);
    // Include sub-folders?
    // 
    wlIncludeSubfolders = new Label(wSourceFiles, SWT.RIGHT);
    wlIncludeSubfolders.setText(BaseMessages.getString(PKG, "JobZipFiles.IncludeSubfolders.Label"));
    props.setLook(wlIncludeSubfolders);
    fdlIncludeSubfolders = new FormData();
    fdlIncludeSubfolders.left = new FormAttachment(0, 0);
    fdlIncludeSubfolders.top = new FormAttachment(wWildcardExclude, margin);
    fdlIncludeSubfolders.right = new FormAttachment(middle, -margin);
    wlIncludeSubfolders.setLayoutData(fdlIncludeSubfolders);
    wIncludeSubfolders = new Button(wSourceFiles, SWT.CHECK);
    props.setLook(wIncludeSubfolders);
    wIncludeSubfolders.setToolTipText(BaseMessages.getString(PKG, "JobZipFiles.IncludeSubfolders.Tooltip"));
    fdIncludeSubfolders = new FormData();
    fdIncludeSubfolders.left = new FormAttachment(middle, 0);
    fdIncludeSubfolders.top = new FormAttachment(wWildcardExclude, margin);
    fdIncludeSubfolders.right = new FormAttachment(100, 0);
    wIncludeSubfolders.setLayoutData(fdIncludeSubfolders);
    wIncludeSubfolders.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    fdSourceFiles = new FormData();
    fdSourceFiles.left = new FormAttachment(0, margin);
    fdSourceFiles.top = new FormAttachment(wName, margin);
    fdSourceFiles.right = new FormAttachment(100, -margin);
    wSourceFiles.setLayoutData(fdSourceFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF SourceFile GROUP
    // ///////////////////////////////////////////////////////////
    // ZipFile grouping?
    // ////////////////////////
    // START OF ZipFile GROUP///
    // /
    wZipFile = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wZipFile);
    wZipFile.setText(BaseMessages.getString(PKG, "JobZipFiles.ZipFile.Group.Label"));
    FormLayout groupLayoutzipfile = new FormLayout();
    groupLayoutzipfile.marginWidth = 10;
    groupLayoutzipfile.marginHeight = 10;
    wZipFile.setLayout(groupLayoutzipfile);
    // ZipFilename line
    wlZipFilename = new Label(wZipFile, SWT.RIGHT);
    wlZipFilename.setText(BaseMessages.getString(PKG, "JobZipFiles.ZipFilename.Label"));
    props.setLook(wlZipFilename);
    fdlZipFilename = new FormData();
    fdlZipFilename.left = new FormAttachment(0, 0);
    fdlZipFilename.top = new FormAttachment(wSourceFiles, margin);
    fdlZipFilename.right = new FormAttachment(middle, -margin);
    wlZipFilename.setLayoutData(fdlZipFilename);
    wbZipFilename = new Button(wZipFile, SWT.PUSH | SWT.CENTER);
    props.setLook(wbZipFilename);
    wbZipFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbZipFilename = new FormData();
    fdbZipFilename.right = new FormAttachment(100, 0);
    fdbZipFilename.top = new FormAttachment(wSourceFiles, 0);
    wbZipFilename.setLayoutData(fdbZipFilename);
    wZipFilename = new TextVar(jobMeta, wZipFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wZipFilename);
    wZipFilename.addModifyListener(lsMod);
    fdZipFilename = new FormData();
    fdZipFilename.left = new FormAttachment(middle, 0);
    fdZipFilename.top = new FormAttachment(wSourceFiles, margin);
    fdZipFilename.right = new FormAttachment(wbZipFilename, -margin);
    wZipFilename.setLayoutData(fdZipFilename);
    // Whenever something changes, set the tooltip to the expanded version:
    wZipFilename.addModifyListener(new ModifyListener() {

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

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.SAVE);
            // dialog.setFilterExtensions(new String[] {"*"});
            dialog.setFilterExtensions(new String[] { "*.zip;*.ZIP", "*" });
            if (wZipFilename.getText() != null) {
                dialog.setFileName(jobMeta.environmentSubstitute(wZipFilename.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
                wZipFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
        }
    });
    // Create Parent Folder
    wlCreateParentFolder = new Label(wZipFile, SWT.RIGHT);
    wlCreateParentFolder.setText(BaseMessages.getString(PKG, "JobZipFiles.CreateParentFolder.Label"));
    props.setLook(wlCreateParentFolder);
    fdlCreateParentFolder = new FormData();
    fdlCreateParentFolder.left = new FormAttachment(0, 0);
    fdlCreateParentFolder.top = new FormAttachment(wZipFilename, margin);
    fdlCreateParentFolder.right = new FormAttachment(middle, -margin);
    wlCreateParentFolder.setLayoutData(fdlCreateParentFolder);
    wCreateParentFolder = new Button(wZipFile, SWT.CHECK);
    wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "JobZipFiles.CreateParentFolder.Tooltip"));
    props.setLook(wCreateParentFolder);
    fdCreateParentFolder = new FormData();
    fdCreateParentFolder.left = new FormAttachment(middle, 0);
    fdCreateParentFolder.top = new FormAttachment(wZipFilename, margin);
    fdCreateParentFolder.right = new FormAttachment(100, 0);
    wCreateParentFolder.setLayoutData(fdCreateParentFolder);
    wCreateParentFolder.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    // Create multi-part file?
    wlAddDate = new Label(wZipFile, SWT.RIGHT);
    wlAddDate.setText(BaseMessages.getString(PKG, "JobZipFiles.AddDate.Label"));
    props.setLook(wlAddDate);
    fdlAddDate = new FormData();
    fdlAddDate.left = new FormAttachment(0, 0);
    fdlAddDate.top = new FormAttachment(wCreateParentFolder, margin);
    fdlAddDate.right = new FormAttachment(middle, -margin);
    wlAddDate.setLayoutData(fdlAddDate);
    wAddDate = new Button(wZipFile, SWT.CHECK);
    props.setLook(wAddDate);
    wAddDate.setToolTipText(BaseMessages.getString(PKG, "JobZipFiles.AddDate.Tooltip"));
    fdAddDate = new FormData();
    fdAddDate.left = new FormAttachment(middle, 0);
    fdAddDate.top = new FormAttachment(wCreateParentFolder, margin);
    fdAddDate.right = new FormAttachment(100, 0);
    wAddDate.setLayoutData(fdAddDate);
    wAddDate.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    // Create multi-part file?
    wlAddTime = new Label(wZipFile, SWT.RIGHT);
    wlAddTime.setText(BaseMessages.getString(PKG, "JobZipFiles.AddTime.Label"));
    props.setLook(wlAddTime);
    fdlAddTime = new FormData();
    fdlAddTime.left = new FormAttachment(0, 0);
    fdlAddTime.top = new FormAttachment(wAddDate, margin);
    fdlAddTime.right = new FormAttachment(middle, -margin);
    wlAddTime.setLayoutData(fdlAddTime);
    wAddTime = new Button(wZipFile, SWT.CHECK);
    props.setLook(wAddTime);
    wAddTime.setToolTipText(BaseMessages.getString(PKG, "JobZipFiles.AddTime.Tooltip"));
    fdAddTime = new FormData();
    fdAddTime.left = new FormAttachment(middle, 0);
    fdAddTime.top = new FormAttachment(wAddDate, margin);
    fdAddTime.right = new FormAttachment(100, 0);
    wAddTime.setLayoutData(fdAddTime);
    wAddTime.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    // Specify date time format?
    wlSpecifyFormat = new Label(wZipFile, SWT.RIGHT);
    wlSpecifyFormat.setText(BaseMessages.getString(PKG, "JobZipFiles.SpecifyFormat.Label"));
    props.setLook(wlSpecifyFormat);
    fdlSpecifyFormat = new FormData();
    fdlSpecifyFormat.left = new FormAttachment(0, 0);
    fdlSpecifyFormat.top = new FormAttachment(wAddTime, margin);
    fdlSpecifyFormat.right = new FormAttachment(middle, -margin);
    wlSpecifyFormat.setLayoutData(fdlSpecifyFormat);
    wSpecifyFormat = new Button(wZipFile, SWT.CHECK);
    props.setLook(wSpecifyFormat);
    wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "JobZipFiles.SpecifyFormat.Tooltip"));
    fdSpecifyFormat = new FormData();
    fdSpecifyFormat.left = new FormAttachment(middle, 0);
    fdSpecifyFormat.top = new FormAttachment(wAddTime, margin);
    fdSpecifyFormat.right = new FormAttachment(100, 0);
    wSpecifyFormat.setLayoutData(fdSpecifyFormat);
    wSpecifyFormat.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
            setDateTimeFormat();
        }
    });
    // Prepare a list of possible DateTimeFormats...
    String[] dats = Const.getDateFormats();
    // DateTimeFormat
    wlDateTimeFormat = new Label(wZipFile, SWT.RIGHT);
    wlDateTimeFormat.setText(BaseMessages.getString(PKG, "JobZipFiles.DateTimeFormat.Label"));
    props.setLook(wlDateTimeFormat);
    fdlDateTimeFormat = new FormData();
    fdlDateTimeFormat.left = new FormAttachment(0, 0);
    fdlDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
    fdlDateTimeFormat.right = new FormAttachment(middle, -margin);
    wlDateTimeFormat.setLayoutData(fdlDateTimeFormat);
    wDateTimeFormat = new CCombo(wZipFile, SWT.BORDER | SWT.READ_ONLY);
    wDateTimeFormat.setEditable(true);
    props.setLook(wDateTimeFormat);
    wDateTimeFormat.addModifyListener(lsMod);
    fdDateTimeFormat = new FormData();
    fdDateTimeFormat.left = new FormAttachment(middle, 0);
    fdDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
    fdDateTimeFormat.right = new FormAttachment(100, 0);
    wDateTimeFormat.setLayoutData(fdDateTimeFormat);
    for (int x = 0; x < dats.length; x++) {
        wDateTimeFormat.add(dats[x]);
    }
    wbShowFiles = new Button(wZipFile, SWT.PUSH | SWT.CENTER);
    props.setLook(wbShowFiles);
    wbShowFiles.setText(BaseMessages.getString(PKG, "JobZipFiles.ShowFile.Button"));
    fdbShowFiles = new FormData();
    fdbShowFiles.left = new FormAttachment(middle, 0);
    fdbShowFiles.top = new FormAttachment(wDateTimeFormat, margin * 2);
    wbShowFiles.setLayoutData(fdbShowFiles);
    wbShowFiles.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (!Utils.isEmpty(wZipFilename.getText())) {
                JobEntryZipFile jobEntry = new JobEntryZipFile();
                String[] filename = new String[1];
                filename[0] = jobEntry.getFullFilename(wZipFilename.getText(), wAddDate.getSelection(), wAddTime.getSelection(), wSpecifyFormat.getSelection(), wDateTimeFormat.getText());
                if (filename != null && filename.length > 0) {
                    EnterSelectionDialog esd = new EnterSelectionDialog(shell, filename, BaseMessages.getString(PKG, "JobZipFiles.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "JobZipFiles.SelectOutputFiles.DialogMessage"));
                    esd.setViewOnly();
                    esd.open();
                } else {
                    MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                    mb.setMessage(BaseMessages.getString(PKG, "JobZipFiles.NoFilesFound.DialogMessage"));
                    mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
                    mb.open();
                }
            }
        }
    });
    fdZipFile = new FormData();
    fdZipFile.left = new FormAttachment(0, margin);
    fdZipFile.top = new FormAttachment(wSourceFiles, margin);
    fdZipFile.right = new FormAttachment(100, -margin);
    wZipFile.setLayoutData(fdZipFile);
    // ///////////////////////////////////////////////////////////
    // END OF ZipFile GROUP
    // ///////////////////////////////////////////////////////////
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(500, -margin);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF ADVANCED TAB ///
    // ////////////////////////
    wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
    wAdvancedTab.setText(BaseMessages.getString(PKG, "JobZipFiles.Tab.Advanced.Label"));
    wAdvancedComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wAdvancedComp);
    FormLayout advancedLayout = new FormLayout();
    advancedLayout.marginWidth = 3;
    advancedLayout.marginHeight = 3;
    wAdvancedComp.setLayout(advancedLayout);
    // ////////////////////////////
    // START OF Settings GROUP
    // 
    wSettings = new Group(wAdvancedComp, SWT.SHADOW_NONE);
    props.setLook(wSettings);
    wSettings.setText(BaseMessages.getString(PKG, "JobZipFiles.Advanced.Group.Label"));
    FormLayout groupLayoutSettings = new FormLayout();
    groupLayoutSettings.marginWidth = 10;
    groupLayoutSettings.marginHeight = 10;
    wSettings.setLayout(groupLayoutSettings);
    // Compression Rate
    wlCompressionRate = new Label(wSettings, SWT.RIGHT);
    wlCompressionRate.setText(BaseMessages.getString(PKG, "JobZipFiles.CompressionRate.Label"));
    props.setLook(wlCompressionRate);
    fdlCompressionRate = new FormData();
    fdlCompressionRate.left = new FormAttachment(0, -margin);
    fdlCompressionRate.right = new FormAttachment(middle, -margin);
    fdlCompressionRate.top = new FormAttachment(wZipFile, margin);
    wlCompressionRate.setLayoutData(fdlCompressionRate);
    wCompressionRate = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wCompressionRate.add(BaseMessages.getString(PKG, "JobZipFiles.NO_COMP_CompressionRate.Label"));
    wCompressionRate.add(BaseMessages.getString(PKG, "JobZipFiles.DEF_COMP_CompressionRate.Label"));
    wCompressionRate.add(BaseMessages.getString(PKG, "JobZipFiles.BEST_COMP_CompressionRate.Label"));
    wCompressionRate.add(BaseMessages.getString(PKG, "JobZipFiles.BEST_SPEED_CompressionRate.Label"));
    // +1: starts at -1
    wCompressionRate.select(1);
    props.setLook(wCompressionRate);
    fdCompressionRate = new FormData();
    fdCompressionRate.left = new FormAttachment(middle, 0);
    fdCompressionRate.top = new FormAttachment(wZipFile, margin);
    fdCompressionRate.right = new FormAttachment(100, 0);
    wCompressionRate.setLayoutData(fdCompressionRate);
    // If File Exists
    wlIfFileExists = new Label(wSettings, SWT.RIGHT);
    wlIfFileExists.setText(BaseMessages.getString(PKG, "JobZipFiles.IfZipFileExists.Label"));
    props.setLook(wlIfFileExists);
    fdlIfFileExists = new FormData();
    fdlIfFileExists.left = new FormAttachment(0, -margin);
    fdlIfFileExists.right = new FormAttachment(middle, -margin);
    fdlIfFileExists.top = new FormAttachment(wCompressionRate, margin);
    wlIfFileExists.setLayoutData(fdlIfFileExists);
    wIfFileExists = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wIfFileExists.add(BaseMessages.getString(PKG, "JobZipFiles.Create_NewFile_IfFileExists.Label"));
    wIfFileExists.add(BaseMessages.getString(PKG, "JobZipFiles.Append_File_IfFileExists.Label"));
    wIfFileExists.add(BaseMessages.getString(PKG, "JobZipFiles.Do_Nothing_IfFileExists.Label"));
    wIfFileExists.add(BaseMessages.getString(PKG, "JobZipFiles.Fail_IfFileExists.Label"));
    // +1: starts at -1
    wIfFileExists.select(3);
    props.setLook(wIfFileExists);
    fdIfFileExists = new FormData();
    fdIfFileExists.left = new FormAttachment(middle, 0);
    fdIfFileExists.top = new FormAttachment(wCompressionRate, margin);
    fdIfFileExists.right = new FormAttachment(100, 0);
    wIfFileExists.setLayoutData(fdIfFileExists);
    // After Zipping
    wlAfterZip = new Label(wSettings, SWT.RIGHT);
    wlAfterZip.setText(BaseMessages.getString(PKG, "JobZipFiles.AfterZip.Label"));
    props.setLook(wlAfterZip);
    fdlAfterZip = new FormData();
    fdlAfterZip.left = new FormAttachment(0, -margin);
    fdlAfterZip.right = new FormAttachment(middle, -margin);
    fdlAfterZip.top = new FormAttachment(wIfFileExists, margin);
    wlAfterZip.setLayoutData(fdlAfterZip);
    wAfterZip = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wAfterZip.add(BaseMessages.getString(PKG, "JobZipFiles.Do_Nothing_AfterZip.Label"));
    wAfterZip.add(BaseMessages.getString(PKG, "JobZipFiles.Delete_Files_AfterZip.Label"));
    wAfterZip.add(BaseMessages.getString(PKG, "JobZipFiles.Move_Files_AfterZip.Label"));
    // +1: starts at -1
    wAfterZip.select(0);
    props.setLook(wAfterZip);
    fdAfterZip = new FormData();
    fdAfterZip.left = new FormAttachment(middle, 0);
    fdAfterZip.top = new FormAttachment(wIfFileExists, margin);
    fdAfterZip.right = new FormAttachment(100, 0);
    wAfterZip.setLayoutData(fdAfterZip);
    wAfterZip.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            AfterZipActivate();
        }
    });
    // moveTo Directory
    wlMovetoDirectory = new Label(wSettings, SWT.RIGHT);
    wlMovetoDirectory.setText(BaseMessages.getString(PKG, "JobZipFiles.MovetoDirectory.Label"));
    props.setLook(wlMovetoDirectory);
    fdlMovetoDirectory = new FormData();
    fdlMovetoDirectory.left = new FormAttachment(0, 0);
    fdlMovetoDirectory.top = new FormAttachment(wAfterZip, margin);
    fdlMovetoDirectory.right = new FormAttachment(middle, -margin);
    wlMovetoDirectory.setLayoutData(fdlMovetoDirectory);
    // Browse folders button ...
    wbMovetoDirectory = new Button(wSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbMovetoDirectory);
    wbMovetoDirectory.setText(BaseMessages.getString(PKG, "JobZipFiles.BrowseFolders.Label"));
    fdbMovetoDirectory = new FormData();
    fdbMovetoDirectory.right = new FormAttachment(100, 0);
    fdbMovetoDirectory.top = new FormAttachment(wAfterZip, margin);
    wbMovetoDirectory.setLayoutData(fdbMovetoDirectory);
    wMovetoDirectory = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobZipFiles.MovetoDirectory.Tooltip"));
    props.setLook(wMovetoDirectory);
    wMovetoDirectory.addModifyListener(lsMod);
    fdMovetoDirectory = new FormData();
    fdMovetoDirectory.left = new FormAttachment(middle, 0);
    fdMovetoDirectory.top = new FormAttachment(wAfterZip, margin);
    fdMovetoDirectory.right = new FormAttachment(wbMovetoDirectory, -margin);
    wMovetoDirectory.setLayoutData(fdMovetoDirectory);
    // create moveto folder
    wlCreateMoveToDirectory = new Label(wSettings, SWT.RIGHT);
    wlCreateMoveToDirectory.setText(BaseMessages.getString(PKG, "JobZipFiles.createMoveToDirectory.Label"));
    props.setLook(wlCreateMoveToDirectory);
    fdlCreateMoveToDirectory = new FormData();
    fdlCreateMoveToDirectory.left = new FormAttachment(0, 0);
    fdlCreateMoveToDirectory.top = new FormAttachment(wMovetoDirectory, margin);
    fdlCreateMoveToDirectory.right = new FormAttachment(middle, -margin);
    wlCreateMoveToDirectory.setLayoutData(fdlCreateMoveToDirectory);
    wCreateMoveToDirectory = new Button(wSettings, SWT.CHECK);
    props.setLook(wCreateMoveToDirectory);
    wCreateMoveToDirectory.setToolTipText(BaseMessages.getString(PKG, "JobZipFiles.createMoveToDirectory.Tooltip"));
    fdCreateMoveToDirectory = new FormData();
    fdCreateMoveToDirectory.left = new FormAttachment(middle, 0);
    fdCreateMoveToDirectory.top = new FormAttachment(wMovetoDirectory, margin);
    fdCreateMoveToDirectory.right = new FormAttachment(100, 0);
    wCreateMoveToDirectory.setLayoutData(fdCreateMoveToDirectory);
    wCreateMoveToDirectory.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    wlStoredSourcePathDepth = new Label(wSettings, SWT.RIGHT);
    wlStoredSourcePathDepth.setText(BaseMessages.getString(PKG, "JobZipFiles.StoredSourcePathDepth.Label"));
    props.setLook(wlStoredSourcePathDepth);
    fdlStoredSourcePathDepth = new FormData();
    fdlStoredSourcePathDepth.left = new FormAttachment(0, 0);
    fdlStoredSourcePathDepth.top = new FormAttachment(wCreateMoveToDirectory, margin);
    fdlStoredSourcePathDepth.right = new FormAttachment(middle, -margin);
    wlStoredSourcePathDepth.setLayoutData(fdlStoredSourcePathDepth);
    wStoredSourcePathDepth = new ComboVar(jobMeta, wSettings, SWT.SINGLE | SWT.BORDER);
    props.setLook(wStoredSourcePathDepth);
    wStoredSourcePathDepth.setToolTipText(BaseMessages.getString(PKG, "JobZipFiles.StoredSourcePathDepth.Tooltip"));
    fdStoredSourcePathDepth = new FormData();
    fdStoredSourcePathDepth.left = new FormAttachment(middle, 0);
    fdStoredSourcePathDepth.top = new FormAttachment(wCreateMoveToDirectory, margin);
    fdStoredSourcePathDepth.right = new FormAttachment(100, 0);
    wStoredSourcePathDepth.setLayoutData(fdStoredSourcePathDepth);
    wStoredSourcePathDepth.setItems(new String[] { "0 : /pentaho/work/transfer/input/project/file.txt", "1 : file.txt", "2 : project/file.txt", "3 : input/project/file.txt", "4 : transfer/input/project/file.txt", "5 : work/transfer/input/project/file.txt", "6 : pentaho/work/transfer/input/project/file.txt", "7 : pentaho/work/transfer/input/project/file.txt", "8 : pentaho/work/transfer/input/project/file.txt" });
    fdSettings = new FormData();
    fdSettings.left = new FormAttachment(0, margin);
    fdSettings.top = new FormAttachment(wZipFile, margin);
    fdSettings.right = new FormAttachment(100, -margin);
    wSettings.setLayoutData(fdSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Settings GROUP
    // ///////////////////////////////////////////////////////////
    // fileresult grouping?
    // ////////////////////////
    // START OF LOGGING GROUP///
    // /
    wFileResult = new Group(wAdvancedComp, SWT.SHADOW_NONE);
    props.setLook(wFileResult);
    wFileResult.setText(BaseMessages.getString(PKG, "JobZipFiles.FileResult.Group.Label"));
    FormLayout groupLayoutresult = new FormLayout();
    groupLayoutresult.marginWidth = 10;
    groupLayoutresult.marginHeight = 10;
    wFileResult.setLayout(groupLayoutresult);
    // Add file to result
    wlAddFileToResult = new Label(wFileResult, SWT.RIGHT);
    wlAddFileToResult.setText(BaseMessages.getString(PKG, "JobZipFiles.AddFileToResult.Label"));
    props.setLook(wlAddFileToResult);
    fdlAddFileToResult = new FormData();
    fdlAddFileToResult.left = new FormAttachment(0, 0);
    fdlAddFileToResult.top = new FormAttachment(wSettings, margin);
    fdlAddFileToResult.right = new FormAttachment(middle, -margin);
    wlAddFileToResult.setLayoutData(fdlAddFileToResult);
    wAddFileToResult = new Button(wFileResult, SWT.CHECK);
    props.setLook(wAddFileToResult);
    wAddFileToResult.setToolTipText(BaseMessages.getString(PKG, "JobZipFiles.AddFileToResult.Tooltip"));
    fdAddFileToResult = new FormData();
    fdAddFileToResult.left = new FormAttachment(middle, 0);
    fdAddFileToResult.top = new FormAttachment(wSettings, margin);
    fdAddFileToResult.right = new FormAttachment(100, 0);
    wAddFileToResult.setLayoutData(fdAddFileToResult);
    wAddFileToResult.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    fdFileResult = new FormData();
    fdFileResult.left = new FormAttachment(0, margin);
    fdFileResult.top = new FormAttachment(wSettings, margin);
    fdFileResult.right = new FormAttachment(100, -margin);
    wFileResult.setLayoutData(fdFileResult);
    // ///////////////////////////////////////////////////////////
    // / END OF FILE RESULT GROUP
    // ///////////////////////////////////////////////////////////
    fdAdvancedComp = new FormData();
    fdAdvancedComp.left = new FormAttachment(0, 0);
    fdAdvancedComp.top = new FormAttachment(0, 0);
    fdAdvancedComp.right = new FormAttachment(100, 0);
    fdAdvancedComp.bottom = new FormAttachment(500, -margin);
    wAdvancedComp.setLayoutData(fdAdvancedComp);
    wAdvancedComp.layout();
    wAdvancedTab.setControl(wAdvancedComp);
    props.setLook(wAdvancedComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Advanced 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();
        }
    };
    wbSourceDirectory.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wSourceDirectory.getText() != null) {
                ddialog.setFilterPath(jobMeta.environmentSubstitute(wSourceDirectory.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
                wSourceDirectory.setText(dir);
            }
        }
    });
    wbMovetoDirectory.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wMovetoDirectory.getText() != null) {
                ddialog.setFilterPath(jobMeta.environmentSubstitute(wMovetoDirectory.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
                wMovetoDirectory.setText(dir);
            }
        }
    });
    wbSourceFile.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*" });
            if (wSourceDirectory.getText() != null) {
                dialog.setFileName(jobMeta.environmentSubstitute(wSourceDirectory.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
                wSourceDirectory.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
        }
    });
    wName.addSelectionListener(lsDef);
    wZipFilename.addSelectionListener(lsDef);
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    setGetFromPrevious();
    AfterZipActivate();
    setDateTimeFormat();
    wTabFolder.setSelection(0);
    BaseStepDialog.setSize(shell);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
Also used : Group(org.eclipse.swt.widgets.Group) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) 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) JobEntryZipFile(org.pentaho.di.job.entries.zipfile.JobEntryZipFile) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) 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) MessageBox(org.eclipse.swt.widgets.MessageBox) 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)

Aggregations

ComboVar (org.pentaho.di.ui.core.widget.ComboVar)40 FormAttachment (org.eclipse.swt.layout.FormAttachment)39 FormData (org.eclipse.swt.layout.FormData)39 Label (org.eclipse.swt.widgets.Label)39 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)36 SelectionEvent (org.eclipse.swt.events.SelectionEvent)36 Button (org.eclipse.swt.widgets.Button)36 FormLayout (org.eclipse.swt.layout.FormLayout)35 ModifyListener (org.eclipse.swt.events.ModifyListener)32 Display (org.eclipse.swt.widgets.Display)31 Listener (org.eclipse.swt.widgets.Listener)31 Shell (org.eclipse.swt.widgets.Shell)31 TextVar (org.pentaho.di.ui.core.widget.TextVar)31 ModifyEvent (org.eclipse.swt.events.ModifyEvent)30 ShellAdapter (org.eclipse.swt.events.ShellAdapter)30 ShellEvent (org.eclipse.swt.events.ShellEvent)30 Text (org.eclipse.swt.widgets.Text)30 Event (org.eclipse.swt.widgets.Event)29 Composite (org.eclipse.swt.widgets.Composite)26 FocusListener (org.eclipse.swt.events.FocusListener)24