Search in sources :

Example 1 with SwtScrollBar

use of org.apache.hop.ui.hopgui.shared.SwtScrollBar in project hop by apache.

the class HopGuiWorkflowGraph method drawWorkflowImage.

public void drawWorkflowImage(GC swtGc, int width, int height, float magnificationFactor) throws HopException {
    IGc gc = new SwtGc(swtGc, width, height, iconSize);
    try {
        PropsUi propsUi = PropsUi.getInstance();
        int gridSize = propsUi.isShowCanvasGridEnabled() ? propsUi.getCanvasGridSize() : 1;
        ScrollBar horizontalScrollBar = wsCanvas.getHorizontalBar();
        ScrollBar verticalScrollBar = wsCanvas.getVerticalBar();
        WorkflowPainter workflowPainter = new WorkflowPainter(gc, variables, workflowMeta, new Point(width, height), horizontalScrollBar == null ? null : new SwtScrollBar(horizontalScrollBar), verticalScrollBar == null ? null : new SwtScrollBar(verticalScrollBar), hopCandidate, selectionRegion, areaOwners, propsUi.getIconSize(), propsUi.getLineWidth(), gridSize, propsUi.getNoteFont().getName(), propsUi.getNoteFont().getHeight(), propsUi.getZoomFactor(), !propsUi.useDoubleClick());
        // correct the magnification with the overall zoom factor
        // 
        float correctedMagnification = (float) (magnificationFactor * propsUi.getZoomFactor());
        workflowPainter.setMagnification(correctedMagnification);
        workflowPainter.setStartHopAction(startHopAction);
        workflowPainter.setEndHopLocation(endHopLocation);
        workflowPainter.setEndHopAction(endHopAction);
        workflowPainter.setNoInputAction(noInputAction);
        if (workflow != null) {
            workflowPainter.setActionResults(workflow.getActionResults());
        } else {
            workflowPainter.setActionResults(new ArrayList<>());
        }
        List<ActionMeta> activeActions = new ArrayList<>();
        if (workflow != null) {
            activeActions.addAll(workflow.getActiveActions());
        }
        workflowPainter.setActiveActions(activeActions);
        try {
            workflowPainter.drawWorkflow();
            if (workflowMeta.isEmpty() || (workflowMeta.nrNotes() == 0 && workflowMeta.nrActions() == 1 && workflowMeta.getAction(0).isStart())) {
                SvgFile svgFile = new SvgFile(BasePropertyHandler.getProperty("WorkflowCanvas_image"), getClass().getClassLoader());
                gc.drawImage(svgFile, 200, 200, 32, 40, gc.getMagnification(), 0);
                gc.setBackground(IGc.EColor.BACKGROUND);
                gc.drawText(BaseMessages.getString(PKG, "PipelineGraph.NewWorkflowBackgroundMessage"), 260, 220);
            }
        } catch (HopException e) {
            throw new HopException("Error drawing workflow", e);
        }
    } finally {
        gc.dispose();
    }
    CanvasFacade.setData(canvas, magnification, workflowMeta, HopGuiWorkflowGraph.class);
}
Also used : SwtGc(org.apache.hop.ui.hopgui.shared.SwtGc) HopException(org.apache.hop.core.exception.HopException) HopExtensionPoint(org.apache.hop.core.extension.HopExtensionPoint) SvgFile(org.apache.hop.core.svg.SvgFile) HopExtensionPoint(org.apache.hop.core.extension.HopExtensionPoint) PropsUi(org.apache.hop.ui.core.PropsUi) SwtScrollBar(org.apache.hop.ui.hopgui.shared.SwtScrollBar) ActionMeta(org.apache.hop.workflow.action.ActionMeta) SwtScrollBar(org.apache.hop.ui.hopgui.shared.SwtScrollBar)

Example 2 with SwtScrollBar

use of org.apache.hop.ui.hopgui.shared.SwtScrollBar in project hop by apache.

the class HopGuiPipelineGraph method drawPipelineImage.

public void drawPipelineImage(GC swtGc, int width, int height, float magnificationFactor) {
    IGc gc = new SwtGc(swtGc, width, height, iconSize);
    try {
        PropsUi propsUi = PropsUi.getInstance();
        int gridSize = propsUi.isShowCanvasGridEnabled() ? propsUi.getCanvasGridSize() : 1;
        ScrollBar horizontalScrollBar = wsCanvas.getHorizontalBar();
        ScrollBar verticalScrollBar = wsCanvas.getVerticalBar();
        PipelinePainter pipelinePainter = new PipelinePainter(gc, variables, pipelineMeta, new Point(width, height), horizontalScrollBar == null ? null : new SwtScrollBar(horizontalScrollBar), verticalScrollBar == null ? null : new SwtScrollBar(verticalScrollBar), candidate, selectionRegion, areaOwners, propsUi.getIconSize(), propsUi.getLineWidth(), gridSize, propsUi.getNoteFont().getName(), propsUi.getNoteFont().getHeight(), pipeline, propsUi.isIndicateSlowPipelineTransformsEnabled(), propsUi.getZoomFactor(), outputRowsMap, !propsUi.useDoubleClick(), stateMap);
        // correct the magnification with the overall zoom factor
        // 
        float correctedMagnification = (float) (magnificationFactor * propsUi.getZoomFactor());
        pipelinePainter.setMagnification(correctedMagnification);
        pipelinePainter.setTransformLogMap(transformLogMap);
        pipelinePainter.setStartHopTransform(startHopTransform);
        pipelinePainter.setEndHopLocation(endHopLocation);
        pipelinePainter.setNoInputTransform(noInputTransform);
        pipelinePainter.setEndHopTransform(endHopTransform);
        pipelinePainter.setCandidateHopType(candidateHopType);
        pipelinePainter.setStartErrorHopTransform(startErrorHopTransform);
        try {
            pipelinePainter.drawPipelineImage();
            if (pipelineMeta.isEmpty()) {
                SvgFile svgFile = new SvgFile(BasePropertyHandler.getProperty("PipelineCanvas_image"), getClass().getClassLoader());
                gc.drawImage(svgFile, 200, 200, 32, 40, gc.getMagnification(), 0);
                gc.setBackground(IGc.EColor.BACKGROUND);
                gc.drawText(BaseMessages.getString(PKG, "PipelineGraph.NewPipelineBackgroundMessage"), 260, 220);
            }
        } catch (Exception e) {
            new ErrorDialog(hopGui.getShell(), "Error", "Error drawing pipeline image", e);
        }
    } finally {
        gc.dispose();
    }
    CanvasFacade.setData(canvas, magnification, pipelineMeta, HopGuiPipelineGraph.class);
}
Also used : SwtScrollBar(org.apache.hop.ui.hopgui.shared.SwtScrollBar) SwtGc(org.apache.hop.ui.hopgui.shared.SwtGc) HopExtensionPoint(org.apache.hop.core.extension.HopExtensionPoint) SvgFile(org.apache.hop.core.svg.SvgFile) HopExtensionPoint(org.apache.hop.core.extension.HopExtensionPoint) SwtScrollBar(org.apache.hop.ui.hopgui.shared.SwtScrollBar) HopException(org.apache.hop.core.exception.HopException) InvocationTargetException(java.lang.reflect.InvocationTargetException) HopTransformException(org.apache.hop.core.exception.HopTransformException) HopValueException(org.apache.hop.core.exception.HopValueException) PropsUi(org.apache.hop.ui.core.PropsUi)

Aggregations

HopException (org.apache.hop.core.exception.HopException)2 HopExtensionPoint (org.apache.hop.core.extension.HopExtensionPoint)2 SvgFile (org.apache.hop.core.svg.SvgFile)2 PropsUi (org.apache.hop.ui.core.PropsUi)2 SwtGc (org.apache.hop.ui.hopgui.shared.SwtGc)2 SwtScrollBar (org.apache.hop.ui.hopgui.shared.SwtScrollBar)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HopTransformException (org.apache.hop.core.exception.HopTransformException)1 HopValueException (org.apache.hop.core.exception.HopValueException)1 ActionMeta (org.apache.hop.workflow.action.ActionMeta)1