Search in sources :

Example 16 with TableItemInsertListener

use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.

the class DBProcDialog method get.

private void get() {
    try {
        RowMetaInterface r = transMeta.getPrevStepFields(stepname);
        if (r != null && !r.isEmpty()) {
            TableItemInsertListener listener = new TableItemInsertListener() {

                public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
                    tableItem.setText(2, "IN");
                    return true;
                }
            };
            BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1 }, new int[] { 3 }, -1, -1, listener);
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "DBProcDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "DBProcDialog.FailedToGetFields.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) TableItem(org.eclipse.swt.widgets.TableItem) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 17 with TableItemInsertListener

use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.

the class DeleteDialog method get.

private void get() {
    try {
        RowMetaInterface r = transMeta.getPrevStepFields(stepname);
        if (r != null && !r.isEmpty()) {
            TableItemInsertListener listener = new TableItemInsertListener() {

                public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
                    tableItem.setText(2, "=");
                    return true;
                }
            };
            BaseStepDialog.getFieldsFromPrevious(r, wKey, 1, new int[] { 1, 3 }, new int[] {}, -1, -1, listener);
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "DeleteDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "DeleteDialog.FailedToGetFields.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) TableItem(org.eclipse.swt.widgets.TableItem) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 18 with TableItemInsertListener

use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.

the class DenormaliserDialog method getAgg.

private void getAgg() {
    // The grouping fields: ignore those.
    wGroup.removeEmptyRows();
    final String[] groupingFields = wGroup.getItems(0);
    try {
        RowMetaInterface r = transMeta.getPrevStepFields(stepname);
        if (r != null && !r.isEmpty()) {
            BaseStepDialog.getFieldsFromPrevious(r, wTarget, 2, new int[] {}, new int[] {}, -1, -1, new TableItemInsertListener() {

                @Override
                public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
                    if (Const.indexOfString(v.getName(), groupingFields) < 0) {
                        // Not a grouping field
                        if (!wKeyField.getText().equalsIgnoreCase(v.getName())) {
                            // Not the key field
                            int nr = tableItem.getParent().indexOf(tableItem) + 1;
                            tableItem.setText(1, BaseMessages.getString(PKG, "DenormaliserDialog.TargetFieldname.Label") + // the target fieldname
                            nr);
                            tableItem.setText(2, v.getName());
                            tableItem.setText(4, v.getTypeDesc());
                            if (v.getLength() >= 0) {
                                tableItem.setText(6, "" + v.getLength());
                            }
                            if (v.getPrecision() >= 0) {
                                tableItem.setText(7, "" + v.getPrecision());
                            }
                        }
                    }
                    return true;
                }
            });
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "DenormaliserDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "DenormaliserDialog.FailedToGetFields.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) TableItem(org.eclipse.swt.widgets.TableItem) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 19 with TableItemInsertListener

use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.

the class DimensionLookupDialog method getLookup.

/**
 * Get the fields from the table in the database and use them as lookup keys. Only get the the fields which are not
 * yet in use as key, or in the field table. Also ignore technical key, version, fromdate, todate.
 */
private void getLookup() {
    DatabaseMeta databaseMeta = transMeta.findDatabase(wConnection.getText());
    if (databaseMeta != null) {
        Database db = new Database(loggingObject, databaseMeta);
        db.shareVariablesWith(transMeta);
        try {
            db.connect();
            String schemaTable = databaseMeta.getQuotedSchemaTableCombination(wSchema.getText(), wTable.getText());
            RowMetaInterface r = db.getTableFields(schemaTable);
            if (r != null && !r.isEmpty()) {
                BaseStepDialog.getFieldsFromPrevious(r, wUpIns, 2, new int[] { 1, 2 }, new int[] { 3 }, -1, -1, new TableItemInsertListener() {

                    public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
                        int idx = wKey.indexOfString(v.getName(), 2);
                        return idx < 0 && !v.getName().equalsIgnoreCase(wTk.getText()) && !v.getName().equalsIgnoreCase(wVersion.getText()) && !v.getName().equalsIgnoreCase(wFromdate.getText()) && !v.getName().equalsIgnoreCase(wTodate.getText());
                    }
                });
            }
        } catch (KettleException e) {
            MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
            mb.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.ErrorOccurred.DialogTitle"));
            mb.setMessage(BaseMessages.getString(PKG, "DimensionLookupDialog.ErrorOccurred.DialogMessage") + Const.CR + e.getMessage());
            mb.open();
        } finally {
            db.disconnect();
        }
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) TableItem(org.eclipse.swt.widgets.TableItem) Database(org.pentaho.di.core.database.Database) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 20 with TableItemInsertListener

use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.

the class HTTPPOSTDialog method get.

private void get() {
    try {
        RowMetaInterface r = transMeta.getPrevStepFields(stepname);
        if (r != null && !r.isEmpty()) {
            TableItemInsertListener listener = new TableItemInsertListener() {

                public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
                    // default is "N"
                    tableItem.setText(3, NO);
                    return true;
                }
            };
            BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1, 2 }, null, -1, -1, listener);
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "HTTPPOSTDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "HTTPPOSTDialog.FailedToGetFields.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) TableItem(org.eclipse.swt.widgets.TableItem) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Aggregations

TableItem (org.eclipse.swt.widgets.TableItem)43 KettleException (org.pentaho.di.core.exception.KettleException)43 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)43 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)43 TableItemInsertListener (org.pentaho.di.ui.trans.step.TableItemInsertListener)43 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)42 Point (org.eclipse.swt.graphics.Point)4 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)3 Cursor (org.eclipse.swt.graphics.Cursor)2 MessageBox (org.eclipse.swt.widgets.MessageBox)2 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)2 FileDialog (org.eclipse.swt.widgets.FileDialog)1 Table (org.eclipse.swt.widgets.Table)1 Database (org.pentaho.di.core.database.Database)1 SAPR3DatabaseMeta (org.pentaho.di.core.database.sap.SAPR3DatabaseMeta)1 RowMeta (org.pentaho.di.core.row.RowMeta)1 SAPConnection (org.pentaho.di.trans.steps.sapinput.sap.SAPConnection)1 SAPField (org.pentaho.di.trans.steps.sapinput.sap.SAPField)1 SAPFunctionSignature (org.pentaho.di.trans.steps.sapinput.sap.SAPFunctionSignature)1 MasterReport (org.pentaho.reporting.engine.classic.core.MasterReport)1