Search in sources :

Example 6 with PreviewRowsDialog

use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-kettle by pentaho.

the class SecretKeyGeneratorDialog method preview.

// Preview the data
private void preview() {
    try {
        // Create the SecretKeyGeneratorMeta input step
        SecretKeyGeneratorMeta oneMeta = new SecretKeyGeneratorMeta();
        getInfo(oneMeta);
        TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
        EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "SecretKeyGeneratorDialog.NumberRows.DialogTitle"), BaseMessages.getString(PKG, "SecretKeyGeneratorDialog.NumberRows.DialogMessage"));
        int previewSize = numberDialog.open();
        if (previewSize > 0) {
            TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
            progressDialog.open();
            if (!progressDialog.isCancelled()) {
                Trans trans = progressDialog.getTrans();
                String loggingText = progressDialog.getLoggingText();
                if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
                    EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
                    etd.setReadOnly();
                    etd.open();
                }
                PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
                prd.open();
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "SecretKeyGeneratorDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "SecretKeyGeneratorDialog.ErrorPreviewingData.DialogMessage"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) SecretKeyGeneratorMeta(org.pentaho.di.trans.steps.symmetriccrypto.secretkeygenerator.SecretKeyGeneratorMeta) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) Trans(org.pentaho.di.trans.Trans)

Example 7 with PreviewRowsDialog

use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-kettle by pentaho.

the class SystemDataDialog method preview.

// Preview the data
private void preview() {
    try {
        SystemDataMeta oneMeta = new SystemDataMeta();
        getInfo(oneMeta);
        TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
        EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "SystemDataDialog.NumberRows.DialogTitle"), BaseMessages.getString(PKG, "SystemDataDialog.NumberRows.DialogMessage"));
        int previewSize = numberDialog.open();
        if (previewSize > 0) {
            TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
            progressDialog.open();
            if (!progressDialog.isCancelled()) {
                Trans trans = progressDialog.getTrans();
                String loggingText = progressDialog.getLoggingText();
                if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
                    EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
                    etd.setReadOnly();
                    etd.open();
                }
                PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
                prd.open();
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "SystemDataDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "SystemDataDialog.ErrorPreviewingData.DialogMessage"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) SystemDataMeta(org.pentaho.di.trans.steps.systemdata.SystemDataMeta) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) Trans(org.pentaho.di.trans.Trans)

Example 8 with PreviewRowsDialog

use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-kettle by pentaho.

the class EnterPreviewRowsDialog method show.

private void show() {
    if (rowDatas.size() == 0) {
        return;
    }
    int nr = wStepList.getSelectionIndex();
    java.util.List<Object[]> buffer = rowDatas.get(nr);
    RowMetaInterface rowMeta = rowMetas.get(nr);
    String name = stepNames.get(nr);
    if (rowMeta != null && buffer != null && buffer.size() > 0) {
        PreviewRowsDialog prd = new PreviewRowsDialog(shell, Variables.getADefaultVariableSpace(), SWT.NONE, name, rowMeta, buffer);
        prd.open();
    } else {
        MessageBox mb = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
        mb.setText(BaseMessages.getString(PKG, "EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Title"));
        mb.setMessage(BaseMessages.getString(PKG, "EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Message"));
        mb.open();
    }
}
Also used : RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 9 with PreviewRowsDialog

use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-kettle by pentaho.

the class MailInputDialog method preview.

// Preview the data
private void preview() {
    try {
        MailInputMeta oneMeta = new MailInputMeta();
        getInfo(oneMeta);
        TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
        EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "MailInputDialog.NumberRows.DialogTitle"), BaseMessages.getString(PKG, "MailInputDialog.NumberRows.DialogMessage"));
        int previewSize = numberDialog.open();
        if (previewSize > 0) {
            TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
            progressDialog.open();
            if (!progressDialog.isCancelled()) {
                Trans trans = progressDialog.getTrans();
                String loggingText = progressDialog.getLoggingText();
                if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
                    EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
                    etd.setReadOnly();
                    etd.open();
                }
                PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
                prd.open();
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "MailInputDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "MailInputDialog.ErrorPreviewingData.DialogMessage"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) MailInputMeta(org.pentaho.di.trans.steps.mailinput.MailInputMeta) TransMeta(org.pentaho.di.trans.TransMeta) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) Trans(org.pentaho.di.trans.Trans)

Example 10 with PreviewRowsDialog

use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-kettle by pentaho.

the class MondrianInputDialog method preview.

/**
 * Preview the data generated by this step. This generates a transformation using this step & a dummy and previews it.
 */
private void preview() {
    // Create the table input reader step...
    MondrianInputMeta oneMeta = new MondrianInputMeta();
    getInfo(oneMeta);
    TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "MondrianInputDialog.EnterPreviewSize"), BaseMessages.getString(PKG, "MondrianInputDialog.NumberOfRowsToPreview"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
        TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
        progressDialog.open();
        Trans trans = progressDialog.getTrans();
        String loggingText = progressDialog.getLoggingText();
        if (!progressDialog.isCancelled()) {
            if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
                EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
                etd.setReadOnly();
                etd.open();
            }
        }
        PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
        prd.open();
    }
}
Also used : TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) MondrianInputMeta(org.pentaho.di.trans.steps.mondrianinput.MondrianInputMeta) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) Trans(org.pentaho.di.trans.Trans)

Aggregations

PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)56 TransMeta (org.pentaho.di.trans.TransMeta)49 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)48 Trans (org.pentaho.di.trans.Trans)47 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)47 EnterNumberDialog (org.pentaho.di.ui.core.dialog.EnterNumberDialog)44 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)30 KettleException (org.pentaho.di.core.exception.KettleException)25 MessageBox (org.eclipse.swt.widgets.MessageBox)10 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)9 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)9 ArrayList (java.util.ArrayList)5 Point (org.eclipse.swt.graphics.Point)5 StepMeta (org.pentaho.di.trans.step.StepMeta)4 Date (java.util.Date)3 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)3 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)3 StepPluginType (org.pentaho.di.core.plugins.StepPluginType)3 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)3 TransHopMeta (org.pentaho.di.trans.TransHopMeta)3