Search in sources :

Example 1 with EnterNumberDialog

use of org.apache.hop.ui.core.dialog.EnterNumberDialog in project hop by apache.

the class DataGridDialog method preview.

/**
 * Preview the data generated by this transform. This generates a pipeline using this transform &
 * a dummy and previews it.
 */
private void preview() {
    // Create the table input reader transform...
    DataGridMeta oneMeta = new DataGridMeta();
    getInfo(oneMeta);
    PipelineMeta previewMeta = PipelinePreviewFactory.generatePreviewPipeline(pipelineMeta.getMetadataProvider(), oneMeta, wTransformName.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "DataGridDialog.EnterPreviewSize.Title"), BaseMessages.getString(PKG, "DataGridDialog.EnterPreviewSize.Message"));
    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() && 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 : EnterTextDialog(org.apache.hop.ui.core.dialog.EnterTextDialog) PreviewRowsDialog(org.apache.hop.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.apache.hop.ui.core.dialog.EnterNumberDialog) Point(org.eclipse.swt.graphics.Point) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) PipelinePreviewProgressDialog(org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog) Pipeline(org.apache.hop.pipeline.Pipeline)

Example 2 with EnterNumberDialog

use of org.apache.hop.ui.core.dialog.EnterNumberDialog in project hop by apache.

the class TableInputDialog method preview.

/**
 * Preview the data generated by this transform. This generates a pipeline using this transform &
 * a dummy and previews it.
 */
private void preview() {
    // Create the table input reader transform...
    TableInputMeta oneMeta = new TableInputMeta();
    getInfo(oneMeta, true);
    PipelineMeta previewMeta = PipelinePreviewFactory.generatePreviewPipeline(pipelineMeta.getMetadataProvider(), oneMeta, wTransformName.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "TableInputDialog.EnterPreviewSize"), BaseMessages.getString(PKG, "TableInputDialog.NumberOfRowsToPreview"));
    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();
            } else {
                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 3 with EnterNumberDialog

use of org.apache.hop.ui.core.dialog.EnterNumberDialog 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)

Aggregations

Pipeline (org.apache.hop.pipeline.Pipeline)3 PipelineMeta (org.apache.hop.pipeline.PipelineMeta)3 EnterNumberDialog (org.apache.hop.ui.core.dialog.EnterNumberDialog)3 EnterTextDialog (org.apache.hop.ui.core.dialog.EnterTextDialog)3 PreviewRowsDialog (org.apache.hop.ui.core.dialog.PreviewRowsDialog)3 PipelinePreviewProgressDialog (org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog)3 Point (org.eclipse.swt.graphics.Point)1