Search in sources :

Example 6 with FieldDisabledListener

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

the class TransDialog method showChannelLogTableOptions.

private void showChannelLogTableOptions() {
    previousLogTableIndex = LOG_INDEX_CHANNEL;
    addDBSchemaTableLogOptions(channelLogTable);
    // 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(channelLogTable.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 = channelLogTable.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)

Example 7 with FieldDisabledListener

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

the class TransDialog method showPerformanceLogTableOptions.

private void showPerformanceLogTableOptions() {
    previousLogTableIndex = LOG_INDEX_PERFORMANCE;
    addDBSchemaTableLogOptions(performanceLogTable);
    // 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(performanceLogTable.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(performanceLogTable.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 = performanceLogTable.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)

Example 8 with FieldDisabledListener

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

the class TransDialog method showMetricsLogTableOptions.

private void showMetricsLogTableOptions() {
    previousLogTableIndex = LOG_INDEX_METRICS;
    addDBSchemaTableLogOptions(metricsLogTable);
    // 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(metricsLogTable.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 = metricsLogTable.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