Search in sources :

Example 66 with ColumnInfo

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

the class TextFileInputDialog method addFiltersTabs.

private void addFiltersTabs() {
    // Filters tab...
    // 
    wFilterTab = new CTabItem(wTabFolder, SWT.NONE);
    wFilterTab.setText(BaseMessages.getString(PKG, "TextFileInputDialog.FilterTab.TabTitle"));
    FormLayout FilterLayout = new FormLayout();
    FilterLayout.marginWidth = Const.FORM_MARGIN;
    FilterLayout.marginHeight = Const.FORM_MARGIN;
    wFilterComp = new Composite(wTabFolder, SWT.NONE);
    wFilterComp.setLayout(FilterLayout);
    props.setLook(wFilterComp);
    final int FilterRows = input.getFilter().length;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.FilterStringColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.FilterPositionColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.StopOnFilterColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.FilterPositiveColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO) };
    colinf[2].setToolTip(BaseMessages.getString(PKG, "TextFileInputDialog.StopOnFilterColumn.Tooltip"));
    colinf[3].setToolTip(BaseMessages.getString(PKG, "TextFileInputDialog.FilterPositiveColumn.Tooltip"));
    wFilter = new TableView(transMeta, wFilterComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FilterRows, lsMod, props);
    fdFilter = new FormData();
    fdFilter.left = new FormAttachment(0, 0);
    fdFilter.top = new FormAttachment(0, 0);
    fdFilter.right = new FormAttachment(100, 0);
    fdFilter.bottom = new FormAttachment(100, 0);
    wFilter.setLayoutData(fdFilter);
    fdFilterComp = new FormData();
    fdFilterComp.left = new FormAttachment(0, 0);
    fdFilterComp.top = new FormAttachment(0, 0);
    fdFilterComp.right = new FormAttachment(100, 0);
    fdFilterComp.bottom = new FormAttachment(100, 0);
    wFilterComp.setLayoutData(fdFilterComp);
    wFilterComp.layout();
    wFilterTab.setControl(wFilterComp);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) 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 67 with ColumnInfo

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

the class TextFileInputDialog method addFieldsTabs.

private void addFieldsTabs() {
    // Fields tab...
    // 
    wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "TextFileInputDialog.FieldsTab.TabTitle"));
    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, "System.Button.GetFields"));
    fdGet = new FormData();
    fdGet.left = new FormAttachment(50, 0);
    fdGet.bottom = new FormAttachment(100, 0);
    wGet.setLayoutData(fdGet);
    wMinWidth = new Button(wFieldsComp, SWT.PUSH);
    wMinWidth.setText(BaseMessages.getString(PKG, "TextFileInputDialog.MinWidth.Button"));
    wMinWidth.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.MinWidth.Tooltip"));
    wMinWidth.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    setButtonPositions(new Button[] { wGet, wMinWidth }, margin, null);
    final int FieldsRows = input.inputFields.length;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_FORMAT, 2), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.PositionColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.LengthColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.PrecisionColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.CurrencyColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.DecimalColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.GroupColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.NullIfColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.IfNullColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.TrimTypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaString.trimTypeDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "TextFileInputDialog.RepeatColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true) };
    colinf[12].setToolTip(BaseMessages.getString(PKG, "TextFileInputDialog.RepeatColumn.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);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) 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 68 with ColumnInfo

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

the class JobHistoryDelegate method displayHistoryData.

private void displayHistoryData(final int index) {
    JobHistoryLogTab model = models[index];
    ColumnInfo[] colinf = model.logDisplayTableView.getColumns();
    // 
    if (model.logDisplayTableView == null || model.logDisplayTableView.isDisposed()) {
        return;
    }
    int selectionIndex = model.logDisplayTableView.getSelectionIndex();
    model.logDisplayTableView.table.clearAll();
    List<Object[]> rows = model.rows;
    if (rows != null && rows.size() > 0) {
        // 
        for (Object[] rowData : rows) {
            TableItem item = new TableItem(model.logDisplayTableView.table, SWT.NONE);
            for (int c = 0; c < colinf.length; c++) {
                ColumnInfo column = colinf[c];
                ValueMetaInterface valueMeta = column.getValueMeta();
                String string = null;
                try {
                    string = valueMeta.getString(rowData[c]);
                } catch (KettleValueException e) {
                    log.logError("history data conversion issue", e);
                }
                item.setText(c + 1, Const.NVL(string, ""));
            }
            // Add some color
            // 
            Long errors = null;
            LogStatus status = null;
            LogTableField errorsField = model.logTable.getErrorsField();
            if (errorsField != null) {
                int index1 = model.logTableFields.indexOf(errorsField);
                try {
                    errors = colinf[index1].getValueMeta().getInteger(rowData[index1]);
                } catch (KettleValueException e) {
                    log.logError("history data conversion issue", e);
                }
            }
            LogTableField statusField = model.logTable.getStatusField();
            if (statusField != null) {
                int index1 = model.logTableFields.indexOf(statusField);
                String statusString = null;
                try {
                    statusString = colinf[index1].getValueMeta().getString(rowData[index1]);
                } catch (KettleValueException e) {
                    log.logError("history data conversion issue", e);
                }
                if (statusString != null) {
                    status = LogStatus.findStatus(statusString);
                }
            }
            if (errors != null && errors > 0L) {
                item.setBackground(GUIResource.getInstance().getColorRed());
            } else if (status != null && LogStatus.STOP.equals(status)) {
                item.setBackground(GUIResource.getInstance().getColorYellow());
            }
        }
        model.logDisplayTableView.removeEmptyRows();
        model.logDisplayTableView.setRowNums();
        model.logDisplayTableView.optWidth(true);
    } else {
        model.logDisplayTableView.clearAll(false);
    // new TableItem(wFields.get(tabIndex).table, SWT.NONE); // Give it an item to prevent errors on various
    // platforms.
    }
    if (selectionIndex >= 0 && selectionIndex < model.logDisplayTableView.getItemCount()) {
        model.logDisplayTableView.table.select(selectionIndex);
        showLogEntry();
    }
}
Also used : LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) LogStatus(org.pentaho.di.core.logging.LogStatus) KettleValueException(org.pentaho.di.core.exception.KettleValueException)

Example 69 with ColumnInfo

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

the class ClusterSchemaDialog method open.

public boolean open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    shell.setImage(GUIResource.getInstance().getImageCluster());
    lsMod = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            clusterSchema.setChanged();
        }
    };
    middle = props.getMiddlePct();
    margin = Const.MARGIN;
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setText(BaseMessages.getString(PKG, "ClusterSchemaDialog.Shell.Title"));
    shell.setLayout(formLayout);
    // First, add the buttons...
    // Buttons
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    Button[] buttons = new Button[] { wOK, wCancel };
    BaseStepDialog.positionBottomButtons(shell, buttons, margin, null);
    // The rest stays above the buttons, so we added those first...
    // What's the schema name??
    Label wlName = new Label(shell, SWT.RIGHT);
    props.setLook(wlName);
    wlName.setText(BaseMessages.getString(PKG, "ClusterSchemaDialog.Schema.Label"));
    FormData fdlName = new FormData();
    fdlName.top = new FormAttachment(0, 0);
    // First one in the left top corner
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, 0);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    FormData fdName = new FormData();
    fdName.top = new FormAttachment(0, 0);
    // To the right of the label
    fdName.left = new FormAttachment(middle, margin);
    fdName.right = new FormAttachment(95, 0);
    wName.setLayoutData(fdName);
    // What's the base port??
    Label wlPort = new Label(shell, SWT.RIGHT);
    props.setLook(wlPort);
    wlPort.setText(BaseMessages.getString(PKG, "ClusterSchemaDialog.Port.Label"));
    FormData fdlPort = new FormData();
    fdlPort.top = new FormAttachment(wName, margin);
    // First one in the left top corner
    fdlPort.left = new FormAttachment(0, 0);
    fdlPort.right = new FormAttachment(middle, 0);
    wlPort.setLayoutData(fdlPort);
    wPort = new TextVar(clusterSchema, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPort);
    wPort.addModifyListener(lsMod);
    FormData fdPort = new FormData();
    fdPort.top = new FormAttachment(wName, margin);
    // To the right of the label
    fdPort.left = new FormAttachment(middle, margin);
    fdPort.right = new FormAttachment(95, 0);
    wPort.setLayoutData(fdPort);
    // What are the sockets buffer sizes??
    Label wlBufferSize = new Label(shell, SWT.RIGHT);
    props.setLook(wlBufferSize);
    wlBufferSize.setText(BaseMessages.getString(PKG, "ClusterSchemaDialog.SocketBufferSize.Label"));
    FormData fdlBufferSize = new FormData();
    fdlBufferSize.top = new FormAttachment(wPort, margin);
    // First one in the left top corner
    fdlBufferSize.left = new FormAttachment(0, 0);
    fdlBufferSize.right = new FormAttachment(middle, 0);
    wlBufferSize.setLayoutData(fdlBufferSize);
    wBufferSize = new TextVar(clusterSchema, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wBufferSize);
    wBufferSize.addModifyListener(lsMod);
    FormData fdBufferSize = new FormData();
    fdBufferSize.top = new FormAttachment(wPort, margin);
    // To the right of the label
    fdBufferSize.left = new FormAttachment(middle, margin);
    fdBufferSize.right = new FormAttachment(95, 0);
    wBufferSize.setLayoutData(fdBufferSize);
    // What are the sockets buffer sizes??
    Label wlFlushInterval = new Label(shell, SWT.RIGHT);
    props.setLook(wlFlushInterval);
    wlFlushInterval.setText(BaseMessages.getString(PKG, "ClusterSchemaDialog.SocketFlushRows.Label"));
    FormData fdlFlushInterval = new FormData();
    fdlFlushInterval.top = new FormAttachment(wBufferSize, margin);
    // First one in the left top corner
    fdlFlushInterval.left = new FormAttachment(0, 0);
    fdlFlushInterval.right = new FormAttachment(middle, 0);
    wlFlushInterval.setLayoutData(fdlFlushInterval);
    wFlushInterval = new TextVar(clusterSchema, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFlushInterval);
    wFlushInterval.addModifyListener(lsMod);
    FormData fdFlushInterval = new FormData();
    fdFlushInterval.top = new FormAttachment(wBufferSize, margin);
    // To the right of the label
    fdFlushInterval.left = new FormAttachment(middle, margin);
    fdFlushInterval.right = new FormAttachment(95, 0);
    wFlushInterval.setLayoutData(fdFlushInterval);
    // What are the sockets buffer sizes??
    Label wlCompressed = new Label(shell, SWT.RIGHT);
    props.setLook(wlCompressed);
    wlCompressed.setText(BaseMessages.getString(PKG, "ClusterSchemaDialog.SocketDataCompressed.Label"));
    FormData fdlCompressed = new FormData();
    fdlCompressed.top = new FormAttachment(wFlushInterval, margin);
    // First one in the left top corner
    fdlCompressed.left = new FormAttachment(0, 0);
    fdlCompressed.right = new FormAttachment(middle, 0);
    wlCompressed.setLayoutData(fdlCompressed);
    wCompressed = new Button(shell, SWT.CHECK);
    props.setLook(wCompressed);
    FormData fdCompressed = new FormData();
    fdCompressed.top = new FormAttachment(wFlushInterval, margin);
    // To the right of the label
    fdCompressed.left = new FormAttachment(middle, margin);
    fdCompressed.right = new FormAttachment(95, 0);
    wCompressed.setLayoutData(fdCompressed);
    // What are the sockets buffer sizes??
    Label wlDynamic = new Label(shell, SWT.RIGHT);
    wlDynamic.setToolTipText(BaseMessages.getString(PKG, "ClusterSchemaDialog.DynamicCluster.Tooltip"));
    props.setLook(wlDynamic);
    wlDynamic.setText(BaseMessages.getString(PKG, "ClusterSchemaDialog.DynamicCluster.Label"));
    FormData fdlDynamic = new FormData();
    fdlDynamic.top = new FormAttachment(wCompressed, margin);
    // First one in the left top corner
    fdlDynamic.left = new FormAttachment(0, 0);
    fdlDynamic.right = new FormAttachment(middle, 0);
    wlDynamic.setLayoutData(fdlDynamic);
    wDynamic = new Button(shell, SWT.CHECK);
    wDynamic.setToolTipText(BaseMessages.getString(PKG, "ClusterSchemaDialog.DynamicCluster.Tooltip"));
    props.setLook(wDynamic);
    FormData fdDynamic = new FormData();
    fdDynamic.top = new FormAttachment(wCompressed, margin);
    // To the right of the label
    fdDynamic.left = new FormAttachment(middle, margin);
    fdDynamic.right = new FormAttachment(95, 0);
    wDynamic.setLayoutData(fdDynamic);
    // Schema servers:
    Label wlServers = new Label(shell, SWT.RIGHT);
    wlServers.setText(BaseMessages.getString(PKG, "ClusterSchemaDialog.SlaveServers.Label"));
    props.setLook(wlServers);
    FormData fdlServers = new FormData();
    fdlServers.left = new FormAttachment(0, 0);
    fdlServers.right = new FormAttachment(middle, 0);
    fdlServers.top = new FormAttachment(wDynamic, margin);
    wlServers.setLayoutData(fdlServers);
    // Some buttons to manage...
    wSelect = new Button(shell, SWT.PUSH);
    wSelect.setText(BaseMessages.getString(PKG, "ClusterSchemaDialog.SelectSlaveServers.Label"));
    props.setLook(wSelect);
    FormData fdSelect = new FormData();
    fdSelect.right = new FormAttachment(100, 0);
    fdSelect.top = new FormAttachment(wlServers, 5 * margin);
    wSelect.setLayoutData(fdSelect);
    wSelect.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            selectSlaveServers();
        }
    });
    ColumnInfo[] partitionColumns = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "ClusterSchemaDialog.ColumnInfoName.Label"), ColumnInfo.COLUMN_TYPE_TEXT, true, false), new ColumnInfo(BaseMessages.getString(PKG, "ClusterSchemaDialog.ColumnInfoServiceURL.Label"), ColumnInfo.COLUMN_TYPE_TEXT, true, true), new ColumnInfo(BaseMessages.getString(PKG, "ClusterSchemaDialog.ColumnInfoMaster.Label"), ColumnInfo.COLUMN_TYPE_TEXT, true, true) };
    wServers = new TableView(clusterSchema, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE, partitionColumns, 1, lsMod, props);
    wServers.setReadonly(false);
    props.setLook(wServers);
    FormData fdServers = new FormData();
    fdServers.left = new FormAttachment(middle, margin);
    fdServers.right = new FormAttachment(wSelect, -2 * margin);
    fdServers.top = new FormAttachment(wDynamic, margin);
    fdServers.bottom = new FormAttachment(wOK, -margin * 2);
    wServers.setLayoutData(fdServers);
    wServers.table.addSelectionListener(new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            editSlaveServer();
        }
    });
    // Add listeners
    wOK.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event e) {
            ok();
        }
    });
    wCancel.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event e) {
            cancel();
        }
    });
    SelectionAdapter selAdapter = new SelectionAdapter() {

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    BaseStepDialog.setSize(shell);
    shell.open();
    Display display = parent.getDisplay();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return ok;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) Display(org.eclipse.swt.widgets.Display)

Example 70 with ColumnInfo

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

the class CheckResultDialog method open.

public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    red = display.getSystemColor(SWT.COLOR_RED);
    green = display.getSystemColor(SWT.COLOR_GREEN);
    yellow = display.getSystemColor(SWT.COLOR_YELLOW);
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
    props.setLook(shell);
    shell.setImage(GUIResource.getInstance().getImageTransGraph());
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "CheckResultDialog.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    wlFields = new Label(shell, SWT.LEFT);
    wlFields.setText(BaseMessages.getString(PKG, "CheckResultDialog.Remarks.Label"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.right = new FormAttachment(middle, -margin);
    fdlFields.top = new FormAttachment(0, margin);
    wlFields.setLayoutData(fdlFields);
    int FieldsCols = 3;
    int FieldsRows = 1;
    ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
    colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "CheckResultDialog.Stepname.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false, true);
    colinf[1] = new ColumnInfo(BaseMessages.getString(PKG, "CheckResultDialog.Result.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false, true);
    colinf[2] = new ColumnInfo(BaseMessages.getString(PKG, "CheckResultDialog.Remark.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false, true);
    wFields = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, true, null, props);
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(wlFields, margin);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(100, -50);
    wFields.setLayoutData(fdFields);
    wNoOK = new Button(shell, SWT.CHECK);
    wNoOK.setText(STRING_SHOW_SUCESSFUL);
    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(wFields, margin);
    wNoOK.setLayoutData(fd);
    wClose = new Button(shell, SWT.PUSH);
    wClose.setText(BaseMessages.getString(PKG, "System.Button.Close"));
    wView = new Button(shell, SWT.PUSH);
    wView.setText(BaseMessages.getString(PKG, "CheckResultDialog.Button.ViewMessage"));
    wEdit = new Button(shell, SWT.PUSH);
    wEdit.setText(BaseMessages.getString(PKG, "CheckResultDialog.Button.EditOriginStep"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wClose, wView, wEdit }, margin, null);
    // Add listeners
    lsClose = new Listener() {

        public void handleEvent(Event e) {
            close();
        }
    };
    lsView = new Listener() {

        public void handleEvent(Event e) {
            view();
        }
    };
    lsEdit = new Listener() {

        public void handleEvent(Event e) {
            edit();
        }
    };
    lsNoOK = new Listener() {

        public void handleEvent(Event e) {
            noOK();
        }
    };
    wClose.addListener(SWT.Selection, lsClose);
    wView.addListener(SWT.Selection, lsView);
    wEdit.addListener(SWT.Selection, lsEdit);
    wNoOK.addListener(SWT.Selection, lsNoOK);
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            close();
        }
    });
    getData();
    BaseStepDialog.setSize(shell);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Listener(org.eclipse.swt.widgets.Listener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) Display(org.eclipse.swt.widgets.Display) TableView(org.pentaho.di.ui.core.widget.TableView)

Aggregations

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