Search in sources :

Example 21 with TableView

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

the class JmsProducerDialog method buildOptionsTab.

private void buildOptionsTab() {
    CTabItem wOptionsTab = new CTabItem(wTabFolder, SWT.NONE);
    wOptionsTab.setText(BaseMessages.getString(PKG, "JmsDialog.Options.Tab"));
    Composite wOptionsComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wOptionsComp);
    FormLayout optionsLayout = new FormLayout();
    optionsLayout.marginHeight = 15;
    optionsLayout.marginWidth = 15;
    wOptionsComp.setLayout(optionsLayout);
    FormData fdOptionsComp = new FormData();
    fdOptionsComp.left = new FormAttachment(0, 0);
    fdOptionsComp.top = new FormAttachment(0, 0);
    fdOptionsComp.right = new FormAttachment(100, 0);
    wOptionsComp.setLayoutData(fdOptionsComp);
    ColumnInfo[] columns = getOptionsColumns();
    int fieldCount = 1;
    optionsTable = new TableView(transMeta, wOptionsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columns, fieldCount, false, lsMod, props, false);
    optionsTable.setSortable(false);
    optionsTable.getTable().addListener(SWT.Resize, event -> {
        Table table = (Table) event.widget;
        table.getColumn(1).setWidth(215);
        table.getColumn(2).setWidth(215);
    });
    populateOptionsTable();
    FormData fdData = new FormData();
    fdData.left = new FormAttachment(0, 0);
    fdData.top = new FormAttachment(0, 0);
    fdData.right = new FormAttachment(100, 0);
    fdData.bottom = new FormAttachment(100, 0);
    fdData.width = INPUT_WIDTH + 10;
    // resize the columns to fit the data in them
    stream(optionsTable.getTable().getColumns()).forEach(column -> {
        if (column.getWidth() > 0) {
            // don't pack anything with a 0 width, it will resize it to make it visible (like the index column)
            column.setWidth(120);
        }
    });
    // don't let any rows get deleted or added (this does not affect the read-only state of the cells)
    optionsTable.setReadonly(true);
    optionsTable.setLayoutData(fdData);
    wOptionsComp.layout();
    wOptionsTab.setControl(wOptionsComp);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) CTabItem(org.eclipse.swt.custom.CTabItem) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView)

Example 22 with TableView

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

the class MQTTConsumerDialog method buildTopicsTable.

private void buildTopicsTable(Composite parentWidget, Control controlAbove, Control controlBelow) {
    ColumnInfo[] columns = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "MQTTConsumerDialog.TopicHeading"), ColumnInfo.COLUMN_TYPE_TEXT, new String[1], false) };
    columns[0].setUsingVariables(true);
    int topicsCount = mqttMeta.getTopics().size();
    topicsTable = new TableView(transMeta, parentWidget, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columns, topicsCount, false, lsMod, props, false);
    topicsTable.setSortable(false);
    topicsTable.getTable().addListener(SWT.Resize, event -> {
        Table table = (Table) event.widget;
        table.getColumn(1).setWidth(330);
    });
    FormData fdData = new FormData();
    fdData.left = new FormAttachment(0, 0);
    fdData.top = new FormAttachment(controlAbove, 5);
    fdData.right = new FormAttachment(0, 350);
    fdData.bottom = new FormAttachment(controlBelow, -10);
    // resize the columns to fit the data in them
    stream(topicsTable.getTable().getColumns()).forEach(column -> {
        if (column.getWidth() > 0) {
            // don't pack anything with a 0 width, it will resize it to make it visible (like the index column)
            column.setWidth(120);
        }
    });
    topicsTable.setLayoutData(fdData);
}
Also used : FormData(org.eclipse.swt.layout.FormData) Table(org.eclipse.swt.widgets.Table) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) Point(org.eclipse.swt.graphics.Point) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView)

Example 23 with TableView

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

the class JobEntryEvalFilesMetricsDialog method open.

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

        public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
        }
    };
    changed = jobEntry.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Tab.General.Label"));
    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // SETTINGS grouping?
    // ////////////////////////
    // START OF SETTINGS GROUP
    // 
    wSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wSettings);
    wSettings.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Settings.Label"));
    FormLayout groupLayout = new FormLayout();
    groupLayout.marginWidth = 10;
    groupLayout.marginHeight = 10;
    wSettings.setLayout(groupLayout);
    // SourceFiles
    wlSourceFiles = new Label(wSettings, SWT.RIGHT);
    wlSourceFiles.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.SourceFiles.Label"));
    props.setLook(wlSourceFiles);
    fdlSourceFiles = new FormData();
    fdlSourceFiles.left = new FormAttachment(0, 0);
    fdlSourceFiles.right = new FormAttachment(middle, -margin);
    fdlSourceFiles.top = new FormAttachment(wName, margin);
    wlSourceFiles.setLayoutData(fdlSourceFiles);
    wSourceFiles = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wSourceFiles.setItems(JobEntryEvalFilesMetrics.SourceFilesDesc);
    // +1: starts at -1
    wSourceFiles.select(0);
    props.setLook(wSourceFiles);
    fdSourceFiles = new FormData();
    fdSourceFiles.left = new FormAttachment(middle, 0);
    fdSourceFiles.top = new FormAttachment(wName, margin);
    fdSourceFiles.right = new FormAttachment(100, 0);
    wSourceFiles.setLayoutData(fdSourceFiles);
    wSourceFiles.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
            RefreshSourceFiles();
        }
    });
    // ResultFilenamesWildcard
    wlResultFilenamesWildcard = new Label(wSettings, SWT.RIGHT);
    wlResultFilenamesWildcard.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFilenamesWildcard.Label"));
    props.setLook(wlResultFilenamesWildcard);
    fdlResultFilenamesWildcard = new FormData();
    fdlResultFilenamesWildcard.left = new FormAttachment(0, 0);
    fdlResultFilenamesWildcard.top = new FormAttachment(wSourceFiles, margin);
    fdlResultFilenamesWildcard.right = new FormAttachment(middle, -margin);
    wlResultFilenamesWildcard.setLayoutData(fdlResultFilenamesWildcard);
    wResultFilenamesWildcard = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wResultFilenamesWildcard.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFilenamesWildcard.Tooltip"));
    props.setLook(wResultFilenamesWildcard);
    wResultFilenamesWildcard.addModifyListener(lsMod);
    fdResultFilenamesWildcard = new FormData();
    fdResultFilenamesWildcard.left = new FormAttachment(middle, 0);
    fdResultFilenamesWildcard.top = new FormAttachment(wSourceFiles, margin);
    fdResultFilenamesWildcard.right = new FormAttachment(100, -margin);
    wResultFilenamesWildcard.setLayoutData(fdResultFilenamesWildcard);
    // ResultFieldFile
    wlResultFieldFile = new Label(wSettings, SWT.RIGHT);
    wlResultFieldFile.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFieldFile.Label"));
    props.setLook(wlResultFieldFile);
    fdlResultFieldFile = new FormData();
    fdlResultFieldFile.left = new FormAttachment(0, 0);
    fdlResultFieldFile.top = new FormAttachment(wResultFilenamesWildcard, margin);
    fdlResultFieldFile.right = new FormAttachment(middle, -margin);
    wlResultFieldFile.setLayoutData(fdlResultFieldFile);
    wResultFieldFile = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wResultFieldFile.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFieldFile.Tooltip"));
    props.setLook(wResultFieldFile);
    wResultFieldFile.addModifyListener(lsMod);
    fdResultFieldFile = new FormData();
    fdResultFieldFile.left = new FormAttachment(middle, 0);
    fdResultFieldFile.top = new FormAttachment(wResultFilenamesWildcard, margin);
    fdResultFieldFile.right = new FormAttachment(100, -margin);
    wResultFieldFile.setLayoutData(fdResultFieldFile);
    // ResultFieldWildcard
    wlResultFieldWildcard = new Label(wSettings, SWT.RIGHT);
    wlResultFieldWildcard.setText(BaseMessages.getString(PKG, "JobEvalWildcardsMetrics.ResultFieldWildcard.Label"));
    props.setLook(wlResultFieldWildcard);
    fdlResultFieldWildcard = new FormData();
    fdlResultFieldWildcard.left = new FormAttachment(0, 0);
    fdlResultFieldWildcard.top = new FormAttachment(wResultFieldFile, margin);
    fdlResultFieldWildcard.right = new FormAttachment(middle, -margin);
    wlResultFieldWildcard.setLayoutData(fdlResultFieldWildcard);
    wResultFieldWildcard = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wResultFieldWildcard.setToolTipText(BaseMessages.getString(PKG, "JobEvalWildcardsMetrics.ResultFieldWildcard.Tooltip"));
    props.setLook(wResultFieldWildcard);
    wResultFieldWildcard.addModifyListener(lsMod);
    fdResultFieldWildcard = new FormData();
    fdResultFieldWildcard.left = new FormAttachment(middle, 0);
    fdResultFieldWildcard.top = new FormAttachment(wResultFieldFile, margin);
    fdResultFieldWildcard.right = new FormAttachment(100, -margin);
    wResultFieldWildcard.setLayoutData(fdResultFieldWildcard);
    // ResultFieldIncludeSubFolders
    wlResultFieldIncludeSubFolders = new Label(wSettings, SWT.RIGHT);
    wlResultFieldIncludeSubFolders.setText(BaseMessages.getString(PKG, "JobEvalIncludeSubFolderssMetrics.ResultFieldIncludeSubFolders.Label"));
    props.setLook(wlResultFieldIncludeSubFolders);
    fdlResultFieldIncludeSubFolders = new FormData();
    fdlResultFieldIncludeSubFolders.left = new FormAttachment(0, 0);
    fdlResultFieldIncludeSubFolders.top = new FormAttachment(wResultFieldWildcard, margin);
    fdlResultFieldIncludeSubFolders.right = new FormAttachment(middle, -margin);
    wlResultFieldIncludeSubFolders.setLayoutData(fdlResultFieldIncludeSubFolders);
    wResultFieldIncludeSubFolders = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wResultFieldIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "JobEvalIncludeSubFolderssMetrics.ResultFieldIncludeSubFolders.Tooltip"));
    props.setLook(wResultFieldIncludeSubFolders);
    wResultFieldIncludeSubFolders.addModifyListener(lsMod);
    fdResultFieldIncludeSubFolders = new FormData();
    fdResultFieldIncludeSubFolders.left = new FormAttachment(middle, 0);
    fdResultFieldIncludeSubFolders.top = new FormAttachment(wResultFieldWildcard, margin);
    fdResultFieldIncludeSubFolders.right = new FormAttachment(100, -margin);
    wResultFieldIncludeSubFolders.setLayoutData(fdResultFieldIncludeSubFolders);
    // EvaluationType
    wlEvaluationType = new Label(wSettings, SWT.RIGHT);
    wlEvaluationType.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.EvaluationType.Label"));
    props.setLook(wlEvaluationType);
    fdlEvaluationType = new FormData();
    fdlEvaluationType.left = new FormAttachment(0, 0);
    fdlEvaluationType.right = new FormAttachment(middle, -margin);
    fdlEvaluationType.top = new FormAttachment(wResultFieldIncludeSubFolders, margin);
    wlEvaluationType.setLayoutData(fdlEvaluationType);
    wEvaluationType = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wEvaluationType.setItems(JobEntryEvalFilesMetrics.EvaluationTypeDesc);
    // +1: starts at -1
    wEvaluationType.select(0);
    props.setLook(wEvaluationType);
    fdEvaluationType = new FormData();
    fdEvaluationType.left = new FormAttachment(middle, 0);
    fdEvaluationType.top = new FormAttachment(wResultFieldIncludeSubFolders, margin);
    fdEvaluationType.right = new FormAttachment(100, 0);
    wEvaluationType.setLayoutData(fdEvaluationType);
    wEvaluationType.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            RefreshSize();
            jobEntry.setChanged();
        }
    });
    fdSettings = new FormData();
    fdSettings.left = new FormAttachment(0, margin);
    fdSettings.top = new FormAttachment(wName, margin);
    fdSettings.right = new FormAttachment(100, -margin);
    wSettings.setLayoutData(fdSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // SourceFileFolder line
    wlSourceFileFolder = new Label(wGeneralComp, SWT.RIGHT);
    wlSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.SourceFileFolder.Label"));
    props.setLook(wlSourceFileFolder);
    fdlSourceFileFolder = new FormData();
    fdlSourceFileFolder.left = new FormAttachment(0, 0);
    fdlSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin);
    fdlSourceFileFolder.right = new FormAttachment(middle, -margin);
    wlSourceFileFolder.setLayoutData(fdlSourceFileFolder);
    // Browse Source folders button ...
    wbSourceDirectory = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbSourceDirectory);
    wbSourceDirectory.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.BrowseFolders.Label"));
    fdbSourceDirectory = new FormData();
    fdbSourceDirectory.right = new FormAttachment(100, 0);
    fdbSourceDirectory.top = new FormAttachment(wSettings, margin);
    wbSourceDirectory.setLayoutData(fdbSourceDirectory);
    wbSourceDirectory.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wSourceFileFolder.getText() != null) {
                ddialog.setFilterPath(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
            }
            // Calling open() will open and run the dialog.
            // It will return the selected directory, or
            // null if user cancels
            String dir = ddialog.open();
            if (dir != null) {
                // Set the text box to the new selection
                wSourceFileFolder.setText(dir);
            }
        }
    });
    // Browse Source files button ...
    wbSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbSourceFileFolder);
    wbSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.BrowseFiles.Label"));
    fdbSourceFileFolder = new FormData();
    fdbSourceFileFolder.right = new FormAttachment(wbSourceDirectory, -margin);
    fdbSourceFileFolder.top = new FormAttachment(wSettings, margin);
    wbSourceFileFolder.setLayoutData(fdbSourceFileFolder);
    // Browse Destination file add button ...
    wbaSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbaSourceFileFolder);
    wbaSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameAdd.Button"));
    fdbaSourceFileFolder = new FormData();
    fdbaSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -margin);
    fdbaSourceFileFolder.top = new FormAttachment(wSettings, margin);
    wbaSourceFileFolder.setLayoutData(fdbaSourceFileFolder);
    wSourceFileFolder = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wSourceFileFolder.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.SourceFileFolder.Tooltip"));
    props.setLook(wSourceFileFolder);
    wSourceFileFolder.addModifyListener(lsMod);
    fdSourceFileFolder = new FormData();
    fdSourceFileFolder.left = new FormAttachment(middle, 0);
    fdSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin);
    fdSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -55);
    wSourceFileFolder.setLayoutData(fdSourceFileFolder);
    // Whenever something changes, set the tooltip to the expanded version:
    wSourceFileFolder.addModifyListener(new ModifyListener() {

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

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*" });
            if (wSourceFileFolder.getText() != null) {
                dialog.setFileName(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
                wSourceFileFolder.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
        }
    });
    // Buttons to the right of the screen...
    wbdSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbdSourceFileFolder);
    wbdSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameDelete.Button"));
    wbdSourceFileFolder.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameDelete.Tooltip"));
    fdbdSourceFileFolder = new FormData();
    fdbdSourceFileFolder.right = new FormAttachment(100, 0);
    fdbdSourceFileFolder.top = new FormAttachment(wSourceFileFolder, 40);
    wbdSourceFileFolder.setLayoutData(fdbdSourceFileFolder);
    wbeSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbeSourceFileFolder);
    wbeSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameEdit.Button"));
    fdbeSourceFileFolder = new FormData();
    fdbeSourceFileFolder.right = new FormAttachment(100, 0);
    fdbeSourceFileFolder.left = new FormAttachment(wbdSourceFileFolder, 0, SWT.LEFT);
    fdbeSourceFileFolder.top = new FormAttachment(wbdSourceFileFolder, margin);
    wbeSourceFileFolder.setLayoutData(fdbeSourceFileFolder);
    // Wildcard
    wlWildcard = new Label(wGeneralComp, SWT.RIGHT);
    wlWildcard.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Wildcard.Label"));
    props.setLook(wlWildcard);
    fdlWildcard = new FormData();
    fdlWildcard.left = new FormAttachment(0, 0);
    fdlWildcard.top = new FormAttachment(wSourceFileFolder, margin);
    fdlWildcard.right = new FormAttachment(middle, -margin);
    wlWildcard.setLayoutData(fdlWildcard);
    wWildcard = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wWildcard.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Wildcard.Tooltip"));
    props.setLook(wWildcard);
    wWildcard.addModifyListener(lsMod);
    fdWildcard = new FormData();
    fdWildcard.left = new FormAttachment(middle, 0);
    fdWildcard.top = new FormAttachment(wSourceFileFolder, margin);
    fdWildcard.right = new FormAttachment(wbSourceFileFolder, -55);
    wWildcard.setLayoutData(fdWildcard);
    wlFields = new Label(wGeneralComp, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.Label"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.right = new FormAttachment(middle, -margin);
    fdlFields.top = new FormAttachment(wWildcard, margin);
    wlFields.setLayoutData(fdlFields);
    int rows = jobEntry.getSourceFileFolder() == null ? 1 : (jobEntry.getSourceFileFolder().length == 0 ? 0 : jobEntry.getSourceFileFolder().length);
    final int FieldsRows = rows;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.SourceFileFolder.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.Wildcard.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.IncludeSubDirs.Label"), ColumnInfo.COLUMN_TYPE_CCOMBO, JobEntryEvalFilesMetrics.IncludeSubFoldersDesc) };
    colinf[0].setUsingVariables(true);
    colinf[0].setToolTip(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.SourceFileFolder.Tooltip"));
    colinf[1].setUsingVariables(true);
    colinf[1].setToolTip(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.Wildcard.Tooltip"));
    wFields = new TableView(jobMeta, wGeneralComp, 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(wbeSourceFileFolder, -margin);
    fdFields.bottom = new FormAttachment(100, -margin);
    wFields.setLayoutData(fdFields);
    // RefreshArgFromPrevious();
    // Add the file to the list of files...
    SelectionAdapter selA = new SelectionAdapter() {

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

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

        public void widgetSelected(SelectionEvent arg0) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                String[] string = wFields.getItem(idx);
                wSourceFileFolder.setText(string[0]);
                wWildcard.setText(string[1]);
                wFields.remove(idx);
            }
            wFields.removeEmptyRows();
            wFields.setRowNums();
        }
    });
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////////////////
    // START OF ADVANCED TAB ///
    // ///////////////////////////////////
    wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
    wAdvancedTab.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Tab.Advanced.Label"));
    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;
    wAdvancedComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wAdvancedComp);
    wAdvancedComp.setLayout(contentLayout);
    // SuccessOngrouping?
    // ////////////////////////
    // START OF SUCCESS ON GROUP///
    // /
    wSuccessOn = new Group(wAdvancedComp, SWT.SHADOW_NONE);
    props.setLook(wSuccessOn);
    wSuccessOn.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.SuccessOn.Group.Label"));
    FormLayout successongroupLayout = new FormLayout();
    successongroupLayout.marginWidth = 10;
    successongroupLayout.marginHeight = 10;
    wSuccessOn.setLayout(successongroupLayout);
    // Scale
    wlScale = new Label(wSuccessOn, SWT.RIGHT);
    wlScale.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.Scale.Label"));
    props.setLook(wlScale);
    fdlScale = new FormData();
    fdlScale.left = new FormAttachment(0, 0);
    fdlScale.right = new FormAttachment(middle, -margin);
    fdlScale.top = new FormAttachment(0, margin);
    wlScale.setLayoutData(fdlScale);
    wScale = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wScale.setItems(JobEntryEvalFilesMetrics.scaleDesc);
    // +1: starts at -1
    wScale.select(0);
    props.setLook(wScale);
    fdScale = new FormData();
    fdScale.left = new FormAttachment(middle, 0);
    fdScale.top = new FormAttachment(0, margin);
    fdScale.right = new FormAttachment(100, 0);
    wScale.setLayoutData(fdScale);
    wScale.addSelectionListener(new SelectionAdapter() {

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

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

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

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

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

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

Example 24 with TableView

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

the class MailInputDialog 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) {
            closeMailConnection();
            input.setChanged();
        }
    };
    SelectionListener lsSelection = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            closeMailConnection();
        }
    };
    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, "MailInputdialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "MailInputdialog.Stepname.Label"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.right = new FormAttachment(middle, -margin);
    fdlStepname.top = new FormAttachment(0, margin);
    wlStepname.setLayoutData(fdlStepname);
    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.General.Label"));
    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wServerSettings);
    wServerSettings.setText(BaseMessages.getString(PKG, "MailInput.ServerSettings.Group.Label"));
    FormLayout ServerSettingsgroupLayout = new FormLayout();
    ServerSettingsgroupLayout.marginWidth = 10;
    ServerSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(ServerSettingsgroupLayout);
    // ServerName line
    wlServerName = new Label(wServerSettings, SWT.RIGHT);
    wlServerName.setText(BaseMessages.getString(PKG, "MailInput.Server.Label"));
    props.setLook(wlServerName);
    fdlServerName = new FormData();
    fdlServerName.left = new FormAttachment(0, 0);
    fdlServerName.top = new FormAttachment(0, 2 * margin);
    fdlServerName.right = new FormAttachment(middle, -margin);
    wlServerName.setLayoutData(fdlServerName);
    wServerName = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    fdServerName = new FormData();
    fdServerName.left = new FormAttachment(middle, 0);
    fdServerName.top = new FormAttachment(0, 2 * margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // USE connection with SSL
    wlUseSSL = new Label(wServerSettings, SWT.RIGHT);
    wlUseSSL.setText(BaseMessages.getString(PKG, "MailInput.UseSSLMails.Label"));
    props.setLook(wlUseSSL);
    fdlUseSSL = new FormData();
    fdlUseSSL.left = new FormAttachment(0, 0);
    fdlUseSSL.top = new FormAttachment(wServerName, margin);
    fdlUseSSL.right = new FormAttachment(middle, -margin);
    wlUseSSL.setLayoutData(fdlUseSSL);
    wUseSSL = new Button(wServerSettings, SWT.CHECK);
    props.setLook(wUseSSL);
    fdUseSSL = new FormData();
    wUseSSL.setToolTipText(BaseMessages.getString(PKG, "MailInput.UseSSLMails.Tooltip"));
    fdUseSSL.left = new FormAttachment(middle, 0);
    fdUseSSL.top = new FormAttachment(wServerName, margin);
    fdUseSSL.right = new FormAttachment(100, 0);
    wUseSSL.setLayoutData(fdUseSSL);
    wUseSSL.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            closeMailConnection();
            refreshPort(true);
        }
    });
    // port
    wlPort = new Label(wServerSettings, SWT.RIGHT);
    wlPort.setText(BaseMessages.getString(PKG, "MailInput.SSLPort.Label"));
    props.setLook(wlPort);
    fdlPort = new FormData();
    fdlPort.left = new FormAttachment(0, 0);
    fdlPort.top = new FormAttachment(wUseSSL, margin);
    fdlPort.right = new FormAttachment(middle, -margin);
    wlPort.setLayoutData(fdlPort);
    wPort = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPort);
    wPort.setToolTipText(BaseMessages.getString(PKG, "MailInput.SSLPort.Tooltip"));
    wPort.addModifyListener(lsMod);
    fdPort = new FormData();
    fdPort.left = new FormAttachment(middle, 0);
    fdPort.top = new FormAttachment(wUseSSL, margin);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);
    // UserName line
    wlUserName = new Label(wServerSettings, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "MailInput.Username.Label"));
    props.setLook(wlUserName);
    fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wPort, margin);
    fdlUserName.right = new FormAttachment(middle, -margin);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.setToolTipText(BaseMessages.getString(PKG, "MailInput.Username.Tooltip"));
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wPort, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wlPassword = new Label(wServerSettings, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "MailInput.Password.Label"));
    props.setLook(wlPassword);
    fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wUserName, margin);
    fdlPassword.right = new FormAttachment(middle, -margin);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // USE proxy
    wlUseProxy = new Label(wServerSettings, SWT.RIGHT);
    wlUseProxy.setText(BaseMessages.getString(PKG, "MailInput.UseProxyMails.Label"));
    props.setLook(wlUseProxy);
    fdlUseProxy = new FormData();
    fdlUseProxy.left = new FormAttachment(0, 0);
    fdlUseProxy.top = new FormAttachment(wPassword, 2 * margin);
    fdlUseProxy.right = new FormAttachment(middle, -margin);
    wlUseProxy.setLayoutData(fdlUseProxy);
    wUseProxy = new Button(wServerSettings, SWT.CHECK);
    props.setLook(wUseProxy);
    fdUseProxy = new FormData();
    wUseProxy.setToolTipText(BaseMessages.getString(PKG, "MailInput.UseProxyMails.Tooltip"));
    fdUseProxy.left = new FormAttachment(middle, 0);
    fdUseProxy.top = new FormAttachment(wPassword, 2 * margin);
    fdUseProxy.right = new FormAttachment(100, 0);
    wUseProxy.setLayoutData(fdUseProxy);
    wUseProxy.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setUserProxy();
            input.setChanged();
        }
    });
    // ProxyUsername line
    wlProxyUsername = new Label(wServerSettings, SWT.RIGHT);
    wlProxyUsername.setText(BaseMessages.getString(PKG, "MailInput.ProxyUsername.Label"));
    wProxyUsername = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wProxyUsername.setToolTipText(BaseMessages.getString(PKG, "MailInput.ProxyUsername.Tooltip"));
    wProxyUsername.addModifyListener(lsMod);
    addLabelInputPairBelow(wlProxyUsername, wProxyUsername, wUseProxy);
    // Use Batch label/checkbox
    Label wlUseBatch = new Label(wServerSettings, SWT.RIGHT);
    wlUseBatch.setText(BaseMessages.getString(PKG, "MailInputDialog.UseBatch.Label"));
    wUseBatch = new Button(wServerSettings, SWT.CHECK);
    wUseBatch.setToolTipText(BaseMessages.getString(PKG, "MailInputDialog.UseBatch.Tooltip"));
    wUseBatch.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setBatchSettingsEnabled();
        }
    });
    addLabelInputPairBelow(wlUseBatch, wUseBatch, wProxyUsername);
    // ignore field errors
    wlIgnoreFieldErrors = new Label(wServerSettings, SWT.RIGHT);
    wlIgnoreFieldErrors.setText(BaseMessages.getString(PKG, "MailInput.IgnoreFieldErrors.Label"));
    wIgnoreFieldErrors = new Button(wServerSettings, SWT.CHECK);
    wIgnoreFieldErrors.setToolTipText(BaseMessages.getString(PKG, "MailInput.IgnoreFieldErrors.Tooltip"));
    addLabelInputPairBelow(wlIgnoreFieldErrors, wIgnoreFieldErrors, wUseBatch);
    // Protocol
    wlProtocol = new Label(wServerSettings, SWT.RIGHT);
    wlProtocol.setText(BaseMessages.getString(PKG, "MailInput.Protocol.Label"));
    wProtocol = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wProtocol.setItems(MailConnectionMeta.protocolCodes);
    wProtocol.select(0);
    wProtocol.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            refreshProtocol(true);
        }
    });
    addLabelInputPairBelow(wlProtocol, wProtocol, wIgnoreFieldErrors);
    // Test connection button
    wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "MailInput.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "MailInput.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wProtocol, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wProtocol, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(wStepname, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF SETTINGS TAB ///
    // ////////////////////////
    wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
    wSettingsTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.Pop.Label"));
    wSettingsComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSettingsComp);
    FormLayout PopLayout = new FormLayout();
    PopLayout.marginWidth = 3;
    PopLayout.marginHeight = 3;
    wSettingsComp.setLayout(PopLayout);
    // Message: for POP3, only INBOX folder is available!
    wlPOP3Message = new Label(wSettingsComp, SWT.RIGHT);
    wlPOP3Message.setText(BaseMessages.getString(PKG, "MailInput.POP3Message.Label"));
    props.setLook(wlPOP3Message);
    fdlPOP3Message = new FormData();
    fdlPOP3Message.left = new FormAttachment(0, margin);
    fdlPOP3Message.top = new FormAttachment(0, 3 * margin);
    wlPOP3Message.setLayoutData(fdlPOP3Message);
    wlPOP3Message.setForeground(GUIResource.getInstance().getColorOrange());
    // ////////////////////////
    // START OF POP3 Settings GROUP///
    // /
    wPOP3Settings = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wPOP3Settings);
    wPOP3Settings.setText(BaseMessages.getString(PKG, "MailInput.POP3Settings.Group.Label"));
    FormLayout POP3SettingsgroupLayout = new FormLayout();
    POP3SettingsgroupLayout.marginWidth = 10;
    POP3SettingsgroupLayout.marginHeight = 10;
    wPOP3Settings.setLayout(POP3SettingsgroupLayout);
    // List of mails of retrieve
    wlListmails = new Label(wPOP3Settings, SWT.RIGHT);
    wlListmails.setText(BaseMessages.getString(PKG, "MailInput.Listmails.Label"));
    props.setLook(wlListmails);
    fdlListmails = new FormData();
    fdlListmails.left = new FormAttachment(0, 0);
    fdlListmails.right = new FormAttachment(middle, 0);
    fdlListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
    wlListmails.setLayoutData(fdlListmails);
    wListmails = new CCombo(wPOP3Settings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wListmails.add(BaseMessages.getString(PKG, "MailInput.RetrieveAllMails.Label"));
    // [PDI-7241] pop3 does not support retrive unread option
    // wListmails.add( BaseMessages.getString( PKG, "MailInput.RetrieveUnreadMails.Label" ) );
    wListmails.add(BaseMessages.getString(PKG, "MailInput.RetrieveFirstMails.Label"));
    // +1: starts at -1
    wListmails.select(0);
    props.setLook(wListmails);
    fdListmails = new FormData();
    fdListmails.left = new FormAttachment(middle, 0);
    fdListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
    fdListmails.right = new FormAttachment(100, 0);
    wListmails.setLayoutData(fdListmails);
    wListmails.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            chooseListMails();
        }
    });
    // Retrieve the first ... mails
    wlFirstmails = new Label(wPOP3Settings, SWT.RIGHT);
    wlFirstmails.setText(BaseMessages.getString(PKG, "MailInput.Firstmails.Label"));
    props.setLook(wlFirstmails);
    fdlFirstmails = new FormData();
    fdlFirstmails.left = new FormAttachment(0, 0);
    fdlFirstmails.right = new FormAttachment(middle, -margin);
    fdlFirstmails.top = new FormAttachment(wListmails, margin);
    wlFirstmails.setLayoutData(fdlFirstmails);
    wFirstmails = new TextVar(transMeta, wPOP3Settings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFirstmails);
    wFirstmails.addModifyListener(lsMod);
    fdFirstmails = new FormData();
    fdFirstmails.left = new FormAttachment(middle, 0);
    fdFirstmails.top = new FormAttachment(wListmails, margin);
    fdFirstmails.right = new FormAttachment(100, 0);
    wFirstmails.setLayoutData(fdFirstmails);
    fdPOP3Settings = new FormData();
    fdPOP3Settings.left = new FormAttachment(0, margin);
    fdPOP3Settings.top = new FormAttachment(wlPOP3Message, 2 * margin);
    fdPOP3Settings.right = new FormAttachment(100, -margin);
    wPOP3Settings.setLayoutData(fdPOP3Settings);
    // ///////////////////////////////////////////////////////////
    // / END OF POP3 SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF IMAP Settings GROUP///
    // /
    wIMAPSettings = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wIMAPSettings);
    wIMAPSettings.setText(BaseMessages.getString(PKG, "MailInput.IMAPSettings.Groupp.Label"));
    FormLayout IMAPSettingsgroupLayout = new FormLayout();
    IMAPSettingsgroupLayout.marginWidth = 10;
    IMAPSettingsgroupLayout.marginHeight = 10;
    wIMAPSettings.setLayout(IMAPSettingsgroupLayout);
    // Is folder name defined in a Field
    wldynamicFolder = new Label(wIMAPSettings, SWT.RIGHT);
    wldynamicFolder.setText(BaseMessages.getString(PKG, "MailInput.dynamicFolder.Label"));
    props.setLook(wldynamicFolder);
    fdldynamicFolder = new FormData();
    fdldynamicFolder.left = new FormAttachment(0, 0);
    fdldynamicFolder.top = new FormAttachment(0, margin);
    fdldynamicFolder.right = new FormAttachment(middle, -margin);
    wldynamicFolder.setLayoutData(fdldynamicFolder);
    wdynamicFolder = new Button(wIMAPSettings, SWT.CHECK);
    props.setLook(wdynamicFolder);
    wdynamicFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.dynamicFolder.Tooltip"));
    fddynamicFolder = new FormData();
    fddynamicFolder.left = new FormAttachment(middle, 0);
    fddynamicFolder.top = new FormAttachment(0, margin);
    wdynamicFolder.setLayoutData(fddynamicFolder);
    SelectionAdapter lsxmlstream = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            activedynamicFolder();
            input.setChanged();
        }
    };
    wdynamicFolder.addSelectionListener(lsxmlstream);
    // Folder field
    wlFolderField = new Label(wIMAPSettings, SWT.RIGHT);
    wlFolderField.setText(BaseMessages.getString(PKG, "MailInput.wlFolderField.Label"));
    props.setLook(wlFolderField);
    fdlFolderField = new FormData();
    fdlFolderField.left = new FormAttachment(0, 0);
    fdlFolderField.top = new FormAttachment(wdynamicFolder, margin);
    fdlFolderField.right = new FormAttachment(middle, -margin);
    wlFolderField.setLayoutData(fdlFolderField);
    wFolderField = new CCombo(wIMAPSettings, SWT.BORDER | SWT.READ_ONLY);
    wFolderField.setEditable(true);
    props.setLook(wFolderField);
    wFolderField.addModifyListener(lsMod);
    fdFolderField = new FormData();
    fdFolderField.left = new FormAttachment(middle, 0);
    fdFolderField.top = new FormAttachment(wdynamicFolder, margin);
    fdFolderField.right = new FormAttachment(100, -margin);
    wFolderField.setLayoutData(fdFolderField);
    wFolderField.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            setFolderField();
        }
    });
    // SelectFolder button
    wSelectFolder = new Button(wIMAPSettings, SWT.PUSH);
    wSelectFolder.setImage(GUIResource.getInstance().getImageBol());
    wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.SelectFolderConnection.Label"));
    props.setLook(wSelectFolder);
    fdSelectFolder = new FormData();
    wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.SelectFolderConnection.Tooltip"));
    fdSelectFolder.top = new FormAttachment(wFolderField, margin);
    fdSelectFolder.right = new FormAttachment(100, 0);
    wSelectFolder.setLayoutData(fdSelectFolder);
    // TestIMAPFolder button
    wTestIMAPFolder = new Button(wIMAPSettings, SWT.PUSH);
    wTestIMAPFolder.setText(BaseMessages.getString(PKG, "MailInput.TestIMAPFolderConnection.Label"));
    props.setLook(wTestIMAPFolder);
    fdTestIMAPFolder = new FormData();
    wTestIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.TestIMAPFolderConnection.Tooltip"));
    fdTestIMAPFolder.top = new FormAttachment(wFolderField, margin);
    fdTestIMAPFolder.right = new FormAttachment(wSelectFolder, -margin);
    wTestIMAPFolder.setLayoutData(fdTestIMAPFolder);
    // IMAPFolder line
    wlIMAPFolder = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPFolder.setText(BaseMessages.getString(PKG, "MailInput.IMAPFolder.Label"));
    props.setLook(wlIMAPFolder);
    fdlIMAPFolder = new FormData();
    fdlIMAPFolder.left = new FormAttachment(0, 0);
    fdlIMAPFolder.top = new FormAttachment(wFolderField, margin);
    fdlIMAPFolder.right = new FormAttachment(middle, -margin);
    wlIMAPFolder.setLayoutData(fdlIMAPFolder);
    wIMAPFolder = new TextVar(transMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIMAPFolder);
    wIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.IMAPFolder.Tooltip"));
    wIMAPFolder.addModifyListener(lsMod);
    fdIMAPFolder = new FormData();
    fdIMAPFolder.left = new FormAttachment(middle, 0);
    fdIMAPFolder.top = new FormAttachment(wFolderField, margin);
    fdIMAPFolder.right = new FormAttachment(wTestIMAPFolder, -margin);
    wIMAPFolder.setLayoutData(fdIMAPFolder);
    // Include subfolders?
    wlIncludeSubFolders = new Label(wIMAPSettings, SWT.RIGHT);
    wlIncludeSubFolders.setText(BaseMessages.getString(PKG, "MailInput.IncludeSubFoldersMails.Label"));
    props.setLook(wlIncludeSubFolders);
    fdlIncludeSubFolders = new FormData();
    fdlIncludeSubFolders.left = new FormAttachment(0, 0);
    fdlIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
    fdlIncludeSubFolders.right = new FormAttachment(middle, -margin);
    wlIncludeSubFolders.setLayoutData(fdlIncludeSubFolders);
    wIncludeSubFolders = new Button(wIMAPSettings, SWT.CHECK);
    props.setLook(wIncludeSubFolders);
    fdIncludeSubFolders = new FormData();
    wIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "MailInput.IncludeSubFoldersMails.Tooltip"));
    fdIncludeSubFolders.left = new FormAttachment(middle, 0);
    fdIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
    fdIncludeSubFolders.right = new FormAttachment(100, 0);
    wIncludeSubFolders.setLayoutData(fdIncludeSubFolders);
    wIncludeSubFolders.addSelectionListener(lsSelection);
    // List of mails of retrieve
    wlIMAPListmails = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPListmails.setText(BaseMessages.getString(PKG, "MailInput.IMAPListmails.Label"));
    props.setLook(wlIMAPListmails);
    fdlIMAPListmails = new FormData();
    fdlIMAPListmails.left = new FormAttachment(0, 0);
    fdlIMAPListmails.right = new FormAttachment(middle, -margin);
    fdlIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
    wlIMAPListmails.setLayoutData(fdlIMAPListmails);
    wIMAPListmails = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wIMAPListmails.setItems(MailConnectionMeta.valueIMAPListDesc);
    // +1: starts at -1
    wIMAPListmails.select(0);
    props.setLook(wIMAPListmails);
    fdIMAPListmails = new FormData();
    fdIMAPListmails.left = new FormAttachment(middle, 0);
    fdIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
    fdIMAPListmails.right = new FormAttachment(100, 0);
    wIMAPListmails.setLayoutData(fdIMAPListmails);
    wIMAPListmails.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
        // ChooseIMAPListmails();
        }
    });
    // Retrieve the first ... mails
    wlIMAPFirstmails = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPFirstmails.setText(BaseMessages.getString(PKG, "MailInput.IMAPFirstmails.Label"));
    props.setLook(wlIMAPFirstmails);
    fdlIMAPFirstmails = new FormData();
    fdlIMAPFirstmails.left = new FormAttachment(0, 0);
    fdlIMAPFirstmails.right = new FormAttachment(middle, -margin);
    fdlIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
    wlIMAPFirstmails.setLayoutData(fdlIMAPFirstmails);
    wIMAPFirstmails = new TextVar(transMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIMAPFirstmails);
    wIMAPFirstmails.addModifyListener(lsMod);
    fdIMAPFirstmails = new FormData();
    fdIMAPFirstmails.left = new FormAttachment(middle, 0);
    fdIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
    fdIMAPFirstmails.right = new FormAttachment(100, 0);
    wIMAPFirstmails.setLayoutData(fdIMAPFirstmails);
    fdIMAPSettings = new FormData();
    fdIMAPSettings.left = new FormAttachment(0, margin);
    fdIMAPSettings.top = new FormAttachment(wPOP3Settings, 2 * margin);
    fdIMAPSettings.right = new FormAttachment(100, -margin);
    wIMAPSettings.setLayoutData(fdIMAPSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF IMAP SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////////////
    // START OF Batch Settings GROUP///
    // 
    wBatchSettingsGroup = createGroup(wSettingsComp, wIMAPSettings, BaseMessages.getString(PKG, "MailInputDialog.BatchSettingsGroup.Label"));
    // Batch size
    Label wlBatchSize = new Label(wBatchSettingsGroup, SWT.RIGHT);
    wlBatchSize.setText(BaseMessages.getString(PKG, "MailInputDialog.BatchSize.Label"));
    wBatchSize = new Text(wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    addLabelInputPairBelow(wlBatchSize, wBatchSize, wBatchSettingsGroup);
    // Starting message
    Label wlStartMessage = new Label(wBatchSettingsGroup, SWT.RIGHT);
    wlStartMessage.setText(BaseMessages.getString(PKG, "MailInputDialog.StartMessage.Label"));
    wStartMessage = new TextVar(transMeta, wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    addLabelInputPairBelow(wlStartMessage, wStartMessage, wBatchSize);
    // Last message
    Label wlEndMessage = new Label(wBatchSettingsGroup, SWT.RIGHT);
    wlEndMessage.setText(BaseMessages.getString(PKG, "MailInputDialog.EndMessage.Label"));
    wEndMessage = new TextVar(transMeta, wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    addLabelInputPairBelow(wlEndMessage, wEndMessage, wStartMessage);
    // 
    // / END OF Batch Settings GROUP
    // ///////////////////////////////
    fdSettingsComp = new FormData();
    fdSettingsComp.left = new FormAttachment(0, 0);
    fdSettingsComp.top = new FormAttachment(wStepname, 0);
    fdSettingsComp.right = new FormAttachment(100, 0);
    fdSettingsComp.bottom = new FormAttachment(100, 0);
    wSettingsComp.setLayoutData(fdSettingsComp);
    wSettingsComp.layout();
    wSettingsTab.setControl(wSettingsComp);
    props.setLook(wSettingsComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Pop TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF SEARCH TAB ///
    // ////////////////////////
    wSearchTab = new CTabItem(wTabFolder, SWT.NONE);
    wSearchTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.Search.Label"));
    wSearchComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSearchComp);
    FormLayout searchLayout = new FormLayout();
    searchLayout.marginWidth = 3;
    searchLayout.marginHeight = 3;
    wSearchComp.setLayout(searchLayout);
    // ////////////////////////
    // START OF HEADER ROUP///
    // /
    wHeader = new Group(wSearchComp, SWT.SHADOW_NONE);
    props.setLook(wHeader);
    wHeader.setText(BaseMessages.getString(PKG, "MailInput.Header.Group.Label"));
    FormLayout HeadergroupLayout = new FormLayout();
    HeadergroupLayout.marginWidth = 10;
    HeadergroupLayout.marginHeight = 10;
    wHeader.setLayout(HeadergroupLayout);
    wNegateSender = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateSender);
    fdNegateSender = new FormData();
    wNegateSender.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateSender.Tooltip"));
    fdNegateSender.top = new FormAttachment(0, margin);
    fdNegateSender.right = new FormAttachment(100, -margin);
    wNegateSender.setLayoutData(fdNegateSender);
    // From line
    wlSender = new Label(wHeader, SWT.RIGHT);
    wlSender.setText(BaseMessages.getString(PKG, "MailInput.wSender.Label"));
    props.setLook(wlSender);
    fdlSender = new FormData();
    fdlSender.left = new FormAttachment(0, 0);
    fdlSender.top = new FormAttachment(0, margin);
    fdlSender.right = new FormAttachment(middle, -margin);
    wlSender.setLayoutData(fdlSender);
    wSender = new TextVar(transMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSender);
    wSender.addModifyListener(lsMod);
    fdSender = new FormData();
    fdSender.left = new FormAttachment(middle, 0);
    fdSender.top = new FormAttachment(0, margin);
    fdSender.right = new FormAttachment(wNegateSender, -margin);
    wSender.setLayoutData(fdSender);
    wNegateReceipient = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateReceipient);
    fdNegateReceipient = new FormData();
    wNegateReceipient.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateReceipient.Tooltip"));
    fdNegateReceipient.top = new FormAttachment(wSender, margin);
    fdNegateReceipient.right = new FormAttachment(100, -margin);
    wNegateReceipient.setLayoutData(fdNegateReceipient);
    // Receipient line
    wlReceipient = new Label(wHeader, SWT.RIGHT);
    wlReceipient.setText(BaseMessages.getString(PKG, "MailInput.Receipient.Label"));
    props.setLook(wlReceipient);
    fdlReceipient = new FormData();
    fdlReceipient.left = new FormAttachment(0, 0);
    fdlReceipient.top = new FormAttachment(wSender, margin);
    fdlReceipient.right = new FormAttachment(middle, -margin);
    wlReceipient.setLayoutData(fdlReceipient);
    wReceipient = new TextVar(transMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wReceipient);
    wReceipient.addModifyListener(lsMod);
    fdReceipient = new FormData();
    fdReceipient.left = new FormAttachment(middle, 0);
    fdReceipient.top = new FormAttachment(wSender, margin);
    fdReceipient.right = new FormAttachment(wNegateReceipient, -margin);
    wReceipient.setLayoutData(fdReceipient);
    wNegateSubject = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateSubject);
    fdNegateSubject = new FormData();
    wNegateSubject.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateSubject.Tooltip"));
    fdNegateSubject.top = new FormAttachment(wReceipient, margin);
    fdNegateSubject.right = new FormAttachment(100, -margin);
    wNegateSubject.setLayoutData(fdNegateSubject);
    // Subject line
    wlSubject = new Label(wHeader, SWT.RIGHT);
    wlSubject.setText(BaseMessages.getString(PKG, "MailInput.Subject.Label"));
    props.setLook(wlSubject);
    fdlSubject = new FormData();
    fdlSubject.left = new FormAttachment(0, 0);
    fdlSubject.top = new FormAttachment(wReceipient, margin);
    fdlSubject.right = new FormAttachment(middle, -margin);
    wlSubject.setLayoutData(fdlSubject);
    wSubject = new TextVar(transMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSubject);
    wSubject.addModifyListener(lsMod);
    fdSubject = new FormData();
    fdSubject.left = new FormAttachment(middle, 0);
    fdSubject.top = new FormAttachment(wReceipient, margin);
    fdSubject.right = new FormAttachment(wNegateSubject, -margin);
    wSubject.setLayoutData(fdSubject);
    fdHeader = new FormData();
    fdHeader.left = new FormAttachment(0, margin);
    fdHeader.top = new FormAttachment(wReceipient, 2 * margin);
    fdHeader.right = new FormAttachment(100, -margin);
    wHeader.setLayoutData(fdHeader);
    // ///////////////////////////////////////////////////////////
    // / END OF HEADER GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF RECEIVED DATE ROUP///
    // /
    wReceivedDate = new Group(wSearchComp, SWT.SHADOW_NONE);
    props.setLook(wReceivedDate);
    wReceivedDate.setText(BaseMessages.getString(PKG, "MailInput.ReceivedDate.Group.Label"));
    FormLayout ReceivedDategroupLayout = new FormLayout();
    ReceivedDategroupLayout.marginWidth = 10;
    ReceivedDategroupLayout.marginHeight = 10;
    wReceivedDate.setLayout(ReceivedDategroupLayout);
    wNegateReceivedDate = new Button(wReceivedDate, SWT.CHECK);
    props.setLook(wNegateReceivedDate);
    fdNegateReceivedDate = new FormData();
    wNegateReceivedDate.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateReceivedDate.Tooltip"));
    fdNegateReceivedDate.top = new FormAttachment(wHeader, margin);
    fdNegateReceivedDate.right = new FormAttachment(100, -margin);
    wNegateReceivedDate.setLayoutData(fdNegateReceivedDate);
    // Received Date Condition
    wlConditionOnReceivedDate = new Label(wReceivedDate, SWT.RIGHT);
    wlConditionOnReceivedDate.setText(BaseMessages.getString(PKG, "MailInput.ConditionOnReceivedDate.Label"));
    props.setLook(wlConditionOnReceivedDate);
    fdlConditionOnReceivedDate = new FormData();
    fdlConditionOnReceivedDate.left = new FormAttachment(0, 0);
    fdlConditionOnReceivedDate.right = new FormAttachment(middle, -margin);
    fdlConditionOnReceivedDate.top = new FormAttachment(wHeader, margin);
    wlConditionOnReceivedDate.setLayoutData(fdlConditionOnReceivedDate);
    wConditionOnReceivedDate = new CCombo(wReceivedDate, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wConditionOnReceivedDate.setItems(MailConnectionMeta.conditionDateDesc);
    // +1: starts at -1
    wConditionOnReceivedDate.select(0);
    props.setLook(wConditionOnReceivedDate);
    fdConditionOnReceivedDate = new FormData();
    fdConditionOnReceivedDate.left = new FormAttachment(middle, 0);
    fdConditionOnReceivedDate.top = new FormAttachment(wHeader, margin);
    fdConditionOnReceivedDate.right = new FormAttachment(wNegateReceivedDate, -margin);
    wConditionOnReceivedDate.setLayoutData(fdConditionOnReceivedDate);
    wConditionOnReceivedDate.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            conditionReceivedDate();
            input.setChanged();
        }
    });
    open = new Button(wReceivedDate, SWT.PUSH);
    open.setImage(GUIResource.getInstance().getImageCalendar());
    open.setToolTipText(BaseMessages.getString(PKG, "MailInput.OpenCalendar"));
    FormData fdlButton = new FormData();
    fdlButton.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdlButton.right = new FormAttachment(100, 0);
    open.setLayoutData(fdlButton);
    open.addSelectionListener(new SelectionAdapter() {

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

                public void widgetSelected(SelectionEvent e) {
                    Calendar cal = Calendar.getInstance();
                    cal.set(Calendar.YEAR, calendar.getYear());
                    cal.set(Calendar.MONTH, calendar.getMonth());
                    cal.set(Calendar.DAY_OF_MONTH, calendar.getDay());
                    cal.set(Calendar.HOUR_OF_DAY, time.getHours());
                    cal.set(Calendar.MINUTE, time.getMinutes());
                    cal.set(Calendar.SECOND, time.getSeconds());
                    wReadFrom.setText(new SimpleDateFormat(MailInputMeta.DATE_PATTERN).format(cal.getTime()));
                    dialog.close();
                }
            });
            dialog.setDefaultButton(ok);
            dialog.pack();
            dialog.open();
        }
    });
    wlReadFrom = new Label(wReceivedDate, SWT.RIGHT);
    wlReadFrom.setText(BaseMessages.getString(PKG, "MailInput.ReadFrom.Label"));
    props.setLook(wlReadFrom);
    fdlReadFrom = new FormData();
    fdlReadFrom.left = new FormAttachment(0, 0);
    fdlReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdlReadFrom.right = new FormAttachment(middle, -margin);
    wlReadFrom.setLayoutData(fdlReadFrom);
    wReadFrom = new TextVar(transMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadFrom.setToolTipText(BaseMessages.getString(PKG, "MailInput.ReadFrom.Tooltip"));
    props.setLook(wReadFrom);
    wReadFrom.addModifyListener(lsMod);
    fdReadFrom = new FormData();
    fdReadFrom.left = new FormAttachment(middle, 0);
    fdReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdReadFrom.right = new FormAttachment(open, -margin);
    wReadFrom.setLayoutData(fdReadFrom);
    opento = new Button(wReceivedDate, SWT.PUSH);
    opento.setImage(GUIResource.getInstance().getImageCalendar());
    opento.setToolTipText(BaseMessages.getString(PKG, "MailInput.OpenCalendar"));
    FormData fdlButtonto = new FormData();
    fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlButtonto.right = new FormAttachment(100, 0);
    opento.setLayoutData(fdlButtonto);
    opento.addSelectionListener(new SelectionAdapter() {

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

                public void widgetSelected(SelectionEvent e) {
                    Calendar cal = Calendar.getInstance();
                    cal.set(Calendar.YEAR, calendarto.getYear());
                    cal.set(Calendar.MONTH, calendarto.getMonth());
                    cal.set(Calendar.DAY_OF_MONTH, calendarto.getDay());
                    cal.set(Calendar.HOUR_OF_DAY, timeto.getHours());
                    cal.set(Calendar.MINUTE, timeto.getMinutes());
                    cal.set(Calendar.SECOND, timeto.getSeconds());
                    wReadTo.setText(new SimpleDateFormat(MailInputMeta.DATE_PATTERN).format(cal.getTime()));
                    dialogto.close();
                }
            });
            dialogto.setDefaultButton(okto);
            dialogto.pack();
            dialogto.open();
        }
    });
    wlReadTo = new Label(wReceivedDate, SWT.RIGHT);
    wlReadTo.setText(BaseMessages.getString(PKG, "MailInput.ReadTo.Label"));
    props.setLook(wlReadTo);
    fdlReadTo = new FormData();
    fdlReadTo.left = new FormAttachment(0, 0);
    fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlReadTo.right = new FormAttachment(middle, -margin);
    wlReadTo.setLayoutData(fdlReadTo);
    wReadTo = new TextVar(transMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadTo.setToolTipText(BaseMessages.getString(PKG, "MailInput.ReadTo.Tooltip"));
    props.setLook(wReadTo);
    wReadTo.addModifyListener(lsMod);
    fdReadTo = new FormData();
    fdReadTo.left = new FormAttachment(middle, 0);
    fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdReadTo.right = new FormAttachment(opento, -margin);
    wReadTo.setLayoutData(fdReadTo);
    fdReceivedDate = new FormData();
    fdReceivedDate.left = new FormAttachment(0, margin);
    fdReceivedDate.top = new FormAttachment(wHeader, margin);
    fdReceivedDate.right = new FormAttachment(100, -margin);
    wReceivedDate.setLayoutData(fdReceivedDate);
    // ///////////////////////////////////////////////////////////
    // / END OF RECEIVED DATE GROUP
    // ///////////////////////////////////////////////////////////
    wlLimit = new Label(wSearchComp, SWT.RIGHT);
    wlLimit.setText(BaseMessages.getString(PKG, "MailInput.Limit.Label"));
    props.setLook(wlLimit);
    fdlLimit = new FormData();
    fdlLimit.left = new FormAttachment(0, 0);
    fdlLimit.top = new FormAttachment(wReceivedDate, 2 * margin);
    fdlLimit.right = new FormAttachment(middle, -margin);
    wlLimit.setLayoutData(fdlLimit);
    wLimit = new Text(wSearchComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLimit);
    wLimit.addModifyListener(lsMod);
    fdLimit = new FormData();
    fdLimit.left = new FormAttachment(middle, 0);
    fdLimit.top = new FormAttachment(wReceivedDate, 2 * margin);
    fdLimit.right = new FormAttachment(100, 0);
    wLimit.setLayoutData(fdLimit);
    fdSearchComp = new FormData();
    fdSearchComp.left = new FormAttachment(0, 0);
    fdSearchComp.top = new FormAttachment(wStepname, 0);
    fdSearchComp.right = new FormAttachment(100, 0);
    fdSearchComp.bottom = new FormAttachment(100, 0);
    wSearchComp.setLayoutData(fdSearchComp);
    wSearchComp.layout();
    wSearchTab.setControl(wSearchComp);
    props.setLook(wSearchComp);
    // ////////////////////////////////
    // / END OF SEARCH TAB
    // ////////////////////////////////
    // Fields tab...
    // 
    wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "MailInputdialog.Fields.Tab"));
    FormLayout fieldsLayout = new FormLayout();
    fieldsLayout.marginWidth = Const.FORM_MARGIN;
    fieldsLayout.marginHeight = Const.FORM_MARGIN;
    wFieldsComp = new Composite(wTabFolder, SWT.NONE);
    wFieldsComp.setLayout(fieldsLayout);
    props.setLook(wFieldsComp);
    wGet = new Button(wFieldsComp, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "MailInputdialog.GetFields.Button"));
    fdGet = new FormData();
    fdGet.left = new FormAttachment(50, 0);
    fdGet.bottom = new FormAttachment(100, 0);
    wGet.setLayoutData(fdGet);
    final int FieldsRows = input.getInputFields().length;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Column.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, MailInputField.ColumnDesc, true) };
    colinf[0].setUsingVariables(true);
    colinf[0].setToolTip(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Name.Column.Tooltip"));
    colinf[1].setToolTip(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Column.Column.Tooltip"));
    wFields = new TableView(transMeta, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(0, 0);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(wGet, -margin);
    wFields.setLayoutData(fdFields);
    fdFieldsComp = new FormData();
    fdFieldsComp.left = new FormAttachment(0, 0);
    fdFieldsComp.top = new FormAttachment(0, 0);
    fdFieldsComp.right = new FormAttachment(100, 0);
    fdFieldsComp.bottom = new FormAttachment(100, 0);
    wFieldsComp.setLayoutData(fdFieldsComp);
    wFieldsComp.layout();
    wFieldsTab.setControl(wFieldsComp);
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wStepname, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wPreview = new Button(shell, SWT.PUSH);
    wPreview.setText(BaseMessages.getString(PKG, "MailInputDialog.Preview"));
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
    lsGet = new Listener() {

        public void handleEvent(Event e) {
            getFields();
        }
    };
    // Add listeners
    lsCancel = new Listener() {

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

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

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

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    lsTest = new Listener() {

        public void handleEvent(Event e) {
            test();
        }
    };
    wTest.addListener(SWT.Selection, lsTest);
    wPreview.addListener(SWT.Selection, lsPreview);
    wGet.addListener(SWT.Selection, lsGet);
    lsTestIMAPFolder = new Listener() {

        public void handleEvent(Event e) {
            checkFolder(transMeta.environmentSubstitute(wIMAPFolder.getText()));
        }
    };
    wTestIMAPFolder.addListener(SWT.Selection, lsTestIMAPFolder);
    lsSelectFolder = new Listener() {

        public void handleEvent(Event e) {
            selectFolder(wIMAPFolder);
        }
    };
    wSelectFolder.addListener(SWT.Selection, lsSelectFolder);
    wStepname.addSelectionListener(lsDef);
    wServerName.addSelectionListener(lsDef);
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    setUserProxy();
    chooseListMails();
    refreshProtocol(false);
    conditionReceivedDate();
    wTabFolder.setSelection(0);
    BaseStepDialog.setSize(shell);
    shell.open();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) SelectionListener(org.eclipse.swt.events.SelectionListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) CTabItem(org.eclipse.swt.custom.CTabItem) DateTime(org.eclipse.swt.widgets.DateTime) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Calendar(java.util.Calendar) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) CCombo(org.eclipse.swt.custom.CCombo) GridData(org.eclipse.swt.layout.GridData) 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) SimpleDateFormat(java.text.SimpleDateFormat) Display(org.eclipse.swt.widgets.Display) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 25 with TableView

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

the class LoadFileInputDialog method open.

public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    setShellImage(shell, input);
    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, "LoadFileInputDialog.DialogTitle"));
    middle = props.getMiddlePct();
    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, "LoadFileInputDialog.File.Tab"));
    wFileComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFileComp);
    FormLayout fileLayout = new FormLayout();
    fileLayout.marginWidth = 3;
    fileLayout.marginHeight = 3;
    wFileComp.setLayout(fileLayout);
    // ///////////////////////////////
    // START OF Output Field GROUP //
    // ///////////////////////////////
    wOutputField = new Group(wFileComp, SWT.SHADOW_NONE);
    props.setLook(wOutputField);
    wOutputField.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.wOutputField.Label"));
    FormLayout outputfieldgroupLayout = new FormLayout();
    outputfieldgroupLayout.marginWidth = 10;
    outputfieldgroupLayout.marginHeight = 10;
    wOutputField.setLayout(outputfieldgroupLayout);
    // Is filename defined in a Field
    wlFilenameInField = new Label(wOutputField, SWT.RIGHT);
    wlFilenameInField.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameInField.Label"));
    props.setLook(wlFilenameInField);
    fdlFilenameInField = new FormData();
    fdlFilenameInField.left = new FormAttachment(0, -margin);
    fdlFilenameInField.top = new FormAttachment(0, margin);
    fdlFilenameInField.right = new FormAttachment(middle, -2 * margin);
    wlFilenameInField.setLayoutData(fdlFilenameInField);
    wFilenameInField = new Button(wOutputField, SWT.CHECK);
    props.setLook(wFilenameInField);
    wFilenameInField.setToolTipText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameInField.Tooltip"));
    fdFileNameInField = new FormData();
    fdFileNameInField.left = new FormAttachment(middle, -margin);
    fdFileNameInField.top = new FormAttachment(0, margin);
    wFilenameInField.setLayoutData(fdFileNameInField);
    SelectionAdapter lsxmlstream = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            ActiveXmlStreamField();
            input.setChanged();
        }
    };
    wFilenameInField.addSelectionListener(lsxmlstream);
    // If Filename defined in a Field
    wlFilenameField = new Label(wOutputField, SWT.RIGHT);
    wlFilenameField.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameField.Label"));
    props.setLook(wlFilenameField);
    fdlFilenameField = new FormData();
    fdlFilenameField.left = new FormAttachment(0, margin);
    fdlFilenameField.top = new FormAttachment(wFilenameInField, margin);
    fdlFilenameField.right = new FormAttachment(middle, -2 * margin);
    wlFilenameField.setLayoutData(fdlFilenameField);
    wFilenameField = new CCombo(wOutputField, SWT.BORDER | SWT.READ_ONLY);
    wFilenameField.setEditable(true);
    props.setLook(wFilenameField);
    wFilenameField.addModifyListener(lsMod);
    fdXMLField = new FormData();
    fdXMLField.left = new FormAttachment(middle, -margin);
    fdXMLField.top = new FormAttachment(wFilenameInField, margin);
    fdXMLField.right = new FormAttachment(100, -margin);
    wFilenameField.setLayoutData(fdXMLField);
    wFilenameField.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            setDynamicFilenameField();
        }
    });
    fdOutputField = new FormData();
    fdOutputField.left = new FormAttachment(0, margin);
    fdOutputField.top = new FormAttachment(wFilenameList, margin);
    fdOutputField.right = new FormAttachment(100, -margin);
    wOutputField.setLayoutData(fdOutputField);
    // ///////////////////////////////////////////////////////////
    // / END OF Output Field GROUP
    // ///////////////////////////////////////////////////////////
    middle = middle / 2;
    // Filename line
    wlFilename = new Label(wFileComp, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wOutputField, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wbbFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbbFilename);
    wbbFilename.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameBrowse.Button"));
    wbbFilename.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
    fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wOutputField, margin);
    wbbFilename.setLayoutData(fdbFilename);
    wbaFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbaFilename);
    wbaFilename.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameAdd.Button"));
    wbaFilename.setToolTipText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameAdd.Tooltip"));
    fdbaFilename = new FormData();
    fdbaFilename.right = new FormAttachment(wbbFilename, -margin);
    fdbaFilename.top = new FormAttachment(wOutputField, margin);
    wbaFilename.setLayoutData(fdbaFilename);
    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.right = new FormAttachment(wbaFilename, -margin);
    fdFilename.top = new FormAttachment(wOutputField, margin);
    wFilename.setLayoutData(fdFilename);
    wlFilemask = new Label(wFileComp, SWT.RIGHT);
    wlFilemask.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.RegExp.Label"));
    props.setLook(wlFilemask);
    fdlFilemask = new FormData();
    fdlFilemask.left = new FormAttachment(0, 0);
    fdlFilemask.top = new FormAttachment(wFilename, 2 * margin);
    fdlFilemask.right = new FormAttachment(middle, -margin);
    wlFilemask.setLayoutData(fdlFilemask);
    wFilemask = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilemask);
    wFilemask.addModifyListener(lsMod);
    fdFilemask = new FormData();
    fdFilemask.left = new FormAttachment(middle, 0);
    fdFilemask.top = new FormAttachment(wFilename, 2 * margin);
    fdFilemask.right = new FormAttachment(100, 0);
    wFilemask.setLayoutData(fdFilemask);
    wlExcludeFilemask = new Label(wFileComp, SWT.RIGHT);
    wlExcludeFilemask.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.ExcludeFilemask.Label"));
    props.setLook(wlExcludeFilemask);
    fdlExcludeFilemask = new FormData();
    fdlExcludeFilemask.left = new FormAttachment(0, 0);
    fdlExcludeFilemask.top = new FormAttachment(wFilemask, margin);
    fdlExcludeFilemask.right = new FormAttachment(middle, -margin);
    wlExcludeFilemask.setLayoutData(fdlExcludeFilemask);
    wExcludeFilemask = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wExcludeFilemask);
    wExcludeFilemask.addModifyListener(lsMod);
    fdExcludeFilemask = new FormData();
    fdExcludeFilemask.left = new FormAttachment(middle, 0);
    fdExcludeFilemask.top = new FormAttachment(wFilemask, margin);
    fdExcludeFilemask.right = new FormAttachment(wFilename, 0, SWT.RIGHT);
    wExcludeFilemask.setLayoutData(fdExcludeFilemask);
    // Filename list line
    wlFilenameList = new Label(wFileComp, SWT.RIGHT);
    wlFilenameList.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameList.Label"));
    props.setLook(wlFilenameList);
    fdlFilenameList = new FormData();
    fdlFilenameList.left = new FormAttachment(0, 0);
    fdlFilenameList.top = new FormAttachment(wExcludeFilemask, margin);
    fdlFilenameList.right = new FormAttachment(middle, -margin);
    wlFilenameList.setLayoutData(fdlFilenameList);
    // Buttons to the right of the screen...
    wbdFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbdFilename);
    wbdFilename.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameRemove.Label"));
    wbdFilename.setToolTipText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameRemove.Tooltip"));
    fdbdFilename = new FormData();
    fdbdFilename.right = new FormAttachment(100, 0);
    fdbdFilename.top = new FormAttachment(wExcludeFilemask, 40);
    wbdFilename.setLayoutData(fdbdFilename);
    wbeFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbeFilename);
    wbeFilename.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameEdit.Label"));
    wbeFilename.setToolTipText(BaseMessages.getString(PKG, "LoadFileInputDialog.FilenameEdit.Tooltip"));
    fdbeFilename = new FormData();
    fdbeFilename.right = new FormAttachment(100, 0);
    fdbeFilename.top = new FormAttachment(wbdFilename, margin);
    wbeFilename.setLayoutData(fdbeFilename);
    wbShowFiles = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbShowFiles);
    wbShowFiles.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.ShowFiles.Button"));
    fdbShowFiles = new FormData();
    fdbShowFiles.left = new FormAttachment(middle, 0);
    fdbShowFiles.bottom = new FormAttachment(100, 0);
    wbShowFiles.setLayoutData(fdbShowFiles);
    ColumnInfo[] colinfo = new ColumnInfo[5];
    colinfo[0] = new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.Files.Filename.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    colinfo[1] = new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.Files.Wildcard.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    colinfo[2] = new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.Files.ExcludeWildcard.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    colinfo[0].setUsingVariables(true);
    colinfo[1].setUsingVariables(true);
    colinfo[1].setToolTip(BaseMessages.getString(PKG, "LoadFileInputDialog.Files.Wildcard.Tooltip"));
    colinfo[2].setUsingVariables(true);
    colinfo[2].setToolTip(BaseMessages.getString(PKG, "LoadFileInputDialog.Files.ExcludeWildcard.Tooltip"));
    colinfo[3] = new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.Required.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO);
    colinfo[3].setToolTip(BaseMessages.getString(PKG, "LoadFileInputDialog.Required.Tooltip"));
    colinfo[4] = new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.IncludeSubDirs.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO);
    colinfo[4].setToolTip(BaseMessages.getString(PKG, "LoadFileInputDialog.IncludeSubDirs.Tooltip"));
    wFilenameList = new TableView(transMeta, wFileComp, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER, colinfo, 2, lsMod, props);
    props.setLook(wFilenameList);
    fdFilenameList = new FormData();
    fdFilenameList.left = new FormAttachment(middle, 0);
    fdFilenameList.right = new FormAttachment(wbdFilename, -margin);
    fdFilenameList.top = new FormAttachment(wExcludeFilemask, margin);
    fdFilenameList.bottom = new FormAttachment(wbShowFiles, -margin);
    wFilenameList.setLayoutData(fdFilenameList);
    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
    // ///////////////////////////////////////////////////////////
    middle = props.getMiddlePct();
    // ////////////////////////
    // START OF CONTENT TAB///
    // /
    wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.Content.Tab"));
    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;
    wContentComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wContentComp);
    wContentComp.setLayout(contentLayout);
    // ///////////////////////////////
    // START OF FileConf Field GROUP //
    // ///////////////////////////////
    wFileConf = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wFileConf);
    wFileConf.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.FileConf.Label"));
    FormLayout XmlConfgroupLayout = new FormLayout();
    XmlConfgroupLayout.marginWidth = 10;
    XmlConfgroupLayout.marginHeight = 10;
    wFileConf.setLayout(XmlConfgroupLayout);
    wlEncoding = new Label(wFileConf, SWT.RIGHT);
    wlEncoding.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.Encoding.Label"));
    props.setLook(wlEncoding);
    fdlEncoding = new FormData();
    fdlEncoding.left = new FormAttachment(0, 0);
    fdlEncoding.top = new FormAttachment(0, margin);
    fdlEncoding.right = new FormAttachment(middle, -margin);
    wlEncoding.setLayoutData(fdlEncoding);
    wEncoding = new CCombo(wFileConf, 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(0, margin);
    fdEncoding.right = new FormAttachment(100, 0);
    wEncoding.setLayoutData(fdEncoding);
    wEncoding.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            setEncodings();
        }
    });
    // Ignore Empty File
    wlIgnoreEmptyFile = new Label(wFileConf, SWT.RIGHT);
    wlIgnoreEmptyFile.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.IgnoreEmptyFile.Label"));
    props.setLook(wlIgnoreEmptyFile);
    fdlIgnoreEmptyFile = new FormData();
    fdlIgnoreEmptyFile.left = new FormAttachment(0, 0);
    fdlIgnoreEmptyFile.top = new FormAttachment(wEncoding, margin);
    fdlIgnoreEmptyFile.right = new FormAttachment(middle, -margin);
    wlIgnoreEmptyFile.setLayoutData(fdlIgnoreEmptyFile);
    wIgnoreEmptyFile = new Button(wFileConf, SWT.CHECK);
    props.setLook(wIgnoreEmptyFile);
    wIgnoreEmptyFile.setToolTipText(BaseMessages.getString(PKG, "LoadFileInputDialog.IgnoreEmptyFile.Tooltip"));
    fdIgnoreEmptyFile = new FormData();
    fdIgnoreEmptyFile.left = new FormAttachment(middle, 0);
    fdIgnoreEmptyFile.top = new FormAttachment(wEncoding, margin);
    wIgnoreEmptyFile.setLayoutData(fdIgnoreEmptyFile);
    wIgnoreEmptyFile.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Ignore missing path
    wlIgnoreMissingPath = new Label(wFileConf, SWT.RIGHT);
    wlIgnoreMissingPath.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.IgnoreMissingPath.Label"));
    props.setLook(wlIgnoreMissingPath);
    fdlIgnoreMissingPath = new FormData();
    fdlIgnoreMissingPath.left = new FormAttachment(0, 0);
    fdlIgnoreMissingPath.top = new FormAttachment(wIgnoreEmptyFile, margin);
    fdlIgnoreMissingPath.right = new FormAttachment(middle, -margin);
    wlIgnoreMissingPath.setLayoutData(fdlIgnoreMissingPath);
    wIgnoreMissingPath = new Button(wFileConf, SWT.CHECK);
    props.setLook(wIgnoreMissingPath);
    wIgnoreMissingPath.setToolTipText(BaseMessages.getString(PKG, "LoadFileInputDialog.IgnoreMissingPath.Tooltip"));
    fdIgnoreMissingPath = new FormData();
    fdIgnoreMissingPath.left = new FormAttachment(middle, 0);
    fdIgnoreMissingPath.top = new FormAttachment(wIgnoreEmptyFile, margin);
    wIgnoreMissingPath.setLayoutData(fdIgnoreMissingPath);
    wIgnoreMissingPath.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // preview limit
    wlLimit = new Label(wFileConf, SWT.RIGHT);
    wlLimit.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.Limit.Label"));
    props.setLook(wlLimit);
    fdlLimit = new FormData();
    fdlLimit.left = new FormAttachment(0, 0);
    fdlLimit.top = new FormAttachment(wIgnoreMissingPath, margin);
    fdlLimit.right = new FormAttachment(middle, -margin);
    wlLimit.setLayoutData(fdlLimit);
    wLimit = new Text(wFileConf, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLimit);
    wLimit.addModifyListener(lsMod);
    fdLimit = new FormData();
    fdLimit.left = new FormAttachment(middle, 0);
    fdLimit.top = new FormAttachment(wIgnoreMissingPath, margin);
    fdLimit.right = new FormAttachment(100, 0);
    wLimit.setLayoutData(fdLimit);
    fdXmlConf = new FormData();
    fdXmlConf.left = new FormAttachment(0, margin);
    fdXmlConf.top = new FormAttachment(0, margin);
    fdXmlConf.right = new FormAttachment(100, -margin);
    wFileConf.setLayoutData(fdXmlConf);
    // ///////////////////////////////////////////////////////////
    // / END OF XmlConf Field GROUP
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////
    // START OF Additional Fields GROUP //
    // ///////////////////////////////
    wAdditionalFields = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wAdditionalFields);
    wAdditionalFields.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.wAdditionalFields.Label"));
    FormLayout AdditionalFieldsgroupLayout = new FormLayout();
    AdditionalFieldsgroupLayout.marginWidth = 10;
    AdditionalFieldsgroupLayout.marginHeight = 10;
    wAdditionalFields.setLayout(AdditionalFieldsgroupLayout);
    wlInclFilename = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclFilename.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.InclFilename.Label"));
    props.setLook(wlInclFilename);
    fdlInclFilename = new FormData();
    fdlInclFilename.left = new FormAttachment(0, 0);
    fdlInclFilename.top = new FormAttachment(wFileConf, 4 * margin);
    fdlInclFilename.right = new FormAttachment(middle, -margin);
    wlInclFilename.setLayoutData(fdlInclFilename);
    wInclFilename = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wInclFilename);
    wInclFilename.setToolTipText(BaseMessages.getString(PKG, "LoadFileInputDialog.InclFilename.Tooltip"));
    fdInclFilename = new FormData();
    fdInclFilename.left = new FormAttachment(middle, 0);
    fdInclFilename.top = new FormAttachment(wFileConf, 4 * margin);
    wInclFilename.setLayoutData(fdInclFilename);
    wlInclFilenameField = new Label(wAdditionalFields, SWT.LEFT);
    wlInclFilenameField.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.InclFilenameField.Label"));
    props.setLook(wlInclFilenameField);
    fdlInclFilenameField = new FormData();
    fdlInclFilenameField.left = new FormAttachment(wInclFilename, margin);
    fdlInclFilenameField.top = new FormAttachment(wLimit, 4 * margin);
    wlInclFilenameField.setLayoutData(fdlInclFilenameField);
    wInclFilenameField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclFilenameField);
    wInclFilenameField.addModifyListener(lsMod);
    fdInclFilenameField = new FormData();
    fdInclFilenameField.left = new FormAttachment(wlInclFilenameField, margin);
    fdInclFilenameField.top = new FormAttachment(wLimit, 4 * margin);
    fdInclFilenameField.right = new FormAttachment(100, 0);
    wInclFilenameField.setLayoutData(fdInclFilenameField);
    wlInclRownum = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclRownum.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.InclRownum.Label"));
    props.setLook(wlInclRownum);
    fdlInclRownum = new FormData();
    fdlInclRownum.left = new FormAttachment(0, 0);
    fdlInclRownum.top = new FormAttachment(wInclFilenameField, margin);
    fdlInclRownum.right = new FormAttachment(middle, -margin);
    wlInclRownum.setLayoutData(fdlInclRownum);
    wInclRownum = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wInclRownum);
    wInclRownum.setToolTipText(BaseMessages.getString(PKG, "LoadFileInputDialog.InclRownum.Tooltip"));
    fdRownum = new FormData();
    fdRownum.left = new FormAttachment(middle, 0);
    fdRownum.top = new FormAttachment(wInclFilenameField, margin);
    wInclRownum.setLayoutData(fdRownum);
    wlInclRownumField = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclRownumField.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.InclRownumField.Label"));
    props.setLook(wlInclRownumField);
    fdlInclRownumField = new FormData();
    fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
    fdlInclRownumField.top = new FormAttachment(wInclFilenameField, margin);
    wlInclRownumField.setLayoutData(fdlInclRownumField);
    wInclRownumField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclRownumField);
    wInclRownumField.addModifyListener(lsMod);
    fdInclRownumField = new FormData();
    fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
    fdInclRownumField.top = new FormAttachment(wInclFilenameField, margin);
    fdInclRownumField.right = new FormAttachment(100, 0);
    wInclRownumField.setLayoutData(fdInclRownumField);
    fdAdditionalFields = new FormData();
    fdAdditionalFields.left = new FormAttachment(0, margin);
    fdAdditionalFields.top = new FormAttachment(wFileConf, margin);
    fdAdditionalFields.right = new FormAttachment(100, -margin);
    wAdditionalFields.setLayoutData(fdAdditionalFields);
    // ///////////////////////////////////////////////////////////
    // / END OF Additional Fields GROUP
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////
    // START OF AddFileResult GROUP //
    // ///////////////////////////////
    wAddFileResult = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wAddFileResult);
    wAddFileResult.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.wAddFileResult.Label"));
    FormLayout AddFileResultgroupLayout = new FormLayout();
    AddFileResultgroupLayout.marginWidth = 10;
    AddFileResultgroupLayout.marginHeight = 10;
    wAddFileResult.setLayout(AddFileResultgroupLayout);
    wlAddResult = new Label(wAddFileResult, SWT.RIGHT);
    wlAddResult.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.AddResult.Label"));
    props.setLook(wlAddResult);
    fdlAddResult = new FormData();
    fdlAddResult.left = new FormAttachment(0, 0);
    fdlAddResult.top = new FormAttachment(wAdditionalFields, margin);
    fdlAddResult.right = new FormAttachment(middle, -margin);
    wlAddResult.setLayoutData(fdlAddResult);
    wAddResult = new Button(wAddFileResult, SWT.CHECK);
    props.setLook(wAddResult);
    wAddResult.setToolTipText(BaseMessages.getString(PKG, "LoadFileInputDialog.AddResult.Tooltip"));
    fdAddResult = new FormData();
    fdAddResult.left = new FormAttachment(middle, 0);
    fdAddResult.top = new FormAttachment(wAdditionalFields, margin);
    wAddResult.setLayoutData(fdAddResult);
    wAddResult.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    fdAddFileResult = new FormData();
    fdAddFileResult.left = new FormAttachment(0, margin);
    fdAddFileResult.top = new FormAttachment(wAdditionalFields, margin);
    fdAddFileResult.right = new FormAttachment(100, -margin);
    wAddFileResult.setLayoutData(fdAddFileResult);
    // ///////////////////////////////////////////////////////////
    // / END OF AddFileResult 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
    // ///////////////////////////////////////////////////////////
    // Fields tab...
    // 
    wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.Fields.Tab"));
    FormLayout fieldsLayout = new FormLayout();
    fieldsLayout.marginWidth = Const.FORM_MARGIN;
    fieldsLayout.marginHeight = Const.FORM_MARGIN;
    wFieldsComp = new Composite(wTabFolder, SWT.NONE);
    wFieldsComp.setLayout(fieldsLayout);
    props.setLook(wFieldsComp);
    wGet = new Button(wFieldsComp, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.GetFields.Button"));
    fdGet = new FormData();
    fdGet.left = new FormAttachment(50, 0);
    fdGet.bottom = new FormAttachment(100, 0);
    wGet.setLayoutData(fdGet);
    final int FieldsRows = input.getInputFields().length;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Element.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, org.pentaho.di.trans.steps.loadfileinput.LoadFileInputField.ElementTypeDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Type.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Format.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, Const.getConversionFormats()), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Length.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Precision.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Currency.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Decimal.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Group.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.TrimType.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, LoadFileInputField.trimTypeDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Repeat.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true) };
    colinf[0].setUsingVariables(true);
    colinf[0].setToolTip(BaseMessages.getString(PKG, "LoadFileInputDialog.FieldsTable.Name.Column.Tooltip"));
    colinfo[2] = new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.Required.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO);
    colinfo[2].setToolTip(BaseMessages.getString(PKG, "LoadFileInputDialog.Required.Tooltip"));
    colinfo[3] = new ColumnInfo(BaseMessages.getString(PKG, "LoadFileInputDialog.IncludeSubDirs.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO);
    colinfo[3].setToolTip(BaseMessages.getString(PKG, "LoadFileInputDialog.IncludeSubDirs.Tooltip"));
    wFields = new TableView(transMeta, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(0, 0);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(wGet, -margin);
    wFields.setLayoutData(fdFields);
    fdFieldsComp = new FormData();
    fdFieldsComp.left = new FormAttachment(0, 0);
    fdFieldsComp.top = new FormAttachment(0, 0);
    fdFieldsComp.right = new FormAttachment(100, 0);
    fdFieldsComp.bottom = new FormAttachment(100, 0);
    wFieldsComp.setLayoutData(fdFieldsComp);
    wFieldsComp.layout();
    wFieldsTab.setControl(wFieldsComp);
    addAdditionalFieldsTab();
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wStepname, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wPreview = new Button(shell, SWT.PUSH);
    wPreview.setText(BaseMessages.getString(PKG, "LoadFileInputDialog.Button.PreviewRows"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
    // Add listeners
    lsOK = new Listener() {

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

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

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

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

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    wLimit.addSelectionListener(lsDef);
    wInclRownumField.addSelectionListener(lsDef);
    wInclFilenameField.addSelectionListener(lsDef);
    // Add the file to the list of files...
    SelectionAdapter selA = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            wFilenameList.add(new String[] { wFilename.getText(), wFilemask.getText(), wExcludeFilemask.getText(), LoadFileInputMeta.RequiredFilesCode[0], LoadFileInputMeta.RequiredFilesCode[0] });
            wFilename.setText("");
            wFilemask.setText("");
            wExcludeFilemask.setText("");
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
            wFilenameList.optWidth(true);
        }
    };
    wbaFilename.addSelectionListener(selA);
    wFilename.addSelectionListener(selA);
    // Delete files from the list of files...
    wbdFilename.addSelectionListener(new SelectionAdapter() {

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

        public void widgetSelected(SelectionEvent arg0) {
            int idx = wFilenameList.getSelectionIndex();
            if (idx >= 0) {
                String[] string = wFilenameList.getItem(idx);
                wFilename.setText(string[0]);
                wFilemask.setText(string[1]);
                wExcludeFilemask.setText(string[2]);
                wFilenameList.remove(idx);
            }
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
        }
    });
    // Show the files that are selected at this time...
    wbShowFiles.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            try {
                LoadFileInputMeta tfii = new LoadFileInputMeta();
                getInfo(tfii);
                FileInputList fileInputList = tfii.getFiles(transMeta);
                String[] files = fileInputList.getFileStrings();
                if (files != null && files.length > 0) {
                    EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "LoadFileInputDialog.FilesReadSelection.DialogTitle"), BaseMessages.getString(PKG, "LoadFileInputDialog.FilesReadSelection.DialogMessage"));
                    esd.setViewOnly();
                    esd.open();
                } else {
                    MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                    mb.setMessage(BaseMessages.getString(PKG, "LoadFileInputDialog.NoFileFound.DialogMessage"));
                    mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
                    mb.open();
                }
            } catch (Exception ex) {
                new ErrorDialog(shell, BaseMessages.getString(PKG, "LoadFileInputDialog.ErrorParsingData.DialogTitle"), BaseMessages.getString(PKG, "LoadFileInputDialog.ErrorParsingData.DialogMessage"), ex);
            }
        }
    });
    // Enable/disable the right fields to allow a filename to be added to each row...
    wInclFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setIncludeFilename();
            input.setChanged();
        }
    });
    // Enable/disable the right fields to allow a row number to be added to each row...
    wInclRownum.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setIncludeRownum();
            input.setChanged();
        }
    });
    // Whenever something changes, set the tooltip to the expanded version of the filename:
    wFilename.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            wFilename.setToolTipText(wFilename.getText());
        }
    });
    // Listen to the Browse... button
    wbbFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (!Utils.isEmpty(wFilemask.getText()) || !Utils.isEmpty(wExcludeFilemask.getText())) {
                // A mask: a directory!
                DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
                if (wFilename.getText() != null) {
                    String fpath = transMeta.environmentSubstitute(wFilename.getText());
                    dialog.setFilterPath(fpath);
                }
                if (dialog.open() != null) {
                    String str = dialog.getFilterPath();
                    wFilename.setText(str);
                }
            } else {
                FileDialog dialog = new FileDialog(shell, SWT.OPEN);
                dialog.setFilterExtensions(new String[] { "*.txt;", "*.csv", "*.TRT", "*" });
                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, "LoadFileInputDialog.FileType.TextAndCSVFiles"), BaseMessages.getString(PKG, "LoadFileInput.FileType.TRTFiles"), 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();
        }
    });
    wTabFolder.setSelection(0);
    // Set the shell size, based upon previous time...
    setSize();
    getData(input);
    ActiveXmlStreamField();
    input.setChanged(changed);
    wFields.optWidth(true);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) 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) FileInputList(org.pentaho.di.core.fileinput.FileInputList) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) TableView(org.pentaho.di.ui.core.widget.TableView) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) LoadFileInputMeta(org.pentaho.di.trans.steps.loadfileinput.LoadFileInputMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) Text(org.eclipse.swt.widgets.Text) KettleException(org.pentaho.di.core.exception.KettleException) TextVar(org.pentaho.di.ui.core.widget.TextVar) MessageBox(org.eclipse.swt.widgets.MessageBox) 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)

Aggregations

TableView (org.pentaho.di.ui.core.widget.TableView)229 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)220 FormAttachment (org.eclipse.swt.layout.FormAttachment)218 FormData (org.eclipse.swt.layout.FormData)218 FormLayout (org.eclipse.swt.layout.FormLayout)200 Label (org.eclipse.swt.widgets.Label)186 Button (org.eclipse.swt.widgets.Button)185 SelectionEvent (org.eclipse.swt.events.SelectionEvent)172 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)168 Shell (org.eclipse.swt.widgets.Shell)157 ShellEvent (org.eclipse.swt.events.ShellEvent)154 Event (org.eclipse.swt.widgets.Event)153 Listener (org.eclipse.swt.widgets.Listener)152 Text (org.eclipse.swt.widgets.Text)151 Display (org.eclipse.swt.widgets.Display)150 ModifyEvent (org.eclipse.swt.events.ModifyEvent)149 ModifyListener (org.eclipse.swt.events.ModifyListener)149 ShellAdapter (org.eclipse.swt.events.ShellAdapter)149 Composite (org.eclipse.swt.widgets.Composite)105 CTabItem (org.eclipse.swt.custom.CTabItem)100