Search in sources :

Example 61 with ColumnInfo

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

the class FixedInputDialog 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, inputMeta);
    ModifyListener lsMod = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            inputMeta.setChanged();
        }
    };
    changed = inputMeta.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "FixedInputDialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Step name line
    // 
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "FixedInputDialog.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);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);
    Control lastControl = wStepname;
    // Filename...
    // 
    // The filename browse button
    // 
    wbbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbbFilename);
    wbbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    wbbFilename.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
    FormData fdbFilename = new FormData();
    fdbFilename.top = new FormAttachment(lastControl, margin);
    fdbFilename.right = new FormAttachment(100, 0);
    wbbFilename.setLayoutData(fdbFilename);
    // The field itself...
    // 
    Label wlFilename = new Label(shell, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "FixedInputDialog.Filename.Label"));
    props.setLook(wlFilename);
    FormData fdlFilename = new FormData();
    fdlFilename.top = new FormAttachment(lastControl, margin);
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wFilename = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    FormData fdFilename = new FormData();
    fdFilename.top = new FormAttachment(lastControl, margin);
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.right = new FormAttachment(wbbFilename, -margin);
    wFilename.setLayoutData(fdFilename);
    lastControl = wFilename;
    // delimiter
    Label wlLineWidth = new Label(shell, SWT.RIGHT);
    wlLineWidth.setText(BaseMessages.getString(PKG, "FixedInputDialog.LineWidth.Label"));
    props.setLook(wlLineWidth);
    FormData fdlLineWidth = new FormData();
    fdlLineWidth.top = new FormAttachment(lastControl, margin);
    fdlLineWidth.left = new FormAttachment(0, 0);
    fdlLineWidth.right = new FormAttachment(middle, -margin);
    wlLineWidth.setLayoutData(fdlLineWidth);
    wLineWidth = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLineWidth);
    wLineWidth.addModifyListener(lsMod);
    FormData fdLineWidth = new FormData();
    fdLineWidth.top = new FormAttachment(lastControl, margin);
    fdLineWidth.left = new FormAttachment(middle, 0);
    fdLineWidth.right = new FormAttachment(100, 0);
    wLineWidth.setLayoutData(fdLineWidth);
    lastControl = wLineWidth;
    // delimiter
    Label wlLineFeedPresent = new Label(shell, SWT.RIGHT);
    wlLineFeedPresent.setText(BaseMessages.getString(PKG, "FixedInputDialog.LineFeedPresent.Label"));
    props.setLook(wlLineFeedPresent);
    FormData fdlLineFeedPresent = new FormData();
    fdlLineFeedPresent.top = new FormAttachment(lastControl, margin);
    fdlLineFeedPresent.left = new FormAttachment(0, 0);
    fdlLineFeedPresent.right = new FormAttachment(middle, -margin);
    wlLineFeedPresent.setLayoutData(fdlLineFeedPresent);
    wLineFeedPresent = new Button(shell, SWT.CHECK);
    props.setLook(wLineFeedPresent);
    FormData fdLineFeedPresent = new FormData();
    fdLineFeedPresent.top = new FormAttachment(lastControl, margin);
    fdLineFeedPresent.left = new FormAttachment(middle, 0);
    fdLineFeedPresent.right = new FormAttachment(100, 0);
    wLineFeedPresent.setLayoutData(fdLineFeedPresent);
    lastControl = wLineFeedPresent;
    // bufferSize
    // 
    Label wlBufferSize = new Label(shell, SWT.RIGHT);
    wlBufferSize.setText(BaseMessages.getString(PKG, "FixedInputDialog.BufferSize.Label"));
    props.setLook(wlBufferSize);
    FormData fdlBufferSize = new FormData();
    fdlBufferSize.top = new FormAttachment(lastControl, margin);
    fdlBufferSize.left = new FormAttachment(0, 0);
    fdlBufferSize.right = new FormAttachment(middle, -margin);
    wlBufferSize.setLayoutData(fdlBufferSize);
    wBufferSize = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wBufferSize);
    wBufferSize.addModifyListener(lsMod);
    FormData fdBufferSize = new FormData();
    fdBufferSize.top = new FormAttachment(lastControl, margin);
    fdBufferSize.left = new FormAttachment(middle, 0);
    fdBufferSize.right = new FormAttachment(100, 0);
    wBufferSize.setLayoutData(fdBufferSize);
    lastControl = wBufferSize;
    // performingLazyConversion?
    // 
    Label wlLazyConversion = new Label(shell, SWT.RIGHT);
    wlLazyConversion.setText(BaseMessages.getString(PKG, "FixedInputDialog.LazyConversion.Label"));
    props.setLook(wlLazyConversion);
    FormData fdlLazyConversion = new FormData();
    fdlLazyConversion.top = new FormAttachment(lastControl, margin);
    fdlLazyConversion.left = new FormAttachment(0, 0);
    fdlLazyConversion.right = new FormAttachment(middle, -margin);
    wlLazyConversion.setLayoutData(fdlLazyConversion);
    wLazyConversion = new Button(shell, SWT.CHECK);
    props.setLook(wLazyConversion);
    FormData fdLazyConversion = new FormData();
    fdLazyConversion.top = new FormAttachment(lastControl, margin);
    fdLazyConversion.left = new FormAttachment(middle, 0);
    fdLazyConversion.right = new FormAttachment(100, 0);
    wLazyConversion.setLayoutData(fdLazyConversion);
    lastControl = wLazyConversion;
    // header row?
    // 
    Label wlHeaderPresent = new Label(shell, SWT.RIGHT);
    wlHeaderPresent.setText(BaseMessages.getString(PKG, "FixedInputDialog.HeaderPresent.Label"));
    props.setLook(wlHeaderPresent);
    FormData fdlHeaderPresent = new FormData();
    fdlHeaderPresent.top = new FormAttachment(lastControl, margin);
    fdlHeaderPresent.left = new FormAttachment(0, 0);
    fdlHeaderPresent.right = new FormAttachment(middle, -margin);
    wlHeaderPresent.setLayoutData(fdlHeaderPresent);
    wHeaderPresent = new Button(shell, SWT.CHECK);
    props.setLook(wHeaderPresent);
    FormData fdHeaderPresent = new FormData();
    fdHeaderPresent.top = new FormAttachment(lastControl, margin);
    fdHeaderPresent.left = new FormAttachment(middle, 0);
    fdHeaderPresent.right = new FormAttachment(100, 0);
    wHeaderPresent.setLayoutData(fdHeaderPresent);
    lastControl = wHeaderPresent;
    // running in parallel?
    // 
    Label wlRunningInParallel = new Label(shell, SWT.RIGHT);
    wlRunningInParallel.setText(BaseMessages.getString(PKG, "FixedInputDialog.RunningInParallel.Label"));
    props.setLook(wlRunningInParallel);
    FormData fdlRunningInParallel = new FormData();
    fdlRunningInParallel.top = new FormAttachment(lastControl, margin);
    fdlRunningInParallel.left = new FormAttachment(0, 0);
    fdlRunningInParallel.right = new FormAttachment(middle, -margin);
    wlRunningInParallel.setLayoutData(fdlRunningInParallel);
    wRunningInParallel = new Button(shell, SWT.CHECK);
    props.setLook(wRunningInParallel);
    FormData fdRunningInParallel = new FormData();
    fdRunningInParallel.top = new FormAttachment(lastControl, margin);
    fdRunningInParallel.left = new FormAttachment(middle, 0);
    wRunningInParallel.setLayoutData(fdRunningInParallel);
    // The file type...
    // 
    wlFileType = new Label(shell, SWT.RIGHT);
    wlFileType.setText(BaseMessages.getString(PKG, "FixedInputDialog.FileType.Label"));
    wlFileType.setToolTipText(BaseMessages.getString(PKG, "FixedInputDialog.FileType.ToolTip"));
    props.setLook(wlFileType);
    FormData fdlFileType = new FormData();
    fdlFileType.top = new FormAttachment(lastControl, margin);
    fdlFileType.left = new FormAttachment(wRunningInParallel, margin * 2);
    wlFileType.setLayoutData(fdlFileType);
    wFileType = new CCombo(shell, SWT.BORDER | SWT.READ_ONLY);
    wFileType.setToolTipText(BaseMessages.getString(PKG, "FixedInputDialog.FileType.ToolTip"));
    props.setLook(wFileType);
    wFileType.setItems(FixedInputMeta.fileTypeDesc);
    FormData fdFileType = new FormData();
    fdFileType.top = new FormAttachment(lastControl, margin);
    fdFileType.left = new FormAttachment(wlFileType, margin);
    fdFileType.right = new FormAttachment(100, 0);
    wFileType.setLayoutData(fdFileType);
    lastControl = wFileType;
    wRunningInParallel.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            enableFields();
        }
    });
    Label wlEncoding = new Label(shell, SWT.RIGHT);
    wlEncoding.setText(BaseMessages.getString(PKG, "FixedInputDialog.Encoding.Label"));
    props.setLook(wlEncoding);
    FormData fdlEncoding = new FormData();
    fdlEncoding.left = new FormAttachment(0, 0);
    fdlEncoding.top = new FormAttachment(lastControl, margin);
    fdlEncoding.right = new FormAttachment(middle, -margin);
    wlEncoding.setLayoutData(fdlEncoding);
    wEncoding = new ComboVar(transMeta, shell, SWT.BORDER | SWT.READ_ONLY);
    wEncoding.setEditable(true);
    props.setLook(wEncoding);
    wEncoding.addModifyListener(lsMod);
    FormData fdEncoding = new FormData();
    fdEncoding.left = new FormAttachment(middle, 0);
    fdEncoding.top = new FormAttachment(lastControl, margin);
    fdEncoding.right = new FormAttachment(100, 0);
    wEncoding.setLayoutData(fdEncoding);
    lastControl = wEncoding;
    wEncoding.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            setEncodings();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    wlAddResult = new Label(shell, SWT.RIGHT);
    wlAddResult.setText(BaseMessages.getString(PKG, "FixedInputDialog.AddResult.Label"));
    props.setLook(wlAddResult);
    fdlAddResult = new FormData();
    fdlAddResult.left = new FormAttachment(0, 0);
    fdlAddResult.top = new FormAttachment(lastControl, margin);
    fdlAddResult.right = new FormAttachment(middle, -margin);
    wlAddResult.setLayoutData(fdlAddResult);
    wAddResult = new Button(shell, SWT.CHECK);
    props.setLook(wAddResult);
    wAddResult.setToolTipText(BaseMessages.getString(PKG, "FixedInputDialog.AddResult.Tooltip"));
    fdAddResult = new FormData();
    fdAddResult.left = new FormAttachment(middle, 0);
    fdAddResult.top = new FormAttachment(lastControl, margin);
    wAddResult.setLayoutData(fdAddResult);
    lastControl = wAddResult;
    // Some buttons first, so that the dialog scales nicely...
    // 
    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, "System.Button.Preview"));
    wGet = new Button(shell, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wGet, wPreview, wCancel }, margin, null);
    // Fields
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_FORMAT, 2), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.WidthColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.LengthColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.PrecisionColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.CurrencyColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.DecimalColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.GroupColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.TrimColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaString.trimTypeDesc) };
    colinf[2].setComboValuesSelectionListener(new ComboValuesSelectionListener() {

        public String[] getComboValues(TableItem tableItem, int rowNr, int colNr) {
            String[] comboValues = new String[] {};
            int type = ValueMetaFactory.getIdForValueMeta(tableItem.getText(colNr - 1));
            switch(type) {
                case ValueMetaInterface.TYPE_DATE:
                    comboValues = Const.getDateFormats();
                    break;
                case ValueMetaInterface.TYPE_INTEGER:
                case ValueMetaInterface.TYPE_BIGNUMBER:
                case ValueMetaInterface.TYPE_NUMBER:
                    comboValues = Const.getNumberFormats();
                    break;
                default:
                    break;
            }
            return comboValues;
        }
    });
    wFields = new TableView(transMeta, shell, SWT.FULL_SELECTION | SWT.MULTI, colinf, 1, lsMod, props);
    FormData fdFields = new FormData();
    fdFields.top = new FormAttachment(lastControl, margin * 2);
    fdFields.bottom = new FormAttachment(wOK, -margin * 2);
    fdFields.left = new FormAttachment(0, 0);
    fdFields.right = new FormAttachment(100, 0);
    wFields.setLayoutData(fdFields);
    // Add listeners
    lsCancel = new Listener() {

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

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

        public void handleEvent(Event e) {
            getFixed();
        }
    };
    lsPreview = new Listener() {

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

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    wFilename.addSelectionListener(lsDef);
    wLineWidth.addSelectionListener(lsDef);
    wBufferSize.addSelectionListener(lsDef);
    // Listen to the browse button next to the file name
    wbbFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.txt", "*" });
            if (wFilename.getText() != null) {
                String fname = transMeta.environmentSubstitute(wFilename.getText());
                dialog.setFileName(fname);
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.TextFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
            if (dialog.open() != null) {
                String str = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
                wFilename.setText(str);
            }
        }
    });
    // 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();
    inputMeta.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : ComboVar(org.pentaho.di.ui.core.widget.ComboVar) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ComboValuesSelectionListener(org.pentaho.di.ui.core.widget.ComboValuesSelectionListener) 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) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) Cursor(org.eclipse.swt.graphics.Cursor) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Control(org.eclipse.swt.widgets.Control) 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) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) ComboValuesSelectionListener(org.pentaho.di.ui.core.widget.ComboValuesSelectionListener) CCombo(org.eclipse.swt.custom.CCombo) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 62 with ColumnInfo

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

the class FormulaDialog method open.

@Override
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, currentMeta);
    ModifyListener lsMod = new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            currentMeta.setChanged();
        }
    };
    changed = currentMeta.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "FormulaDialog.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.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);
    wlFields = new Label(shell, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "FormulaDialog.Fields.Label"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wStepname, margin);
    wlFields.setLayoutData(fdlFields);
    final int FieldsRows = currentMeta.getFormula() != null ? currentMeta.getFormula().length : 1;
    colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "FormulaDialog.NewField.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FormulaDialog.Formula.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FormulaDialog.ValueType.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "FormulaDialog.Length.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FormulaDialog.Precision.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FormulaDialog.Replace.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}) };
    wFields = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(wlFields, margin);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(100, -50);
    wFields.setLayoutData(fdFields);
    // 
    // Search the fields in the background
    // 
    final Runnable runnable = new Runnable() {

        @Override
        public void run() {
            StepMeta stepMeta = transMeta.findStep(stepname);
            if (stepMeta != null) {
                try {
                    RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
                    // Remember these fields...
                    for (int i = 0; i < row.size(); i++) {
                        inputFields.put(row.getValueMeta(i).getName(), new Integer(i));
                    }
                    setComboBoxes();
                } catch (KettleException e) {
                    logError(BaseMessages.getString(PKG, "FormulaDialog.Log.UnableToFindInput"));
                }
            }
        }
    };
    new Thread(runnable).start();
    colinf[1].setSelectionAdapter(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (fieldNames == null) {
                return;
            }
            TableView tv = (TableView) e.widget;
            TableItem item = tv.table.getItem(e.y);
            String formula = item.getText(e.x);
            try {
                if (!shell.isDisposed()) {
                    LibFormulaEditor libFormulaEditor = new LibFormulaEditor(shell, SWT.APPLICATION_MODAL | SWT.SHEET, Const.NVL(formula, ""), fieldNames);
                    formula = libFormulaEditor.open();
                    if (formula != null && !tv.isDisposed()) {
                        tv.setText(formula, e.x, e.y);
                    }
                }
            } catch (Exception ex) {
                new ErrorDialog(shell, "Error", "There was an unexpected error in the formula editor", ex);
            }
        }
    });
    wFields.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent arg0) {
            // Now set the combo's
            shell.getDisplay().asyncExec(new Runnable() {

                @Override
                public void run() {
                    setComboBoxes();
                }
            });
        }
    });
    // 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, null);
    // Add listeners
    lsCancel = new Listener() {

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

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

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

        @Override
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    // Set the shell size, based upon previous time...
    setSize();
    getData();
    currentMeta.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) 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) LibFormulaEditor(org.pentaho.libformula.ui.editor.LibFormulaEditor) 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) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) Text(org.eclipse.swt.widgets.Text) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) KettleException(org.pentaho.di.core.exception.KettleException) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Display(org.eclipse.swt.widgets.Display)

Example 63 with ColumnInfo

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

the class ExcelOutputDialog 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();
        }
    };
    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, "ExcelOutputDialog.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, "ExcelOutputDialog.FileTab.TabTitle"));
    Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFileComp);
    FormLayout fileLayout = new FormLayout();
    fileLayout.marginWidth = 3;
    fileLayout.marginHeight = 3;
    wFileComp.setLayout(fileLayout);
    // Filename line
    wlFilename = new Label(wFileComp, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(0, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wbFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbFilename);
    wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(0, 0);
    wbFilename.setLayoutData(fdbFilename);
    wFilename = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.top = new FormAttachment(0, margin);
    fdFilename.right = new FormAttachment(wbFilename, -margin);
    wFilename.setLayoutData(fdFilename);
    // Create Parent Folder
    wlCreateParentFolder = new Label(wFileComp, SWT.RIGHT);
    wlCreateParentFolder.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.CreateParentFolder.Label"));
    props.setLook(wlCreateParentFolder);
    fdlCreateParentFolder = new FormData();
    fdlCreateParentFolder.left = new FormAttachment(0, 0);
    fdlCreateParentFolder.top = new FormAttachment(wFilename, margin);
    fdlCreateParentFolder.right = new FormAttachment(middle, -margin);
    wlCreateParentFolder.setLayoutData(fdlCreateParentFolder);
    wCreateParentFolder = new Button(wFileComp, SWT.CHECK);
    wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.CreateParentFolder.Tooltip"));
    props.setLook(wCreateParentFolder);
    fdCreateParentFolder = new FormData();
    fdCreateParentFolder.left = new FormAttachment(middle, 0);
    fdCreateParentFolder.top = new FormAttachment(wFilename, margin);
    fdCreateParentFolder.right = new FormAttachment(100, 0);
    wCreateParentFolder.setLayoutData(fdCreateParentFolder);
    wCreateParentFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Open new File at Init
    wlDoNotOpenNewFileInit = new Label(wFileComp, SWT.RIGHT);
    wlDoNotOpenNewFileInit.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.DoNotOpenNewFileInit.Label"));
    props.setLook(wlDoNotOpenNewFileInit);
    fdlDoNotOpenNewFileInit = new FormData();
    fdlDoNotOpenNewFileInit.left = new FormAttachment(0, 0);
    fdlDoNotOpenNewFileInit.top = new FormAttachment(wCreateParentFolder, margin);
    fdlDoNotOpenNewFileInit.right = new FormAttachment(middle, -margin);
    wlDoNotOpenNewFileInit.setLayoutData(fdlDoNotOpenNewFileInit);
    wDoNotOpenNewFileInit = new Button(wFileComp, SWT.CHECK);
    wDoNotOpenNewFileInit.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.DoNotOpenNewFileInit.Tooltip"));
    props.setLook(wDoNotOpenNewFileInit);
    fdDoNotOpenNewFileInit = new FormData();
    fdDoNotOpenNewFileInit.left = new FormAttachment(middle, 0);
    fdDoNotOpenNewFileInit.top = new FormAttachment(wCreateParentFolder, margin);
    fdDoNotOpenNewFileInit.right = new FormAttachment(100, 0);
    wDoNotOpenNewFileInit.setLayoutData(fdDoNotOpenNewFileInit);
    wDoNotOpenNewFileInit.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Extension line
    wlExtension = new Label(wFileComp, SWT.RIGHT);
    wlExtension.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
    props.setLook(wlExtension);
    fdlExtension = new FormData();
    fdlExtension.left = new FormAttachment(0, 0);
    fdlExtension.top = new FormAttachment(wDoNotOpenNewFileInit, margin);
    fdlExtension.right = new FormAttachment(middle, -margin);
    wlExtension.setLayoutData(fdlExtension);
    wExtension = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wExtension.setText("");
    props.setLook(wExtension);
    wExtension.addModifyListener(lsMod);
    fdExtension = new FormData();
    fdExtension.left = new FormAttachment(middle, 0);
    fdExtension.top = new FormAttachment(wDoNotOpenNewFileInit, margin);
    fdExtension.right = new FormAttachment(wbFilename, -margin);
    wExtension.setLayoutData(fdExtension);
    // Create multi-part file?
    wlAddStepnr = new Label(wFileComp, SWT.RIGHT);
    wlAddStepnr.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddStepnr.Label"));
    props.setLook(wlAddStepnr);
    fdlAddStepnr = new FormData();
    fdlAddStepnr.left = new FormAttachment(0, 0);
    fdlAddStepnr.top = new FormAttachment(wExtension, margin);
    fdlAddStepnr.right = new FormAttachment(middle, -margin);
    wlAddStepnr.setLayoutData(fdlAddStepnr);
    wAddStepnr = new Button(wFileComp, SWT.CHECK);
    props.setLook(wAddStepnr);
    fdAddStepnr = new FormData();
    fdAddStepnr.left = new FormAttachment(middle, 0);
    fdAddStepnr.top = new FormAttachment(wExtension, margin);
    fdAddStepnr.right = new FormAttachment(100, 0);
    wAddStepnr.setLayoutData(fdAddStepnr);
    wAddStepnr.addSelectionListener(new SelectionAdapter() {

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

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        // System.out.println("wAddDate.getSelection()="+wAddDate.getSelection());
        }
    });
    // Create multi-part file?
    wlAddTime = new Label(wFileComp, SWT.RIGHT);
    wlAddTime.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddTime.Label"));
    props.setLook(wlAddTime);
    fdlAddTime = new FormData();
    fdlAddTime.left = new FormAttachment(0, 0);
    fdlAddTime.top = new FormAttachment(wAddDate, margin);
    fdlAddTime.right = new FormAttachment(middle, -margin);
    wlAddTime.setLayoutData(fdlAddTime);
    wAddTime = new Button(wFileComp, SWT.CHECK);
    props.setLook(wAddTime);
    fdAddTime = new FormData();
    fdAddTime.left = new FormAttachment(middle, 0);
    fdAddTime.top = new FormAttachment(wAddDate, margin);
    fdAddTime.right = new FormAttachment(100, 0);
    wAddTime.setLayoutData(fdAddTime);
    wAddTime.addSelectionListener(new SelectionAdapter() {

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

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

        @Override
        public void widgetSelected(SelectionEvent e) {
            ExcelOutputMeta tfoi = new ExcelOutputMeta();
            getInfo(tfoi);
            String[] files = tfoi.getFiles(transMeta);
            if (files != null && files.length > 0) {
                EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "ExcelOutputDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "ExcelOutputDialog.SelectOutputFiles.DialogMessage"));
                esd.setViewOnly();
                esd.open();
            } else {
                MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                mb.setMessage(BaseMessages.getString(PKG, "ExcelOutputDialog.NoFilesFound.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
                mb.open();
            }
        }
    });
    // Add File to the result files name
    wlAddToResult = new Label(wFileComp, SWT.RIGHT);
    wlAddToResult.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddFileToResult.Label"));
    props.setLook(wlAddToResult);
    fdlAddToResult = new FormData();
    fdlAddToResult.left = new FormAttachment(0, 0);
    fdlAddToResult.top = new FormAttachment(wbShowFiles, 2 * margin);
    fdlAddToResult.right = new FormAttachment(middle, -margin);
    wlAddToResult.setLayoutData(fdlAddToResult);
    wAddToResult = new Button(wFileComp, SWT.CHECK);
    wAddToResult.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddFileToResult.Tooltip"));
    props.setLook(wAddToResult);
    fdAddToResult = new FormData();
    fdAddToResult.left = new FormAttachment(middle, 0);
    fdAddToResult.top = new FormAttachment(wbShowFiles, 2 * margin);
    fdAddToResult.right = new FormAttachment(100, 0);
    wAddToResult.setLayoutData(fdAddToResult);
    SelectionAdapter lsSelR = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
        }
    };
    wAddToResult.addSelectionListener(lsSelR);
    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, "ExcelOutputDialog.ContentTab.TabTitle"));
    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;
    Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wContentComp);
    wContentComp.setLayout(contentLayout);
    // Append checkbox
    wlAppend = new Label(wContentComp, SWT.RIGHT);
    wlAppend.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Append.Label"));
    props.setLook(wlAppend);
    fdlAppend = new FormData();
    fdlAppend.left = new FormAttachment(0, 0);
    fdlAppend.top = new FormAttachment(0, 0);
    fdlAppend.right = new FormAttachment(middle, -margin);
    wlAppend.setLayoutData(fdlAppend);
    wAppend = new Button(wContentComp, SWT.CHECK);
    props.setLook(wAppend);
    wAppend.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.Append.Tooltip"));
    fdAppend = new FormData();
    fdAppend.left = new FormAttachment(middle, 0);
    fdAppend.top = new FormAttachment(0, 0);
    fdAppend.right = new FormAttachment(100, 0);
    wAppend.setLayoutData(fdAppend);
    wAppend.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
        }
    });
    wlHeader = new Label(wContentComp, SWT.RIGHT);
    wlHeader.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Header.Label"));
    props.setLook(wlHeader);
    fdlHeader = new FormData();
    fdlHeader.left = new FormAttachment(0, 0);
    fdlHeader.top = new FormAttachment(wAppend, margin);
    fdlHeader.right = new FormAttachment(middle, -margin);
    wlHeader.setLayoutData(fdlHeader);
    wHeader = new Button(wContentComp, SWT.CHECK);
    props.setLook(wHeader);
    fdHeader = new FormData();
    fdHeader.left = new FormAttachment(middle, 0);
    fdHeader.top = new FormAttachment(wAppend, margin);
    fdHeader.right = new FormAttachment(100, 0);
    wHeader.setLayoutData(fdHeader);
    wHeader.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    wlFooter = new Label(wContentComp, SWT.RIGHT);
    wlFooter.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Footer.Label"));
    props.setLook(wlFooter);
    fdlFooter = new FormData();
    fdlFooter.left = new FormAttachment(0, 0);
    fdlFooter.top = new FormAttachment(wHeader, margin);
    fdlFooter.right = new FormAttachment(middle, -margin);
    wlFooter.setLayoutData(fdlFooter);
    wFooter = new Button(wContentComp, SWT.CHECK);
    props.setLook(wFooter);
    fdFooter = new FormData();
    fdFooter.left = new FormAttachment(middle, 0);
    fdFooter.top = new FormAttachment(wHeader, margin);
    fdFooter.right = new FormAttachment(100, 0);
    wFooter.setLayoutData(fdFooter);
    wFooter.addSelectionListener(new SelectionAdapter() {

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

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

        @Override
        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();
        }
    });
    wlSplitEvery = new Label(wContentComp, SWT.RIGHT);
    wlSplitEvery.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.SplitEvery.Label"));
    props.setLook(wlSplitEvery);
    fdlSplitEvery = new FormData();
    fdlSplitEvery.left = new FormAttachment(0, 0);
    fdlSplitEvery.top = new FormAttachment(wEncoding, margin);
    fdlSplitEvery.right = new FormAttachment(middle, -margin);
    wlSplitEvery.setLayoutData(fdlSplitEvery);
    wSplitEvery = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSplitEvery);
    wSplitEvery.addModifyListener(lsMod);
    fdSplitEvery = new FormData();
    fdSplitEvery.left = new FormAttachment(middle, 0);
    fdSplitEvery.top = new FormAttachment(wEncoding, margin);
    fdSplitEvery.right = new FormAttachment(100, 0);
    wSplitEvery.setLayoutData(fdSplitEvery);
    // Sheet name line
    wlSheetname = new Label(wContentComp, SWT.RIGHT);
    wlSheetname.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Sheetname.Label"));
    props.setLook(wlSheetname);
    fdlSheetname = new FormData();
    fdlSheetname.left = new FormAttachment(0, 0);
    fdlSheetname.top = new FormAttachment(wSplitEvery, margin);
    fdlSheetname.right = new FormAttachment(middle, -margin);
    wlSheetname.setLayoutData(fdlSheetname);
    wSheetname = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wSheetname.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.Sheetname.Tooltip"));
    props.setLook(wSheetname);
    wSheetname.addModifyListener(lsMod);
    fdSheetname = new FormData();
    fdSheetname.left = new FormAttachment(middle, 0);
    fdSheetname.top = new FormAttachment(wSplitEvery, margin);
    fdSheetname.right = new FormAttachment(100, 0);
    wSheetname.setLayoutData(fdSheetname);
    // Protect Sheet?
    wlProtectSheet = new Label(wContentComp, SWT.RIGHT);
    wlProtectSheet.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.ProtectSheet.Label"));
    props.setLook(wlProtectSheet);
    fdlProtectSheet = new FormData();
    fdlProtectSheet.left = new FormAttachment(0, 0);
    fdlProtectSheet.top = new FormAttachment(wSheetname, margin);
    fdlProtectSheet.right = new FormAttachment(middle, -margin);
    wlProtectSheet.setLayoutData(fdlProtectSheet);
    wProtectSheet = new Button(wContentComp, SWT.CHECK);
    props.setLook(wProtectSheet);
    fdProtectSheet = new FormData();
    fdProtectSheet.left = new FormAttachment(middle, 0);
    fdProtectSheet.top = new FormAttachment(wSheetname, margin);
    fdProtectSheet.right = new FormAttachment(100, 0);
    wProtectSheet.setLayoutData(fdProtectSheet);
    wProtectSheet.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            EnablePassword();
        }
    });
    // Password line
    wlPassword = new Label(wContentComp, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Password.Label"));
    props.setLook(wlPassword);
    fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wProtectSheet, margin);
    fdlPassword.right = new FormAttachment(middle, -margin);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wPassword.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.Password.Tooltip"));
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, 0);
    fdPassword.top = new FormAttachment(wProtectSheet, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // auto size columns?
    wlAutoSize = new Label(wContentComp, SWT.RIGHT);
    wlAutoSize.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AutoSize.Label"));
    props.setLook(wlAutoSize);
    fdlAutoSize = new FormData();
    fdlAutoSize.left = new FormAttachment(0, 0);
    fdlAutoSize.top = new FormAttachment(wPassword, margin);
    fdlAutoSize.right = new FormAttachment(middle, -margin);
    wlAutoSize.setLayoutData(fdlAutoSize);
    wAutoSize = new Button(wContentComp, SWT.CHECK);
    props.setLook(wAutoSize);
    wAutoSize.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.AutoSize.Tooltip"));
    fdAutoSize = new FormData();
    fdAutoSize.left = new FormAttachment(middle, 0);
    fdAutoSize.top = new FormAttachment(wPassword, margin);
    fdAutoSize.right = new FormAttachment(100, 0);
    wAutoSize.setLayoutData(fdAutoSize);
    wAutoSize.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            EnableAutoSize();
        }
    });
    // write null values as blank cells ?
    wlNullIsBlank = new Label(wContentComp, SWT.RIGHT);
    wlNullIsBlank.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.NullIsBlank.Label"));
    props.setLook(wlNullIsBlank);
    fdlNullIsBlank = new FormData();
    fdlNullIsBlank.left = new FormAttachment(0, 0);
    fdlNullIsBlank.top = new FormAttachment(wAutoSize, margin);
    fdlNullIsBlank.right = new FormAttachment(middle, -margin);
    wlNullIsBlank.setLayoutData(fdlNullIsBlank);
    wNullIsBlank = new Button(wContentComp, SWT.CHECK);
    props.setLook(wNullIsBlank);
    wNullIsBlank.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.NullIsBlank.Tooltip"));
    fdNullIsBlank = new FormData();
    fdNullIsBlank.left = new FormAttachment(middle, 0);
    fdNullIsBlank.top = new FormAttachment(wAutoSize, margin);
    fdNullIsBlank.right = new FormAttachment(100, 0);
    wNullIsBlank.setLayoutData(fdNullIsBlank);
    // use temporary files?
    wluseTempFiles = new Label(wContentComp, SWT.RIGHT);
    wluseTempFiles.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.useTempFile.Label"));
    props.setLook(wluseTempFiles);
    fdluseTempFiles = new FormData();
    fdluseTempFiles.left = new FormAttachment(0, 0);
    fdluseTempFiles.top = new FormAttachment(wNullIsBlank, margin);
    fdluseTempFiles.right = new FormAttachment(middle, -margin);
    wluseTempFiles.setLayoutData(fdluseTempFiles);
    wuseTempFiles = new Button(wContentComp, SWT.CHECK);
    props.setLook(wuseTempFiles);
    wuseTempFiles.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.useTempFile.Tooltip"));
    fduseTempFiles = new FormData();
    fduseTempFiles.left = new FormAttachment(middle, 0);
    fduseTempFiles.top = new FormAttachment(wNullIsBlank, margin);
    fduseTempFiles.right = new FormAttachment(100, 0);
    wuseTempFiles.setLayoutData(fduseTempFiles);
    wuseTempFiles.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            useTempFile();
        }
    });
    // TempDirectory line
    wlTempDirectory = new Label(wContentComp, SWT.RIGHT);
    wlTempDirectory.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TempDirectory.Label"));
    props.setLook(wlTempDirectory);
    fdlTempDirectory = new FormData();
    fdlTempDirectory.left = new FormAttachment(0, 0);
    fdlTempDirectory.top = new FormAttachment(wuseTempFiles, margin);
    fdlTempDirectory.right = new FormAttachment(middle, -margin);
    wlTempDirectory.setLayoutData(fdlTempDirectory);
    // Select TempDir
    wbTempDir = new Button(wContentComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTempDir);
    wbTempDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbTempDir = new FormData();
    fdbTempDir.right = new FormAttachment(100, -margin);
    fdbTempDir.top = new FormAttachment(wuseTempFiles, margin);
    wbTempDir.setLayoutData(fdbTempDir);
    wTempDirectory = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTempDirectory.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.TempDirectory.Tooltip"));
    props.setLook(wTempDirectory);
    wTempDirectory.addModifyListener(lsMod);
    fdTempDirectory = new FormData();
    fdTempDirectory.left = new FormAttachment(middle, 0);
    fdTempDirectory.top = new FormAttachment(wuseTempFiles, margin);
    fdTempDirectory.right = new FormAttachment(wbTempDir, -margin);
    wTempDirectory.setLayoutData(fdTempDirectory);
    wTempDirectory.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            input.setChanged();
        }
    });
    // ///////////////////////////////
    // START OF Template Group GROUP //
    // ///////////////////////////////
    wTemplateGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wTemplateGroup);
    wTemplateGroup.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TemplateGroup.Label"));
    FormLayout TemplateGroupgroupLayout = new FormLayout();
    TemplateGroupgroupLayout.marginWidth = 10;
    TemplateGroupgroupLayout.marginHeight = 10;
    wTemplateGroup.setLayout(TemplateGroupgroupLayout);
    // Use template
    wlTemplate = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplate.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Template.Label"));
    props.setLook(wlTemplate);
    fdlTemplate = new FormData();
    fdlTemplate.left = new FormAttachment(0, 0);
    fdlTemplate.top = new FormAttachment(wTempDirectory, margin);
    fdlTemplate.right = new FormAttachment(middle, -margin);
    wlTemplate.setLayoutData(fdlTemplate);
    wTemplate = new Button(wTemplateGroup, SWT.CHECK);
    props.setLook(wTemplate);
    fdTemplate = new FormData();
    fdTemplate.left = new FormAttachment(middle, 0);
    fdTemplate.top = new FormAttachment(wTempDirectory, margin);
    fdTemplate.right = new FormAttachment(100, 0);
    wTemplate.setLayoutData(fdTemplate);
    wTemplate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            EnableTemplate();
        }
    });
    // TemplateFilename line
    wlTemplateFilename = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplateFilename.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TemplateFilename.Label"));
    props.setLook(wlTemplateFilename);
    fdlTemplateFilename = new FormData();
    fdlTemplateFilename.left = new FormAttachment(0, 0);
    fdlTemplateFilename.top = new FormAttachment(wTemplate, margin);
    fdlTemplateFilename.right = new FormAttachment(middle, -margin);
    wlTemplateFilename.setLayoutData(fdlTemplateFilename);
    wbTemplateFilename = new Button(wTemplateGroup, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTemplateFilename);
    wbTemplateFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbTemplateFilename = new FormData();
    fdbTemplateFilename.right = new FormAttachment(100, 0);
    fdbTemplateFilename.top = new FormAttachment(wTemplate, 0);
    wbTemplateFilename.setLayoutData(fdbTemplateFilename);
    wTemplateFilename = new TextVar(transMeta, wTemplateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTemplateFilename);
    wTemplateFilename.addModifyListener(lsMod);
    fdTemplateFilename = new FormData();
    fdTemplateFilename.left = new FormAttachment(middle, 0);
    fdTemplateFilename.top = new FormAttachment(wTemplate, margin);
    fdTemplateFilename.right = new FormAttachment(wbTemplateFilename, -margin);
    wTemplateFilename.setLayoutData(fdTemplateFilename);
    // Template Append
    wlTemplateAppend = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplateAppend.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TemplateAppend.Label"));
    props.setLook(wlTemplateAppend);
    fdlTemplateAppend = new FormData();
    fdlTemplateAppend.left = new FormAttachment(0, 0);
    fdlTemplateAppend.top = new FormAttachment(wTemplateFilename, margin);
    fdlTemplateAppend.right = new FormAttachment(middle, -margin);
    wlTemplateAppend.setLayoutData(fdlTemplateAppend);
    wTemplateAppend = new Button(wTemplateGroup, SWT.CHECK);
    props.setLook(wTemplateAppend);
    fdTemplateAppend = new FormData();
    fdTemplateAppend.left = new FormAttachment(middle, 0);
    fdTemplateAppend.top = new FormAttachment(wTemplateFilename, margin);
    fdTemplateAppend.right = new FormAttachment(100, 0);
    wTemplateAppend.setLayoutData(fdTemplateAppend);
    wTemplateAppend.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    fdTemplateGroup = new FormData();
    fdTemplateGroup.left = new FormAttachment(0, margin);
    fdTemplateGroup.top = new FormAttachment(wTempDirectory, margin);
    fdTemplateGroup.right = new FormAttachment(100, -margin);
    wTemplateGroup.setLayoutData(fdTemplateGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Template Group 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(fdContentComp);
    wContentComp.layout();
    wContentTab.setControl(wContentComp);
    // ///////////////////////////////////////////////////////////
    // / END OF CONTENT TAB
    // ///////////////////////////////////////////////////////////
    // Custom tab...
    // 
    wCustomTab = new CTabItem(wTabFolder, SWT.NONE);
    wCustomTab.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.CustomTab.TabTitle"));
    FormLayout CustomLayout = new FormLayout();
    CustomLayout.marginWidth = Const.FORM_MARGIN;
    CustomLayout.marginHeight = Const.FORM_MARGIN;
    Composite wCustomComp = new Composite(wTabFolder, SWT.NONE);
    wCustomComp.setLayout(CustomLayout);
    props.setLook(wCustomComp);
    // ///////////////////////////////
    // START OF Header Font GROUP //
    // ///////////////////////////////
    wFontHeaderGroup = new Group(wCustomComp, SWT.SHADOW_NONE);
    props.setLook(wFontHeaderGroup);
    wFontHeaderGroup.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.FontHeaderGroup.Label"));
    FormLayout FontHeadergroupLayout = new FormLayout();
    FontHeadergroupLayout.marginWidth = 10;
    FontHeadergroupLayout.marginHeight = 10;
    wFontHeaderGroup.setLayout(FontHeadergroupLayout);
    // Header font name
    wlHeaderFontName = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontName.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontName.Label"));
    props.setLook(wlHeaderFontName);
    fdlHeaderFontName = new FormData();
    fdlHeaderFontName.left = new FormAttachment(0, 0);
    fdlHeaderFontName.top = new FormAttachment(0, margin);
    fdlHeaderFontName.right = new FormAttachment(middle, -margin);
    wlHeaderFontName.setLayoutData(fdlHeaderFontName);
    wHeaderFontName = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    wHeaderFontName.setItems(ExcelOutputMeta.font_name_desc);
    props.setLook(wHeaderFontName);
    wHeaderFontName.addModifyListener(lsMod);
    fdHeaderFontName = new FormData();
    fdHeaderFontName.left = new FormAttachment(middle, 0);
    fdHeaderFontName.top = new FormAttachment(0, margin);
    fdHeaderFontName.right = new FormAttachment(100, 0);
    wHeaderFontName.setLayoutData(fdHeaderFontName);
    // Header font size
    wlHeaderFontSize = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontSize.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontSize.Label"));
    props.setLook(wlHeaderFontSize);
    fdlHeaderFontSize = new FormData();
    fdlHeaderFontSize.left = new FormAttachment(0, 0);
    fdlHeaderFontSize.top = new FormAttachment(wHeaderFontName, margin);
    fdlHeaderFontSize.right = new FormAttachment(middle, -margin);
    wlHeaderFontSize.setLayoutData(fdlHeaderFontSize);
    wHeaderFontSize = new TextVar(transMeta, wFontHeaderGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wHeaderFontSize.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontSize.Tooltip"));
    props.setLook(wHeaderFontSize);
    wHeaderFontSize.addModifyListener(lsMod);
    fdHeaderFontSize = new FormData();
    fdHeaderFontSize.left = new FormAttachment(middle, 0);
    fdHeaderFontSize.top = new FormAttachment(wHeaderFontName, margin);
    fdHeaderFontSize.right = new FormAttachment(100, 0);
    wHeaderFontSize.setLayoutData(fdHeaderFontSize);
    // Header font bold?
    wlHeaderFontBold = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontBold.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontBold.Label"));
    props.setLook(wlHeaderFontBold);
    fdlHeaderFontBold = new FormData();
    fdlHeaderFontBold.left = new FormAttachment(0, 0);
    fdlHeaderFontBold.top = new FormAttachment(wHeaderFontSize, margin);
    fdlHeaderFontBold.right = new FormAttachment(middle, -margin);
    wlHeaderFontBold.setLayoutData(fdlHeaderFontBold);
    wHeaderFontBold = new Button(wFontHeaderGroup, SWT.CHECK);
    props.setLook(wHeaderFontBold);
    fdHeaderFontBold = new FormData();
    fdHeaderFontBold.left = new FormAttachment(middle, 0);
    fdHeaderFontBold.top = new FormAttachment(wHeaderFontSize, margin);
    fdHeaderFontBold.right = new FormAttachment(100, 0);
    wHeaderFontBold.setLayoutData(fdHeaderFontBold);
    wHeaderFontBold.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Header font bold?
    wlHeaderFontItalic = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontItalic.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontItalic.Label"));
    props.setLook(wlHeaderFontItalic);
    fdlHeaderFontItalic = new FormData();
    fdlHeaderFontItalic.left = new FormAttachment(0, 0);
    fdlHeaderFontItalic.top = new FormAttachment(wHeaderFontBold, margin);
    fdlHeaderFontItalic.right = new FormAttachment(middle, -margin);
    wlHeaderFontItalic.setLayoutData(fdlHeaderFontItalic);
    wHeaderFontItalic = new Button(wFontHeaderGroup, SWT.CHECK);
    props.setLook(wHeaderFontItalic);
    fdHeaderFontItalic = new FormData();
    fdHeaderFontItalic.left = new FormAttachment(middle, 0);
    fdHeaderFontItalic.top = new FormAttachment(wHeaderFontBold, margin);
    fdHeaderFontItalic.right = new FormAttachment(100, 0);
    wHeaderFontItalic.setLayoutData(fdHeaderFontItalic);
    wHeaderFontItalic.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Font header uderline?
    wlHeaderFontUnderline = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontUnderline.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontUnderline.Label"));
    props.setLook(wlHeaderFontUnderline);
    fdlHeaderFontUnderline = new FormData();
    fdlHeaderFontUnderline.left = new FormAttachment(0, 0);
    fdlHeaderFontUnderline.top = new FormAttachment(wHeaderFontItalic, margin);
    fdlHeaderFontUnderline.right = new FormAttachment(middle, -margin);
    wlHeaderFontUnderline.setLayoutData(fdlHeaderFontUnderline);
    wHeaderFontUnderline = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    wHeaderFontUnderline.setItems(ExcelOutputMeta.font_underline_desc);
    props.setLook(wHeaderFontUnderline);
    wHeaderFontUnderline.addModifyListener(lsMod);
    fdHeaderFontUnderline = new FormData();
    fdHeaderFontUnderline.left = new FormAttachment(middle, 0);
    fdHeaderFontUnderline.top = new FormAttachment(wHeaderFontItalic, margin);
    fdHeaderFontUnderline.right = new FormAttachment(100, 0);
    wHeaderFontUnderline.setLayoutData(fdHeaderFontUnderline);
    // Font header orientation
    wlHeaderFontOrientation = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontOrientation.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontOrientation.Label"));
    props.setLook(wlHeaderFontOrientation);
    fdlHeaderFontOrientation = new FormData();
    fdlHeaderFontOrientation.left = new FormAttachment(0, 0);
    fdlHeaderFontOrientation.top = new FormAttachment(wHeaderFontUnderline, margin);
    fdlHeaderFontOrientation.right = new FormAttachment(middle, -margin);
    wlHeaderFontOrientation.setLayoutData(fdlHeaderFontOrientation);
    wHeaderFontOrientation = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    wHeaderFontOrientation.setItems(ExcelOutputMeta.font_orientation_desc);
    props.setLook(wHeaderFontOrientation);
    wHeaderFontOrientation.addModifyListener(lsMod);
    fdHeaderFontOrientation = new FormData();
    fdHeaderFontOrientation.left = new FormAttachment(middle, 0);
    fdHeaderFontOrientation.top = new FormAttachment(wHeaderFontUnderline, margin);
    fdHeaderFontOrientation.right = new FormAttachment(100, 0);
    wHeaderFontOrientation.setLayoutData(fdHeaderFontOrientation);
    // Font header color
    wlHeaderFontColor = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontColor.Label"));
    props.setLook(wlHeaderFontColor);
    fdlHeaderFontColor = new FormData();
    fdlHeaderFontColor.left = new FormAttachment(0, 0);
    fdlHeaderFontColor.top = new FormAttachment(wHeaderFontOrientation, margin);
    fdlHeaderFontColor.right = new FormAttachment(middle, -margin);
    wlHeaderFontColor.setLayoutData(fdlHeaderFontColor);
    wHeaderFontColor = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wHeaderFontColor);
    fdHeaderFontColor = new FormData();
    fdHeaderFontColor.left = new FormAttachment(middle, 0);
    fdHeaderFontColor.top = new FormAttachment(wHeaderFontOrientation, margin);
    fdHeaderFontColor.right = new FormAttachment(100, 0);
    wHeaderFontColor.setLayoutData(fdHeaderFontColor);
    wHeaderFontColor.setItems(ExcelOutputMeta.font_color_desc);
    // Font header background color
    wlHeaderBackGroundColor = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderBackGroundColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderBackGroundColor.Label"));
    props.setLook(wlHeaderBackGroundColor);
    fdlHeaderBackGroundColor = new FormData();
    fdlHeaderBackGroundColor.left = new FormAttachment(0, 0);
    fdlHeaderBackGroundColor.top = new FormAttachment(wHeaderFontColor, margin);
    fdlHeaderBackGroundColor.right = new FormAttachment(middle, -margin);
    wlHeaderBackGroundColor.setLayoutData(fdlHeaderBackGroundColor);
    wHeaderBackGroundColor = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wHeaderBackGroundColor);
    fdHeaderBackGroundColor = new FormData();
    fdHeaderBackGroundColor.left = new FormAttachment(middle, 0);
    fdHeaderBackGroundColor.top = new FormAttachment(wHeaderFontColor, margin);
    fdHeaderBackGroundColor.right = new FormAttachment(100, 0);
    wHeaderBackGroundColor.setLayoutData(fdHeaderBackGroundColor);
    wHeaderBackGroundColor.setItems(ExcelOutputMeta.font_color_desc);
    // Header font size
    wlHeaderRowHeight = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderRowHeight.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderRowHeight.Label"));
    props.setLook(wlHeaderRowHeight);
    fdlHeaderRowHeight = new FormData();
    fdlHeaderRowHeight.left = new FormAttachment(0, 0);
    fdlHeaderRowHeight.top = new FormAttachment(wHeaderBackGroundColor, margin);
    fdlHeaderRowHeight.right = new FormAttachment(middle, -margin);
    wlHeaderRowHeight.setLayoutData(fdlHeaderRowHeight);
    wHeaderRowHeight = new TextVar(transMeta, wFontHeaderGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wHeaderRowHeight.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderRowHeight.Tooltip"));
    props.setLook(wHeaderRowHeight);
    wHeaderRowHeight.addModifyListener(lsMod);
    fdHeaderRowHeight = new FormData();
    fdHeaderRowHeight.left = new FormAttachment(middle, 0);
    fdHeaderRowHeight.top = new FormAttachment(wHeaderBackGroundColor, margin);
    fdHeaderRowHeight.right = new FormAttachment(100, 0);
    wHeaderRowHeight.setLayoutData(fdHeaderRowHeight);
    // Header Alignment
    wlHeaderAlignment = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderAlignment.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderAlignment.Label"));
    props.setLook(wlHeaderAlignment);
    fdlHeaderAlignment = new FormData();
    fdlHeaderAlignment.left = new FormAttachment(0, 0);
    fdlHeaderAlignment.top = new FormAttachment(wHeaderRowHeight, margin);
    fdlHeaderAlignment.right = new FormAttachment(middle, -margin);
    wlHeaderAlignment.setLayoutData(fdlHeaderAlignment);
    wHeaderAlignment = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    wHeaderAlignment.setItems(ExcelOutputMeta.font_alignment_desc);
    props.setLook(wHeaderAlignment);
    wHeaderAlignment.addModifyListener(lsMod);
    fdHeaderAlignment = new FormData();
    fdHeaderAlignment.left = new FormAttachment(middle, 0);
    fdHeaderAlignment.top = new FormAttachment(wHeaderRowHeight, margin);
    fdHeaderAlignment.right = new FormAttachment(100, 0);
    wHeaderAlignment.setLayoutData(fdHeaderAlignment);
    // Select Image
    wbImage = new Button(wFontHeaderGroup, SWT.PUSH | SWT.CENTER);
    props.setLook(wbImage);
    wbImage.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddImage"));
    fdbImage = new FormData();
    fdbImage.right = new FormAttachment(100, 0);
    fdbImage.top = new FormAttachment(wHeaderAlignment, margin);
    wbImage.setLayoutData(fdbImage);
    wbImage.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.png", "*.*" });
            if (wImage.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wImage.getText()));
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "ExcelOutputDialog.FileType.PNGFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
            if (dialog.open() != null) {
                wImage.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
            }
        }
    });
    // Image line
    wlImage = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlImage.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Image.Label"));
    props.setLook(wlImage);
    fdlImage = new FormData();
    fdlImage.left = new FormAttachment(0, 0);
    fdlImage.top = new FormAttachment(wHeaderAlignment, margin);
    fdlImage.right = new FormAttachment(middle, -margin);
    wlImage.setLayoutData(fdlImage);
    wImage = new TextVar(transMeta, wFontHeaderGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wImage);
    wImage.addModifyListener(lsMod);
    fdImage = new FormData();
    fdImage.left = new FormAttachment(middle, 0);
    fdImage.top = new FormAttachment(wHeaderAlignment, margin);
    fdImage.right = new FormAttachment(wbImage, -margin);
    wImage.setLayoutData(fdImage);
    fdFontHeaderGroup = new FormData();
    fdFontHeaderGroup.left = new FormAttachment(0, margin);
    fdFontHeaderGroup.top = new FormAttachment(0, margin);
    fdFontHeaderGroup.right = new FormAttachment(100, -margin);
    wFontHeaderGroup.setLayoutData(fdFontHeaderGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Font Group GROUP
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////
    // START OF Row Font GROUP //
    // ///////////////////////////////
    wFontRowGroup = new Group(wCustomComp, SWT.SHADOW_NONE);
    props.setLook(wFontRowGroup);
    wFontRowGroup.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.FontRowGroup.Label"));
    FormLayout FontRowGroupLayout = new FormLayout();
    FontRowGroupLayout.marginWidth = 10;
    FontRowGroupLayout.marginHeight = 10;
    wFontRowGroup.setLayout(FontRowGroupLayout);
    // Font Row name
    wlRowFontName = new Label(wFontRowGroup, SWT.RIGHT);
    wlRowFontName.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontName.Label"));
    props.setLook(wlRowFontName);
    fdlRowFontName = new FormData();
    fdlRowFontName.left = new FormAttachment(0, 0);
    fdlRowFontName.top = new FormAttachment(0, margin);
    fdlRowFontName.right = new FormAttachment(middle, -margin);
    wlRowFontName.setLayoutData(fdlRowFontName);
    wRowFontName = new CCombo(wFontRowGroup, SWT.BORDER | SWT.READ_ONLY);
    wRowFontName.setItems(ExcelOutputMeta.font_name_desc);
    props.setLook(wRowFontName);
    wRowFontName.addModifyListener(lsMod);
    fdRowFontName = new FormData();
    fdRowFontName.left = new FormAttachment(middle, 0);
    fdRowFontName.top = new FormAttachment(0, margin);
    fdRowFontName.right = new FormAttachment(100, 0);
    wRowFontName.setLayoutData(fdRowFontName);
    // Row font size
    wlRowFontSize = new Label(wFontRowGroup, SWT.RIGHT);
    wlRowFontSize.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontSize.Label"));
    props.setLook(wlRowFontSize);
    fdlRowFontSize = new FormData();
    fdlRowFontSize.left = new FormAttachment(0, 0);
    fdlRowFontSize.top = new FormAttachment(wRowFontName, margin);
    fdlRowFontSize.right = new FormAttachment(middle, -margin);
    wlRowFontSize.setLayoutData(fdlRowFontSize);
    wRowFontSize = new TextVar(transMeta, wFontRowGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wRowFontSize.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontSize.Tooltip"));
    props.setLook(wRowFontSize);
    wRowFontSize.addModifyListener(lsMod);
    fdRowFontSize = new FormData();
    fdRowFontSize.left = new FormAttachment(middle, 0);
    fdRowFontSize.top = new FormAttachment(wRowFontName, margin);
    fdRowFontSize.right = new FormAttachment(100, 0);
    wRowFontSize.setLayoutData(fdRowFontSize);
    // Font Row color
    wlRowFontColor = new Label(wFontRowGroup, SWT.RIGHT);
    wlRowFontColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontColor.Label"));
    props.setLook(wlRowFontColor);
    fdlRowFontColor = new FormData();
    fdlRowFontColor.left = new FormAttachment(0, 0);
    fdlRowFontColor.top = new FormAttachment(wRowFontSize, margin);
    fdlRowFontColor.right = new FormAttachment(middle, -margin);
    wlRowFontColor.setLayoutData(fdlRowFontColor);
    wRowFontColor = new CCombo(wFontRowGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wRowFontColor);
    fdRowFontColor = new FormData();
    fdRowFontColor.left = new FormAttachment(middle, 0);
    fdRowFontColor.top = new FormAttachment(wRowFontSize, margin);
    fdRowFontColor.right = new FormAttachment(100, 0);
    wRowFontColor.setLayoutData(fdRowFontColor);
    wRowFontColor.setItems(ExcelOutputMeta.font_color_desc);
    // Font Row background color
    wlRowBackGroundColor = new Label(wFontRowGroup, SWT.RIGHT);
    wlRowBackGroundColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowBackGroundColor.Label"));
    props.setLook(wlRowBackGroundColor);
    fdlRowBackGroundColor = new FormData();
    fdlRowBackGroundColor.left = new FormAttachment(0, 0);
    fdlRowBackGroundColor.top = new FormAttachment(wRowFontColor, margin);
    fdlRowBackGroundColor.right = new FormAttachment(middle, -margin);
    wlRowBackGroundColor.setLayoutData(fdlRowBackGroundColor);
    wRowBackGroundColor = new CCombo(wFontRowGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wRowBackGroundColor);
    fdRowBackGroundColor = new FormData();
    fdRowBackGroundColor.left = new FormAttachment(middle, 0);
    fdRowBackGroundColor.top = new FormAttachment(wRowFontColor, margin);
    fdRowBackGroundColor.right = new FormAttachment(100, 0);
    wRowBackGroundColor.setLayoutData(fdRowBackGroundColor);
    wRowBackGroundColor.setItems(ExcelOutputMeta.font_color_desc);
    fdFontRowGroup = new FormData();
    fdFontRowGroup.left = new FormAttachment(0, margin);
    fdFontRowGroup.top = new FormAttachment(wFontHeaderGroup, margin);
    fdFontRowGroup.right = new FormAttachment(100, -margin);
    wFontRowGroup.setLayoutData(fdFontRowGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Row Font Group
    // ///////////////////////////////////////////////////////////
    fdCustomComp = new FormData();
    fdCustomComp.left = new FormAttachment(0, 0);
    fdCustomComp.top = new FormAttachment(0, 0);
    fdCustomComp.right = new FormAttachment(100, 0);
    fdCustomComp.bottom = new FormAttachment(100, 0);
    wCustomComp.setLayoutData(fdCustomComp);
    wCustomComp.layout();
    wCustomTab.setControl(wCustomComp);
    // ///////////////////////////////////////////////////////////
    // / END OF customer TAB
    // ///////////////////////////////////////////////////////////
    // Fields tab...
    // 
    wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.FieldsTab.TabTitle"));
    FormLayout fieldsLayout = new FormLayout();
    fieldsLayout.marginWidth = Const.FORM_MARGIN;
    fieldsLayout.marginHeight = Const.FORM_MARGIN;
    Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE);
    wFieldsComp.setLayout(fieldsLayout);
    props.setLook(wFieldsComp);
    wGet = new Button(wFieldsComp, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
    wGet.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.GetFields"));
    wMinWidth = new Button(wFieldsComp, SWT.PUSH);
    wMinWidth.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.MinWidth.Button"));
    wMinWidth.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.MinWidth.Tooltip"));
    setButtonPositions(new Button[] { wGet, wMinWidth }, margin, null);
    final int FieldsRows = input.getOutputFields().length;
    // Prepare a list of possible formats...
    String[] formats = new String[] { // Numbers
    "#", "0", "0.00", "#,##0", "#,##0.00", "$#,##0;($#,##0)", "$#,##0;($#,##0)", "$#,##0;($#,##0)", "$#,##0;($#,##0)", "0%", "0.00%", "0.00E00", "#,##0;(#,##0)", "#,##0;(#,##0)", "#,##0.00;(#,##0.00)", "#,##0.00;(#,##0.00)", "#,##0;(#,##0)", "#,##0;(#,##0)", "#,##0.00;(#,##0.00)", "#,##0.00;(#,##0.00)", "#,##0.00;(#,##0.00)", "##0.0E0", // Forces text
    "@", // Dates
    "M/d/yy", "d-MMM-yy", "d-MMM", "MMM-yy", "h:mm a", "h:mm:ss a", "H:mm", "H:mm:ss", "M/d/yy H:mm", "mm:ss", "H:mm:ss", "H:mm:ss" };
    colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "ExcelOutputDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "ExcelOutputDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "ExcelOutputDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, formats) };
    wFields = new TableView(transMeta, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(0, 0);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(wGet, -margin);
    wFields.setLayoutData(fdFields);
    // 
    // Search the fields in the background
    final Runnable runnable = new Runnable() {

        @Override
        public void run() {
            StepMeta stepMeta = transMeta.findStep(stepname);
            if (stepMeta != null) {
                try {
                    RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
                    // Remember these fields...
                    for (int i = 0; i < row.size(); i++) {
                        inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
                    }
                    setComboBoxes();
                } catch (KettleException e) {
                    logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
                }
            }
        }
    };
    new Thread(runnable).start();
    fdFieldsComp = new FormData();
    fdFieldsComp.left = new FormAttachment(0, 0);
    fdFieldsComp.top = new FormAttachment(0, 0);
    fdFieldsComp.right = new FormAttachment(100, 0);
    fdFieldsComp.bottom = new FormAttachment(100, 0);
    wFieldsComp.setLayoutData(fdFieldsComp);
    wFieldsComp.layout();
    wFieldsTab.setControl(wFieldsComp);
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wStepname, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsOK = new Listener() {

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

        @Override
        public void handleEvent(Event e) {
            get();
        }
    };
    lsMinWidth = new Listener() {

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

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

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    wFilename.addSelectionListener(lsDef);
    wTemplateFilename.addSelectionListener(lsDef);
    // Whenever something changes, set the tooltip to the expanded version:
    wFilename.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wFilename.setToolTipText(transMeta.environmentSubstitute(wFilename.getText()));
        }
    });
    wTemplateFilename.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wTemplateFilename.setToolTipText(transMeta.environmentSubstitute(wTemplateFilename.getText()));
        }
    });
    wbFilename.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.SAVE);
            dialog.setFilterExtensions(new String[] { "*.xls", "*.*" });
            if (wFilename.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wFilename.getText()));
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.ExcelFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
            if (dialog.open() != null) {
                wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
            }
        }
    });
    wbTemplateFilename.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.xls", "*.*" });
            if (wTemplateFilename.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wTemplateFilename.getText()));
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.ExcelFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
            if (dialog.open() != null) {
                wTemplateFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
            }
        }
    });
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        @Override
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    lsResize = new Listener() {

        @Override
        public void handleEvent(Event event) {
            Point size = shell.getSize();
            wFields.setSize(size.x - 10, size.y - 50);
            wFields.table.setSize(size.x - 10, size.y - 50);
            wFields.redraw();
        }
    };
    shell.addListener(SWT.Resize, lsResize);
    wTabFolder.setSelection(0);
    // Set the shell size, based upon previous time...
    setSize();
    getData();
    setDateTimeFormat();
    EnableAutoSize();
    useTempFile();
    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) CTabFolder(org.eclipse.swt.custom.CTabFolder) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) Cursor(org.eclipse.swt.graphics.Cursor) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) 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) ExcelOutputMeta(org.pentaho.di.trans.steps.exceloutput.ExcelOutputMeta) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) Point(org.eclipse.swt.graphics.Point) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) Point(org.eclipse.swt.graphics.Point) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) MessageBox(org.eclipse.swt.widgets.MessageBox) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) CCombo(org.eclipse.swt.custom.CCombo) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 64 with ColumnInfo

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

the class ExecProcessDialog 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();
        }
    };
    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, "ExecProcessDialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "ExecProcessDialog.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);
    // The Tab Folders
    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, "ExecProcessDialog.GeneralTab.TabItem"));
    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = margin;
    generalLayout.marginHeight = margin;
    wGeneralComp.setLayout(generalLayout);
    // filename field
    wlProcess = new Label(wGeneralComp, SWT.RIGHT);
    wlProcess.setText(BaseMessages.getString(PKG, "ExecProcessDialog.Process.Label"));
    props.setLook(wlProcess);
    fdlProcess = new FormData();
    fdlProcess.left = new FormAttachment(0, 0);
    fdlProcess.right = new FormAttachment(middle, -margin);
    fdlProcess.top = new FormAttachment(wStepname, margin);
    wlProcess.setLayoutData(fdlProcess);
    wProcess = new CCombo(wGeneralComp, SWT.BORDER | SWT.READ_ONLY);
    wProcess.setEditable(true);
    props.setLook(wProcess);
    wProcess.addModifyListener(lsMod);
    fdProcess = new FormData();
    fdProcess.left = new FormAttachment(middle, 0);
    fdProcess.top = new FormAttachment(wStepname, margin);
    fdProcess.right = new FormAttachment(100, -margin);
    wProcess.setLayoutData(fdProcess);
    wProcess.addFocusListener(new FocusListener() {

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

        @Override
        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            get();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Command Arguments are in separate fields
    wlArgumentsInFields = new Label(wGeneralComp, SWT.RIGHT);
    wlArgumentsInFields.setText(BaseMessages.getString(PKG, "ExecProcessDialog.ArgumentInFields.Label"));
    props.setLook(wlArgumentsInFields);
    fdlArgumentsInFields = new FormData();
    fdlArgumentsInFields.left = new FormAttachment(0, 0);
    fdlArgumentsInFields.top = new FormAttachment(wProcess, margin);
    fdlArgumentsInFields.right = new FormAttachment(middle, -margin);
    wlArgumentsInFields.setLayoutData(fdlArgumentsInFields);
    wArgumentsInFields = new Button(wGeneralComp, SWT.CHECK);
    wArgumentsInFields.setToolTipText(BaseMessages.getString(PKG, "ExecProcessDialog.ArgumentInFields.Tooltip"));
    props.setLook(wArgumentsInFields);
    fdArgumentsInFields = new FormData();
    fdArgumentsInFields.left = new FormAttachment(middle, 0);
    fdArgumentsInFields.top = new FormAttachment(wProcess, margin);
    fdArgumentsInFields.right = new FormAttachment(100, 0);
    wArgumentsInFields.setLayoutData(fdArgumentsInFields);
    wArgumentsInFields.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            enableFields();
            input.setChanged();
        }
    });
    // Fail when status is different than 0
    wlFailWhenNotSuccess = new Label(wGeneralComp, SWT.RIGHT);
    wlFailWhenNotSuccess.setText(BaseMessages.getString(PKG, "ExecProcessDialog.FailWhenNotSuccess.Label"));
    props.setLook(wlFailWhenNotSuccess);
    fdlFailWhenNotSuccess = new FormData();
    fdlFailWhenNotSuccess.left = new FormAttachment(0, 0);
    fdlFailWhenNotSuccess.top = new FormAttachment(wArgumentsInFields, margin);
    fdlFailWhenNotSuccess.right = new FormAttachment(middle, -margin);
    wlFailWhenNotSuccess.setLayoutData(fdlFailWhenNotSuccess);
    wFailWhenNotSuccess = new Button(wGeneralComp, SWT.CHECK);
    wFailWhenNotSuccess.setToolTipText(BaseMessages.getString(PKG, "ExecProcessDialog.FailWhenNotSuccess.Tooltip"));
    props.setLook(wFailWhenNotSuccess);
    fdFailWhenNotSuccess = new FormData();
    fdFailWhenNotSuccess.left = new FormAttachment(middle, 0);
    fdFailWhenNotSuccess.top = new FormAttachment(wArgumentsInFields, margin);
    fdFailWhenNotSuccess.right = new FormAttachment(100, 0);
    wFailWhenNotSuccess.setLayoutData(fdFailWhenNotSuccess);
    wFailWhenNotSuccess.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // List of Argument Fields when ArgumentsInFields is enabled
    wlArgumentFields = new Label(wGeneralComp, SWT.LEFT);
    wlArgumentFields.setText(BaseMessages.getString(PKG, "ExecProcessDialog.ArgumentFields.Label"));
    props.setLook(wlArgumentFields);
    fdlArgumentFields = new FormData();
    fdlArgumentFields.left = new FormAttachment(0, 0);
    fdlArgumentFields.top = new FormAttachment(wFailWhenNotSuccess, margin);
    fdlArgumentFields.right = new FormAttachment(middle, -margin);
    wlArgumentFields.setLayoutData(fdlArgumentFields);
    ColumnInfo[] colinf = new ColumnInfo[1];
    colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "ExecProcessDialog.ArgumentField.Label"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    colinf[0].setToolTip(BaseMessages.getString(PKG, "ExecProcessDialog.ArgumentField.Tooltip"));
    wArgumentFields = new TableView(null, wGeneralComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, 1, lsMod, props);
    fdArgumentFields = new FormData();
    fdArgumentFields.left = new FormAttachment(0, 0);
    fdArgumentFields.top = new FormAttachment(wlArgumentFields, margin);
    fdArgumentFields.right = new FormAttachment(100, 0);
    fdArgumentFields.bottom = new FormAttachment(100, -margin);
    wArgumentFields.setLayoutData(fdArgumentFields);
    FormData fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    // /////////////////////
    // END OF GENERAL TAB //
    // /////////////////////
    // //////////////////////
    // START OF OUTPUT TAB //
    // //////////////////////
    wOutputTab = new CTabItem(wTabFolder, SWT.NONE);
    wOutputTab.setText(BaseMessages.getString(PKG, "ExecProcessDialog.Output.TabItem"));
    wOutputComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wOutputComp);
    FormLayout fdOutputCompLayout = new FormLayout();
    fdOutputCompLayout.marginWidth = margin;
    fdOutputCompLayout.marginHeight = margin;
    wOutputComp.setLayout(fdOutputCompLayout);
    // Output Line Delimiter
    wOutputDelim = new LabelTextVar(transMeta, wOutputComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ExecProcessDialog.OutputDelimiterField.Label"), BaseMessages.getString(PKG, "ExecProcessDialog.OutputDelimiterField.Tooltip"));
    wOutputDelim.addModifyListener(lsMod);
    fdOutputDelim = new FormData();
    fdOutputDelim.left = new FormAttachment(0, 0);
    fdOutputDelim.top = new FormAttachment(0, margin);
    fdOutputDelim.right = new FormAttachment(100, 0);
    wOutputDelim.setLayoutData(fdOutputDelim);
    // Result fieldname ...
    wResult = new LabelTextVar(transMeta, wOutputComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ExecProcessDialog.ResultField.Label"), BaseMessages.getString(PKG, "ExecProcessDialog.ResultField.Tooltip"));
    wResult.addModifyListener(lsMod);
    fdResult = new FormData();
    fdResult.left = new FormAttachment(0, 0);
    fdResult.top = new FormAttachment(wOutputDelim, margin);
    fdResult.right = new FormAttachment(100, 0);
    wResult.setLayoutData(fdResult);
    // Error fieldname ...
    wError = new LabelTextVar(transMeta, wOutputComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ExecProcessDialog.ErrorField.Label"), BaseMessages.getString(PKG, "ExecProcessDialog.ErrorField.Tooltip"));
    wError.addModifyListener(lsMod);
    fdError = new FormData();
    fdError.left = new FormAttachment(0, 0);
    fdError.top = new FormAttachment(wResult, margin);
    fdError.right = new FormAttachment(100, 0);
    wError.setLayoutData(fdError);
    // ExitValue fieldname ...
    wExitValue = new LabelTextVar(transMeta, wOutputComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ExecProcessDialog.ExitValueField.Label"), BaseMessages.getString(PKG, "ExecProcessDialog.ExitValueField.Tooltip"));
    wExitValue.addModifyListener(lsMod);
    fdExitValue = new FormData();
    fdExitValue.left = new FormAttachment(0, 0);
    fdExitValue.top = new FormAttachment(wError, margin);
    fdExitValue.right = new FormAttachment(100, 0);
    wExitValue.setLayoutData(fdExitValue);
    FormData fdOutputComp = new FormData();
    fdOutputComp.left = new FormAttachment(0, 0);
    fdOutputComp.top = new FormAttachment(0, 0);
    fdOutputComp.right = new FormAttachment(100, 0);
    fdOutputComp.bottom = new FormAttachment(100, 0);
    wOutputComp.setLayoutData(fdOutputComp);
    wOutputComp.layout();
    wOutputTab.setControl(wOutputComp);
    // ////////////////////
    // END OF OUTPUT TAB //
    // ////////////////////
    FormData 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);
    wTabFolder.setSelection(0);
    // ////////////////////
    // END OF TAB FOLDER //
    // ////////////////////
    // THE BUTTONS
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsOK = new Listener() {

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

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

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

        @Override
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    // Set the shell size, based upon previous time...
    setSize();
    RowMetaInterface r = null;
    try {
        r = transMeta.getPrevStepFields(stepname);
        if (r != null) {
            wArgumentFields.getColumns()[0].setComboValues(r.getFieldNames());
        }
    } catch (KettleStepException ignore) {
    // Do nothing
    }
    getData();
    enableFields();
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) KettleStepException(org.pentaho.di.core.exception.KettleStepException) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) Cursor(org.eclipse.swt.graphics.Cursor) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) 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) Display(org.eclipse.swt.widgets.Display)

Example 65 with ColumnInfo

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

the class FieldsChangeSequenceDialog 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, "FieldsChangeSequenceDialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.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);
    // Result line...
    wlResult = new Label(shell, SWT.RIGHT);
    wlResult.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Result.Label"));
    props.setLook(wlResult);
    fdlResult = new FormData();
    fdlResult.left = new FormAttachment(0, 0);
    fdlResult.right = new FormAttachment(middle, -margin);
    fdlResult.top = new FormAttachment(wStepname, 2 * margin);
    wlResult.setLayoutData(fdlResult);
    wResult = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wResult);
    wResult.addModifyListener(lsMod);
    fdResult = new FormData();
    fdResult.left = new FormAttachment(middle, 0);
    fdResult.top = new FormAttachment(wStepname, 2 * margin);
    fdResult.right = new FormAttachment(100, 0);
    wResult.setLayoutData(fdResult);
    // Start
    wlStart = new Label(shell, SWT.RIGHT);
    wlStart.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Start.Label"));
    props.setLook(wlStart);
    fdlStart = new FormData();
    fdlStart.left = new FormAttachment(0, 0);
    fdlStart.right = new FormAttachment(middle, -margin);
    fdlStart.top = new FormAttachment(wResult, margin);
    wlStart.setLayoutData(fdlStart);
    wStart = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wStart);
    fdStart = new FormData();
    fdStart.left = new FormAttachment(middle, 0);
    fdStart.top = new FormAttachment(wResult, margin);
    fdStart.right = new FormAttachment(100, 0);
    wStart.setLayoutData(fdStart);
    // Increment
    wlIncrement = new Label(shell, SWT.RIGHT);
    wlIncrement.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Increment.Label"));
    props.setLook(wlIncrement);
    fdlIncrement = new FormData();
    fdlIncrement.left = new FormAttachment(0, 0);
    fdlIncrement.right = new FormAttachment(middle, -margin);
    fdlIncrement.top = new FormAttachment(wStart, margin);
    wlIncrement.setLayoutData(fdlIncrement);
    wIncrement = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIncrement);
    fdIncrement = new FormData();
    fdIncrement.left = new FormAttachment(middle, 0);
    fdIncrement.top = new FormAttachment(wStart, margin);
    fdIncrement.right = new FormAttachment(100, 0);
    wIncrement.setLayoutData(fdIncrement);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wGet = new Button(shell, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wGet, wCancel }, margin, null);
    // Table with fields
    wlFields = new Label(shell, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Fields.Label"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wIncrement, margin);
    wlFields.setLayoutData(fdlFields);
    final int FieldsCols = 1;
    final int FieldsRows = input.getFieldName().length;
    colinf = new ColumnInfo[FieldsCols];
    colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Fieldname.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    wFields = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(wlFields, margin);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(wOK, -2 * margin);
    wFields.setLayoutData(fdFields);
    // Add listeners
    lsCancel = new Listener() {

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

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

        public void handleEvent(Event e) {
            ok();
        }
    };
    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);
    wGet.addListener(SWT.Selection, lsGet);
    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();
    // 
    // 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);
                    if (row != null) {
                        // Remember these fields...
                        for (int i = 0; i < row.size(); i++) {
                            inputFields.put(row.getValueMeta(i).getName(), new Integer(i));
                        }
                        setComboBoxes();
                    }
                    // Dislay in red missing field names
                    Display.getDefault().asyncExec(new Runnable() {

                        public void run() {
                            if (!wFields.isDisposed()) {
                                for (int i = 0; i < wFields.table.getItemCount(); i++) {
                                    TableItem it = wFields.table.getItem(i);
                                    if (!Utils.isEmpty(it.getText(1))) {
                                        if (!inputFields.containsKey(it.getText(1))) {
                                            it.setBackground(GUIResource.getInstance().getColorRed());
                                        }
                                    }
                                }
                            }
                        }
                    });
                } catch (KettleException e) {
                    logError(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.ErrorGettingPreviousFields", e.getMessage()));
                }
            }
        }
    };
    new Thread(runnable).start();
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) 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) 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) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) TextVar(org.pentaho.di.ui.core.widget.TextVar) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Display(org.eclipse.swt.widgets.Display)

Aggregations

ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)258 FormAttachment (org.eclipse.swt.layout.FormAttachment)220 FormData (org.eclipse.swt.layout.FormData)220 TableView (org.pentaho.di.ui.core.widget.TableView)216 FormLayout (org.eclipse.swt.layout.FormLayout)200 Label (org.eclipse.swt.widgets.Label)190 Button (org.eclipse.swt.widgets.Button)183 SelectionEvent (org.eclipse.swt.events.SelectionEvent)173 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)168 ShellEvent (org.eclipse.swt.events.ShellEvent)155 Event (org.eclipse.swt.widgets.Event)155 Listener (org.eclipse.swt.widgets.Listener)154 Shell (org.eclipse.swt.widgets.Shell)154 Display (org.eclipse.swt.widgets.Display)152 Text (org.eclipse.swt.widgets.Text)152 ModifyEvent (org.eclipse.swt.events.ModifyEvent)151 ModifyListener (org.eclipse.swt.events.ModifyListener)151 ShellAdapter (org.eclipse.swt.events.ShellAdapter)150 Composite (org.eclipse.swt.widgets.Composite)105 CTabItem (org.eclipse.swt.custom.CTabItem)100