Class DefaultProcessDiagramCanvas

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

public class DefaultProcessDiagramCanvas extends Object
Represents a canvas on which BPMN 2.0 constructs can be drawn.

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 Color TASK_BOX_COLOR
    • SUBPROCESS_BOX_COLOR

      protected static Color SUBPROCESS_BOX_COLOR
    • EVENT_COLOR

      protected static Color EVENT_COLOR
    • CONNECTION_COLOR

      protected static Color CONNECTION_COLOR
    • CONDITIONAL_INDICATOR_COLOR

      protected static Color CONDITIONAL_INDICATOR_COLOR
    • HIGHLIGHT_CURRENT_COLOR

      protected static Color HIGHLIGHT_CURRENT_COLOR
    • HIGHLIGHT_COMPLETED_ACTIVITY_COLOR

      protected static Color HIGHLIGHT_COMPLETED_ACTIVITY_COLOR
    • HIGHLIGHT_ERRORED_ACTIVITY_COLOR

      protected static Color HIGHLIGHT_ERRORED_ACTIVITY_COLOR
    • LABEL_COLOR

      protected static Color LABEL_COLOR
    • TASK_BORDER_COLOR

      protected static Color TASK_BORDER_COLOR
    • EVENT_BORDER_COLOR

      protected static Color EVENT_BORDER_COLOR
    • SUBPROCESS_BORDER_COLOR

      protected static Color SUBPROCESS_BORDER_COLOR
    • LABEL_FONT

      protected static Font LABEL_FONT
    • ANNOTATION_FONT

      protected static Font ANNOTATION_FONT
    • THICK_TASK_BORDER_STROKE

      protected static Stroke THICK_TASK_BORDER_STROKE
    • GATEWAY_TYPE_STROKE

      protected static Stroke GATEWAY_TYPE_STROKE
    • END_EVENT_STROKE

      protected static Stroke END_EVENT_STROKE
    • MULTI_INSTANCE_STROKE

      protected static Stroke MULTI_INSTANCE_STROKE
    • EVENT_SUBPROCESS_STROKE

      protected static Stroke EVENT_SUBPROCESS_STROKE
    • NON_INTERRUPTING_EVENT_STROKE

      protected static Stroke NON_INTERRUPTING_EVENT_STROKE
    • HIGHLIGHT_FLOW_STROKE

      protected static Stroke HIGHLIGHT_FLOW_STROKE
    • ANNOTATION_STROKE

      protected static Stroke ANNOTATION_STROKE
    • ASSOCIATION_STROKE

      protected static Stroke ASSOCIATION_STROKE
    • ICON_PADDING

      protected static int ICON_PADDING
    • USERTASK_IMAGE

      protected static TaskIconType USERTASK_IMAGE
    • SCRIPTTASK_IMAGE

      protected static TaskIconType SCRIPTTASK_IMAGE
    • SERVICETASK_IMAGE

      protected static TaskIconType SERVICETASK_IMAGE
    • RECEIVETASK_IMAGE

      protected static TaskIconType RECEIVETASK_IMAGE
    • SENDTASK_IMAGE

      protected static TaskIconType SENDTASK_IMAGE
    • MANUALTASK_IMAGE

      protected static TaskIconType MANUALTASK_IMAGE
    • BUSINESS_RULE_TASK_IMAGE

      protected static TaskIconType BUSINESS_RULE_TASK_IMAGE
    • TIMER_IMAGE

      protected static IconType TIMER_IMAGE
    • COMPENSATE_THROW_IMAGE

      protected static IconType COMPENSATE_THROW_IMAGE
    • COMPENSATE_CATCH_IMAGE

      protected static IconType COMPENSATE_CATCH_IMAGE
    • ERROR_THROW_IMAGE

      protected static IconType ERROR_THROW_IMAGE
    • ERROR_CATCH_IMAGE

      protected static IconType ERROR_CATCH_IMAGE
    • MESSAGE_CATCH_IMAGE

      protected static IconType MESSAGE_CATCH_IMAGE
    • SIGNAL_CATCH_IMAGE

      protected static IconType SIGNAL_CATCH_IMAGE
    • SIGNAL_THROW_IMAGE

      protected static IconType SIGNAL_THROW_IMAGE
    • canvasWidth

      protected int canvasWidth
    • canvasHeight

      protected int canvasHeight
    • minX

      protected int minX
    • minY

      protected int minY
    • g

    • fontMetrics

      protected FontMetrics fontMetrics
    • closed

      protected boolean closed
    • 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 activityFontName, String labelFontName, String annotationFontName)
      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)
      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()
    • generateImage

      public InputStream generateImage()
      Generates an image of what currently is drawn on the canvas.

      Throws an ActivitiImageException when close() is already called.

    • close

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

      public void drawNoneStartEvent(String id, GraphicInfo graphicInfo)
    • drawTimerStartEvent

      public void drawTimerStartEvent(String id, GraphicInfo graphicInfo)
    • drawSignalStartEvent

      public void drawSignalStartEvent(String id, GraphicInfo graphicInfo)
    • drawMessageStartEvent

      public void drawMessageStartEvent(String id, GraphicInfo graphicInfo)
    • drawStartEvent

      public void drawStartEvent(String id, GraphicInfo graphicInfo, IconType icon)
    • drawNoneEndEvent

      public void drawNoneEndEvent(String id, String name, GraphicInfo graphicInfo)
    • drawErrorEndEvent

      public void drawErrorEndEvent(String id, String name, GraphicInfo graphicInfo)
    • drawErrorStartEvent

      public void drawErrorStartEvent(String id, GraphicInfo graphicInfo)
    • drawCatchingEvent

      public void drawCatchingEvent(String id, GraphicInfo graphicInfo, boolean isInterrupting, IconType icon, String eventType)
    • drawCatchingCompensateEvent

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

      public void drawCatchingCompensateEvent(String id, GraphicInfo graphicInfo, boolean isInterrupting)
    • drawCatchingTimerEvent

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

      public void drawCatchingTimerEvent(String id, GraphicInfo graphicInfo, boolean isInterrupting)
    • drawCatchingErrorEvent

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

      public void drawCatchingErrorEvent(String id, GraphicInfo graphicInfo, boolean isInterrupting)
    • drawCatchingSignalEvent

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

      public void drawCatchingSignalEvent(String id, GraphicInfo graphicInfo, boolean isInterrupting)
    • drawCatchingMessageEvent

      public void drawCatchingMessageEvent(String id, GraphicInfo graphicInfo, boolean isInterrupting)
    • drawCatchingMessageEvent

      public void drawCatchingMessageEvent(String id, String name, GraphicInfo graphicInfo, boolean isInterrupting)
    • drawThrowingCompensateEvent

      public void drawThrowingCompensateEvent(String id, GraphicInfo graphicInfo)
    • drawThrowingSignalEvent

      public void drawThrowingSignalEvent(String id, GraphicInfo graphicInfo)
    • drawThrowingNoneEvent

      public void drawThrowingNoneEvent(String id, GraphicInfo graphicInfo)
    • drawSequenceflow

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

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

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

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

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

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

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

      public void drawArrowHead(Line2D.Double line)
    • drawDefaultSequenceFlowIndicator

      public void drawDefaultSequenceFlowIndicator(Line2D.Double line)
    • drawConditionalSequenceFlowIndicator

      public void drawConditionalSequenceFlowIndicator(Line2D.Double line)
    • drawTask

      public void drawTask(TaskIconType icon, String id, String name, GraphicInfo graphicInfo)
    • drawTask

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

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

      protected void drawTask(String id, String name, GraphicInfo graphicInfo, boolean thickBorder)
    • 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 id, String name, GraphicInfo graphicInfo)
    • drawScriptTask

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

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

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

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

      public void drawManualTask(String id, String name, GraphicInfo graphicInfo)
    • drawBusinessRuleTask

      public void drawBusinessRuleTask(String id, String name, GraphicInfo graphicInfo)
    • drawExpandedSubProcess

      public void drawExpandedSubProcess(String id, String name, GraphicInfo graphicInfo, Class<?> type)
    • drawCollapsedSubProcess

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

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

      protected void drawCollapsedTask(String id, String name, GraphicInfo graphicInfo, boolean thickBorder)
    • 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)
    • drawGatewayHighLight

      public void drawGatewayHighLight(GraphicInfo graphicInfo, Color color)
    • drawGatewayHighLightCompleted

      public void drawGatewayHighLightCompleted(GraphicInfo graphicInfo)
    • drawGatewayHighLightErrored

      public void drawGatewayHighLightErrored(GraphicInfo graphicInfo)
    • drawParallelGateway

      public void drawParallelGateway(String id, GraphicInfo graphicInfo)
    • drawExclusiveGateway

      public void drawExclusiveGateway(String id, GraphicInfo graphicInfo)
    • drawInclusiveGateway

      public void drawInclusiveGateway(String id, GraphicInfo graphicInfo)
    • drawEventBasedGateway

      public void drawEventBasedGateway(String id, GraphicInfo graphicInfo)
    • drawMultiInstanceMarker

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

      public void drawHighLightCurrent(GraphicInfo graphicInfo)
    • drawHighLightCompleted

      public void drawHighLightCompleted(GraphicInfo graphicInfo)
    • drawHighLightErrored

      public void drawHighLightErrored(GraphicInfo graphicInfo)
    • drawHighLight

      public void drawHighLight(GraphicInfo graphicInfo, Color color)
    • drawEventHighLight

      public void drawEventHighLight(GraphicInfo graphicInfo, Color color)
    • drawEventHighLightCompleted

      public void drawEventHighLightCompleted(GraphicInfo graphicInfo)
    • drawEventHighLightErrored

      public void drawEventHighLightErrored(GraphicInfo graphicInfo)
    • drawTextAnnotation

      public void drawTextAnnotation(String id, String text, GraphicInfo graphicInfo)
    • 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 -