Search in sources :

Example 21 with PipelinePreviewProgressDialog

use of org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog in project hop by apache.

the class GetSubFoldersDialog method preview.

// Preview the data
private void preview() {
    // Create the XML input transform
    GetSubFoldersMeta oneMeta = new GetSubFoldersMeta();
    getInfo(oneMeta);
    PipelineMeta previewMeta = PipelinePreviewFactory.generatePreviewPipeline(pipelineMeta.getMetadataProvider(), oneMeta, wTransformName.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "GetSubFoldersDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "GetSubFoldersDialog.PreviewSize.DialogMessage"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
        PipelinePreviewProgressDialog progressDialog = new PipelinePreviewProgressDialog(shell, variables, previewMeta, new String[] { wTransformName.getText() }, new int[] { previewSize });
        progressDialog.open();
        if (!progressDialog.isCancelled()) {
            Pipeline pipeline = progressDialog.getPipeline();
            String loggingText = progressDialog.getLoggingText();
            if (pipeline.getResult() != null && pipeline.getResult().getNrErrors() > 0) {
                EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "GetSubFoldersDialog.ErrorInPreview.DialogMessage"), loggingText, true);
                etd.setReadOnly();
                etd.open();
            }
            PreviewRowsDialog prd = new PreviewRowsDialog(shell, variables, SWT.NONE, wTransformName.getText(), progressDialog.getPreviewRowsMeta(wTransformName.getText()), progressDialog.getPreviewRows(wTransformName.getText()), loggingText);
            prd.open();
        }
    }
}
Also used : EnterTextDialog(org.apache.hop.ui.core.dialog.EnterTextDialog) PreviewRowsDialog(org.apache.hop.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.apache.hop.ui.core.dialog.EnterNumberDialog) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) PipelinePreviewProgressDialog(org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog) Pipeline(org.apache.hop.pipeline.Pipeline)

Example 22 with PipelinePreviewProgressDialog

use of org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog in project hop by apache.

the class GetTableNamesDialog method preview.

// Preview the data
private void preview() {
    GetTableNamesMeta oneMeta = new GetTableNamesMeta();
    getInfo(oneMeta);
    if (oneMeta.getDatabase() == null) {
        MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
        mb.setMessage(BaseMessages.getString(PKG, "GetTableNamesDialog.InvalidConnection.DialogMessage"));
        mb.setText(BaseMessages.getString(PKG, "GetTableNamesDialog.InvalidConnection.DialogTitle"));
        mb.open();
        return;
    }
    if (!checkUserInput(oneMeta)) {
        return;
    }
    PipelineMeta previewMeta = PipelinePreviewFactory.generatePreviewPipeline(pipelineMeta.getMetadataProvider(), oneMeta, wTransformName.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "GetTableNamesDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "GetTableNamesDialog.PreviewSize.DialogMessage"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
        PipelinePreviewProgressDialog progressDialog = new PipelinePreviewProgressDialog(shell, variables, previewMeta, new String[] { wTransformName.getText() }, new int[] { previewSize });
        progressDialog.open();
        if (!progressDialog.isCancelled()) {
            Pipeline pipeline = progressDialog.getPipeline();
            String loggingText = progressDialog.getLoggingText();
            if (pipeline.getResult() != null && pipeline.getResult().getNrErrors() > 0) {
                EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "GetTableNamesDialog.ErrorInPreview.DialogMessage"), loggingText, true);
                etd.setReadOnly();
                etd.open();
            }
            PreviewRowsDialog prd = new PreviewRowsDialog(shell, variables, SWT.NONE, wTransformName.getText(), progressDialog.getPreviewRowsMeta(wTransformName.getText()), progressDialog.getPreviewRows(wTransformName.getText()), loggingText);
            prd.open();
        }
    }
}
Also used : PipelineMeta(org.apache.hop.pipeline.PipelineMeta) PipelinePreviewProgressDialog(org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog) Pipeline(org.apache.hop.pipeline.Pipeline)

Example 23 with PipelinePreviewProgressDialog

use of org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog in project hop by apache.

the class GetVariableDialog method preview.

// Preview the data
private void preview() {
    try {
        // Create the Access input transform
        GetVariableMeta oneMeta = new GetVariableMeta();
        getInfo(oneMeta);
        PipelineMeta previewMeta = PipelinePreviewFactory.generatePreviewPipeline(pipelineMeta.getMetadataProvider(), oneMeta, wTransformName.getText());
        // We always just want to preview a single output row
        // 
        PipelinePreviewProgressDialog progressDialog = new PipelinePreviewProgressDialog(shell, variables, previewMeta, new String[] { wTransformName.getText() }, new int[] { 1 });
        progressDialog.open();
        if (!progressDialog.isCancelled()) {
            Pipeline pipeline = progressDialog.getPipeline();
            String loggingText = progressDialog.getLoggingText();
            if (pipeline.getResult() != null && pipeline.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, variables, SWT.NONE, wTransformName.getText(), progressDialog.getPreviewRowsMeta(wTransformName.getText()), progressDialog.getPreviewRows(wTransformName.getText()), loggingText);
            prd.open();
        }
    } catch (HopException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "GetVariableDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "GetVariableDialog.ErrorPreviewingData.DialogMessage"), e);
    }
}
Also used : HopException(org.apache.hop.core.exception.HopException) EnterTextDialog(org.apache.hop.ui.core.dialog.EnterTextDialog) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) ValueMetaString(org.apache.hop.core.row.value.ValueMetaString) PreviewRowsDialog(org.apache.hop.ui.core.dialog.PreviewRowsDialog) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) PipelinePreviewProgressDialog(org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog) Pipeline(org.apache.hop.pipeline.Pipeline)

Example 24 with PipelinePreviewProgressDialog

use of org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog in project hop by apache.

the class TextFileInputDialog method preview.

// Preview the data
private void preview() {
    // Create the XML input transform
    TextFileInputMeta oneMeta = new TextFileInputMeta();
    getInfo(oneMeta, true);
    if (oneMeta.inputFiles.acceptingFilenames) {
        MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
        mb.setMessage(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Message"));
        mb.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Title"));
        mb.open();
        return;
    }
    PipelineMeta previewMeta = PipelinePreviewFactory.generatePreviewPipeline(pipelineMeta.getMetadataProvider(), oneMeta, wTransformName.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogMessage"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
        PipelinePreviewProgressDialog progressDialog = new PipelinePreviewProgressDialog(shell, variables, previewMeta, new String[] { wTransformName.getText() }, new int[] { previewSize });
        progressDialog.open();
        Pipeline pipeline = progressDialog.getPipeline();
        String loggingText = progressDialog.getLoggingText();
        if (!progressDialog.isCancelled()) {
            if (pipeline.getResult() != null && pipeline.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, variables, SWT.NONE, wTransformName.getText(), progressDialog.getPreviewRowsMeta(wTransformName.getText()), progressDialog.getPreviewRows(wTransformName.getText()), loggingText);
        prd.open();
    }
}
Also used : ValueMetaString(org.apache.hop.core.row.value.ValueMetaString) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) PipelinePreviewProgressDialog(org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog) Pipeline(org.apache.hop.pipeline.Pipeline)

Example 25 with PipelinePreviewProgressDialog

use of org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog in project hop by apache.

the class CsvInputDialog method preview.

// Preview the data
private synchronized void preview() {
    // Create the XML input transform
    CsvInputMeta oneMeta = new CsvInputMeta();
    getInfo(oneMeta);
    PipelineMeta previewMeta = PipelinePreviewFactory.generatePreviewPipeline(pipelineMeta.getMetadataProvider(), oneMeta, wTransformName.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "CsvInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "CsvInputDialog.PreviewSize.DialogMessage"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
        PipelinePreviewProgressDialog progressDialog = new PipelinePreviewProgressDialog(shell, variables, previewMeta, new String[] { wTransformName.getText() }, new int[] { previewSize });
        progressDialog.open();
        Pipeline pipeline = progressDialog.getPipeline();
        String loggingText = progressDialog.getLoggingText();
        if (!progressDialog.isCancelled()) {
            if (pipeline.getResult() != null && pipeline.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, variables, SWT.NONE, wTransformName.getText(), progressDialog.getPreviewRowsMeta(wTransformName.getText()), progressDialog.getPreviewRows(wTransformName.getText()), loggingText);
        prd.open();
    }
}
Also used : ValueMetaString(org.apache.hop.core.row.value.ValueMetaString) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) PipelinePreviewProgressDialog(org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog) Pipeline(org.apache.hop.pipeline.Pipeline)

Aggregations

Pipeline (org.apache.hop.pipeline.Pipeline)32 PipelineMeta (org.apache.hop.pipeline.PipelineMeta)32 PipelinePreviewProgressDialog (org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog)32 HopException (org.apache.hop.core.exception.HopException)17 ValueMetaString (org.apache.hop.core.row.value.ValueMetaString)6 EnterTextDialog (org.apache.hop.ui.core.dialog.EnterTextDialog)6 PreviewRowsDialog (org.apache.hop.ui.core.dialog.PreviewRowsDialog)6 Point (org.eclipse.swt.graphics.Point)4 EnterNumberDialog (org.apache.hop.ui.core.dialog.EnterNumberDialog)3 ErrorDialog (org.apache.hop.ui.core.dialog.ErrorDialog)3 PluginRegistry (org.apache.hop.core.plugins.PluginRegistry)2 TransformPluginType (org.apache.hop.core.plugins.TransformPluginType)2 IRowMeta (org.apache.hop.core.row.IRowMeta)2 IValueMeta (org.apache.hop.core.row.IValueMeta)2 PipelineHopMeta (org.apache.hop.pipeline.PipelineHopMeta)2 BaseTransformMeta (org.apache.hop.pipeline.transform.BaseTransformMeta)2 TransformMeta (org.apache.hop.pipeline.transform.TransformMeta)2 GeneratorField (org.apache.hop.pipeline.transforms.rowgenerator.GeneratorField)2 RowGeneratorMeta (org.apache.hop.pipeline.transforms.rowgenerator.RowGeneratorMeta)2 IOException (java.io.IOException)1