Search in sources :

Example 11 with LogTableField

use of org.pentaho.di.core.logging.LogTableField 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 12 with LogTableField

use of org.pentaho.di.core.logging.LogTableField in project pentaho-kettle by pentaho.

the class TransDialog method getPerformanceLogTableOptions.

private void getPerformanceLogTableOptions() {
    if (previousLogTableIndex == LOG_INDEX_PERFORMANCE) {
        // The connection...
        // 
        performanceLogTable.setConnectionName(wLogconnection.getText());
        performanceLogTable.setSchemaName(wLogSchema.getText());
        performanceLogTable.setTableName(wLogTable.getText());
        performanceLogTable.setLogInterval(wLogInterval.getText());
        performanceLogTable.setTimeoutInDays(wLogTimeout.getText());
        for (int i = 0; i < performanceLogTable.getFields().size(); i++) {
            TableItem item = wOptionFields.table.getItem(i);
            LogTableField field = performanceLogTable.getFields().get(i);
            field.setEnabled(item.getChecked());
            field.setFieldName(item.getText(1));
        }
    }
}
Also used : LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem)

Example 13 with LogTableField

use of org.pentaho.di.core.logging.LogTableField in project pentaho-kettle by pentaho.

the class TransDialog method getTransLogTableOptions.

private void getTransLogTableOptions() {
    if (previousLogTableIndex == LOG_INDEX_TRANS) {
        // The connection...
        // 
        transLogTable.setConnectionName(wLogconnection.getText());
        transLogTable.setSchemaName(wLogSchema.getText());
        transLogTable.setTableName(wLogTable.getText());
        transLogTable.setLogInterval(wLogInterval.getText());
        transLogTable.setLogSizeLimit(wLogSizeLimit.getText());
        transLogTable.setTimeoutInDays(wLogTimeout.getText());
        for (int i = 0; i < transLogTable.getFields().size(); i++) {
            TableItem item = wOptionFields.table.getItem(i);
            LogTableField field = transLogTable.getFields().get(i);
            field.setEnabled(item.getChecked());
            field.setFieldName(item.getText(1));
            if (field.isSubjectAllowed()) {
                field.setSubject(transMeta.findStep(item.getText(2)));
            }
        }
    }
}
Also used : LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem)

Example 14 with LogTableField

use of org.pentaho.di.core.logging.LogTableField in project pentaho-kettle by pentaho.

the class TransDialog method getMetricsLogTableOptions.

private void getMetricsLogTableOptions() {
    if (previousLogTableIndex == LOG_INDEX_METRICS) {
        // The connection...
        // 
        metricsLogTable.setConnectionName(wLogconnection.getText());
        metricsLogTable.setSchemaName(wLogSchema.getText());
        metricsLogTable.setTableName(wLogTable.getText());
        metricsLogTable.setTimeoutInDays(wLogTimeout.getText());
        for (int i = 0; i < metricsLogTable.getFields().size(); i++) {
            TableItem item = wOptionFields.table.getItem(i);
            LogTableField field = metricsLogTable.getFields().get(i);
            field.setEnabled(item.getChecked());
            field.setFieldName(item.getText(1));
        }
    }
}
Also used : LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem)

Example 15 with LogTableField

use of org.pentaho.di.core.logging.LogTableField 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

LogTableField (org.pentaho.di.core.logging.LogTableField)25 TableItem (org.eclipse.swt.widgets.TableItem)18 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)10 FormAttachment (org.eclipse.swt.layout.FormAttachment)8 FormData (org.eclipse.swt.layout.FormData)8 Label (org.eclipse.swt.widgets.Label)8 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)8 TextVar (org.pentaho.di.ui.core.widget.TextVar)8 FieldDisabledListener (org.pentaho.di.ui.core.widget.FieldDisabledListener)7 KettleValueException (org.pentaho.di.core.exception.KettleValueException)6 TableView (org.pentaho.di.ui.core.widget.TableView)5 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)3 Database (org.pentaho.di.core.database.Database)3 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)3 ResultSet (java.sql.ResultSet)2 ArrayList (java.util.ArrayList)2 Text (org.eclipse.swt.widgets.Text)2 KettleException (org.pentaho.di.core.exception.KettleException)2 LogStatus (org.pentaho.di.core.logging.LogStatus)2 LogTableInterface (org.pentaho.di.core.logging.LogTableInterface)2