Search in sources :

Example 11 with LabelTextVar

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

the class SalesforceInputDialog method open.

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

        @Override
        public void modifyText(ModifyEvent e) {
            input.setChanged();
        }
    };
    SelectionListener checkBoxModifyListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent 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, "SalesforceInputDialog.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 FILE TAB ///
    // ////////////////////////
    wFileTab = new CTabItem(wTabFolder, SWT.NONE);
    wFileTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.File.Tab"));
    wFileComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFileComp);
    FormLayout fileLayout = new FormLayout();
    fileLayout.marginWidth = 3;
    fileLayout.marginHeight = 3;
    wFileComp.setLayout(fileLayout);
    // ////////////////////////
    // START CONNECTION GROUP
    wConnectionGroup = new Group(wFileComp, SWT.SHADOW_ETCHED_IN);
    wConnectionGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ConnectionGroup.Label"));
    FormLayout fconnLayout = new FormLayout();
    fconnLayout.marginWidth = 3;
    fconnLayout.marginHeight = 3;
    wConnectionGroup.setLayout(fconnLayout);
    props.setLook(wConnectionGroup);
    // Webservice URL
    wURL = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.URL.Tooltip"));
    props.setLook(wURL);
    wURL.addModifyListener(lsMod);
    fdURL = new FormData();
    fdURL.left = new FormAttachment(0, 0);
    fdURL.top = new FormAttachment(0, margin);
    fdURL.right = new FormAttachment(100, 0);
    wURL.setLayoutData(fdURL);
    // UserName line
    wUserName = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.User.Tooltip"));
    props.setLook(wUserName);
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(0, 0);
    fdUserName.top = new FormAttachment(wURL, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wPassword = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.Password.Tooltip"), true);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    fdPassword = new FormData();
    fdPassword.left = new FormAttachment(0, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // Test Salesforce connection button
    wTest = new Button(wConnectionGroup, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.TestConnection.Tooltip"));
    // fdTest.left = new FormAttachment(middle, 0);
    fdTest.top = new FormAttachment(wPassword, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    FormData fdConnectionGroup = new FormData();
    fdConnectionGroup.left = new FormAttachment(0, 0);
    fdConnectionGroup.right = new FormAttachment(100, 0);
    fdConnectionGroup.top = new FormAttachment(0, margin);
    wConnectionGroup.setLayoutData(fdConnectionGroup);
    // END CONNECTION GROUP
    // ////////////////////////
    // ////////////////////////
    // START SETTINGS GROUP
    wSettingsGroup = new Group(wFileComp, SWT.SHADOW_ETCHED_IN);
    wSettingsGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.HttpAuthGroup.Label"));
    FormLayout fsettingsLayout = new FormLayout();
    fsettingsLayout.marginWidth = 3;
    fsettingsLayout.marginHeight = 3;
    wSettingsGroup.setLayout(fsettingsLayout);
    props.setLook(wSettingsGroup);
    wlspecifyQuery = new Label(wSettingsGroup, SWT.RIGHT);
    wlspecifyQuery.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.specifyQuery.Label"));
    props.setLook(wlspecifyQuery);
    fdlspecifyQuery = new FormData();
    fdlspecifyQuery.left = new FormAttachment(0, 0);
    fdlspecifyQuery.top = new FormAttachment(wConnectionGroup, 2 * margin);
    fdlspecifyQuery.right = new FormAttachment(middle, -margin);
    wlspecifyQuery.setLayoutData(fdlspecifyQuery);
    wspecifyQuery = new Button(wSettingsGroup, SWT.CHECK);
    props.setLook(wspecifyQuery);
    wspecifyQuery.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.specifyQuery.Tooltip"));
    fdspecifyQuery = new FormData();
    fdspecifyQuery.left = new FormAttachment(middle, 0);
    fdspecifyQuery.top = new FormAttachment(wConnectionGroup, 2 * margin);
    wspecifyQuery.setLayoutData(fdspecifyQuery);
    wspecifyQuery.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setEnableQuery();
            input.setChanged();
        }
    });
    // Module
    wlModule = new Label(wSettingsGroup, SWT.RIGHT);
    wlModule.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Module.Label"));
    props.setLook(wlModule);
    fdlModule = new FormData();
    fdlModule.left = new FormAttachment(0, 0);
    fdlModule.top = new FormAttachment(wspecifyQuery, margin);
    fdlModule.right = new FormAttachment(middle, -margin);
    wlModule.setLayoutData(fdlModule);
    wModule = new ComboVar(transMeta, wSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
    wModule.setEditable(true);
    props.setLook(wModule);
    wModule.addModifyListener(lsMod);
    fdModule = new FormData();
    fdModule.left = new FormAttachment(middle, margin);
    fdModule.top = new FormAttachment(wspecifyQuery, margin);
    fdModule.right = new FormAttachment(100, -margin);
    wModule.setLayoutData(fdModule);
    wModule.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(org.eclipse.swt.events.FocusEvent e) {
            getModulesListError = false;
        }

        @Override
        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            // check if the URL and login credentials passed and not just had error
            if (Utils.isEmpty(wURL.getText()) || Utils.isEmpty(wUserName.getText()) || Utils.isEmpty(wPassword.getText()) || (getModulesListError)) {
                return;
            }
            getModulesList();
        }
    });
    wlPosition = new Label(wSettingsGroup, SWT.NONE);
    props.setLook(wlPosition);
    fdlPosition = new FormData();
    fdlPosition.left = new FormAttachment(middle, 0);
    fdlPosition.right = new FormAttachment(100, 0);
    fdlPosition.bottom = new FormAttachment(100, -margin);
    wlPosition.setLayoutData(fdlPosition);
    // condition
    wlCondition = new Label(wSettingsGroup, SWT.RIGHT);
    wlCondition.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Condition.Label"));
    props.setLook(wlCondition);
    FormData fdlCondition = new FormData();
    fdlCondition.left = new FormAttachment(0, -margin);
    fdlCondition.top = new FormAttachment(wModule, margin);
    fdlCondition.right = new FormAttachment(middle, -margin);
    wlCondition.setLayoutData(fdlCondition);
    wCondition = new StyledTextComp(transMeta, wSettingsGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
    wCondition.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.Condition.Tooltip"));
    props.setLook(wCondition, Props.WIDGET_STYLE_FIXED);
    wCondition.addModifyListener(lsMod);
    fdCondition = new FormData();
    fdCondition.left = new FormAttachment(middle, margin);
    fdCondition.top = new FormAttachment(wModule, margin);
    fdCondition.right = new FormAttachment(100, -2 * margin);
    fdCondition.bottom = new FormAttachment(wlPosition, -margin);
    wCondition.setLayoutData(fdCondition);
    wCondition.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent arg0) {
            setQueryToolTip();
            setPosition();
        }
    });
    wCondition.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            setPosition();
        }

        @Override
        public void keyReleased(KeyEvent e) {
            setPosition();
        }
    });
    wCondition.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            setPosition();
        }

        @Override
        public void focusLost(FocusEvent e) {
            setPosition();
        }
    });
    wCondition.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            setPosition();
        }

        @Override
        public void mouseDown(MouseEvent e) {
            setPosition();
        }

        @Override
        public void mouseUp(MouseEvent e) {
            setPosition();
        }
    });
    // Text Higlighting
    wCondition.addLineStyleListener(new SOQLValuesHighlight());
    // Query
    wlQuery = new Label(wSettingsGroup, SWT.RIGHT);
    wlQuery.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Query.Label"));
    props.setLook(wlQuery);
    fdlQuery = new FormData();
    fdlQuery.left = new FormAttachment(0, -margin);
    fdlQuery.top = new FormAttachment(wspecifyQuery, margin);
    fdlQuery.right = new FormAttachment(middle, -margin);
    wlQuery.setLayoutData(fdlQuery);
    wQuery = new StyledTextComp(transMeta, wSettingsGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
    props.setLook(wQuery, Props.WIDGET_STYLE_FIXED);
    wQuery.addModifyListener(lsMod);
    fdQuery = new FormData();
    fdQuery.left = new FormAttachment(middle, 0);
    fdQuery.top = new FormAttachment(wspecifyQuery, margin);
    fdQuery.right = new FormAttachment(100, -2 * margin);
    fdQuery.bottom = new FormAttachment(wlPosition, -margin);
    wQuery.setLayoutData(fdQuery);
    wQuery.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent arg0) {
            setQueryToolTip();
        }
    });
    wQuery.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            setPosition();
        }

        @Override
        public void keyReleased(KeyEvent e) {
            setPosition();
        }
    });
    wQuery.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            setPosition();
        }

        @Override
        public void focusLost(FocusEvent e) {
            setPosition();
        }
    });
    wQuery.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            setPosition();
        }

        @Override
        public void mouseDown(MouseEvent e) {
            setPosition();
        }

        @Override
        public void mouseUp(MouseEvent e) {
            setPosition();
        }
    });
    // Text Higlighting
    wQuery.addLineStyleListener(new SOQLValuesHighlight());
    FormData fdSettingsGroup = new FormData();
    fdSettingsGroup.left = new FormAttachment(0, 0);
    fdSettingsGroup.right = new FormAttachment(100, 0);
    fdSettingsGroup.bottom = new FormAttachment(100, 0);
    fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin);
    wSettingsGroup.setLayoutData(fdSettingsGroup);
    // END SETTINGS GROUP
    // ////////////////////////
    fdFileComp = new FormData();
    fdFileComp.left = new FormAttachment(0, 0);
    fdFileComp.top = new FormAttachment(0, 0);
    fdFileComp.right = new FormAttachment(100, 0);
    fdFileComp.bottom = new FormAttachment(100, 0);
    wFileComp.setLayoutData(fdFileComp);
    wFileComp.layout();
    wFileTab.setControl(wFileComp);
    // ///////////////////////////////////////////////////////////
    // / END OF FILE TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF CONTENT TAB///
    // /
    wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Content.Tab"));
    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;
    wContentComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wContentComp);
    wContentComp.setLayout(contentLayout);
    // ///////////////////////////////
    // START OF Advanced GROUP //
    // ///////////////////////////////
    wAdvancedGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wAdvancedGroup);
    wAdvancedGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.AdvancedGroup.Label"));
    FormLayout advancedgroupLayout = new FormLayout();
    advancedgroupLayout.marginWidth = 10;
    advancedgroupLayout.marginHeight = 10;
    wAdvancedGroup.setLayout(advancedgroupLayout);
    // RecordsFilter
    wlRecordsFilter = new Label(wAdvancedGroup, SWT.RIGHT);
    wlRecordsFilter.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.RecordsFilter.Label"));
    props.setLook(wlRecordsFilter);
    fdlRecordsFilter = new FormData();
    fdlRecordsFilter.left = new FormAttachment(0, 0);
    fdlRecordsFilter.right = new FormAttachment(middle, -margin);
    fdlRecordsFilter.top = new FormAttachment(0, 2 * margin);
    wlRecordsFilter.setLayoutData(fdlRecordsFilter);
    wRecordsFilter = new CCombo(wAdvancedGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wRecordsFilter);
    wRecordsFilter.addModifyListener(lsMod);
    fdRecordsFilter = new FormData();
    fdRecordsFilter.left = new FormAttachment(middle, 0);
    fdRecordsFilter.top = new FormAttachment(0, 2 * margin);
    fdRecordsFilter.right = new FormAttachment(100, -margin);
    wRecordsFilter.setLayoutData(fdRecordsFilter);
    wRecordsFilter.setItems(SalesforceConnectionUtils.recordsFilterDesc);
    wRecordsFilter.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateRecordsFilter();
        }
    });
    // Query All?
    wlQueryAll = new Label(wAdvancedGroup, SWT.RIGHT);
    wlQueryAll.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.QueryAll.Label"));
    props.setLook(wlQueryAll);
    FormData fdlQueryAll = new FormData();
    fdlQueryAll.left = new FormAttachment(0, 0);
    fdlQueryAll.top = new FormAttachment(wRecordsFilter, margin);
    fdlQueryAll.right = new FormAttachment(middle, -margin);
    wlQueryAll.setLayoutData(fdlQueryAll);
    wQueryAll = new Button(wAdvancedGroup, SWT.CHECK);
    wQueryAll.addSelectionListener(checkBoxModifyListener);
    props.setLook(wQueryAll);
    wQueryAll.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.QueryAll.Tooltip"));
    FormData fdQueryAll = new FormData();
    fdQueryAll.left = new FormAttachment(middle, 0);
    fdQueryAll.top = new FormAttachment(wRecordsFilter, margin);
    wQueryAll.setLayoutData(fdQueryAll);
    wQueryAll.addSelectionListener(new ComponentSelectionListener(input));
    open = new Button(wAdvancedGroup, SWT.PUSH);
    open.setImage(GUIResource.getInstance().getImageCalendar());
    open.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.OpenCalendar"));
    FormData fdlButton = new FormData();
    fdlButton.top = new FormAttachment(wQueryAll, margin);
    fdlButton.right = new FormAttachment(100, 0);
    open.setLayoutData(fdlButton);
    open.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
            dialog.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.SelectDate"));
            dialog.setImage(GUIResource.getInstance().getImageSpoon());
            dialog.setLayout(new GridLayout(3, false));
            final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
            final DateTime time = new DateTime(dialog, SWT.TIME | SWT.TIME);
            new Label(dialog, SWT.NONE);
            new Label(dialog, SWT.NONE);
            Button ok = new Button(dialog, SWT.PUSH);
            ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
            ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
            ok.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    wReadFrom.setText(calendar.getYear() + "-" + ((calendar.getMonth() + 1) < 10 ? "0" + (calendar.getMonth() + 1) : (calendar.getMonth() + 1)) + "-" + (calendar.getDay() < 10 ? "0" + calendar.getDay() : calendar.getDay()) + " " + (time.getHours() < 10 ? "0" + time.getHours() : time.getHours()) + ":" + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()) + ":" + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()));
                    dialog.close();
                }
            });
            dialog.setDefaultButton(ok);
            dialog.pack();
            dialog.open();
        }
    });
    wlReadFrom = new Label(wAdvancedGroup, SWT.RIGHT);
    wlReadFrom.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadFrom.Label"));
    props.setLook(wlReadFrom);
    fdlReadFrom = new FormData();
    fdlReadFrom.left = new FormAttachment(0, 0);
    fdlReadFrom.top = new FormAttachment(wQueryAll, margin);
    fdlReadFrom.right = new FormAttachment(middle, -margin);
    wlReadFrom.setLayoutData(fdlReadFrom);
    wReadFrom = new TextVar(transMeta, wAdvancedGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadFrom.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadFrom.Tooltip"));
    props.setLook(wReadFrom);
    wReadFrom.addModifyListener(lsMod);
    fdReadFrom = new FormData();
    fdReadFrom.left = new FormAttachment(middle, 0);
    fdReadFrom.top = new FormAttachment(wQueryAll, margin);
    fdReadFrom.right = new FormAttachment(open, -margin);
    wReadFrom.setLayoutData(fdReadFrom);
    opento = new Button(wAdvancedGroup, SWT.PUSH);
    opento.setImage(GUIResource.getInstance().getImageCalendar());
    opento.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.OpenCalendar"));
    FormData fdlButtonto = new FormData();
    fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlButtonto.right = new FormAttachment(100, 0);
    opento.setLayoutData(fdlButtonto);
    opento.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
            dialogto.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.SelectDate"));
            dialogto.setImage(GUIResource.getInstance().getImageSpoon());
            dialogto.setLayout(new GridLayout(3, false));
            final DateTime calendarto = new DateTime(dialogto, SWT.CALENDAR | SWT.BORDER);
            final DateTime timeto = new DateTime(dialogto, SWT.TIME | SWT.TIME);
            new Label(dialogto, SWT.NONE);
            new Label(dialogto, SWT.NONE);
            Button okto = new Button(dialogto, SWT.PUSH);
            okto.setText(BaseMessages.getString(PKG, "System.Button.OK"));
            okto.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
            okto.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    wReadTo.setText(calendarto.getYear() + "-" + ((calendarto.getMonth() + 1) < 10 ? "0" + (calendarto.getMonth() + 1) : (calendarto.getMonth() + 1)) + "-" + (calendarto.getDay() < 10 ? "0" + calendarto.getDay() : calendarto.getDay()) + " " + (timeto.getHours() < 10 ? "0" + timeto.getHours() : timeto.getHours()) + ":" + (timeto.getMinutes() < 10 ? "0" + timeto.getMinutes() : timeto.getMinutes()) + ":" + (timeto.getSeconds() < 10 ? "0" + timeto.getSeconds() : timeto.getSeconds()));
                    dialogto.close();
                }
            });
            dialogto.setDefaultButton(okto);
            dialogto.pack();
            dialogto.open();
        }
    });
    wlReadTo = new Label(wAdvancedGroup, SWT.RIGHT);
    wlReadTo.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadTo.Label"));
    props.setLook(wlReadTo);
    fdlReadTo = new FormData();
    fdlReadTo.left = new FormAttachment(0, 0);
    fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlReadTo.right = new FormAttachment(middle, -margin);
    wlReadTo.setLayoutData(fdlReadTo);
    wReadTo = new TextVar(transMeta, wAdvancedGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadTo.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadTo.Tooltip"));
    props.setLook(wReadTo);
    wReadTo.addModifyListener(lsMod);
    fdReadTo = new FormData();
    fdReadTo.left = new FormAttachment(middle, 0);
    fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdReadTo.right = new FormAttachment(opento, -margin);
    wReadTo.setLayoutData(fdReadTo);
    fdAdvancedGroup = new FormData();
    fdAdvancedGroup.left = new FormAttachment(0, margin);
    fdAdvancedGroup.top = new FormAttachment(0, 2 * margin);
    fdAdvancedGroup.right = new FormAttachment(100, -margin);
    wAdvancedGroup.setLayoutData(fdAdvancedGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Advanced GROUP
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////
    // START OF Additional Fields GROUP //
    // ///////////////////////////////
    wAdditionalFields = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wAdditionalFields);
    wAdditionalFields.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.wAdditionalFields.Label"));
    FormLayout AdditionalFieldsgroupLayout = new FormLayout();
    AdditionalFieldsgroupLayout.marginWidth = 10;
    AdditionalFieldsgroupLayout.marginHeight = 10;
    wAdditionalFields.setLayout(AdditionalFieldsgroupLayout);
    // Add Salesforce URL in the output stream ?
    wlInclURL = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclURL.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURL.Label"));
    props.setLook(wlInclURL);
    fdlInclURL = new FormData();
    fdlInclURL.left = new FormAttachment(0, 0);
    fdlInclURL.top = new FormAttachment(wAdvancedGroup, margin);
    fdlInclURL.right = new FormAttachment(middle, -margin);
    wlInclURL.setLayoutData(fdlInclURL);
    wInclURL = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wInclURL);
    wInclURL.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURL.Tooltip"));
    fdInclURL = new FormData();
    fdInclURL.left = new FormAttachment(middle, 0);
    fdInclURL.top = new FormAttachment(wAdvancedGroup, margin);
    wInclURL.setLayoutData(fdInclURL);
    wInclURL.addSelectionListener(checkBoxModifyListener);
    wInclURL.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setEnableInclTargetURL();
            input.setChanged();
        }
    });
    wlInclURLField = new Label(wAdditionalFields, SWT.LEFT);
    wlInclURLField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURLField.Label"));
    props.setLook(wlInclURLField);
    fdlInclURLField = new FormData();
    fdlInclURLField.left = new FormAttachment(wInclURL, margin);
    fdlInclURLField.top = new FormAttachment(wAdvancedGroup, margin);
    wlInclURLField.setLayoutData(fdlInclURLField);
    wInclURLField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wlInclURLField);
    wInclURLField.addModifyListener(lsMod);
    fdInclURLField = new FormData();
    fdInclURLField.left = new FormAttachment(wlInclURLField, margin);
    fdInclURLField.top = new FormAttachment(wAdvancedGroup, margin);
    fdInclURLField.right = new FormAttachment(100, 0);
    wInclURLField.setLayoutData(fdInclURLField);
    // Add module in the output stream ?
    wlInclModule = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclModule.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModule.Label"));
    props.setLook(wlInclModule);
    fdlInclModule = new FormData();
    fdlInclModule.left = new FormAttachment(0, 0);
    fdlInclModule.top = new FormAttachment(wInclURLField, margin);
    fdlInclModule.right = new FormAttachment(middle, -margin);
    wlInclModule.setLayoutData(fdlInclModule);
    wInclModule = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wInclModule);
    wInclModule.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModule.Tooltip"));
    fdModule = new FormData();
    fdModule.left = new FormAttachment(middle, 0);
    fdModule.top = new FormAttachment(wInclURLField, margin);
    wInclModule.setLayoutData(fdModule);
    wInclModule.addSelectionListener(checkBoxModifyListener);
    wInclModule.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setEnableInclModule();
            input.setChanged();
        }
    });
    wlInclModuleField = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclModuleField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModuleField.Label"));
    props.setLook(wlInclModuleField);
    fdlInclModuleField = new FormData();
    fdlInclModuleField.left = new FormAttachment(wInclModule, margin);
    fdlInclModuleField.top = new FormAttachment(wInclURLField, margin);
    wlInclModuleField.setLayoutData(fdlInclModuleField);
    wInclModuleField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclModuleField);
    wInclModuleField.addModifyListener(lsMod);
    fdInclModuleField = new FormData();
    fdInclModuleField.left = new FormAttachment(wlInclModuleField, margin);
    fdInclModuleField.top = new FormAttachment(wInclURLField, margin);
    fdInclModuleField.right = new FormAttachment(100, 0);
    wInclModuleField.setLayoutData(fdInclModuleField);
    // Add SQL in the output stream ?
    wlInclSQL = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclSQL.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQL.Label"));
    props.setLook(wlInclSQL);
    fdlInclSQL = new FormData();
    fdlInclSQL.left = new FormAttachment(0, 0);
    fdlInclSQL.top = new FormAttachment(wInclModuleField, margin);
    fdlInclSQL.right = new FormAttachment(middle, -margin);
    wlInclSQL.setLayoutData(fdlInclSQL);
    wInclSQL = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wInclSQL);
    wInclSQL.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQL.Tooltip"));
    fdInclSQL = new FormData();
    fdInclSQL.left = new FormAttachment(middle, 0);
    fdInclSQL.top = new FormAttachment(wInclModuleField, margin);
    wInclSQL.setLayoutData(fdInclSQL);
    wInclSQL.addSelectionListener(checkBoxModifyListener);
    wInclSQL.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setEnableInclSQL();
            input.setChanged();
        }
    });
    wlInclSQLField = new Label(wAdditionalFields, SWT.LEFT);
    wlInclSQLField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQLField.Label"));
    props.setLook(wlInclSQLField);
    fdlInclSQLField = new FormData();
    fdlInclSQLField.left = new FormAttachment(wInclSQL, margin);
    fdlInclSQLField.top = new FormAttachment(wInclModuleField, margin);
    wlInclSQLField.setLayoutData(fdlInclSQLField);
    wInclSQLField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wlInclSQLField);
    wInclSQLField.addModifyListener(lsMod);
    fdInclSQLField = new FormData();
    fdInclSQLField.left = new FormAttachment(wlInclSQLField, margin);
    fdInclSQLField.top = new FormAttachment(wInclModuleField, margin);
    fdInclSQLField.right = new FormAttachment(100, 0);
    wInclSQLField.setLayoutData(fdInclSQLField);
    // Add Timestamp in the output stream ?
    wlInclTimestamp = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclTimestamp.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestamp.Label"));
    props.setLook(wlInclTimestamp);
    fdlInclTimestamp = new FormData();
    fdlInclTimestamp.left = new FormAttachment(0, 0);
    fdlInclTimestamp.top = new FormAttachment(wInclSQLField, margin);
    fdlInclTimestamp.right = new FormAttachment(middle, -margin);
    wlInclTimestamp.setLayoutData(fdlInclTimestamp);
    wInclTimestamp = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wInclTimestamp);
    wInclTimestamp.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestamp.Tooltip"));
    fdInclTimestamp = new FormData();
    fdInclTimestamp.left = new FormAttachment(middle, 0);
    fdInclTimestamp.top = new FormAttachment(wInclSQLField, margin);
    wInclTimestamp.setLayoutData(fdInclTimestamp);
    wInclTimestamp.addSelectionListener(checkBoxModifyListener);
    wInclTimestamp.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setEnableInclTimestamp();
            input.setChanged();
        }
    });
    wlInclTimestampField = new Label(wAdditionalFields, SWT.LEFT);
    wlInclTimestampField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestampField.Label"));
    props.setLook(wlInclTimestampField);
    fdlInclTimestampField = new FormData();
    fdlInclTimestampField.left = new FormAttachment(wInclTimestamp, margin);
    fdlInclTimestampField.top = new FormAttachment(wInclSQLField, margin);
    wlInclTimestampField.setLayoutData(fdlInclTimestampField);
    wInclTimestampField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wlInclTimestampField);
    wInclTimestampField.addModifyListener(lsMod);
    fdInclTimestampField = new FormData();
    fdInclTimestampField.left = new FormAttachment(wlInclTimestampField, margin);
    fdInclTimestampField.top = new FormAttachment(wInclSQLField, margin);
    fdInclTimestampField.right = new FormAttachment(100, 0);
    wInclTimestampField.setLayoutData(fdInclTimestampField);
    // Include Rownum in output stream?
    wlInclRownum = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclRownum.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownum.Label"));
    props.setLook(wlInclRownum);
    FormData fdlInclRownum = new FormData();
    fdlInclRownum.left = new FormAttachment(0, 0);
    fdlInclRownum.top = new FormAttachment(wInclTimestampField, margin);
    fdlInclRownum.right = new FormAttachment(middle, -margin);
    wlInclRownum.setLayoutData(fdlInclRownum);
    wInclRownum = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wInclRownum);
    wInclRownum.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownum.Tooltip"));
    FormData fdRownum = new FormData();
    fdRownum.left = new FormAttachment(middle, 0);
    fdRownum.top = new FormAttachment(wInclTimestampField, margin);
    wInclRownum.setLayoutData(fdRownum);
    wInclRownum.addSelectionListener(checkBoxModifyListener);
    wInclRownum.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setEnableInclRownum();
            input.setChanged();
        }
    });
    wlInclRownumField = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclRownumField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownumField.Label"));
    props.setLook(wlInclRownumField);
    fdlInclRownumField = new FormData();
    fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
    fdlInclRownumField.top = new FormAttachment(wInclTimestampField, margin);
    wlInclRownumField.setLayoutData(fdlInclRownumField);
    wInclRownumField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclRownumField);
    wInclRownumField.addModifyListener(lsMod);
    FormData fdInclRownumField = new FormData();
    fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
    fdInclRownumField.top = new FormAttachment(wInclTimestampField, margin);
    fdInclRownumField.right = new FormAttachment(100, 0);
    wInclRownumField.setLayoutData(fdInclRownumField);
    // Include DeletionDate in output stream?
    wlInclDeletionDate = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclDeletionDate.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDate.Label"));
    props.setLook(wlInclDeletionDate);
    fdlInclDeletionDate = new FormData();
    fdlInclDeletionDate.left = new FormAttachment(0, 0);
    fdlInclDeletionDate.top = new FormAttachment(wInclRownumField, margin);
    fdlInclDeletionDate.right = new FormAttachment(middle, -margin);
    wlInclDeletionDate.setLayoutData(fdlInclDeletionDate);
    wInclDeletionDate = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wInclDeletionDate);
    wInclDeletionDate.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDate.Tooltip"));
    fdDeletionDate = new FormData();
    fdDeletionDate.left = new FormAttachment(middle, 0);
    fdDeletionDate.top = new FormAttachment(wInclRownumField, margin);
    wInclDeletionDate.setLayoutData(fdDeletionDate);
    wInclDeletionDate.addSelectionListener(checkBoxModifyListener);
    wInclDeletionDate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setEnableInclDeletionDate();
            input.setChanged();
        }
    });
    wlInclDeletionDateField = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclDeletionDateField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDateField.Label"));
    props.setLook(wlInclDeletionDateField);
    fdlInclDeletionDateField = new FormData();
    fdlInclDeletionDateField.left = new FormAttachment(wInclDeletionDate, margin);
    fdlInclDeletionDateField.top = new FormAttachment(wInclRownumField, margin);
    wlInclDeletionDateField.setLayoutData(fdlInclDeletionDateField);
    wInclDeletionDateField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclDeletionDateField);
    wInclDeletionDateField.addModifyListener(lsMod);
    fdInclDeletionDateField = new FormData();
    fdInclDeletionDateField.left = new FormAttachment(wlInclDeletionDateField, margin);
    fdInclDeletionDateField.top = new FormAttachment(wInclRownumField, margin);
    fdInclDeletionDateField.right = new FormAttachment(100, 0);
    wInclDeletionDateField.setLayoutData(fdInclDeletionDateField);
    fdAdditionalFields = new FormData();
    fdAdditionalFields.left = new FormAttachment(0, margin);
    fdAdditionalFields.top = new FormAttachment(wAdvancedGroup, margin);
    fdAdditionalFields.right = new FormAttachment(100, -margin);
    wAdditionalFields.setLayoutData(fdAdditionalFields);
    // ///////////////////////////////////////////////////////////
    // / END OF Additional Fields GROUP
    // ///////////////////////////////////////////////////////////
    // Timeout
    wlTimeOut = new Label(wContentComp, SWT.RIGHT);
    wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.TimeOut.Label"));
    props.setLook(wlTimeOut);
    fdlTimeOut = new FormData();
    fdlTimeOut.left = new FormAttachment(0, 0);
    fdlTimeOut.top = new FormAttachment(wAdditionalFields, 2 * margin);
    fdlTimeOut.right = new FormAttachment(middle, -margin);
    wlTimeOut.setLayoutData(fdlTimeOut);
    wTimeOut = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTimeOut);
    wTimeOut.addModifyListener(lsMod);
    fdTimeOut = new FormData();
    fdTimeOut.left = new FormAttachment(middle, 0);
    fdTimeOut.top = new FormAttachment(wAdditionalFields, 2 * margin);
    fdTimeOut.right = new FormAttachment(100, 0);
    wTimeOut.setLayoutData(fdTimeOut);
    // Use compression?
    wlUseCompression = new Label(wContentComp, SWT.RIGHT);
    wlUseCompression.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.UseCompression.Label"));
    props.setLook(wlUseCompression);
    FormData fdlUseCompression = new FormData();
    fdlUseCompression.left = new FormAttachment(0, 0);
    fdlUseCompression.top = new FormAttachment(wTimeOut, margin);
    fdlUseCompression.right = new FormAttachment(middle, -margin);
    wlUseCompression.setLayoutData(fdlUseCompression);
    wUseCompression = new Button(wContentComp, SWT.CHECK);
    wUseCompression.addSelectionListener(checkBoxModifyListener);
    props.setLook(wUseCompression);
    wUseCompression.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.UseCompression.Tooltip"));
    FormData fdUseCompression = new FormData();
    fdUseCompression.left = new FormAttachment(middle, 0);
    fdUseCompression.top = new FormAttachment(wTimeOut, margin);
    wUseCompression.setLayoutData(fdUseCompression);
    wUseCompression.addSelectionListener(new ComponentSelectionListener(input));
    // Limit rows
    wlLimit = new Label(wContentComp, SWT.RIGHT);
    wlLimit.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Limit.Label"));
    props.setLook(wlLimit);
    fdlLimit = new FormData();
    fdlLimit.left = new FormAttachment(0, 0);
    fdlLimit.top = new FormAttachment(wUseCompression, margin);
    fdlLimit.right = new FormAttachment(middle, -margin);
    wlLimit.setLayoutData(fdlLimit);
    wLimit = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLimit);
    wLimit.addModifyListener(lsMod);
    fdLimit = new FormData();
    fdLimit.left = new FormAttachment(middle, 0);
    fdLimit.top = new FormAttachment(wUseCompression, margin);
    fdLimit.right = new FormAttachment(100, 0);
    wLimit.setLayoutData(fdLimit);
    fdContentComp = new FormData();
    fdContentComp.left = new FormAttachment(0, 0);
    fdContentComp.top = new FormAttachment(0, 0);
    fdContentComp.right = new FormAttachment(100, 0);
    fdContentComp.bottom = new FormAttachment(100, 0);
    wContentComp.setLayoutData(fdContentComp);
    wContentComp.layout();
    wContentTab.setControl(wContentComp);
    // ///////////////////////////////////////////////////////////
    // / END OF CONTENT TAB
    // ///////////////////////////////////////////////////////////
    // Fields tab...
    // 
    wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Fields.Tab"));
    FormLayout fieldsLayout = new FormLayout();
    fieldsLayout.marginWidth = Const.FORM_MARGIN;
    fieldsLayout.marginHeight = Const.FORM_MARGIN;
    wFieldsComp = new Composite(wTabFolder, SWT.NONE);
    wFieldsComp.setLayout(fieldsLayout);
    props.setLook(wFieldsComp);
    wGet = new Button(wFieldsComp, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.GetFields.Button"));
    fdGet = new FormData();
    fdGet.left = new FormAttachment(50, 0);
    fdGet.bottom = new FormAttachment(100, 0);
    wGet.setLayoutData(fdGet);
    final int FieldsRows = input.getInputFields().length;
    colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Field.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.IsIdLookup.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Type.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Format.Column"), ColumnInfo.COLUMN_TYPE_FORMAT, 3), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Length.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Precision.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Currency.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Decimal.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Group.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.TrimType.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, SalesforceInputField.trimTypeDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Repeat.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true) };
    colinf[0].setUsingVariables(true);
    colinf[0].setToolTip(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Name.Column.Tooltip"));
    colinf[1].setUsingVariables(true);
    colinf[1].setToolTip(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Field.Column.Tooltip"));
    colinf[2].setReadOnly(true);
    wFields = new TableView(transMeta, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(0, 0);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(wGet, -margin);
    wFields.setLayoutData(fdFields);
    fdFieldsComp = new FormData();
    fdFieldsComp.left = new FormAttachment(0, 0);
    fdFieldsComp.top = new FormAttachment(0, 0);
    fdFieldsComp.right = new FormAttachment(100, 0);
    fdFieldsComp.bottom = new FormAttachment(100, 0);
    wFieldsComp.setLayoutData(fdFieldsComp);
    wFieldsComp.layout();
    wFieldsTab.setControl(wFieldsComp);
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wStepname, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    // THE BUTTONS
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wPreview = new Button(shell, SWT.PUSH);
    wPreview.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Button.PreviewRows"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
    // Add listeners
    lsOK = new Listener() {

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

        @Override
        public void handleEvent(Event e) {
            test();
        }
    };
    lsGet = new Listener() {

        @Override
        public void handleEvent(Event e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            get();
            shell.setCursor(null);
            busy.dispose();
            input.setChanged();
        }
    };
    lsPreview = new Listener() {

        @Override
        public void handleEvent(Event e) {
            preview();
        }
    };
    lsCancel = new Listener() {

        @Override
        public void handleEvent(Event e) {
            cancel();
        }
    };
    wOK.addListener(SWT.Selection, lsOK);
    wGet.addListener(SWT.Selection, lsGet);
    wTest.addListener(SWT.Selection, lsTest);
    wPreview.addListener(SWT.Selection, lsPreview);
    wCancel.addListener(SWT.Selection, lsCancel);
    lsDef = new SelectionAdapter() {

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

        @Override
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    wTabFolder.setSelection(0);
    // Set the shell size, based upon previous time...
    setSize();
    getData(input);
    setEnableInclTargetURL();
    setEnableInclSQL();
    setEnableInclTimestamp();
    setEnableInclModule();
    setEnableInclRownum();
    setEnableInclDeletionDate();
    setEnableQuery();
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : StyledTextComp(org.pentaho.di.ui.core.widget.StyledTextComp) Group(org.eclipse.swt.widgets.Group) FocusAdapter(org.eclipse.swt.events.FocusAdapter) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) SelectionListener(org.eclipse.swt.events.SelectionListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) KeyAdapter(org.eclipse.swt.events.KeyAdapter) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) Cursor(org.eclipse.swt.graphics.Cursor) CTabItem(org.eclipse.swt.custom.CTabItem) FocusEvent(org.eclipse.swt.events.FocusEvent) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) DateTime(org.eclipse.swt.widgets.DateTime) KeyEvent(org.eclipse.swt.events.KeyEvent) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) Text(org.eclipse.swt.widgets.Text) SOQLValuesHighlight(org.pentaho.di.trans.steps.salesforce.SOQLValuesHighlight) TextVar(org.pentaho.di.ui.core.widget.TextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) CCombo(org.eclipse.swt.custom.CCombo) GridData(org.eclipse.swt.layout.GridData) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) 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) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 12 with LabelTextVar

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

the class SalesforceUpdateDialog 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();
        }
    };
    ModifyListener lsTableMod = new ModifyListener() {

        public void modifyText(ModifyEvent arg0) {
            input.setChanged();
            setModuleFieldCombo();
        }
    };
    SelectionAdapter lsSelection = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            setModuleFieldCombo();
        }
    };
    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, "SalesforceUpdateDialog.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 FILE TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.General.Tab"));
    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ///////////////////////////////
    // START OF Connection GROUP //
    // ///////////////////////////////
    wConnectionGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wConnectionGroup);
    wConnectionGroup.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.ConnectionGroup.Label"));
    FormLayout connectionGroupLayout = new FormLayout();
    connectionGroupLayout.marginWidth = 10;
    connectionGroupLayout.marginHeight = 10;
    wConnectionGroup.setLayout(connectionGroupLayout);
    // Webservice URL
    wURL = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceUpdateDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceUpdateDialog.URL.Tooltip"));
    props.setLook(wURL);
    wURL.addModifyListener(lsMod);
    fdURL = new FormData();
    fdURL.left = new FormAttachment(0, 0);
    fdURL.top = new FormAttachment(wStepname, margin);
    fdURL.right = new FormAttachment(100, 0);
    wURL.setLayoutData(fdURL);
    // UserName line
    wUserName = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceUpdateDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceUpdateDialog.User.Tooltip"));
    props.setLook(wUserName);
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(0, 0);
    fdUserName.top = new FormAttachment(wURL, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wPassword = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceUpdateDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceUpdateDialog.Password.Tooltip"), true);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    fdPassword = new FormData();
    fdPassword.left = new FormAttachment(0, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // Test Salesforce connection button
    wTest = new Button(wConnectionGroup, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.TestConnection.Tooltip"));
    // fdTest.left = new FormAttachment(middle, 0);
    fdTest.top = new FormAttachment(wPassword, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    fdConnectionGroup = new FormData();
    fdConnectionGroup.left = new FormAttachment(0, margin);
    fdConnectionGroup.top = new FormAttachment(wStepname, margin);
    fdConnectionGroup.right = new FormAttachment(100, -margin);
    wConnectionGroup.setLayoutData(fdConnectionGroup);
    // ///////////////////////////////
    // END OF Connection GROUP //
    // ///////////////////////////////
    // ///////////////////////////////
    // START OF Settings GROUP //
    // ///////////////////////////////
    wSettingsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wSettingsGroup);
    wSettingsGroup.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.SettingsGroup.Label"));
    FormLayout settingGroupLayout = new FormLayout();
    settingGroupLayout.marginWidth = 10;
    settingGroupLayout.marginHeight = 10;
    wSettingsGroup.setLayout(settingGroupLayout);
    // Timeout
    wlTimeOut = new Label(wSettingsGroup, SWT.RIGHT);
    wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.TimeOut.Label"));
    props.setLook(wlTimeOut);
    fdlTimeOut = new FormData();
    fdlTimeOut.left = new FormAttachment(0, 0);
    fdlTimeOut.top = new FormAttachment(wSettingsGroup, margin);
    fdlTimeOut.right = new FormAttachment(middle, -margin);
    wlTimeOut.setLayoutData(fdlTimeOut);
    wTimeOut = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTimeOut);
    wTimeOut.addModifyListener(lsMod);
    fdTimeOut = new FormData();
    fdTimeOut.left = new FormAttachment(middle, 0);
    fdTimeOut.top = new FormAttachment(wSettingsGroup, margin);
    fdTimeOut.right = new FormAttachment(100, 0);
    wTimeOut.setLayoutData(fdTimeOut);
    // Use compression?
    wlUseCompression = new Label(wSettingsGroup, SWT.RIGHT);
    wlUseCompression.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.UseCompression.Label"));
    props.setLook(wlUseCompression);
    fdlUseCompression = new FormData();
    fdlUseCompression.left = new FormAttachment(0, 0);
    fdlUseCompression.top = new FormAttachment(wTimeOut, margin);
    fdlUseCompression.right = new FormAttachment(middle, -margin);
    wlUseCompression.setLayoutData(fdlUseCompression);
    wUseCompression = new Button(wSettingsGroup, SWT.CHECK);
    props.setLook(wUseCompression);
    wUseCompression.setToolTipText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.UseCompression.Tooltip"));
    fdUseCompression = new FormData();
    fdUseCompression.left = new FormAttachment(middle, 0);
    fdUseCompression.top = new FormAttachment(wTimeOut, margin);
    wUseCompression.setLayoutData(fdUseCompression);
    wUseCompression.addSelectionListener(new ComponentSelectionListener(input));
    // Rollback all changes on error?
    wlRollbackAllChangesOnError = new Label(wSettingsGroup, SWT.RIGHT);
    wlRollbackAllChangesOnError.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.RollbackAllChangesOnError.Label"));
    props.setLook(wlRollbackAllChangesOnError);
    fdlRollbackAllChangesOnError = new FormData();
    fdlRollbackAllChangesOnError.left = new FormAttachment(0, 0);
    fdlRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
    fdlRollbackAllChangesOnError.right = new FormAttachment(middle, -margin);
    wlRollbackAllChangesOnError.setLayoutData(fdlRollbackAllChangesOnError);
    wRollbackAllChangesOnError = new Button(wSettingsGroup, SWT.CHECK);
    wRollbackAllChangesOnError.addSelectionListener(new ComponentSelectionListener(input));
    props.setLook(wRollbackAllChangesOnError);
    wRollbackAllChangesOnError.setToolTipText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.RollbackAllChangesOnError.Tooltip"));
    fdRollbackAllChangesOnError = new FormData();
    fdRollbackAllChangesOnError.left = new FormAttachment(middle, 0);
    fdRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
    wRollbackAllChangesOnError.setLayoutData(fdRollbackAllChangesOnError);
    // BatchSize value
    wlBatchSize = new Label(wSettingsGroup, SWT.RIGHT);
    wlBatchSize.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.Limit.Label"));
    props.setLook(wlBatchSize);
    fdlBatchSize = new FormData();
    fdlBatchSize.left = new FormAttachment(0, 0);
    fdlBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
    fdlBatchSize.right = new FormAttachment(middle, -margin);
    wlBatchSize.setLayoutData(fdlBatchSize);
    wBatchSize = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wBatchSize);
    wBatchSize.addModifyListener(lsMod);
    fdBatchSize = new FormData();
    fdBatchSize.left = new FormAttachment(middle, 0);
    fdBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
    fdBatchSize.right = new FormAttachment(100, 0);
    wBatchSize.setLayoutData(fdBatchSize);
    // Module
    wlModule = new Label(wSettingsGroup, SWT.RIGHT);
    wlModule.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.Module.Label"));
    props.setLook(wlModule);
    fdlModule = new FormData();
    fdlModule.left = new FormAttachment(0, 0);
    fdlModule.top = new FormAttachment(wBatchSize, margin);
    fdlModule.right = new FormAttachment(middle, -margin);
    wlModule.setLayoutData(fdlModule);
    wModule = new ComboVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wModule.setEditable(true);
    props.setLook(wModule);
    wModule.addModifyListener(lsTableMod);
    wModule.addSelectionListener(lsSelection);
    fdModule = new FormData();
    fdModule.left = new FormAttachment(middle, 0);
    fdModule.top = new FormAttachment(wBatchSize, margin);
    fdModule.right = new FormAttachment(100, -margin);
    wModule.setLayoutData(fdModule);
    wModule.addFocusListener(new FocusListener() {

        public void focusLost(org.eclipse.swt.events.FocusEvent e) {
            getModulesListError = false;
        }

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            // check if the URL and login credentials passed and not just had error
            if (Utils.isEmpty(wURL.getText()) || Utils.isEmpty(wUserName.getText()) || Utils.isEmpty(wPassword.getText()) || (getModulesListError)) {
                return;
            }
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getModulesList();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    fdSettingsGroup = new FormData();
    fdSettingsGroup.left = new FormAttachment(0, margin);
    fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin);
    fdSettingsGroup.right = new FormAttachment(100, -margin);
    wSettingsGroup.setLayoutData(fdSettingsGroup);
    // ///////////////////////////////
    // END OF Settings GROUP //
    // ///////////////////////////////
    // THE UPDATE/INSERT TABLE
    wlReturn = new Label(wGeneralComp, SWT.NONE);
    wlReturn.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.UpdateFields.Label"));
    props.setLook(wlReturn);
    fdlReturn = new FormData();
    fdlReturn.left = new FormAttachment(0, 0);
    fdlReturn.top = new FormAttachment(wSettingsGroup, 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, "SalesforceUpdateDialog.ColumnInfo.TableField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    ciReturn[1] = new ColumnInfo(BaseMessages.getString(PKG, "SalesforceUpdateDialog.ColumnInfo.StreamField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    ciReturn[2] = new ColumnInfo(BaseMessages.getString(PKG, "SalesforceUpdateDialog.ColumnInfo.UseExternalId"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "Y", "N" });
    ciReturn[2].setToolTip(BaseMessages.getString(PKG, "SalesforceUpdateDialog.ColumnInfo.UseExternalId.Tooltip"));
    tableFieldColumns.add(ciReturn[0]);
    wReturn = new TableView(transMeta, wGeneralComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props);
    wGetLU = new Button(wGeneralComp, SWT.PUSH);
    wGetLU.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.GetAndUpdateFields.Label"));
    fdGetLU = new FormData();
    fdGetLU.top = new FormAttachment(wlReturn, margin);
    fdGetLU.right = new FormAttachment(100, 0);
    wGetLU.setLayoutData(fdGetLU);
    wDoMapping = new Button(wGeneralComp, SWT.PUSH);
    wDoMapping.setText(BaseMessages.getString(PKG, "SalesforceUpdateDialog.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();
                    // Dislay in red missing field names
                    Display.getDefault().asyncExec(new Runnable() {

                        public void run() {
                            if (!wReturn.isDisposed()) {
                                for (int i = 0; i < wReturn.table.getItemCount(); i++) {
                                    TableItem it = wReturn.table.getItem(i);
                                    if (!Utils.isEmpty(it.getText(2))) {
                                        if (!inputFields.containsKey(it.getText(2))) {
                                            it.setBackground(GUIResource.getInstance().getColorRed());
                                        }
                                    }
                                }
                            }
                        }
                    });
                } catch (KettleException e) {
                    logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
                }
            }
        }
    };
    new Thread(runnable).start();
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(wStepname, margin);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    // THE BUTTONS
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wCancel }, margin, null);
    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(wOK, -margin);
    wTabFolder.setLayoutData(fdTabFolder);
    // Add listeners
    lsOK = new Listener() {

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

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

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

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

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    wTabFolder.setSelection(0);
    // Set the shell size, based upon previous time...
    setSize();
    getData(input);
    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) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) 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) TableItem(org.eclipse.swt.widgets.TableItem) 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) Cursor(org.eclipse.swt.graphics.Cursor) CTabItem(org.eclipse.swt.custom.CTabItem) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) StepMeta(org.pentaho.di.trans.step.StepMeta) SalesforceStepMeta(org.pentaho.di.trans.steps.salesforce.SalesforceStepMeta) TextVar(org.pentaho.di.ui.core.widget.TextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) 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 13 with LabelTextVar

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

the class SalesforceUpsertDialog 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();
        }
    };
    ModifyListener lsTableMod = new ModifyListener() {

        public void modifyText(ModifyEvent arg0) {
            input.setChanged();
            moduleFields = null;
        }
    };
    SelectionAdapter lsSelection = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            moduleFields = null;
        }
    };
    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, "SalesforceUpsertDialog.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 FILE TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.General.Tab"));
    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ///////////////////////////////
    // START OF Connection GROUP //
    // ///////////////////////////////
    wConnectionGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wConnectionGroup);
    wConnectionGroup.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.ConnectionGroup.Label"));
    FormLayout connectionGroupLayout = new FormLayout();
    connectionGroupLayout.marginWidth = 10;
    connectionGroupLayout.marginHeight = 10;
    wConnectionGroup.setLayout(connectionGroupLayout);
    // Webservice URL
    wURL = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceUpsertDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceUpsertDialog.URL.Tooltip"));
    props.setLook(wURL);
    wURL.addModifyListener(lsMod);
    fdURL = new FormData();
    fdURL.left = new FormAttachment(0, 0);
    fdURL.top = new FormAttachment(wStepname, margin);
    fdURL.right = new FormAttachment(100, 0);
    wURL.setLayoutData(fdURL);
    // UserName line
    wUserName = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceUpsertDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceUpsertDialog.User.Tooltip"));
    props.setLook(wUserName);
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(0, 0);
    fdUserName.top = new FormAttachment(wURL, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wPassword = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceUpsertDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceUpsertDialog.Password.Tooltip"), true);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    fdPassword = new FormData();
    fdPassword.left = new FormAttachment(0, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // Test Salesforce connection button
    wTest = new Button(wConnectionGroup, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.TestConnection.Tooltip"));
    // fdTest.left = new FormAttachment(middle, 0);
    fdTest.top = new FormAttachment(wPassword, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    fdConnectionGroup = new FormData();
    fdConnectionGroup.left = new FormAttachment(0, margin);
    fdConnectionGroup.top = new FormAttachment(wStepname, margin);
    fdConnectionGroup.right = new FormAttachment(100, -margin);
    wConnectionGroup.setLayoutData(fdConnectionGroup);
    // ///////////////////////////////
    // END OF Connection GROUP //
    // ///////////////////////////////
    // ///////////////////////////////
    // START OF Settings GROUP //
    // ///////////////////////////////
    wSettingsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wSettingsGroup);
    wSettingsGroup.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.SettingsGroup.Label"));
    FormLayout settingGroupLayout = new FormLayout();
    settingGroupLayout.marginWidth = 10;
    settingGroupLayout.marginHeight = 10;
    wSettingsGroup.setLayout(settingGroupLayout);
    // Timeout
    wlTimeOut = new Label(wSettingsGroup, SWT.RIGHT);
    wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.TimeOut.Label"));
    props.setLook(wlTimeOut);
    fdlTimeOut = new FormData();
    fdlTimeOut.left = new FormAttachment(0, 0);
    fdlTimeOut.top = new FormAttachment(wSettingsGroup, margin);
    fdlTimeOut.right = new FormAttachment(middle, -margin);
    wlTimeOut.setLayoutData(fdlTimeOut);
    wTimeOut = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTimeOut);
    wTimeOut.addModifyListener(lsMod);
    fdTimeOut = new FormData();
    fdTimeOut.left = new FormAttachment(middle, 0);
    fdTimeOut.top = new FormAttachment(wSettingsGroup, margin);
    fdTimeOut.right = new FormAttachment(100, 0);
    wTimeOut.setLayoutData(fdTimeOut);
    // Use compression?
    wlUseCompression = new Label(wSettingsGroup, SWT.RIGHT);
    wlUseCompression.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.UseCompression.Label"));
    props.setLook(wlUseCompression);
    fdlUseCompression = new FormData();
    fdlUseCompression.left = new FormAttachment(0, 0);
    fdlUseCompression.top = new FormAttachment(wTimeOut, margin);
    fdlUseCompression.right = new FormAttachment(middle, -margin);
    wlUseCompression.setLayoutData(fdlUseCompression);
    wUseCompression = new Button(wSettingsGroup, SWT.CHECK);
    props.setLook(wUseCompression);
    wUseCompression.setToolTipText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.UseCompression.Tooltip"));
    fdUseCompression = new FormData();
    fdUseCompression.left = new FormAttachment(middle, 0);
    fdUseCompression.top = new FormAttachment(wTimeOut, margin);
    wUseCompression.setLayoutData(fdUseCompression);
    wUseCompression.addSelectionListener(new ComponentSelectionListener(input));
    // Rollback all changes on error?
    wlRollbackAllChangesOnError = new Label(wSettingsGroup, SWT.RIGHT);
    wlRollbackAllChangesOnError.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.RollbackAllChangesOnError.Label"));
    props.setLook(wlRollbackAllChangesOnError);
    fdlRollbackAllChangesOnError = new FormData();
    fdlRollbackAllChangesOnError.left = new FormAttachment(0, 0);
    fdlRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
    fdlRollbackAllChangesOnError.right = new FormAttachment(middle, -margin);
    wlRollbackAllChangesOnError.setLayoutData(fdlRollbackAllChangesOnError);
    wRollbackAllChangesOnError = new Button(wSettingsGroup, SWT.CHECK);
    wRollbackAllChangesOnError.addSelectionListener(new ComponentSelectionListener(input));
    props.setLook(wRollbackAllChangesOnError);
    wRollbackAllChangesOnError.setToolTipText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.RollbackAllChangesOnError.Tooltip"));
    fdRollbackAllChangesOnError = new FormData();
    fdRollbackAllChangesOnError.left = new FormAttachment(middle, 0);
    fdRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
    wRollbackAllChangesOnError.setLayoutData(fdRollbackAllChangesOnError);
    // BatchSize value
    wlBatchSize = new Label(wSettingsGroup, SWT.RIGHT);
    wlBatchSize.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.Limit.Label"));
    props.setLook(wlBatchSize);
    fdlBatchSize = new FormData();
    fdlBatchSize.left = new FormAttachment(0, 0);
    fdlBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
    fdlBatchSize.right = new FormAttachment(middle, -margin);
    wlBatchSize.setLayoutData(fdlBatchSize);
    wBatchSize = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wBatchSize);
    wBatchSize.addModifyListener(lsMod);
    fdBatchSize = new FormData();
    fdBatchSize.left = new FormAttachment(middle, 0);
    fdBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
    fdBatchSize.right = new FormAttachment(100, 0);
    wBatchSize.setLayoutData(fdBatchSize);
    // Module
    wlModule = new Label(wSettingsGroup, SWT.RIGHT);
    wlModule.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.Module.Label"));
    props.setLook(wlModule);
    fdlModule = new FormData();
    fdlModule.left = new FormAttachment(0, 0);
    fdlModule.top = new FormAttachment(wBatchSize, margin);
    fdlModule.right = new FormAttachment(middle, -margin);
    wlModule.setLayoutData(fdlModule);
    wModule = new ComboVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wModule.setEditable(true);
    props.setLook(wModule);
    wModule.addModifyListener(lsTableMod);
    wModule.addSelectionListener(lsSelection);
    fdModule = new FormData();
    fdModule.left = new FormAttachment(middle, 0);
    fdModule.top = new FormAttachment(wBatchSize, margin);
    fdModule.right = new FormAttachment(100, -margin);
    wModule.setLayoutData(fdModule);
    wModule.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            // check if the URL and login credentials passed and not just had error
            if (skipFetchModules()) {
                getModulesListError = false;
                return;
            }
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getModulesList();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Upsert Field
    wlUpsertField = new Label(wSettingsGroup, SWT.RIGHT);
    wlUpsertField.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.Upsert.Label"));
    props.setLook(wlUpsertField);
    fdlUpsertField = new FormData();
    fdlUpsertField.left = new FormAttachment(0, 0);
    fdlUpsertField.top = new FormAttachment(wModule, margin);
    fdlUpsertField.right = new FormAttachment(middle, -margin);
    wlUpsertField.setLayoutData(fdlUpsertField);
    wUpsertField = new CCombo(wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wUpsertField.setEditable(true);
    props.setLook(wUpsertField);
    wUpsertField.addModifyListener(lsMod);
    fdUpsertField = new FormData();
    fdUpsertField.left = new FormAttachment(middle, 0);
    fdUpsertField.top = new FormAttachment(wModule, margin);
    fdUpsertField.right = new FormAttachment(100, -margin);
    wUpsertField.setLayoutData(fdUpsertField);
    wUpsertField.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            getFieldsList();
        }
    });
    fdSettingsGroup = new FormData();
    fdSettingsGroup.left = new FormAttachment(0, margin);
    fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin);
    fdSettingsGroup.right = new FormAttachment(100, -margin);
    wSettingsGroup.setLayoutData(fdSettingsGroup);
    // ///////////////////////////////
    // END OF Settings GROUP //
    // ///////////////////////////////
    // ///////////////////////////////
    // START OF OutFields GROUP //
    // ///////////////////////////////
    wOutFieldsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wOutFieldsGroup);
    wOutFieldsGroup.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.OutFieldsGroup.Label"));
    FormLayout OutFieldsGroupLayout = new FormLayout();
    OutFieldsGroupLayout.marginWidth = 10;
    OutFieldsGroupLayout.marginHeight = 10;
    wOutFieldsGroup.setLayout(OutFieldsGroupLayout);
    // SalesforceIDFieldName
    wlSalesforceIDFieldName = new Label(wOutFieldsGroup, SWT.RIGHT);
    wlSalesforceIDFieldName.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.SalesforceIDFieldName.Label"));
    props.setLook(wlSalesforceIDFieldName);
    fdlSalesforceIDFieldName = new FormData();
    fdlSalesforceIDFieldName.left = new FormAttachment(0, 0);
    fdlSalesforceIDFieldName.top = new FormAttachment(wSettingsGroup, margin);
    fdlSalesforceIDFieldName.right = new FormAttachment(middle, -margin);
    wlSalesforceIDFieldName.setLayoutData(fdlSalesforceIDFieldName);
    wSalesforceIDFieldName = new TextVar(transMeta, wOutFieldsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSalesforceIDFieldName);
    wSalesforceIDFieldName.setToolTipText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.SalesforceIDFieldName.Tooltip"));
    wSalesforceIDFieldName.addModifyListener(lsMod);
    fdSalesforceIDFieldName = new FormData();
    fdSalesforceIDFieldName.left = new FormAttachment(middle, 0);
    fdSalesforceIDFieldName.top = new FormAttachment(wSettingsGroup, margin);
    fdSalesforceIDFieldName.right = new FormAttachment(100, 0);
    wSalesforceIDFieldName.setLayoutData(fdSalesforceIDFieldName);
    fdOutFieldsGroup = new FormData();
    fdOutFieldsGroup.left = new FormAttachment(0, margin);
    fdOutFieldsGroup.top = new FormAttachment(wSettingsGroup, margin);
    fdOutFieldsGroup.right = new FormAttachment(100, -margin);
    wOutFieldsGroup.setLayoutData(fdOutFieldsGroup);
    // ///////////////////////////////
    // END OF OutFields GROUP //
    // ///////////////////////////////
    // THE UPDATE/INSERT TABLE
    wlReturn = new Label(wGeneralComp, SWT.NONE);
    wlReturn.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.UpdateFields.Label"));
    props.setLook(wlReturn);
    fdlReturn = new FormData();
    fdlReturn.left = new FormAttachment(0, 0);
    fdlReturn.top = new FormAttachment(wOutFieldsGroup, 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, "SalesforceUpsertDialog.ColumnInfo.TableField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    ciReturn[1] = new ColumnInfo(BaseMessages.getString(PKG, "SalesforceUpsertDialog.ColumnInfo.StreamField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    ciReturn[2] = new ColumnInfo(BaseMessages.getString(PKG, "SalesforceUpsertDialog.ColumnInfo.UseExternalId"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "Y", "N" });
    ciReturn[2].setToolTip(BaseMessages.getString(PKG, "SalesforceUpdateDialog.ColumnInfo.UseExternalId.Tooltip"));
    tableFieldColumns.add(ciReturn[0]);
    wReturn = new TableView(transMeta, wGeneralComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props);
    wReturn.getTable().addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            setModuleFieldCombo();
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });
    wGetLU = new Button(wGeneralComp, SWT.PUSH);
    wGetLU.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.GetAndUpdateFields.Label"));
    fdGetLU = new FormData();
    fdGetLU.top = new FormAttachment(wlReturn, margin);
    fdGetLU.right = new FormAttachment(100, 0);
    wGetLU.setLayoutData(fdGetLU);
    wDoMapping = new Button(wGeneralComp, SWT.PUSH);
    wDoMapping.setText(BaseMessages.getString(PKG, "SalesforceUpsertDialog.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();
                    // Dislay in red missing field names
                    Display.getDefault().asyncExec(new Runnable() {

                        public void run() {
                            if (!wReturn.isDisposed()) {
                                for (int i = 0; i < wReturn.table.getItemCount(); i++) {
                                    TableItem it = wReturn.table.getItem(i);
                                    if (!Utils.isEmpty(it.getText(2))) {
                                        if (!inputFields.containsKey(it.getText(2))) {
                                            it.setBackground(GUIResource.getInstance().getColorRed());
                                        }
                                    }
                                }
                            }
                        }
                    });
                } catch (KettleException e) {
                    logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
                }
            }
        }
    };
    new Thread(runnable).start();
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(wStepname, margin);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    // THE BUTTONS
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wCancel }, margin, null);
    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(wOK, -margin);
    wTabFolder.setLayoutData(fdTabFolder);
    // Add listeners
    lsOK = new Listener() {

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

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

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

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

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    wTabFolder.setSelection(0);
    // Set the shell size, based upon previous time...
    setSize();
    getData(input);
    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) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) 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) TableItem(org.eclipse.swt.widgets.TableItem) 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) FocusEvent(org.eclipse.swt.events.FocusEvent) Cursor(org.eclipse.swt.graphics.Cursor) CTabItem(org.eclipse.swt.custom.CTabItem) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) FocusEvent(org.eclipse.swt.events.FocusEvent) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) StepMeta(org.pentaho.di.trans.step.StepMeta) SalesforceStepMeta(org.pentaho.di.trans.steps.salesforce.SalesforceStepMeta) TextVar(org.pentaho.di.ui.core.widget.TextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) CCombo(org.eclipse.swt.custom.CCombo) FocusEvent(org.eclipse.swt.events.FocusEvent) 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 14 with LabelTextVar

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

the class JobEntrySNMPTrapDialog 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, "JobSNMPTrap.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Job entry name line
    wName = new LabelText(shell, BaseMessages.getString(PKG, "JobSNMPTrap.Name.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.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, "JobSNMPTrap.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, "JobSNMPTrap.ServerSettings.Group.Label"));
    FormLayout ServerSettingsgroupLayout = new FormLayout();
    ServerSettingsgroupLayout.marginWidth = 10;
    ServerSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(ServerSettingsgroupLayout);
    // ServerName line
    wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Server.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.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, "JobSNMPTrap.Port.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Port.Tooltip"));
    props.setLook(wPort);
    wPort.addModifyListener(lsMod);
    fdPort = new FormData();
    fdPort.left = new FormAttachment(0, 0);
    fdPort.top = new FormAttachment(wServerName, margin);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);
    // Server OID line
    wOID = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSNMPTrap.OID.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.OID.Tooltip"));
    props.setLook(wOID);
    wOID.addModifyListener(lsMod);
    fdOID = new FormData();
    fdOID.left = new FormAttachment(0, 0);
    fdOID.top = new FormAttachment(wPort, margin);
    fdOID.right = new FormAttachment(100, 0);
    wOID.setLayoutData(fdOID);
    // Test connection button
    wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "JobSNMPTrap.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "JobSNMPTrap.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wOID, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wName, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Advanced SETTINGS GROUP///
    // /
    wAdvancedSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wAdvancedSettings);
    wAdvancedSettings.setText(BaseMessages.getString(PKG, "JobSNMPTrap.AdvancedSettings.Group.Label"));
    FormLayout AdvancedSettingsgroupLayout = new FormLayout();
    AdvancedSettingsgroupLayout.marginWidth = 10;
    AdvancedSettingsgroupLayout.marginHeight = 10;
    wAdvancedSettings.setLayout(AdvancedSettingsgroupLayout);
    // Target type
    wlTargetType = new Label(wAdvancedSettings, SWT.RIGHT);
    wlTargetType.setText(BaseMessages.getString(PKG, "JobSNMPTrap.TargetType.Label"));
    props.setLook(wlTargetType);
    fdlTargetType = new FormData();
    fdlTargetType.left = new FormAttachment(0, margin);
    fdlTargetType.right = new FormAttachment(middle, -margin);
    fdlTargetType.top = new FormAttachment(wServerSettings, margin);
    wlTargetType.setLayoutData(fdlTargetType);
    wTargetType = new CCombo(wAdvancedSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wTargetType.setItems(JobEntrySNMPTrap.target_type_Desc);
    props.setLook(wTargetType);
    fdTargetType = new FormData();
    fdTargetType.left = new FormAttachment(middle, margin);
    fdTargetType.top = new FormAttachment(wServerSettings, margin);
    fdTargetType.right = new FormAttachment(100, 0);
    wTargetType.setLayoutData(fdTargetType);
    wTargetType.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            CheckuseUserTarget();
        }
    });
    // Community String line
    wComString = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.ComString.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.ComString.Tooltip"));
    props.setLook(wComString);
    wComString.addModifyListener(lsMod);
    fdComString = new FormData();
    fdComString.left = new FormAttachment(0, 0);
    fdComString.top = new FormAttachment(wTargetType, margin);
    fdComString.right = new FormAttachment(100, 0);
    wComString.setLayoutData(fdComString);
    // User line
    wUser = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.User.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.User.Tooltip"));
    props.setLook(wUser);
    wUser.addModifyListener(lsMod);
    fdUser = new FormData();
    fdUser.left = new FormAttachment(0, 0);
    fdUser.top = new FormAttachment(wComString, margin);
    fdUser.right = new FormAttachment(100, 0);
    wUser.setLayoutData(fdUser);
    // Passphrase String line
    wPassphrase = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Passphrase.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Passphrase.Tooltip"), true);
    props.setLook(wPassphrase);
    wPassphrase.addModifyListener(lsMod);
    fdPassphrase = new FormData();
    fdPassphrase.left = new FormAttachment(0, 0);
    fdPassphrase.top = new FormAttachment(wUser, margin);
    fdPassphrase.right = new FormAttachment(100, 0);
    wPassphrase.setLayoutData(fdPassphrase);
    // EngineID String line
    wEngineID = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.EngineID.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.EngineID.Tooltip"));
    props.setLook(wEngineID);
    wEngineID.addModifyListener(lsMod);
    fdEngineID = new FormData();
    fdEngineID.left = new FormAttachment(0, 0);
    fdEngineID.top = new FormAttachment(wPassphrase, margin);
    fdEngineID.right = new FormAttachment(100, 0);
    wEngineID.setLayoutData(fdEngineID);
    // Retry line
    wRetry = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Retry.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Retry.Tooltip"));
    props.setLook(wRetry);
    wRetry.addModifyListener(lsMod);
    fdRetry = new FormData();
    fdRetry.left = new FormAttachment(0, 0);
    fdRetry.top = new FormAttachment(wEngineID, margin);
    fdRetry.right = new FormAttachment(100, 0);
    wRetry.setLayoutData(fdRetry);
    // Timeout line
    wTimeout = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Timeout.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Timeout.Tooltip"));
    props.setLook(wTimeout);
    wTimeout.addModifyListener(lsMod);
    fdTimeout = new FormData();
    fdTimeout.left = new FormAttachment(0, 0);
    fdTimeout.top = new FormAttachment(wRetry, margin);
    fdTimeout.right = new FormAttachment(100, 0);
    wTimeout.setLayoutData(fdTimeout);
    fdAdvancedSettings = new FormData();
    fdAdvancedSettings.left = new FormAttachment(0, margin);
    fdAdvancedSettings.top = new FormAttachment(wServerSettings, margin);
    fdAdvancedSettings.right = new FormAttachment(100, -margin);
    wAdvancedSettings.setLayoutData(fdAdvancedSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Advanced SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF MESSAGE GROUP///
    // /
    wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wMessageGroup);
    wMessageGroup.setText(BaseMessages.getString(PKG, "JobSNMPTrap.MessageGroup.Group.Label"));
    FormLayout MessageGroupgroupLayout = new FormLayout();
    MessageGroupgroupLayout.marginWidth = 10;
    MessageGroupgroupLayout.marginHeight = 10;
    wMessageGroup.setLayout(MessageGroupgroupLayout);
    // Message line
    wlMessage = new Label(wMessageGroup, SWT.RIGHT);
    wlMessage.setText(BaseMessages.getString(PKG, "JobSNMPTrap.Message.Label"));
    props.setLook(wlMessage);
    fdlMessage = new FormData();
    fdlMessage.left = new FormAttachment(0, 0);
    fdlMessage.top = new FormAttachment(wComString, 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, 0);
    fdMessage.top = new FormAttachment(wComString, 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(wAdvancedSettings, 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);
    wTimeout.addSelectionListener(lsDef);
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    CheckuseUserTarget();
    wTabFolder.setSelection(0);
    BaseStepDialog.setSize(shell);
    shell.open();
    props.setDialogSize(shell, "JobSNMPTrapDialogSize");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) StyledTextComp(org.pentaho.di.ui.core.widget.StyledTextComp) Group(org.eclipse.swt.widgets.Group) 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) CTabItem(org.eclipse.swt.custom.CTabItem) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) 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) LabelText(org.pentaho.di.ui.core.widget.LabelText) 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 15 with LabelTextVar

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

the class MailDialog method open.

public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    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, "MailDialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "MailDialog.Stepname.Label"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.right = new FormAttachment(middle, -margin);
    fdlStepname.top = new FormAttachment(0, margin);
    wlStepname.setLayoutData(fdlStepname);
    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "Mail.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 Destination Settings GROUP
    // ////////////////////////
    wDestinationGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wDestinationGroup);
    wDestinationGroup.setText(BaseMessages.getString(PKG, "Mail.Group.DestinationAddress.Label"));
    FormLayout destinationgroupLayout = new FormLayout();
    destinationgroupLayout.marginWidth = 10;
    destinationgroupLayout.marginHeight = 10;
    wDestinationGroup.setLayout(destinationgroupLayout);
    // Destination
    wlDestination = new Label(wDestinationGroup, SWT.RIGHT);
    wlDestination.setText(BaseMessages.getString(PKG, "Mail.DestinationAddress.Label"));
    props.setLook(wlDestination);
    fdlDestination = new FormData();
    fdlDestination.left = new FormAttachment(0, -margin);
    fdlDestination.top = new FormAttachment(wStepname, margin);
    fdlDestination.right = new FormAttachment(middle, -2 * margin);
    wlDestination.setLayoutData(fdlDestination);
    wDestination = new CCombo(wDestinationGroup, SWT.BORDER | SWT.READ_ONLY);
    wDestination.setEditable(true);
    props.setLook(wDestination);
    wDestination.addModifyListener(lsMod);
    fdDestination = new FormData();
    fdDestination.left = new FormAttachment(middle, -margin);
    fdDestination.top = new FormAttachment(wStepname, margin);
    fdDestination.right = new FormAttachment(100, -margin);
    wDestination.setLayoutData(fdDestination);
    wDestination.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // DestinationCcCc
    wlDestinationCc = new Label(wDestinationGroup, SWT.RIGHT);
    wlDestinationCc.setText(BaseMessages.getString(PKG, "Mail.DestinationAddressCc.Label"));
    props.setLook(wlDestinationCc);
    fdlDestinationCc = new FormData();
    fdlDestinationCc.left = new FormAttachment(0, -margin);
    fdlDestinationCc.top = new FormAttachment(wDestination, margin);
    fdlDestinationCc.right = new FormAttachment(middle, -2 * margin);
    wlDestinationCc.setLayoutData(fdlDestinationCc);
    wDestinationCc = new CCombo(wDestinationGroup, SWT.BORDER | SWT.READ_ONLY);
    wDestinationCc.setEditable(true);
    props.setLook(wDestinationCc);
    wDestinationCc.addModifyListener(lsMod);
    fdDestinationCc = new FormData();
    fdDestinationCc.left = new FormAttachment(middle, -margin);
    fdDestinationCc.top = new FormAttachment(wDestination, margin);
    fdDestinationCc.right = new FormAttachment(100, -margin);
    wDestinationCc.setLayoutData(fdDestinationCc);
    wDestinationCc.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // DestinationBCc
    wlDestinationBCc = new Label(wDestinationGroup, SWT.RIGHT);
    wlDestinationBCc.setText(BaseMessages.getString(PKG, "Mail.DestinationAddressBCc.Label"));
    props.setLook(wlDestinationBCc);
    fdlDestinationBCc = new FormData();
    fdlDestinationBCc.left = new FormAttachment(0, -margin);
    fdlDestinationBCc.top = new FormAttachment(wDestinationCc, margin);
    fdlDestinationBCc.right = new FormAttachment(middle, -2 * margin);
    wlDestinationBCc.setLayoutData(fdlDestinationBCc);
    wDestinationBCc = new CCombo(wDestinationGroup, SWT.BORDER | SWT.READ_ONLY);
    wDestinationBCc.setEditable(true);
    props.setLook(wDestinationBCc);
    wDestinationBCc.addModifyListener(lsMod);
    fdDestinationBCc = new FormData();
    fdDestinationBCc.left = new FormAttachment(middle, -margin);
    fdDestinationBCc.top = new FormAttachment(wDestinationCc, margin);
    fdDestinationBCc.right = new FormAttachment(100, -margin);
    wDestinationBCc.setLayoutData(fdDestinationBCc);
    wDestinationBCc.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    FormData fdDestinationGroup = new FormData();
    fdDestinationGroup.left = new FormAttachment(0, margin);
    fdDestinationGroup.top = new FormAttachment(wName, margin);
    fdDestinationGroup.right = new FormAttachment(100, -margin);
    wDestinationGroup.setLayoutData(fdDestinationGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF DESTINATION ADDRESS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Reply Settings GROUP
    // ////////////////////////
    wReplyGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wReplyGroup);
    wReplyGroup.setText(BaseMessages.getString(PKG, "MailDialog.Group.Reply.Label"));
    FormLayout replygroupLayout = new FormLayout();
    replygroupLayout.marginWidth = 10;
    replygroupLayout.marginHeight = 10;
    wReplyGroup.setLayout(replygroupLayout);
    // ReplyName
    wlReplyName = new Label(wReplyGroup, SWT.RIGHT);
    wlReplyName.setText(BaseMessages.getString(PKG, "Mail.ReplyName.Label"));
    props.setLook(wlReplyName);
    fdlReplyName = new FormData();
    fdlReplyName.left = new FormAttachment(0, -margin);
    fdlReplyName.top = new FormAttachment(wDestinationGroup, margin);
    fdlReplyName.right = new FormAttachment(middle, -2 * margin);
    wlReplyName.setLayoutData(fdlReplyName);
    wReplyName = new CCombo(wReplyGroup, SWT.BORDER | SWT.READ_ONLY);
    wReplyName.setEditable(true);
    props.setLook(wReplyName);
    wReplyName.addModifyListener(lsMod);
    fdReplyName = new FormData();
    fdReplyName.left = new FormAttachment(middle, -margin);
    fdReplyName.top = new FormAttachment(wDestinationGroup, margin);
    fdReplyName.right = new FormAttachment(100, -margin);
    wReplyName.setLayoutData(fdReplyName);
    wReplyName.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Reply
    wlReply = new Label(wReplyGroup, SWT.RIGHT);
    wlReply.setText(BaseMessages.getString(PKG, "Mail.ReplyAddress.Label"));
    props.setLook(wlReply);
    fdlReply = new FormData();
    fdlReply.left = new FormAttachment(0, -margin);
    fdlReply.top = new FormAttachment(wReplyName, margin);
    fdlReply.right = new FormAttachment(middle, -2 * margin);
    wlReply.setLayoutData(fdlReply);
    wReply = new CCombo(wReplyGroup, SWT.BORDER | SWT.READ_ONLY);
    wReply.setEditable(true);
    props.setLook(wReply);
    wReply.addModifyListener(lsMod);
    fdReply = new FormData();
    fdReply.left = new FormAttachment(middle, -margin);
    fdReply.top = new FormAttachment(wReplyName, margin);
    fdReply.right = new FormAttachment(100, -margin);
    wReply.setLayoutData(fdReply);
    wReply.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    FormData fdReplyGroup = new FormData();
    fdReplyGroup.left = new FormAttachment(0, margin);
    fdReplyGroup.top = new FormAttachment(wDestinationGroup, margin);
    fdReplyGroup.right = new FormAttachment(100, -margin);
    wReplyGroup.setLayoutData(fdReplyGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Reply GROUP
    // ///////////////////////////////////////////////////////////
    // Reply to addresses
    wlReplyToAddresses = new Label(wGeneralComp, SWT.RIGHT);
    wlReplyToAddresses.setText(BaseMessages.getString(PKG, "MailDialog.ReplyToAddresses.Label"));
    props.setLook(wlReplyToAddresses);
    fdlReplyToAddresses = new FormData();
    fdlReplyToAddresses.left = new FormAttachment(0, -margin);
    fdlReplyToAddresses.top = new FormAttachment(wReplyGroup, 2 * margin);
    fdlReplyToAddresses.right = new FormAttachment(middle, -2 * margin);
    wlReplyToAddresses.setLayoutData(fdlReplyToAddresses);
    wReplyToAddresses = new CCombo(wGeneralComp, SWT.BORDER | SWT.READ_ONLY);
    wReplyToAddresses.setEditable(true);
    props.setLook(wReplyToAddresses);
    wReplyToAddresses.addModifyListener(lsMod);
    fdReplyToAddresses = new FormData();
    fdReplyToAddresses.left = new FormAttachment(middle, -margin);
    fdReplyToAddresses.top = new FormAttachment(wReplyGroup, 2 * margin);
    fdReplyToAddresses.right = new FormAttachment(100, -margin);
    wReplyToAddresses.setLayoutData(fdReplyToAddresses);
    wReplyToAddresses.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Person
    wlPerson = new Label(wGeneralComp, SWT.RIGHT);
    wlPerson.setText(BaseMessages.getString(PKG, "Mail.Contact.Label"));
    props.setLook(wlPerson);
    fdlPerson = new FormData();
    fdlPerson.left = new FormAttachment(0, -margin);
    fdlPerson.top = new FormAttachment(wReplyToAddresses, 2 * margin);
    fdlPerson.right = new FormAttachment(middle, -2 * margin);
    wlPerson.setLayoutData(fdlPerson);
    wPerson = new CCombo(wGeneralComp, SWT.BORDER | SWT.READ_ONLY);
    wPerson.setEditable(true);
    props.setLook(wPerson);
    wPerson.addModifyListener(lsMod);
    fdPerson = new FormData();
    fdPerson.left = new FormAttachment(middle, -margin);
    fdPerson.top = new FormAttachment(wReplyToAddresses, 2 * margin);
    fdPerson.right = new FormAttachment(100, -margin);
    wPerson.setLayoutData(fdPerson);
    wPerson.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Phone line
    wlPhone = new Label(wGeneralComp, SWT.RIGHT);
    wlPhone.setText(BaseMessages.getString(PKG, "Mail.ContactPhone.Label"));
    props.setLook(wlPhone);
    fdlPhone = new FormData();
    fdlPhone.left = new FormAttachment(0, -margin);
    fdlPhone.top = new FormAttachment(wPerson, margin);
    fdlPhone.right = new FormAttachment(middle, -2 * margin);
    wlPhone.setLayoutData(fdlPhone);
    wPhone = new CCombo(wGeneralComp, SWT.BORDER | SWT.READ_ONLY);
    wPhone.setEditable(true);
    props.setLook(wPhone);
    wPhone.addModifyListener(lsMod);
    fdPhone = new FormData();
    fdPhone.left = new FormAttachment(middle, -margin);
    fdPhone.top = new FormAttachment(wPerson, margin);
    fdPhone.right = new FormAttachment(100, -margin);
    wPhone.setLayoutData(fdPhone);
    wPhone.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    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 SERVER TAB ///
    // ///////////////////////////////////
    wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setText(BaseMessages.getString(PKG, "MailDialog.Server.Label"));
    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;
    wContentComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wContentComp);
    wContentComp.setLayout(contentLayout);
    // ////////////////////////
    // START OF SERVER GROUP
    // /////////////////////////
    wServerGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wServerGroup);
    wServerGroup.setText(BaseMessages.getString(PKG, "Mail.Group.SMTPServer.Label"));
    FormLayout servergroupLayout = new FormLayout();
    servergroupLayout.marginWidth = 10;
    servergroupLayout.marginHeight = 10;
    wServerGroup.setLayout(servergroupLayout);
    // Server
    wlServer = new Label(wServerGroup, SWT.RIGHT);
    wlServer.setText(BaseMessages.getString(PKG, "Mail.SMTPServer.Label"));
    props.setLook(wlServer);
    fdlServer = new FormData();
    fdlServer.left = new FormAttachment(0, -margin);
    fdlServer.top = new FormAttachment(0, margin);
    fdlServer.right = new FormAttachment(middle, -2 * margin);
    wlServer.setLayoutData(fdlServer);
    wServer = new CCombo(wServerGroup, SWT.BORDER | SWT.READ_ONLY);
    wServer.setEditable(true);
    props.setLook(wServer);
    wServer.addModifyListener(lsMod);
    fdServer = new FormData();
    fdServer.left = new FormAttachment(middle, -margin);
    fdServer.top = new FormAttachment(0, margin);
    fdServer.right = new FormAttachment(100, -margin);
    wServer.setLayoutData(fdServer);
    wServer.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Port
    wlPort = new Label(wServerGroup, SWT.RIGHT);
    wlPort.setText(BaseMessages.getString(PKG, "Mail.Port.Label"));
    props.setLook(wlPort);
    fdlPort = new FormData();
    fdlPort.left = new FormAttachment(0, -margin);
    fdlPort.top = new FormAttachment(wServer, margin);
    fdlPort.right = new FormAttachment(middle, -2 * margin);
    wlPort.setLayoutData(fdlPort);
    wPort = new CCombo(wServerGroup, SWT.BORDER | SWT.READ_ONLY);
    wPort.setEditable(true);
    props.setLook(wPort);
    wPort.addModifyListener(lsMod);
    fdPort = new FormData();
    fdPort.left = new FormAttachment(middle, -margin);
    fdPort.top = new FormAttachment(wServer, margin);
    fdPort.right = new FormAttachment(100, -margin);
    wPort.setLayoutData(fdPort);
    wPort.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    FormData fdServerGroup = new FormData();
    fdServerGroup.left = new FormAttachment(0, margin);
    fdServerGroup.top = new FormAttachment(wName, margin);
    fdServerGroup.right = new FormAttachment(100, -margin);
    wServerGroup.setLayoutData(fdServerGroup);
    // //////////////////////////////////////
    // / END OF SERVER ADDRESS GROUP
    // ///////////////////////////////////////
    // ////////////////////////////////////
    // START OF AUTHENTIFICATION GROUP
    // ////////////////////////////////////
    wAuthentificationGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wAuthentificationGroup);
    wAuthentificationGroup.setText(BaseMessages.getString(PKG, "Mail.Group.Authentification.Label"));
    FormLayout authentificationgroupLayout = new FormLayout();
    authentificationgroupLayout.marginWidth = 10;
    authentificationgroupLayout.marginHeight = 10;
    wAuthentificationGroup.setLayout(authentificationgroupLayout);
    // Authentication?
    wlUseAuth = new Label(wAuthentificationGroup, SWT.RIGHT);
    wlUseAuth.setText(BaseMessages.getString(PKG, "Mail.UseAuthentication.Label"));
    props.setLook(wlUseAuth);
    fdlUseAuth = new FormData();
    fdlUseAuth.left = new FormAttachment(0, 0);
    fdlUseAuth.top = new FormAttachment(wServerGroup, margin);
    fdlUseAuth.right = new FormAttachment(middle, -2 * margin);
    wlUseAuth.setLayoutData(fdlUseAuth);
    wUseAuth = new Button(wAuthentificationGroup, SWT.CHECK);
    props.setLook(wUseAuth);
    fdUseAuth = new FormData();
    fdUseAuth.left = new FormAttachment(middle, -margin);
    fdUseAuth.top = new FormAttachment(wServerGroup, margin);
    fdUseAuth.right = new FormAttachment(100, 0);
    wUseAuth.setLayoutData(fdUseAuth);
    wUseAuth.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setUseAuth();
            input.setChanged();
        }
    });
    // AuthUser line
    wlAuthUser = new Label(wAuthentificationGroup, SWT.RIGHT);
    wlAuthUser.setText(BaseMessages.getString(PKG, "Mail.AuthenticationUser.Label"));
    props.setLook(wlAuthUser);
    fdlAuthUser = new FormData();
    fdlAuthUser.left = new FormAttachment(0, -margin);
    fdlAuthUser.top = new FormAttachment(wUseAuth, margin);
    fdlAuthUser.right = new FormAttachment(middle, -2 * margin);
    wlAuthUser.setLayoutData(fdlAuthUser);
    wAuthUser = new CCombo(wAuthentificationGroup, SWT.BORDER | SWT.READ_ONLY);
    wAuthUser.setEditable(true);
    props.setLook(wAuthUser);
    wAuthUser.addModifyListener(lsMod);
    fdAuthUser = new FormData();
    fdAuthUser.left = new FormAttachment(middle, -margin);
    fdAuthUser.top = new FormAttachment(wUseAuth, margin);
    fdAuthUser.right = new FormAttachment(100, -margin);
    wAuthUser.setLayoutData(fdAuthUser);
    wAuthUser.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // AuthPass line
    wlAuthPass = new Label(wAuthentificationGroup, SWT.RIGHT);
    wlAuthPass.setText(BaseMessages.getString(PKG, "Mail.AuthenticationPassword.Label"));
    props.setLook(wlAuthPass);
    fdlAuthPass = new FormData();
    fdlAuthPass.left = new FormAttachment(0, -margin);
    fdlAuthPass.top = new FormAttachment(wAuthUser, margin);
    fdlAuthPass.right = new FormAttachment(middle, -2 * margin);
    wlAuthPass.setLayoutData(fdlAuthPass);
    wAuthPass = new CCombo(wAuthentificationGroup, SWT.BORDER | SWT.READ_ONLY);
    wAuthPass.setEditable(true);
    props.setLook(wAuthPass);
    wAuthPass.addModifyListener(lsMod);
    fdAuthPass = new FormData();
    fdAuthPass.left = new FormAttachment(middle, -margin);
    fdAuthPass.top = new FormAttachment(wAuthUser, margin);
    fdAuthPass.right = new FormAttachment(100, -margin);
    wAuthPass.setLayoutData(fdAuthPass);
    wAuthPass.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Use secure authentication?
    wlUseSecAuth = new Label(wAuthentificationGroup, SWT.RIGHT);
    wlUseSecAuth.setText(BaseMessages.getString(PKG, "Mail.UseSecAuthentication.Label"));
    props.setLook(wlUseSecAuth);
    fdlUseSecAuth = new FormData();
    fdlUseSecAuth.left = new FormAttachment(0, 0);
    fdlUseSecAuth.top = new FormAttachment(wAuthPass, margin);
    fdlUseSecAuth.right = new FormAttachment(middle, -2 * margin);
    wlUseSecAuth.setLayoutData(fdlUseSecAuth);
    wUseSecAuth = new Button(wAuthentificationGroup, SWT.CHECK);
    props.setLook(wUseSecAuth);
    fdUseSecAuth = new FormData();
    fdUseSecAuth.left = new FormAttachment(middle, -margin);
    fdUseSecAuth.top = new FormAttachment(wAuthPass, margin);
    fdUseSecAuth.right = new FormAttachment(100, 0);
    wUseSecAuth.setLayoutData(fdUseSecAuth);
    wUseSecAuth.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setSecureConnectiontype();
            input.setChanged();
        }
    });
    // SecureConnectionType
    wlSecureConnectionType = new Label(wAuthentificationGroup, SWT.RIGHT);
    wlSecureConnectionType.setText(BaseMessages.getString(PKG, "Mail.SecureConnectionType.Label"));
    props.setLook(wlSecureConnectionType);
    fdlSecureConnectionType = new FormData();
    fdlSecureConnectionType.left = new FormAttachment(0, 0);
    fdlSecureConnectionType.top = new FormAttachment(wUseSecAuth, margin);
    fdlSecureConnectionType.right = new FormAttachment(middle, -2 * margin);
    wlSecureConnectionType.setLayoutData(fdlSecureConnectionType);
    wSecureConnectionType = new CCombo(wAuthentificationGroup, SWT.BORDER | SWT.READ_ONLY);
    wSecureConnectionType.setEditable(true);
    props.setLook(wSecureConnectionType);
    wSecureConnectionType.addModifyListener(lsMod);
    fdSecureConnectionType = new FormData();
    fdSecureConnectionType.left = new FormAttachment(middle, -margin);
    fdSecureConnectionType.top = new FormAttachment(wUseSecAuth, margin);
    fdSecureConnectionType.right = new FormAttachment(100, 0);
    wSecureConnectionType.setLayoutData(fdSecureConnectionType);
    wSecureConnectionType.add("SSL");
    wSecureConnectionType.add("TLS");
    wSecureConnectionType.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setSecureConnectiontype();
            input.setChanged();
        }
    });
    FormData fdAuthentificationGroup = new FormData();
    fdAuthentificationGroup.left = new FormAttachment(0, margin);
    fdAuthentificationGroup.top = new FormAttachment(wServerGroup, margin);
    fdAuthentificationGroup.right = new FormAttachment(100, -margin);
    fdAuthentificationGroup.bottom = new FormAttachment(100, -margin);
    wAuthentificationGroup.setLayoutData(fdAuthentificationGroup);
    // //////////////////////////////////////
    // / END OF AUTHENTIFICATION GROUP
    // ///////////////////////////////////////
    fdContentComp = new FormData();
    fdContentComp.left = new FormAttachment(0, 0);
    fdContentComp.top = new FormAttachment(0, 0);
    fdContentComp.right = new FormAttachment(100, 0);
    fdContentComp.bottom = new FormAttachment(100, 0);
    wContentComp.setLayoutData(wContentComp);
    wContentComp.layout();
    wContentTab.setControl(wContentComp);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////////////////
    // START OF MESSAGE TAB ///
    // ///////////////////////////////////
    wMessageTab = new CTabItem(wTabFolder, SWT.NONE);
    wMessageTab.setText(BaseMessages.getString(PKG, "Mail.Tab.Message.Label"));
    FormLayout messageLayout = new FormLayout();
    messageLayout.marginWidth = 3;
    messageLayout.marginHeight = 3;
    wMessageComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wMessageComp);
    wMessageComp.setLayout(contentLayout);
    // ////////////////////////////////////
    // START OF MESSAGE SETTINGS GROUP
    // ////////////////////////////////////
    wMessageSettingsGroup = new Group(wMessageComp, SWT.SHADOW_NONE);
    props.setLook(wMessageSettingsGroup);
    wMessageSettingsGroup.setText(BaseMessages.getString(PKG, "Mail.Group.MessageSettings.Label"));
    FormLayout messagesettingsgroupLayout = new FormLayout();
    messagesettingsgroupLayout.marginWidth = 10;
    messagesettingsgroupLayout.marginHeight = 10;
    wMessageSettingsGroup.setLayout(messagesettingsgroupLayout);
    // Add date to logfile name?
    wlAddDate = new Label(wMessageSettingsGroup, SWT.RIGHT);
    wlAddDate.setText(BaseMessages.getString(PKG, "Mail.IncludeDate.Label"));
    props.setLook(wlAddDate);
    fdlAddDate = new FormData();
    fdlAddDate.left = new FormAttachment(0, 0);
    fdlAddDate.top = new FormAttachment(0, margin);
    fdlAddDate.right = new FormAttachment(middle, -2 * margin);
    wlAddDate.setLayoutData(fdlAddDate);
    wAddDate = new Button(wMessageSettingsGroup, SWT.CHECK);
    props.setLook(wAddDate);
    fdAddDate = new FormData();
    fdAddDate.left = new FormAttachment(middle, -margin);
    fdAddDate.top = new FormAttachment(0, margin);
    fdAddDate.right = new FormAttachment(100, 0);
    wAddDate.setLayoutData(fdAddDate);
    wAddDate.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Only send the comment in the mail body
    wlOnlyComment = new Label(wMessageSettingsGroup, SWT.RIGHT);
    wlOnlyComment.setText(BaseMessages.getString(PKG, "Mail.OnlyCommentInBody.Label"));
    props.setLook(wlOnlyComment);
    fdlOnlyComment = new FormData();
    fdlOnlyComment.left = new FormAttachment(0, 0);
    fdlOnlyComment.top = new FormAttachment(wAddDate, margin);
    fdlOnlyComment.right = new FormAttachment(middle, -2 * margin);
    wlOnlyComment.setLayoutData(fdlOnlyComment);
    wOnlyComment = new Button(wMessageSettingsGroup, SWT.CHECK);
    props.setLook(wOnlyComment);
    fdOnlyComment = new FormData();
    fdOnlyComment.left = new FormAttachment(middle, -margin);
    fdOnlyComment.top = new FormAttachment(wAddDate, margin);
    fdOnlyComment.right = new FormAttachment(100, 0);
    wOnlyComment.setLayoutData(fdOnlyComment);
    wOnlyComment.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // HTML format ?
    wlUseHTML = new Label(wMessageSettingsGroup, SWT.RIGHT);
    wlUseHTML.setText(BaseMessages.getString(PKG, "Mail.UseHTMLInBody.Label"));
    props.setLook(wlUseHTML);
    fdlUseHTML = new FormData();
    fdlUseHTML.left = new FormAttachment(0, 0);
    fdlUseHTML.top = new FormAttachment(wOnlyComment, margin);
    fdlUseHTML.right = new FormAttachment(middle, -2 * margin);
    wlUseHTML.setLayoutData(fdlUseHTML);
    wUseHTML = new Button(wMessageSettingsGroup, SWT.CHECK);
    props.setLook(wUseHTML);
    fdUseHTML = new FormData();
    fdUseHTML.left = new FormAttachment(middle, -margin);
    fdUseHTML.top = new FormAttachment(wOnlyComment, margin);
    fdUseHTML.right = new FormAttachment(100, 0);
    wUseHTML.setLayoutData(fdUseHTML);
    wUseHTML.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            SetEnabledEncoding();
            input.setChanged();
        }
    });
    // Encoding
    wlEncoding = new Label(wMessageSettingsGroup, SWT.RIGHT);
    wlEncoding.setText(BaseMessages.getString(PKG, "Mail.Encoding.Label"));
    props.setLook(wlEncoding);
    fdlEncoding = new FormData();
    fdlEncoding.left = new FormAttachment(0, 0);
    fdlEncoding.top = new FormAttachment(wUseHTML, margin);
    fdlEncoding.right = new FormAttachment(middle, -2 * margin);
    wlEncoding.setLayoutData(fdlEncoding);
    wEncoding = new CCombo(wMessageSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
    wEncoding.setEditable(true);
    props.setLook(wEncoding);
    wEncoding.addModifyListener(lsMod);
    fdEncoding = new FormData();
    fdEncoding.left = new FormAttachment(middle, -margin);
    fdEncoding.top = new FormAttachment(wUseHTML, margin);
    fdEncoding.right = new FormAttachment(100, 0);
    wEncoding.setLayoutData(fdEncoding);
    wEncoding.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            setEncodings();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Use Priority ?
    wlUsePriority = new Label(wMessageSettingsGroup, SWT.RIGHT);
    wlUsePriority.setText(BaseMessages.getString(PKG, "Mail.UsePriority.Label"));
    props.setLook(wlUsePriority);
    fdlPriority = new FormData();
    fdlPriority.left = new FormAttachment(0, 0);
    fdlPriority.top = new FormAttachment(wEncoding, margin);
    fdlPriority.right = new FormAttachment(middle, -2 * margin);
    wlUsePriority.setLayoutData(fdlPriority);
    wUsePriority = new Button(wMessageSettingsGroup, SWT.CHECK);
    wUsePriority.setToolTipText(BaseMessages.getString(PKG, "Mail.UsePriority.Tooltip"));
    props.setLook(wUsePriority);
    fdUsePriority = new FormData();
    fdUsePriority.left = new FormAttachment(middle, -margin);
    fdUsePriority.top = new FormAttachment(wEncoding, margin);
    fdUsePriority.right = new FormAttachment(100, 0);
    wUsePriority.setLayoutData(fdUsePriority);
    wUsePriority.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeUsePriority();
            input.setChanged();
        }
    });
    SelectionAdapter selChanged = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    };
    // Priority
    wlPriority = new Label(wMessageSettingsGroup, SWT.RIGHT);
    wlPriority.setText(BaseMessages.getString(PKG, "Mail.Priority.Label"));
    props.setLook(wlPriority);
    fdlPriority = new FormData();
    fdlPriority.left = new FormAttachment(0, 0);
    fdlPriority.right = new FormAttachment(middle, -2 * margin);
    fdlPriority.top = new FormAttachment(wUsePriority, margin);
    wlPriority.setLayoutData(fdlPriority);
    wPriority = new CCombo(wMessageSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wPriority.add(BaseMessages.getString(PKG, "Mail.Priority.Low.Label"));
    wPriority.add(BaseMessages.getString(PKG, "Mail.Priority.Normal.Label"));
    wPriority.add(BaseMessages.getString(PKG, "Mail.Priority.High.Label"));
    // +1: starts at -1
    wPriority.select(1);
    wPriority.addSelectionListener(selChanged);
    props.setLook(wPriority);
    fdPriority = new FormData();
    fdPriority.left = new FormAttachment(middle, -margin);
    fdPriority.top = new FormAttachment(wUsePriority, margin);
    fdPriority.right = new FormAttachment(100, 0);
    wPriority.setLayoutData(fdPriority);
    // Importance
    wlImportance = new Label(wMessageSettingsGroup, SWT.RIGHT);
    wlImportance.setText(BaseMessages.getString(PKG, "Mail.Importance.Label"));
    props.setLook(wlImportance);
    fdlImportance = new FormData();
    fdlImportance.left = new FormAttachment(0, 0);
    fdlImportance.right = new FormAttachment(middle, -2 * margin);
    fdlImportance.top = new FormAttachment(wPriority, margin);
    wlImportance.setLayoutData(fdlImportance);
    wImportance = new CCombo(wMessageSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wImportance.add(BaseMessages.getString(PKG, "Mail.Priority.Low.Label"));
    wImportance.add(BaseMessages.getString(PKG, "Mail.Priority.Normal.Label"));
    wImportance.add(BaseMessages.getString(PKG, "Mail.Priority.High.Label"));
    // +1: starts at -1
    wImportance.select(1);
    wImportance.addSelectionListener(selChanged);
    props.setLook(wImportance);
    fdImportance = new FormData();
    fdImportance.left = new FormAttachment(middle, -margin);
    fdImportance.top = new FormAttachment(wPriority, margin);
    fdImportance.right = new FormAttachment(100, 0);
    wImportance.setLayoutData(fdImportance);
    // Sensitivity
    wlSensitivity = new Label(wMessageSettingsGroup, SWT.RIGHT);
    wlSensitivity.setText(BaseMessages.getString(PKG, "Mail.Sensitivity.Label"));
    props.setLook(wlSensitivity);
    fdlSensitivity = new FormData();
    fdlSensitivity.left = new FormAttachment(0, 0);
    fdlSensitivity.right = new FormAttachment(middle, -2 * margin);
    fdlSensitivity.top = new FormAttachment(wImportance, margin);
    wlSensitivity.setLayoutData(fdlSensitivity);
    wSensitivity = new CCombo(wMessageSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wSensitivity.add(BaseMessages.getString(PKG, "Mail.Sensitivity.normal.Label"));
    wSensitivity.add(BaseMessages.getString(PKG, "Mail.Sensitivity.personal.Label"));
    wSensitivity.add(BaseMessages.getString(PKG, "Mail.Sensitivity.private.Label"));
    wSensitivity.add(BaseMessages.getString(PKG, "Mail.Sensitivity.confidential.Label"));
    wSensitivity.select(0);
    wSensitivity.addSelectionListener(selChanged);
    props.setLook(wSensitivity);
    fdSensitivity = new FormData();
    fdSensitivity.left = new FormAttachment(middle, -margin);
    fdSensitivity.top = new FormAttachment(wImportance, margin);
    fdSensitivity.right = new FormAttachment(100, 0);
    wSensitivity.setLayoutData(fdSensitivity);
    FormData fdMessageSettingsGroup = new FormData();
    fdMessageSettingsGroup.left = new FormAttachment(0, margin);
    fdMessageSettingsGroup.top = new FormAttachment(wName, margin);
    fdMessageSettingsGroup.right = new FormAttachment(100, -margin);
    wMessageSettingsGroup.setLayoutData(fdMessageSettingsGroup);
    // //////////////////////////////////////
    // / END OF MESSAGE SETTINGS GROUP
    // ///////////////////////////////////////
    // ////////////////////////////////////
    // START OF MESSAGE GROUP
    // ////////////////////////////////////
    wMessageGroup = new Group(wMessageComp, SWT.SHADOW_NONE);
    props.setLook(wMessageGroup);
    wMessageGroup.setText(BaseMessages.getString(PKG, "Mail.Group.Message.Label"));
    FormLayout messagegroupLayout = new FormLayout();
    messagegroupLayout.marginWidth = 10;
    messagegroupLayout.marginHeight = 10;
    wMessageGroup.setLayout(messagegroupLayout);
    // Subject line
    wlSubject = new Label(wMessageGroup, SWT.RIGHT);
    wlSubject.setText(BaseMessages.getString(PKG, "Mail.Subject.Label"));
    props.setLook(wlSubject);
    fdlSubject = new FormData();
    fdlSubject.left = new FormAttachment(0, -margin);
    fdlSubject.top = new FormAttachment(wMessageSettingsGroup, margin);
    fdlSubject.right = new FormAttachment(middle, -2 * margin);
    wlSubject.setLayoutData(fdlSubject);
    wSubject = new CCombo(wMessageGroup, SWT.BORDER | SWT.READ_ONLY);
    wSubject.setEditable(true);
    props.setLook(wSubject);
    wSubject.addModifyListener(lsMod);
    fdSubject = new FormData();
    fdSubject.left = new FormAttachment(middle, -margin);
    fdSubject.top = new FormAttachment(wMessageSettingsGroup, margin);
    fdSubject.right = new FormAttachment(100, -margin);
    wSubject.setLayoutData(fdSubject);
    wSubject.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Comment line
    wlComment = new Label(wMessageGroup, SWT.RIGHT);
    wlComment.setText(BaseMessages.getString(PKG, "Mail.Comment.Label"));
    props.setLook(wlComment);
    fdlComment = new FormData();
    fdlComment.left = new FormAttachment(0, -margin);
    fdlComment.top = new FormAttachment(wSubject, margin);
    fdlComment.right = new FormAttachment(middle, -2 * margin);
    wlComment.setLayoutData(fdlComment);
    wComment = new CCombo(wMessageGroup, SWT.BORDER | SWT.READ_ONLY);
    wComment.setEditable(true);
    props.setLook(wComment);
    wComment.addModifyListener(lsMod);
    fdComment = new FormData();
    fdComment.left = new FormAttachment(middle, -margin);
    fdComment.top = new FormAttachment(wSubject, margin);
    fdComment.right = new FormAttachment(100, -margin);
    wComment.setLayoutData(fdComment);
    wComment.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    FormData fdMessageGroup = new FormData();
    fdMessageGroup.left = new FormAttachment(0, margin);
    fdMessageGroup.top = new FormAttachment(wMessageSettingsGroup, margin);
    fdMessageGroup.bottom = new FormAttachment(100, -margin);
    fdMessageGroup.right = new FormAttachment(100, -margin);
    wMessageGroup.setLayoutData(fdMessageGroup);
    // //////////////////////////////////////
    // / END OF MESSAGE GROUP
    // ///////////////////////////////////////
    fdMessageComp = new FormData();
    fdMessageComp.left = new FormAttachment(0, 0);
    fdMessageComp.top = new FormAttachment(0, 0);
    fdMessageComp.right = new FormAttachment(100, 0);
    fdMessageComp.bottom = new FormAttachment(100, 0);
    wMessageComp.setLayoutData(wMessageComp);
    wMessageComp.layout();
    wMessageTab.setControl(wMessageComp);
    // ///////////////////////////////////////////////////////////
    // / END OF MESSAGE TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////////////////
    // START OF ATTACHED FILES TAB ///
    // ///////////////////////////////////
    wAttachedTab = new CTabItem(wTabFolder, SWT.NONE);
    wAttachedTab.setText(BaseMessages.getString(PKG, "Mail.Tab.AttachedFiles.Label"));
    FormLayout attachedLayout = new FormLayout();
    attachedLayout.marginWidth = 3;
    attachedLayout.marginHeight = 3;
    wAttachedComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wAttachedComp);
    wAttachedComp.setLayout(attachedLayout);
    // ///////////////////////////////
    // START OF Attached files GROUP //
    // ///////////////////////////////
    wAttachedContent = new Group(wAttachedComp, SWT.SHADOW_NONE);
    props.setLook(wAttachedContent);
    wAttachedContent.setText(BaseMessages.getString(PKG, "MailDialog.AttachedContent.Label"));
    FormLayout AttachedContentgroupLayout = new FormLayout();
    AttachedContentgroupLayout.marginWidth = 10;
    AttachedContentgroupLayout.marginHeight = 10;
    wAttachedContent.setLayout(AttachedContentgroupLayout);
    // Is Filename defined in a Field
    wlisattachContentField = new Label(wAttachedContent, SWT.RIGHT);
    wlisattachContentField.setText(BaseMessages.getString(PKG, "MailDialog.isattachContentField.Label"));
    props.setLook(wlisattachContentField);
    FormData fdlisattachContentField = new FormData();
    fdlisattachContentField.left = new FormAttachment(0, -margin);
    fdlisattachContentField.top = new FormAttachment(0, margin);
    fdlisattachContentField.right = new FormAttachment(middle, -2 * margin);
    wlisattachContentField.setLayoutData(fdlisattachContentField);
    wisattachContentField = new Button(wAttachedContent, SWT.CHECK);
    props.setLook(wisattachContentField);
    wisattachContentField.setToolTipText(BaseMessages.getString(PKG, "MailDialog.isattachContentField.Tooltip"));
    FormData fdisattachContentField = new FormData();
    fdisattachContentField.left = new FormAttachment(middle, -margin);
    fdisattachContentField.top = new FormAttachment(0, margin);
    wisattachContentField.setLayoutData(fdisattachContentField);
    SelectionAdapter lisattachContentField = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            activeISAttachContentField();
            input.setChanged();
        }
    };
    wisattachContentField.addSelectionListener(lisattachContentField);
    // attache file content field
    wlattachContentField = new Label(wAttachedContent, SWT.RIGHT);
    wlattachContentField.setText(BaseMessages.getString(PKG, "MailDialog.attachContentField.Label"));
    props.setLook(wlattachContentField);
    FormData fdlattachContentField = new FormData();
    fdlattachContentField.left = new FormAttachment(0, -margin);
    fdlattachContentField.top = new FormAttachment(wisattachContentField, margin);
    fdlattachContentField.right = new FormAttachment(middle, -2 * margin);
    wlattachContentField.setLayoutData(fdlattachContentField);
    wattachContentField = new CCombo(wAttachedContent, SWT.BORDER | SWT.READ_ONLY);
    wattachContentField.setEditable(true);
    props.setLook(wattachContentField);
    wattachContentField.addModifyListener(lsMod);
    FormData fdattachContentField = new FormData();
    fdattachContentField.left = new FormAttachment(middle, -margin);
    fdattachContentField.top = new FormAttachment(wisattachContentField, margin);
    fdattachContentField.right = new FormAttachment(100, -margin);
    wattachContentField.setLayoutData(fdattachContentField);
    wattachContentField.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // attached content filename field
    wlattachContentFileNameField = new Label(wAttachedContent, SWT.RIGHT);
    wlattachContentFileNameField.setText(BaseMessages.getString(PKG, "MailDialog.attachContentFileNameField.Label"));
    props.setLook(wlattachContentFileNameField);
    FormData fdlattachContentFileNameField = new FormData();
    fdlattachContentFileNameField.left = new FormAttachment(0, -margin);
    fdlattachContentFileNameField.top = new FormAttachment(wattachContentField, margin);
    fdlattachContentFileNameField.right = new FormAttachment(middle, -2 * margin);
    wlattachContentFileNameField.setLayoutData(fdlattachContentFileNameField);
    wattachContentFileNameField = new CCombo(wAttachedContent, SWT.BORDER | SWT.READ_ONLY);
    wattachContentFileNameField.setEditable(true);
    props.setLook(wattachContentFileNameField);
    wattachContentFileNameField.addModifyListener(lsMod);
    FormData fdattachContentFileNameField = new FormData();
    fdattachContentFileNameField.left = new FormAttachment(middle, -margin);
    fdattachContentFileNameField.top = new FormAttachment(wattachContentField, margin);
    fdattachContentFileNameField.right = new FormAttachment(100, -margin);
    wattachContentFileNameField.setLayoutData(fdattachContentFileNameField);
    wattachContentFileNameField.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    FormData fdAttachedContent = new FormData();
    fdAttachedContent.left = new FormAttachment(0, margin);
    fdAttachedContent.top = new FormAttachment(0, 2 * margin);
    fdAttachedContent.right = new FormAttachment(100, -margin);
    wAttachedContent.setLayoutData(fdAttachedContent);
    // ///////////////////////////////////////////////////////////
    // / END OF Attached files GROUP
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////
    // START OF Origin files GROUP //
    // ///////////////////////////////
    wOriginFiles = new Group(wAttachedComp, SWT.SHADOW_NONE);
    props.setLook(wOriginFiles);
    wOriginFiles.setText(BaseMessages.getString(PKG, "MailDialog.OriginAttachedFiles.Label"));
    FormLayout OriginFilesgroupLayout = new FormLayout();
    OriginFilesgroupLayout.marginWidth = 10;
    OriginFilesgroupLayout.marginHeight = 10;
    wOriginFiles.setLayout(OriginFilesgroupLayout);
    // Is Filename defined in a Field
    wlisFileDynamic = new Label(wOriginFiles, SWT.RIGHT);
    wlisFileDynamic.setText(BaseMessages.getString(PKG, "MailDialog.isFileDynamic.Label"));
    props.setLook(wlisFileDynamic);
    FormData fdlisFileDynamic = new FormData();
    fdlisFileDynamic.left = new FormAttachment(0, -margin);
    fdlisFileDynamic.top = new FormAttachment(wAttachedContent, margin);
    fdlisFileDynamic.right = new FormAttachment(middle, -2 * margin);
    wlisFileDynamic.setLayoutData(fdlisFileDynamic);
    wisFileDynamic = new Button(wOriginFiles, SWT.CHECK);
    props.setLook(wisFileDynamic);
    wisFileDynamic.setToolTipText(BaseMessages.getString(PKG, "MailDialog.isFileDynamic.Tooltip"));
    FormData fdisFileDynamic = new FormData();
    fdisFileDynamic.left = new FormAttachment(middle, -margin);
    fdisFileDynamic.top = new FormAttachment(wAttachedContent, margin);
    wisFileDynamic.setLayoutData(fdisFileDynamic);
    SelectionAdapter lisFileDynamic = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            ActiveisFileDynamic();
            input.setChanged();
        }
    };
    wisFileDynamic.addSelectionListener(lisFileDynamic);
    // Filename field
    wlDynamicFilenameField = new Label(wOriginFiles, SWT.RIGHT);
    wlDynamicFilenameField.setText(BaseMessages.getString(PKG, "MailDialog.DynamicFilenameField.Label"));
    props.setLook(wlDynamicFilenameField);
    FormData fdlFilenameField = new FormData();
    fdlFilenameField.left = new FormAttachment(0, -margin);
    fdlFilenameField.top = new FormAttachment(wisFileDynamic, margin);
    fdlFilenameField.right = new FormAttachment(middle, -2 * margin);
    wlDynamicFilenameField.setLayoutData(fdlFilenameField);
    wDynamicFilenameField = new CCombo(wOriginFiles, SWT.BORDER | SWT.READ_ONLY);
    wDynamicFilenameField.setEditable(true);
    props.setLook(wDynamicFilenameField);
    wDynamicFilenameField.addModifyListener(lsMod);
    FormData fdFilenameField = new FormData();
    fdFilenameField.left = new FormAttachment(middle, -margin);
    fdFilenameField.top = new FormAttachment(wisFileDynamic, margin);
    fdFilenameField.right = new FormAttachment(100, -margin);
    wDynamicFilenameField.setLayoutData(fdFilenameField);
    wDynamicFilenameField.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Wildcard field
    wlDynamicWildcardField = new Label(wOriginFiles, SWT.RIGHT);
    wlDynamicWildcardField.setText(BaseMessages.getString(PKG, "MailDialog.DynamicWildcardField.Label"));
    props.setLook(wlDynamicWildcardField);
    FormData fdlDynamicWildcardField = new FormData();
    fdlDynamicWildcardField.left = new FormAttachment(0, -margin);
    fdlDynamicWildcardField.top = new FormAttachment(wDynamicFilenameField, margin);
    fdlDynamicWildcardField.right = new FormAttachment(middle, -2 * margin);
    wlDynamicWildcardField.setLayoutData(fdlDynamicWildcardField);
    wDynamicWildcardField = new CCombo(wOriginFiles, SWT.BORDER | SWT.READ_ONLY);
    wDynamicWildcardField.setEditable(true);
    props.setLook(wDynamicWildcardField);
    wDynamicWildcardField.addModifyListener(lsMod);
    FormData fdDynamicWildcardField = new FormData();
    fdDynamicWildcardField.left = new FormAttachment(middle, -margin);
    fdDynamicWildcardField.top = new FormAttachment(wDynamicFilenameField, margin);
    fdDynamicWildcardField.right = new FormAttachment(100, -margin);
    wDynamicWildcardField.setLayoutData(fdDynamicWildcardField);
    wDynamicWildcardField.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // FileFoldername line
    wlSourceFileFoldername = new Label(wOriginFiles, SWT.RIGHT);
    wlSourceFileFoldername.setText(BaseMessages.getString(PKG, "MailDialog.FileFoldername.Label"));
    props.setLook(wlSourceFileFoldername);
    fdlSourceFileFoldername = new FormData();
    fdlSourceFileFoldername.left = new FormAttachment(0, 0);
    fdlSourceFileFoldername.top = new FormAttachment(wDynamicWildcardField, 2 * margin);
    fdlSourceFileFoldername.right = new FormAttachment(middle, -margin);
    wlSourceFileFoldername.setLayoutData(fdlSourceFileFoldername);
    // Browse Destination folders button ...
    wbSourceFolder = new Button(wOriginFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbSourceFolder);
    wbSourceFolder.setText(BaseMessages.getString(PKG, "MailDialog.BrowseFolders.Label"));
    fdbSourceFolder = new FormData();
    fdbSourceFolder.right = new FormAttachment(100, 0);
    fdbSourceFolder.top = new FormAttachment(wDynamicWildcardField, 2 * margin);
    wbSourceFolder.setLayoutData(fdbSourceFolder);
    wbSourceFolder.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wSourceFileFoldername.getText() != null) {
                ddialog.setFilterPath(transMeta.environmentSubstitute(wSourceFileFoldername.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
                wSourceFileFoldername.setText(dir);
            }
        }
    });
    // Browse source file button ...
    wbFileFoldername = new Button(wOriginFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbFileFoldername);
    wbFileFoldername.setText(BaseMessages.getString(PKG, "MailDialog.BrowseFiles.Label"));
    fdbSourceFileFoldername = new FormData();
    fdbSourceFileFoldername.right = new FormAttachment(wbSourceFolder, -margin);
    fdbSourceFileFoldername.top = new FormAttachment(wDynamicWildcardField, 2 * margin);
    wbFileFoldername.setLayoutData(fdbSourceFileFoldername);
    wSourceFileFoldername = new TextVar(transMeta, wOriginFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSourceFileFoldername);
    wSourceFileFoldername.addModifyListener(lsMod);
    fdSourceFileFoldername = new FormData();
    fdSourceFileFoldername.left = new FormAttachment(middle, 0);
    fdSourceFileFoldername.top = new FormAttachment(wDynamicWildcardField, 2 * margin);
    fdSourceFileFoldername.right = new FormAttachment(wbFileFoldername, -margin);
    wSourceFileFoldername.setLayoutData(fdSourceFileFoldername);
    // Whenever something changes, set the tooltip to the expanded version:
    wSourceFileFoldername.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            wSourceFileFoldername.setToolTipText(transMeta.environmentSubstitute(wSourceFileFoldername.getText()));
        }
    });
    wbFileFoldername.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*" });
            if (wSourceFileFoldername.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wSourceFileFoldername.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
                wSourceFileFoldername.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
        }
    });
    // Include sub folders
    wlincludeSubFolders = new Label(wOriginFiles, SWT.RIGHT);
    wlincludeSubFolders.setText(BaseMessages.getString(PKG, "MailDialog.includeSubFolders.Label"));
    props.setLook(wlincludeSubFolders);
    fdlincludeSubFolders = new FormData();
    fdlincludeSubFolders.left = new FormAttachment(0, 0);
    fdlincludeSubFolders.top = new FormAttachment(wSourceFileFoldername, margin);
    fdlincludeSubFolders.right = new FormAttachment(middle, -margin);
    wlincludeSubFolders.setLayoutData(fdlincludeSubFolders);
    wincludeSubFolders = new Button(wOriginFiles, SWT.CHECK);
    props.setLook(wincludeSubFolders);
    wincludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "MailDialog.includeSubFolders.Tooltip"));
    fdincludeSubFolders = new FormData();
    fdincludeSubFolders.left = new FormAttachment(middle, 0);
    fdincludeSubFolders.top = new FormAttachment(wSourceFileFoldername, margin);
    fdincludeSubFolders.right = new FormAttachment(100, 0);
    wincludeSubFolders.setLayoutData(fdincludeSubFolders);
    wincludeSubFolders.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Wildcard
    wlWildcard = new Label(wOriginFiles, SWT.RIGHT);
    wlWildcard.setText(BaseMessages.getString(PKG, "MailDialog.Wildcard.Label"));
    props.setLook(wlWildcard);
    fdlWildcard = new FormData();
    fdlWildcard.left = new FormAttachment(0, 0);
    fdlWildcard.top = new FormAttachment(wincludeSubFolders, margin);
    fdlWildcard.right = new FormAttachment(middle, -margin);
    wlWildcard.setLayoutData(fdlWildcard);
    wWildcard = new TextVar(transMeta, wOriginFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wWildcard);
    wWildcard.setToolTipText(BaseMessages.getString(PKG, "MailDialog.Wildcard.Tooltip"));
    wWildcard.addModifyListener(lsMod);
    fdWildcard = new FormData();
    fdWildcard.left = new FormAttachment(middle, 0);
    fdWildcard.top = new FormAttachment(wincludeSubFolders, margin);
    fdWildcard.right = new FormAttachment(wbFileFoldername, -margin);
    wWildcard.setLayoutData(fdWildcard);
    // Whenever something changes, set the tooltip to the expanded version:
    wWildcard.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            wWildcard.setToolTipText(transMeta.environmentSubstitute(wWildcard.getText()));
        }
    });
    FormData fdOriginFiles = new FormData();
    fdOriginFiles.left = new FormAttachment(0, margin);
    fdOriginFiles.top = new FormAttachment(wAttachedContent, 2 * margin);
    fdOriginFiles.right = new FormAttachment(100, -margin);
    wOriginFiles.setLayoutData(fdOriginFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Origin files GROUP
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////
    // START OF Zip Group files GROUP //
    // ///////////////////////////////
    wZipGroup = new Group(wAttachedComp, SWT.SHADOW_NONE);
    props.setLook(wZipGroup);
    wZipGroup.setText(BaseMessages.getString(PKG, "MailDialog.ZipGroup.Label"));
    FormLayout ZipGroupgroupLayout = new FormLayout();
    ZipGroupgroupLayout.marginWidth = 10;
    ZipGroupgroupLayout.marginHeight = 10;
    wZipGroup.setLayout(ZipGroupgroupLayout);
    // Zip Files?
    wlZipFiles = new Label(wZipGroup, SWT.RIGHT);
    wlZipFiles.setText(BaseMessages.getString(PKG, "MailDialog.ZipFiles.Label"));
    props.setLook(wlZipFiles);
    fdlZipFiles = new FormData();
    fdlZipFiles.left = new FormAttachment(0, -margin);
    fdlZipFiles.top = new FormAttachment(wOriginFiles, margin);
    fdlZipFiles.right = new FormAttachment(middle, -2 * margin);
    wlZipFiles.setLayoutData(fdlZipFiles);
    wZipFiles = new Button(wZipGroup, SWT.CHECK);
    props.setLook(wZipFiles);
    fdZipFiles = new FormData();
    fdZipFiles.left = new FormAttachment(middle, -margin);
    fdZipFiles.top = new FormAttachment(wOriginFiles, margin);
    fdZipFiles.right = new FormAttachment(100, -margin);
    wZipFiles.setLayoutData(fdZipFiles);
    wZipFiles.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            setZip();
        }
    });
    // is zipfilename is dynamic?
    wlisZipFileDynamic = new Label(wZipGroup, SWT.RIGHT);
    wlisZipFileDynamic.setText(BaseMessages.getString(PKG, "MailDialog.isZipFileDynamic.Label"));
    props.setLook(wlisZipFileDynamic);
    fdlisZipFileDynamic = new FormData();
    fdlisZipFileDynamic.left = new FormAttachment(0, -margin);
    fdlisZipFileDynamic.top = new FormAttachment(wZipFiles, margin);
    fdlisZipFileDynamic.right = new FormAttachment(middle, -2 * margin);
    wlisZipFileDynamic.setLayoutData(fdlisZipFileDynamic);
    wisZipFileDynamic = new Button(wZipGroup, SWT.CHECK);
    props.setLook(wisZipFileDynamic);
    fdisZipFileDynamic = new FormData();
    fdisZipFileDynamic.left = new FormAttachment(middle, -margin);
    fdisZipFileDynamic.top = new FormAttachment(wZipFiles, margin);
    fdisZipFileDynamic.right = new FormAttachment(100, -margin);
    wisZipFileDynamic.setLayoutData(fdisZipFileDynamic);
    wisZipFileDynamic.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            setDynamicZip();
        }
    });
    // ZipFile field
    wlDynamicZipFileField = new Label(wZipGroup, SWT.RIGHT);
    wlDynamicZipFileField.setText(BaseMessages.getString(PKG, "MailDialog.DynamicZipFileField.Label"));
    props.setLook(wlDynamicZipFileField);
    fdlDynamicZipFileField = new FormData();
    fdlDynamicZipFileField.left = new FormAttachment(0, -margin);
    fdlDynamicZipFileField.top = new FormAttachment(wisZipFileDynamic, margin);
    fdlDynamicZipFileField.right = new FormAttachment(middle, -2 * margin);
    wlDynamicZipFileField.setLayoutData(fdlDynamicZipFileField);
    wDynamicZipFileField = new CCombo(wZipGroup, SWT.BORDER | SWT.READ_ONLY);
    wDynamicZipFileField.setEditable(true);
    props.setLook(wDynamicZipFileField);
    wDynamicZipFileField.addModifyListener(lsMod);
    fdDynamicZipFileField = new FormData();
    fdDynamicZipFileField.left = new FormAttachment(middle, -margin);
    fdDynamicZipFileField.top = new FormAttachment(wisZipFileDynamic, margin);
    fdDynamicZipFileField.right = new FormAttachment(100, -margin);
    wDynamicZipFileField.setLayoutData(fdDynamicZipFileField);
    wDynamicZipFileField.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            getPreviousFields();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // ZipFilename line
    wZipFilename = new LabelTextVar(transMeta, wZipGroup, BaseMessages.getString(PKG, "MailDialog.ZipFilename.Label"), BaseMessages.getString(PKG, "MailDialog.ZipFilename.Tooltip"));
    wZipFilename.addModifyListener(lsMod);
    fdZipFilename = new FormData();
    fdZipFilename.left = new FormAttachment(0, -margin);
    fdZipFilename.top = new FormAttachment(wDynamicZipFileField, margin);
    fdZipFilename.right = new FormAttachment(100, -4 * margin);
    wZipFilename.setLayoutData(fdZipFilename);
    // Zip files on condition?
    wZipSizeCondition = new LabelTextVar(transMeta, wZipGroup, BaseMessages.getString(PKG, "MailDialog.ZipSizeCondition.Label"), BaseMessages.getString(PKG, "MailDialog.ZipSizeCondition.Tooltip"));
    wZipSizeCondition.addModifyListener(lsMod);
    fdZipSizeCondition = new FormData();
    fdZipSizeCondition.left = new FormAttachment(0, -margin);
    fdZipSizeCondition.top = new FormAttachment(wZipFilename, margin);
    fdZipSizeCondition.right = new FormAttachment(100, -4 * margin);
    wZipSizeCondition.setLayoutData(fdZipSizeCondition);
    FormData fdZipGroup = new FormData();
    fdZipGroup.left = new FormAttachment(0, margin);
    fdZipGroup.top = new FormAttachment(wOriginFiles, margin);
    fdZipGroup.right = new FormAttachment(100, -margin);
    wZipGroup.setLayoutData(fdZipGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Zip Group GROUP
    // ///////////////////////////////////////////////////////////
    fdAttachedComp = new FormData();
    fdAttachedComp.left = new FormAttachment(0, 0);
    fdAttachedComp.top = new FormAttachment(0, 0);
    fdAttachedComp.right = new FormAttachment(100, 0);
    fdAttachedComp.bottom = new FormAttachment(100, 0);
    wAttachedComp.setLayoutData(wAttachedComp);
    wAttachedComp.layout();
    wAttachedTab.setControl(wAttachedComp);
    // ///////////////////////////////////////////////////////////
    // / END OF FILES TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////////////////
    // START OF embedded images TAB ///
    // ///////////////////////////////////
    wembeddedTab = new CTabItem(wTabFolder, SWT.NONE);
    wembeddedTab.setText(BaseMessages.getString(PKG, "Mail.Tab.embeddedImages.Label"));
    FormLayout embeddedLayout = new FormLayout();
    embeddedLayout.marginWidth = 3;
    embeddedLayout.marginHeight = 3;
    wembeddedComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wembeddedComp);
    wembeddedComp.setLayout(embeddedLayout);
    // ImageFilename line
    wlImageFilename = new Label(wembeddedComp, SWT.RIGHT);
    wlImageFilename.setText(BaseMessages.getString(PKG, "MailDialog.ImageFilename.Label"));
    props.setLook(wlImageFilename);
    FormData fdlImageFilename = new FormData();
    fdlImageFilename.left = new FormAttachment(0, 0);
    fdlImageFilename.top = new FormAttachment(wStepname, margin);
    fdlImageFilename.right = new FormAttachment(middle, -margin);
    wlImageFilename.setLayoutData(fdlImageFilename);
    wbImageFilename = new Button(wembeddedComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbImageFilename);
    wbImageFilename.setText(BaseMessages.getString(PKG, "MailDialog.BrowseFiles.Label"));
    wbImageFilename.setToolTipText(BaseMessages.getString(PKG, "MailDialog.BrowseFiles.Tooltip"));
    FormData fdbImageFilename = new FormData();
    fdbImageFilename.right = new FormAttachment(100, 0);
    fdbImageFilename.top = new FormAttachment(wStepname, margin);
    fdbImageFilename.right = new FormAttachment(100, -margin);
    wbImageFilename.setLayoutData(fdbImageFilename);
    wbaImageFilename = new Button(wembeddedComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbaImageFilename);
    wbaImageFilename.setText(BaseMessages.getString(PKG, "MailDialog.ImageFilenameAdd.Button"));
    wbaImageFilename.setToolTipText(BaseMessages.getString(PKG, "MailDialog.ImageFilenameAdd.Tooltip"));
    FormData fdbaImageFilename = new FormData();
    fdbaImageFilename.right = new FormAttachment(wbImageFilename, -margin);
    fdbaImageFilename.top = new FormAttachment(wStepname, margin);
    wbaImageFilename.setLayoutData(fdbaImageFilename);
    wImageFilename = new TextVar(transMeta, wembeddedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wImageFilename);
    wImageFilename.addModifyListener(lsMod);
    FormData fdImageFilename = new FormData();
    fdImageFilename.left = new FormAttachment(middle, 0);
    fdImageFilename.top = new FormAttachment(wStepname, margin);
    fdImageFilename.right = new FormAttachment(wbaImageFilename, -margin);
    wImageFilename.setLayoutData(fdImageFilename);
    // Whenever something changes, set the tooltip to the expanded version:
    wImageFilename.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            wImageFilename.setToolTipText(transMeta.environmentSubstitute(wImageFilename.getText()));
        }
    });
    wbImageFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*png;*PNG", "*jpeg;*jpg;*JPEG;*JPG", "*gif;*GIF", "*" });
            if (wImageFilename.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wImageFilename.getText()));
            }
            dialog.setFilterNames(IMAGES_FILE_TYPES);
            if (dialog.open() != null) {
                wImageFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
                Random randomgen = new Random();
                wContentID.setText(Long.toString(Math.abs(randomgen.nextLong()), 32));
            }
        }
    });
    // ContentID
    wlContentID = new Label(wembeddedComp, SWT.RIGHT);
    wlContentID.setText(BaseMessages.getString(PKG, "MailDialog.ContentID.Label"));
    props.setLook(wlContentID);
    FormData fdlContentID = new FormData();
    fdlContentID.left = new FormAttachment(0, 0);
    fdlContentID.top = new FormAttachment(wImageFilename, margin);
    fdlContentID.right = new FormAttachment(middle, -margin);
    wlContentID.setLayoutData(fdlContentID);
    wContentID = new TextVar(transMeta, wembeddedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "MailDialog.ContentID.Tooltip"));
    props.setLook(wContentID);
    wContentID.addModifyListener(lsMod);
    FormData fdContentID = new FormData();
    fdContentID.left = new FormAttachment(middle, 0);
    fdContentID.top = new FormAttachment(wImageFilename, margin);
    fdContentID.right = new FormAttachment(wbaImageFilename, -margin);
    wContentID.setLayoutData(fdContentID);
    // Buttons to the right of the screen...
    wbdImageFilename = new Button(wembeddedComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbdImageFilename);
    wbdImageFilename.setText(BaseMessages.getString(PKG, "MailDialog.ImageFilenameDelete.Button"));
    wbdImageFilename.setToolTipText(BaseMessages.getString(PKG, "MailDialog.ImageFilenameDelete.Tooltip"));
    FormData fdbdImageFilename = new FormData();
    fdbdImageFilename.right = new FormAttachment(100, 0);
    fdbdImageFilename.top = new FormAttachment(wContentID, 40);
    wbdImageFilename.setLayoutData(fdbdImageFilename);
    wbeImageFilename = new Button(wembeddedComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbeImageFilename);
    wbeImageFilename.setText(BaseMessages.getString(PKG, "MailDialog.ImageFilenameEdit.Button"));
    wbeImageFilename.setToolTipText(BaseMessages.getString(PKG, "MailDialog.ImageFilenameEdit.Tooltip"));
    FormData fdbeImageFilename = new FormData();
    fdbeImageFilename.right = new FormAttachment(100, 0);
    fdbeImageFilename.left = new FormAttachment(wbdImageFilename, 0, SWT.LEFT);
    fdbeImageFilename.top = new FormAttachment(wbdImageFilename, margin);
    wbeImageFilename.setLayoutData(fdbeImageFilename);
    wlFields = new Label(wembeddedComp, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "MailDialog.Fields.Label"));
    props.setLook(wlFields);
    FormData fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.right = new FormAttachment(middle, -margin);
    fdlFields.top = new FormAttachment(wContentID, margin);
    wlFields.setLayoutData(fdlFields);
    int rows = input.getEmbeddedImages() == null ? 1 : (input.getEmbeddedImages().length == 0 ? 0 : input.getEmbeddedImages().length);
    final int FieldsRows = rows;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "MailDialog.Fields.Image.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "MailDialog.Fields.ContentID.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
    colinf[0].setUsingVariables(true);
    colinf[0].setToolTip(BaseMessages.getString(PKG, "MailDialog.Fields.Image.Tooltip"));
    colinf[1].setUsingVariables(true);
    colinf[1].setToolTip(BaseMessages.getString(PKG, "MailDialog.Fields.ContentID.Tooltip"));
    wFields = new TableView(transMeta, wembeddedComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    FormData fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(wlFields, margin);
    fdFields.right = new FormAttachment(wbeImageFilename, -margin);
    fdFields.bottom = new FormAttachment(100, -margin);
    wFields.setLayoutData(fdFields);
    // Add the file to the list of files...
    SelectionAdapter selA = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            wFields.add(new String[] { wImageFilename.getText(), wContentID.getText() });
            wImageFilename.setText("");
            wContentID.setText("");
            wFields.removeEmptyRows();
            wFields.setRowNums();
            wFields.optWidth(true);
        }
    };
    wbaImageFilename.addSelectionListener(selA);
    wImageFilename.addSelectionListener(selA);
    // Delete files from the list of files...
    wbdImageFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            int[] idx = wFields.getSelectionIndices();
            wFields.remove(idx);
            wFields.removeEmptyRows();
            wFields.setRowNums();
        }
    });
    // Edit the selected file & remove from the list...
    wbeImageFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                String[] string = wFields.getItem(idx);
                wImageFilename.setText(string[0]);
                wContentID.setText(string[1]);
                wFields.remove(idx);
            }
            wFields.removeEmptyRows();
            wFields.setRowNums();
        }
    });
    fdembeddedComp = new FormData();
    fdembeddedComp.left = new FormAttachment(0, 0);
    fdembeddedComp.top = new FormAttachment(0, 0);
    fdembeddedComp.right = new FormAttachment(100, 0);
    fdembeddedComp.bottom = new FormAttachment(100, 0);
    wembeddedComp.setLayoutData(wembeddedComp);
    wembeddedComp.layout();
    wembeddedTab.setControl(wembeddedComp);
    // ///////////////////////////////////////////////////////////
    // / END OF embedded images 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);
    // Some buttons
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsCancel = new Listener() {

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

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

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    // Set the shell size, based upon previous time...
    setSize();
    getData();
    ActiveisFileDynamic();
    SetEnabledEncoding();
    activeUsePriority();
    setDynamicZip();
    setZip();
    setUseAuth();
    activeISAttachContentField();
    input.setChanged(changed);
    wTabFolder.setSelection(0);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) 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) Cursor(org.eclipse.swt.graphics.Cursor) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Random(java.util.Random) 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) LabelText(org.pentaho.di.ui.core.widget.LabelText) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) 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) FocusListener(org.eclipse.swt.events.FocusListener) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Aggregations

SelectionEvent (org.eclipse.swt.events.SelectionEvent)37 FormAttachment (org.eclipse.swt.layout.FormAttachment)37 FormData (org.eclipse.swt.layout.FormData)37 FormLayout (org.eclipse.swt.layout.FormLayout)37 Button (org.eclipse.swt.widgets.Button)37 LabelTextVar (org.pentaho.di.ui.core.widget.LabelTextVar)37 ModifyEvent (org.eclipse.swt.events.ModifyEvent)36 ModifyListener (org.eclipse.swt.events.ModifyListener)36 Event (org.eclipse.swt.widgets.Event)36 Listener (org.eclipse.swt.widgets.Listener)36 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)35 Shell (org.eclipse.swt.widgets.Shell)35 Label (org.eclipse.swt.widgets.Label)34 Display (org.eclipse.swt.widgets.Display)33 ShellEvent (org.eclipse.swt.events.ShellEvent)32 ShellAdapter (org.eclipse.swt.events.ShellAdapter)31 Group (org.eclipse.swt.widgets.Group)30 CTabFolder (org.eclipse.swt.custom.CTabFolder)27 CTabItem (org.eclipse.swt.custom.CTabItem)27 Composite (org.eclipse.swt.widgets.Composite)27