Search in sources :

Example 1 with PaloDimInputMeta

use of org.pentaho.di.trans.steps.palo.diminput.PaloDimInputMeta in project pentaho-kettle by pentaho.

the class PaloDimInputDialog method preview.

private void preview() {
    PaloDimInputMeta oneMeta = new PaloDimInputMeta();
    try {
        getInfo(oneMeta);
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "PaloInputDialog.Illegal.Dialog.Settings.Title"), BaseMessages.getString(PKG, "PaloInputDialog.Illegal.Dialog.Settings.Message"), e);
        return;
    }
    TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, textStepName.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, 500, BaseMessages.getString("System.Dialog.EnterPreviewSize.Title"), BaseMessages.getString("System.Dialog.EnterPreviewSize.Message"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
        TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { textStepName.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("System.Dialog.PreviewError.Title"), BaseMessages.getString("System.Dialog.PreviewError.Message"), loggingText, true);
                etd.setReadOnly();
                etd.open();
            }
        }
        PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, textStepName.getText(), progressDialog.getPreviewRowsMeta(textStepName.getText()), progressDialog.getPreviewRows(textStepName.getText()), loggingText);
        prd.open();
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) PaloDimInputMeta(org.pentaho.di.trans.steps.palo.diminput.PaloDimInputMeta) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) 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

KettleException (org.pentaho.di.core.exception.KettleException)1 Trans (org.pentaho.di.trans.Trans)1 TransMeta (org.pentaho.di.trans.TransMeta)1 PaloDimInputMeta (org.pentaho.di.trans.steps.palo.diminput.PaloDimInputMeta)1 EnterNumberDialog (org.pentaho.di.ui.core.dialog.EnterNumberDialog)1 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)1 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)1 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)1 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)1