Search in sources :

Example 1 with FieldDisabledListener

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

the class KettlePropertiesFileDialog method open.

public Map<String, String> open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
    shell.setImage(GUIResource.getInstance().getImageTransGraph());
    props.setLook(shell);
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Title"));
    int margin = Const.MARGIN;
    // Message line
    // 
    wlFields = new Label(shell, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Message"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(0, margin);
    wlFields.setLayoutData(fdlFields);
    int FieldsRows = 0;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Name.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Value.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Description.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
    colinf[2].setDisabledListener(new FieldDisabledListener() {

        public boolean isFieldDisabled(int rowNr) {
            return false;
        }
    });
    wFields = new TableView(Variables.getADefaultVariableSpace(), shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, null, props);
    wFields.setReadonly(false);
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(wlFields, 30);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(100, -50);
    wFields.setLayoutData(fdFields);
    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, wFields);
    // Add listeners
    lsOK = new Listener() {

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

        public void handleEvent(Event e) {
            cancel();
        }
    };
    wOK.addListener(SWT.Selection, lsOK);
    wCancel.addListener(SWT.Selection, lsCancel);
    // 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();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return kettleProperties;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) FieldDisabledListener(org.pentaho.di.ui.core.widget.FieldDisabledListener) 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) FieldDisabledListener(org.pentaho.di.ui.core.widget.FieldDisabledListener) 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)

Example 2 with FieldDisabledListener

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

the class JobDialog method showChannelLogTableOptions.

private void showChannelLogTableOptions(ChannelLogTable channelLogTable) {
    addDBSchemaTableLogOptions(channelLogTable);
    // The log timeout in days
    // 
    Label wlLogTimeout = new Label(wLogOptionsComposite, SWT.RIGHT);
    wlLogTimeout.setText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Label"));
    wlLogTimeout.setToolTipText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Tooltip"));
    props.setLook(wlLogTimeout);
    FormData fdlLogTimeout = new FormData();
    fdlLogTimeout.left = new FormAttachment(0, 0);
    fdlLogTimeout.right = new FormAttachment(middle, -margin);
    fdlLogTimeout.top = new FormAttachment(wLogTable, margin);
    wlLogTimeout.setLayoutData(fdlLogTimeout);
    wLogTimeout = new TextVar(jobMeta, wLogOptionsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wLogTimeout.setToolTipText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Tooltip"));
    props.setLook(wLogTimeout);
    wLogTimeout.addModifyListener(lsMod);
    FormData fdLogTimeout = new FormData();
    fdLogTimeout.left = new FormAttachment(middle, 0);
    fdLogTimeout.top = new FormAttachment(wLogTable, margin);
    fdLogTimeout.right = new FormAttachment(100, 0);
    wLogTimeout.setLayoutData(fdLogTimeout);
    wLogTimeout.setText(Const.NVL(channelLogTable.getTimeoutInDays(), ""));
    // Add the fields grid...
    // 
    Label wlFields = new Label(wLogOptionsComposite, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Label"));
    props.setLook(wlFields);
    FormData fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wLogTimeout, margin * 2);
    wlFields.setLayoutData(fdlFields);
    final java.util.List<LogTableField> fields = channelLogTable.getFields();
    final int nrRows = fields.size();
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.FieldName"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Description"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
    FieldDisabledListener disabledListener = new FieldDisabledListener() {

        public boolean isFieldDisabled(int rowNr) {
            if (rowNr >= 0 && rowNr < fields.size()) {
                LogTableField field = fields.get(rowNr);
                return field.isSubjectAllowed();
            } else {
                return true;
            }
        }
    };
    colinf[1].setDisabledListener(disabledListener);
    wOptionFields = new // add a
    TableView(// add a
    jobMeta, // add a
    wLogOptionsComposite, // add a
    SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.CHECK, // left...
    colinf, nrRows, true, lsMod, props);
    wOptionFields.setSortable(false);
    for (int i = 0; i < fields.size(); i++) {
        LogTableField field = fields.get(i);
        TableItem item = wOptionFields.table.getItem(i);
        item.setChecked(field.isEnabled());
        item.setText(new String[] { "", Const.NVL(field.getFieldName(), ""), Const.NVL(field.getDescription(), "") });
    }
    wOptionFields.table.getColumn(0).setText(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Enabled"));
    FormData fdOptionFields = new FormData();
    fdOptionFields.left = new FormAttachment(0, 0);
    fdOptionFields.top = new FormAttachment(wlFields, margin);
    fdOptionFields.right = new FormAttachment(100, 0);
    fdOptionFields.bottom = new FormAttachment(100, 0);
    wOptionFields.setLayoutData(fdOptionFields);
    wOptionFields.optWidth(true);
    wOptionFields.layout();
}
Also used : FormData(org.eclipse.swt.layout.FormData) LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) FieldDisabledListener(org.pentaho.di.ui.core.widget.FieldDisabledListener) TextVar(org.pentaho.di.ui.core.widget.TextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 3 with FieldDisabledListener

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

the class JobDialog method showJobEntryLogTableOptions.

private void showJobEntryLogTableOptions(JobEntryLogTable jobEntryLogTable) {
    addDBSchemaTableLogOptions(jobEntryLogTable);
    // The log timeout in days
    // 
    Label wlLogTimeout = new Label(wLogOptionsComposite, SWT.RIGHT);
    wlLogTimeout.setText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Label"));
    wlLogTimeout.setToolTipText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Tooltip"));
    props.setLook(wlLogTimeout);
    FormData fdlLogTimeout = new FormData();
    fdlLogTimeout.left = new FormAttachment(0, 0);
    fdlLogTimeout.right = new FormAttachment(middle, -margin);
    fdlLogTimeout.top = new FormAttachment(wLogTable, margin);
    wlLogTimeout.setLayoutData(fdlLogTimeout);
    wLogTimeout = new TextVar(jobMeta, wLogOptionsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wLogTimeout.setToolTipText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Tooltip"));
    props.setLook(wLogTimeout);
    wLogTimeout.addModifyListener(lsMod);
    FormData fdLogTimeout = new FormData();
    fdLogTimeout.left = new FormAttachment(middle, 0);
    fdLogTimeout.top = new FormAttachment(wLogTable, margin);
    fdLogTimeout.right = new FormAttachment(100, 0);
    wLogTimeout.setLayoutData(fdLogTimeout);
    wLogTimeout.setText(Const.NVL(jobEntryLogTable.getTimeoutInDays(), ""));
    // Add the fields grid...
    // 
    Label wlFields = new Label(wLogOptionsComposite, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Label"));
    props.setLook(wlFields);
    FormData fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wLogTimeout, margin * 2);
    wlFields.setLayoutData(fdlFields);
    final java.util.List<LogTableField> fields = jobEntryLogTable.getFields();
    final int nrRows = fields.size();
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.FieldName"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Description"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
    FieldDisabledListener disabledListener = new FieldDisabledListener() {

        public boolean isFieldDisabled(int rowNr) {
            if (rowNr >= 0 && rowNr < fields.size()) {
                LogTableField field = fields.get(rowNr);
                return field.isSubjectAllowed();
            } else {
                return true;
            }
        }
    };
    colinf[1].setDisabledListener(disabledListener);
    wOptionFields = new // add a
    TableView(// add a
    jobMeta, // add a
    wLogOptionsComposite, // add a
    SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.CHECK, // left...
    colinf, nrRows, true, lsMod, props);
    wOptionFields.setSortable(false);
    for (int i = 0; i < fields.size(); i++) {
        LogTableField field = fields.get(i);
        TableItem item = wOptionFields.table.getItem(i);
        item.setChecked(field.isEnabled());
        item.setText(new String[] { "", Const.NVL(field.getFieldName(), ""), Const.NVL(field.getDescription(), "") });
    }
    wOptionFields.table.getColumn(0).setText(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Enabled"));
    FormData fdOptionFields = new FormData();
    fdOptionFields.left = new FormAttachment(0, 0);
    fdOptionFields.top = new FormAttachment(wlFields, margin);
    fdOptionFields.right = new FormAttachment(100, 0);
    fdOptionFields.bottom = new FormAttachment(100, 0);
    wOptionFields.setLayoutData(fdOptionFields);
    wOptionFields.optWidth(true);
    wOptionFields.layout();
}
Also used : FormData(org.eclipse.swt.layout.FormData) LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) FieldDisabledListener(org.pentaho.di.ui.core.widget.FieldDisabledListener) TextVar(org.pentaho.di.ui.core.widget.TextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 4 with FieldDisabledListener

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

the class TransDialog method showTransLogTableOptions.

private void showTransLogTableOptions() {
    previousLogTableIndex = LOG_INDEX_TRANS;
    addDBSchemaTableLogOptions(transLogTable);
    // Log interval...
    // 
    Label wlLogInterval = new Label(wLogOptionsComposite, SWT.RIGHT);
    wlLogInterval.setText(BaseMessages.getString(PKG, "TransDialog.LogInterval.Label"));
    props.setLook(wlLogInterval);
    FormData fdlLogInterval = new FormData();
    fdlLogInterval.left = new FormAttachment(0, 0);
    fdlLogInterval.right = new FormAttachment(middle, -margin);
    fdlLogInterval.top = new FormAttachment(wLogTable, margin);
    wlLogInterval.setLayoutData(fdlLogInterval);
    wLogInterval = new TextVar(transMeta, wLogOptionsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLogInterval);
    wLogInterval.addModifyListener(lsMod);
    FormData fdLogInterval = new FormData();
    fdLogInterval.left = new FormAttachment(middle, 0);
    fdLogInterval.top = new FormAttachment(wLogTable, margin);
    fdLogInterval.right = new FormAttachment(100, 0);
    wLogInterval.setLayoutData(fdLogInterval);
    wLogInterval.setText(Const.NVL(transLogTable.getLogInterval(), ""));
    // The log timeout in days
    // 
    Label wlLogTimeout = new Label(wLogOptionsComposite, SWT.RIGHT);
    wlLogTimeout.setText(BaseMessages.getString(PKG, "TransDialog.LogTimeout.Label"));
    wlLogTimeout.setToolTipText(BaseMessages.getString(PKG, "TransDialog.LogTimeout.Tooltip"));
    props.setLook(wlLogTimeout);
    FormData fdlLogTimeout = new FormData();
    fdlLogTimeout.left = new FormAttachment(0, 0);
    fdlLogTimeout.right = new FormAttachment(middle, -margin);
    fdlLogTimeout.top = new FormAttachment(wLogInterval, margin);
    wlLogTimeout.setLayoutData(fdlLogTimeout);
    wLogTimeout = new TextVar(transMeta, wLogOptionsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wLogTimeout.setToolTipText(BaseMessages.getString(PKG, "TransDialog.LogTimeout.Tooltip"));
    props.setLook(wLogTimeout);
    wLogTimeout.addModifyListener(lsMod);
    FormData fdLogTimeout = new FormData();
    fdLogTimeout.left = new FormAttachment(middle, 0);
    fdLogTimeout.top = new FormAttachment(wLogInterval, margin);
    fdLogTimeout.right = new FormAttachment(100, 0);
    wLogTimeout.setLayoutData(fdLogTimeout);
    wLogTimeout.setText(Const.NVL(transLogTable.getTimeoutInDays(), ""));
    // The log size limit
    // 
    Label wlLogSizeLimit = new Label(wLogOptionsComposite, SWT.RIGHT);
    wlLogSizeLimit.setText(BaseMessages.getString(PKG, "TransDialog.LogSizeLimit.Label"));
    wlLogSizeLimit.setToolTipText(BaseMessages.getString(PKG, "TransDialog.LogSizeLimit.Tooltip"));
    props.setLook(wlLogSizeLimit);
    FormData fdlLogSizeLimit = new FormData();
    fdlLogSizeLimit.left = new FormAttachment(0, 0);
    fdlLogSizeLimit.right = new FormAttachment(middle, -margin);
    fdlLogSizeLimit.top = new FormAttachment(wLogTimeout, margin);
    wlLogSizeLimit.setLayoutData(fdlLogSizeLimit);
    wLogSizeLimit = new TextVar(transMeta, wLogOptionsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wLogSizeLimit.setToolTipText(BaseMessages.getString(PKG, "TransDialog.LogSizeLimit.Tooltip"));
    props.setLook(wLogSizeLimit);
    wLogSizeLimit.addModifyListener(lsMod);
    FormData fdLogSizeLimit = new FormData();
    fdLogSizeLimit.left = new FormAttachment(middle, 0);
    fdLogSizeLimit.top = new FormAttachment(wLogTimeout, margin);
    fdLogSizeLimit.right = new FormAttachment(100, 0);
    wLogSizeLimit.setLayoutData(fdLogSizeLimit);
    wLogSizeLimit.setText(Const.NVL(transLogTable.getLogSizeLimit(), ""));
    // Add the fields grid...
    // 
    Label wlFields = new Label(wLogOptionsComposite, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "TransDialog.TransLogTable.Fields.Label"));
    props.setLook(wlFields);
    FormData fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wLogSizeLimit, margin * 2);
    wlFields.setLayoutData(fdlFields);
    final java.util.List<LogTableField> fields = transLogTable.getFields();
    final int nrRows = fields.size();
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "TransDialog.TransLogTable.Fields.FieldName"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TransDialog.TransLogTable.Fields.StepName"), ColumnInfo.COLUMN_TYPE_CCOMBO, transMeta.getStepNames()), new ColumnInfo(BaseMessages.getString(PKG, "TransDialog.TransLogTable.Fields.Description"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
    FieldDisabledListener disabledListener = new FieldDisabledListener() {

        public boolean isFieldDisabled(int rowNr) {
            if (rowNr >= 0 && rowNr < fields.size()) {
                LogTableField field = fields.get(rowNr);
                return !field.isSubjectAllowed();
            } else {
                return true;
            }
        }
    };
    colinf[1].setDisabledListener(disabledListener);
    wOptionFields = new TableView(transMeta, wLogOptionsComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.CHECK, colinf, nrRows, true, lsMod, props);
    wOptionFields.setSortable(false);
    for (int i = 0; i < fields.size(); i++) {
        LogTableField field = fields.get(i);
        TableItem item = wOptionFields.table.getItem(i);
        item.setChecked(field.isEnabled());
        item.setText(new String[] { "", Const.NVL(field.getFieldName(), ""), field.getSubject() == null ? "" : field.getSubject().toString(), Const.NVL(field.getDescription(), "") });
        // 
        if (disabledListener.isFieldDisabled(i)) {
            item.setBackground(2, GUIResource.getInstance().getColorLightGray());
        }
    }
    wOptionFields.table.getColumn(0).setText(BaseMessages.getString(PKG, "TransDialog.TransLogTable.Fields.Enabled"));
    FormData fdOptionFields = new FormData();
    fdOptionFields.left = new FormAttachment(0, 0);
    fdOptionFields.top = new FormAttachment(wlFields, margin);
    fdOptionFields.right = new FormAttachment(100, 0);
    fdOptionFields.bottom = new FormAttachment(100, 0);
    wOptionFields.setLayoutData(fdOptionFields);
    wOptionFields.optWidth(true);
    wOptionFields.layout();
    wLogOptionsComposite.layout(true, true);
    wLogComp.layout(true, true);
}
Also used : FormData(org.eclipse.swt.layout.FormData) LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) FieldDisabledListener(org.pentaho.di.ui.core.widget.FieldDisabledListener) TextVar(org.pentaho.di.ui.core.widget.TextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView)

Example 5 with FieldDisabledListener

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

the class TransDialog method showStepLogTableOptions.

private void showStepLogTableOptions() {
    previousLogTableIndex = LOG_INDEX_STEP;
    addDBSchemaTableLogOptions(stepLogTable);
    // The log timeout in days
    // 
    Label wlLogTimeout = new Label(wLogOptionsComposite, SWT.RIGHT);
    wlLogTimeout.setText(BaseMessages.getString(PKG, "TransDialog.LogTimeout.Label"));
    wlLogTimeout.setToolTipText(BaseMessages.getString(PKG, "TransDialog.LogTimeout.Tooltip"));
    props.setLook(wlLogTimeout);
    FormData fdlLogTimeout = new FormData();
    fdlLogTimeout.left = new FormAttachment(0, 0);
    fdlLogTimeout.right = new FormAttachment(middle, -margin);
    fdlLogTimeout.top = new FormAttachment(wLogTable, margin);
    wlLogTimeout.setLayoutData(fdlLogTimeout);
    wLogTimeout = new TextVar(transMeta, wLogOptionsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wLogTimeout.setToolTipText(BaseMessages.getString(PKG, "TransDialog.LogTimeout.Tooltip"));
    props.setLook(wLogTimeout);
    wLogTimeout.addModifyListener(lsMod);
    FormData fdLogTimeout = new FormData();
    fdLogTimeout.left = new FormAttachment(middle, 0);
    fdLogTimeout.top = new FormAttachment(wLogTable, margin);
    fdLogTimeout.right = new FormAttachment(100, 0);
    wLogTimeout.setLayoutData(fdLogTimeout);
    wLogTimeout.setText(Const.NVL(stepLogTable.getTimeoutInDays(), ""));
    // Add the fields grid...
    // 
    Label wlFields = new Label(wLogOptionsComposite, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "TransDialog.TransLogTable.Fields.Label"));
    props.setLook(wlFields);
    FormData fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wLogTimeout, margin * 2);
    wlFields.setLayoutData(fdlFields);
    final java.util.List<LogTableField> fields = stepLogTable.getFields();
    final int nrRows = fields.size();
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "TransDialog.TransLogTable.Fields.FieldName"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "TransDialog.TransLogTable.Fields.Description"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
    FieldDisabledListener disabledListener = new FieldDisabledListener() {

        public boolean isFieldDisabled(int rowNr) {
            if (rowNr >= 0 && rowNr < fields.size()) {
                LogTableField field = fields.get(rowNr);
                return field.isSubjectAllowed();
            } else {
                return true;
            }
        }
    };
    colinf[1].setDisabledListener(disabledListener);
    wOptionFields = new TableView(transMeta, wLogOptionsComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.CHECK, colinf, nrRows, true, lsMod, props);
    wOptionFields.setSortable(false);
    for (int i = 0; i < fields.size(); i++) {
        LogTableField field = fields.get(i);
        TableItem item = wOptionFields.table.getItem(i);
        item.setChecked(field.isEnabled());
        item.setText(new String[] { "", Const.NVL(field.getFieldName(), ""), Const.NVL(field.getDescription(), "") });
    }
    wOptionFields.table.getColumn(0).setText(BaseMessages.getString(PKG, "TransDialog.TransLogTable.Fields.Enabled"));
    FormData fdOptionFields = new FormData();
    fdOptionFields.left = new FormAttachment(0, 0);
    fdOptionFields.top = new FormAttachment(wlFields, margin);
    fdOptionFields.right = new FormAttachment(100, 0);
    fdOptionFields.bottom = new FormAttachment(100, 0);
    wOptionFields.setLayoutData(fdOptionFields);
    wOptionFields.optWidth(true);
    wOptionFields.layout();
    wLogOptionsComposite.layout(true, true);
    wLogComp.layout(true, true);
}
Also used : FormData(org.eclipse.swt.layout.FormData) LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) FieldDisabledListener(org.pentaho.di.ui.core.widget.FieldDisabledListener) TextVar(org.pentaho.di.ui.core.widget.TextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView)

Aggregations

FormAttachment (org.eclipse.swt.layout.FormAttachment)8 FormData (org.eclipse.swt.layout.FormData)8 Label (org.eclipse.swt.widgets.Label)8 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)8 FieldDisabledListener (org.pentaho.di.ui.core.widget.FieldDisabledListener)8 TableItem (org.eclipse.swt.widgets.TableItem)7 LogTableField (org.pentaho.di.core.logging.LogTableField)7 TextVar (org.pentaho.di.ui.core.widget.TextVar)7 TableView (org.pentaho.di.ui.core.widget.TableView)6 ShellAdapter (org.eclipse.swt.events.ShellAdapter)1 ShellEvent (org.eclipse.swt.events.ShellEvent)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 Button (org.eclipse.swt.widgets.Button)1 Display (org.eclipse.swt.widgets.Display)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 Shell (org.eclipse.swt.widgets.Shell)1