Class DefaultProcessDiagramCanvas

java.lang.Object
org.flowable.image.impl.DefaultProcessDiagramCanvas

public class DefaultProcessDiagramCanvas extends Object
Represents a canvas on which BPMN 2.0 constructs can be drawn. Some of the icons used are licensed under a Creative Commons Attribution 2.5 License, see http://www.famfamfam.com/lab/icons/silk/
Author:
Joram Barrez
See Also:
  • Field Details

    • LOGGER

      protected static final org.slf4j.Logger LOGGER
    • ARROW_WIDTH

      protected static final int ARROW_WIDTH
      See Also:
    • CONDITIONAL_INDICATOR_WIDTH

      protected static final int CONDITIONAL_INDICATOR_WIDTH
      See Also:
    • DEFAULT_INDICATOR_WIDTH

      protected static final int DEFAULT_INDICATOR_WIDTH
      See Also:
    • MARKER_WIDTH

      protected static final int MARKER_WIDTH
      See Also:
    • FONT_SIZE

      protected static final int FONT_SIZE
      See Also:
    • FONT_SPACING

      protected static final int FONT_SPACING
      See Also:
    • TEXT_PADDING

      protected static final int TEXT_PADDING
      See Also:
    • ANNOTATION_TEXT_PADDING

      protected static final int ANNOTATION_TEXT_PADDING
      See Also:
    • LINE_HEIGHT

      protected static final int LINE_HEIGHT
      See Also:
    • TASK_BOX_COLOR

      protected static final Color TASK_BOX_COLOR
    • SUBPROCESS_BOX_COLOR

      protected static final Color SUBPROCESS_BOX_COLOR
    • EVENT_COLOR

      protected static final Color EVENT_COLOR
    • CONNECTION_COLOR

      protected static final Color CONNECTION_COLOR
    • CONDITIONAL_INDICATOR_COLOR

      protected static final Color CONDITIONAL_INDICATOR_COLOR
    • HIGHLIGHT_COLOR

      protected static final Color HIGHLIGHT_COLOR
    • LABEL_COLOR

      protected static final Color LABEL_COLOR
    • TASK_BORDER_COLOR

      protected static final Color TASK_BORDER_COLOR
    • EVENT_BORDER_COLOR

      protected static final Color EVENT_BORDER_COLOR
    • SUBPROCESS_BORDER_COLOR

      protected static final Color SUBPROCESS_BORDER_COLOR
    • LABEL_FONT

      protected static Font LABEL_FONT
    • ANNOTATION_FONT

      protected static Font ANNOTATION_FONT
    • THICK_TASK_BORDER_STROKE

      protected static final Stroke THICK_TASK_BORDER_STROKE
    • GATEWAY_TYPE_STROKE

      protected static final Stroke GATEWAY_TYPE_STROKE
    • END_EVENT_STROKE

      protected static final Stroke END_EVENT_STROKE
    • MULTI_INSTANCE_STROKE

      protected static final Stroke MULTI_INSTANCE_STROKE
    • EVENT_SUBPROCESS_STROKE

      protected static final Stroke EVENT_SUBPROCESS_STROKE
    • NON_INTERRUPTING_EVENT_STROKE

      protected static final Stroke NON_INTERRUPTING_EVENT_STROKE
    • HIGHLIGHT_FLOW_STROKE

      protected static final Stroke HIGHLIGHT_FLOW_STROKE
    • ANNOTATION_STROKE

      protected static final Stroke ANNOTATION_STROKE
    • ASSOCIATION_STROKE

      protected static final Stroke ASSOCIATION_STROKE
    • ICON_PADDING

      protected static final int ICON_PADDING
      See Also:
    • USERTASK_IMAGE

      protected static BufferedImage USERTASK_IMAGE
    • SCRIPTTASK_IMAGE

      protected static BufferedImage SCRIPTTASK_IMAGE
    • SERVICETASK_IMAGE

      protected static BufferedImage SERVICETASK_IMAGE
    • RECEIVETASK_IMAGE

      protected static BufferedImage RECEIVETASK_IMAGE
    • SENDTASK_IMAGE

      protected static BufferedImage SENDTASK_IMAGE
    • CASETASK_IMAGE

      protected static BufferedImage CASETASK_IMAGE
    • MANUALTASK_IMAGE

      protected static BufferedImage MANUALTASK_IMAGE
    • BUSINESS_RULE_TASK_IMAGE

      protected static BufferedImage BUSINESS_RULE_TASK_IMAGE
    • SHELL_TASK_IMAGE

      protected static BufferedImage SHELL_TASK_IMAGE
    • DMN_TASK_IMAGE

      protected static BufferedImage DMN_TASK_IMAGE
    • CAMEL_TASK_IMAGE

      protected static BufferedImage CAMEL_TASK_IMAGE
    • HTTP_TASK_IMAGE

      protected static BufferedImage HTTP_TASK_IMAGE
    • TIMER_IMAGE

      protected static BufferedImage TIMER_IMAGE
    • COMPENSATE_THROW_IMAGE

      protected static BufferedImage COMPENSATE_THROW_IMAGE
    • COMPENSATE_CATCH_IMAGE

      protected static BufferedImage COMPENSATE_CATCH_IMAGE
    • CONDITIONAL_CATCH_IMAGE

      protected static BufferedImage CONDITIONAL_CATCH_IMAGE
    • ERROR_THROW_IMAGE

      protected static BufferedImage ERROR_THROW_IMAGE
    • ERROR_CATCH_IMAGE

      protected static BufferedImage ERROR_CATCH_IMAGE
    • ESCALATION_THROW_IMAGE

      protected static BufferedImage ESCALATION_THROW_IMAGE
    • ESCALATION_CATCH_IMAGE

      protected static BufferedImage ESCALATION_CATCH_IMAGE
    • MESSAGE_THROW_IMAGE

      protected static BufferedImage MESSAGE_THROW_IMAGE
    • MESSAGE_CATCH_IMAGE

      protected static BufferedImage MESSAGE_CATCH_IMAGE
    • SIGNAL_CATCH_IMAGE

      protected static BufferedImage SIGNAL_CATCH_IMAGE
    • SIGNAL_THROW_IMAGE

      protected static BufferedImage SIGNAL_THROW_IMAGE
    • canvasWidth

      protected int canvasWidth
    • canvasHeight

      protected int canvasHeight
    • minX

      protected int minX
    • minY

      protected int minY
    • processDiagram

      protected BufferedImage processDiagram
    • g

      protected Graphics2D g
    • fontMetrics

      protected FontMetrics fontMetrics
    • closed

      protected boolean closed
    • customClassLoader

      protected ClassLoader customClassLoader
    • activityFontName

      protected String activityFontName
    • labelFontName

      protected String labelFontName
    • annotationFontName

      protected String annotationFontName
  • Constructor Details

    • DefaultProcessDiagramCanvas

      public DefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader)
      Creates an empty canvas with given width and height. Allows to specify minimal boundaries on the left and upper side of the canvas. This is useful for diagrams that have white space there. Everything beneath these minimum values will be cropped. It's also possible to pass a specific font name and a class loader for the icon images.
    • DefaultProcessDiagramCanvas

      public DefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType)
      Creates an empty canvas with given width and height. Allows to specify minimal boundaries on the left and upper side of the canvas. This is useful for diagrams that have white space there (eg Signavio). Everything beneath these minimum values will be cropped.
      Parameters:
      minX - Hint that will be used when generating the image. Parts that fall below minX on the horizontal scale will be cropped.
      minY - Hint that will be used when generating the image. Parts that fall below minX on the horizontal scale will be cropped.
  • Method Details

    • initialize

      public void initialize(String imageType)
    • generateImage

      public InputStream generateImage(String imageType)
      Generates an image of what currently is drawn on the canvas. Throws an FlowableImageException when close() is already called.
    • generateBufferedImage

      public BufferedImage generateBufferedImage(String imageType)
      Generates an image of what currently is drawn on the canvas. Throws an FlowableImageException when close() is already called.
    • close

      public void close()
      Closes the canvas which disallows further drawing and releases graphical resources.
    • drawNoneStartEvent

      public void drawNoneStartEvent(GraphicInfo graphicInfo)
    • drawTimerStartEvent

      public void drawTimerStartEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawSignalStartEvent

      public void drawSignalStartEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawMessageStartEvent

      public void drawMessageStartEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawEventRegistryStartEvent

      public void drawEventRegistryStartEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawStartEvent

      public void drawStartEvent(GraphicInfo graphicInfo, BufferedImage image, double scaleFactor)
    • drawNoneEndEvent

      public void drawNoneEndEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawErrorEndEvent

      public void drawErrorEndEvent(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawEscalationEndEvent

      public void drawEscalationEndEvent(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawErrorEndEvent

      public void drawErrorEndEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawEscalationEndEvent

      public void drawEscalationEndEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawErrorStartEvent

      public void drawErrorStartEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawEscalationStartEvent

      public void drawEscalationStartEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawConditionalStartEvent

      public void drawConditionalStartEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawCatchingEvent

      public void drawCatchingEvent(GraphicInfo graphicInfo, boolean isInterrupting, BufferedImage image, String eventType, double scaleFactor)
    • drawCatchingCompensateEvent

      public void drawCatchingCompensateEvent(String name, GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingCompensateEvent

      public void drawCatchingCompensateEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingConditionalEvent

      public void drawCatchingConditionalEvent(String name, GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingConditionalEvent

      public void drawCatchingConditionalEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingTimerEvent

      public void drawCatchingTimerEvent(String name, GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingTimerEvent

      public void drawCatchingTimerEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingErrorEvent

      public void drawCatchingErrorEvent(String name, GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingErrorEvent

      public void drawCatchingErrorEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingEscalationEvent

      public void drawCatchingEscalationEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingSignalEvent

      public void drawCatchingSignalEvent(String name, GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingSignalEvent

      public void drawCatchingSignalEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingMessageEvent

      public void drawCatchingMessageEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingEventRegistryEvent

      public void drawCatchingEventRegistryEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingMessageEvent

      public void drawCatchingMessageEvent(String name, GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawCatchingEventRegistryEvent

      public void drawCatchingEventRegistryEvent(String name, GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor)
    • drawThrowingCompensateEvent

      public void drawThrowingCompensateEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawThrowingSignalEvent

      public void drawThrowingSignalEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawThrowingEscalationEvent

      public void drawThrowingEscalationEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawThrowingNoneEvent

      public void drawThrowingNoneEvent(GraphicInfo graphicInfo, double scaleFactor)
    • drawSequenceflow

      public void drawSequenceflow(int srcX, int srcY, int targetX, int targetY, boolean conditional, double scaleFactor)
    • drawSequenceflow

      public void drawSequenceflow(int srcX, int srcY, int targetX, int targetY, boolean conditional, boolean highLighted, double scaleFactor)
    • drawAssociation

      public void drawAssociation(int[] xPoints, int[] yPoints, AssociationDirection associationDirection, boolean highLighted, double scaleFactor)
    • drawSequenceflow

      public void drawSequenceflow(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, boolean highLighted, double scaleFactor)
    • drawConnection

      public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType, AssociationDirection associationDirection, boolean highLighted, double scaleFactor)
    • drawSequenceflowWithoutArrow

      public void drawSequenceflowWithoutArrow(int srcX, int srcY, int targetX, int targetY, boolean conditional, double scaleFactor)
    • drawSequenceflowWithoutArrow

      public void drawSequenceflowWithoutArrow(int srcX, int srcY, int targetX, int targetY, boolean conditional, boolean highLighted, double scaleFactor)
    • drawArrowHead

      public void drawArrowHead(Line2D.Double line, double scaleFactor)
    • drawDefaultSequenceFlowIndicator

      public void drawDefaultSequenceFlowIndicator(Line2D.Double line, double scaleFactor)
    • drawConditionalSequenceFlowIndicator

      public void drawConditionalSequenceFlowIndicator(Line2D.Double line, double scaleFactor)
    • drawTask

      public void drawTask(BufferedImage icon, String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawTask

      public void drawTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawPoolOrLane

      public void drawPoolOrLane(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawTask

      protected void drawTask(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor)
    • drawMultilineCentredText

      protected void drawMultilineCentredText(String text, int x, int y, int boxWidth, int boxHeight)
    • drawMultilineAnnotationText

      protected void drawMultilineAnnotationText(String text, int x, int y, int boxWidth, int boxHeight)
    • drawMultilineText

      protected void drawMultilineText(String text, int x, int y, int boxWidth, int boxHeight, boolean centered)
    • fitTextToWidth

      protected String fitTextToWidth(String original, int width)
    • drawUserTask

      public void drawUserTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawScriptTask

      public void drawScriptTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawServiceTask

      public void drawServiceTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawReceiveTask

      public void drawReceiveTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawSendTask

      public void drawSendTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawManualTask

      public void drawManualTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawSendEventServiceTask

      public void drawSendEventServiceTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawCaseServiceTask

      public void drawCaseServiceTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawBusinessRuleTask

      public void drawBusinessRuleTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawShellTask

      public void drawShellTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawDMNTask

      public void drawDMNTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawCamelTask

      public void drawCamelTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawHttpTask

      public void drawHttpTask(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawExpandedSubProcess

      public void drawExpandedSubProcess(String name, GraphicInfo graphicInfo, boolean isTriggeredByEvent, double scaleFactor)
    • drawExpandedTransaction

      public void drawExpandedTransaction(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawCollapsedSubProcess

      public void drawCollapsedSubProcess(String name, GraphicInfo graphicInfo, Boolean isTriggeredByEvent, double scaleFactor)
    • drawCollapsedCallActivity

      public void drawCollapsedCallActivity(String name, GraphicInfo graphicInfo, double scaleFactor)
    • drawCollapsedTask

      protected void drawCollapsedTask(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor)
    • drawCollapsedMarker

      public void drawCollapsedMarker(int x, int y, int width, int height)
    • drawActivityMarkers

      public void drawActivityMarkers(int x, int y, int width, int height, boolean multiInstanceSequential, boolean multiInstanceParallel, boolean collapsed)
    • drawGateway

      public void drawGateway(GraphicInfo graphicInfo)
    • drawParallelGateway

      public void drawParallelGateway(GraphicInfo graphicInfo, double scaleFactor)
    • drawExclusiveGateway

      public void drawExclusiveGateway(GraphicInfo graphicInfo, double scaleFactor)
    • drawInclusiveGateway

      public void drawInclusiveGateway(GraphicInfo graphicInfo, double scaleFactor)
    • drawEventBasedGateway

      public void drawEventBasedGateway(GraphicInfo graphicInfo, double scaleFactor)
    • drawMultiInstanceMarker

      public void drawMultiInstanceMarker(boolean sequential, int x, int y, int width, int height)
    • drawHighLight

      public void drawHighLight(int x, int y, int width, int height)
    • drawTextAnnotation

      public void drawTextAnnotation(String text, GraphicInfo graphicInfo, double scaleFactor)
    • drawLabel

      public void drawLabel(String text, GraphicInfo graphicInfo)
    • drawLabel

      public void drawLabel(String text, GraphicInfo graphicInfo, boolean centered)
    • connectionPerfectionizer

      public List<GraphicInfo> connectionPerfectionizer(DefaultProcessDiagramCanvas.SHAPE_TYPE sourceShapeType, DefaultProcessDiagramCanvas.SHAPE_TYPE targetShapeType, GraphicInfo sourceGraphicInfo, GraphicInfo targetGraphicInfo, List<GraphicInfo> graphicInfoList)
      This method makes coordinates of connection flow better.
      Parameters:
      sourceShapeType -
      targetShapeType -
      sourceGraphicInfo -
      targetGraphicInfo -
      graphicInfoList -