org.camunda.bpm.engine.impl.bpmn.diagram
Class ProcessDiagramCanvas

java.lang.Object
  extended by org.camunda.bpm.engine.impl.bpmn.diagram.ProcessDiagramCanvas

public class ProcessDiagramCanvas
extends Object

Represents a canvas on which BPMN 2.0 constructs can be drawn. Some of the icons used are licenced under a Creative Commons Attribution 2.5 License, see http://www.famfamfam.com/lab/icons/silk/

Author:
Joram Barrez
See Also:
ProcessDiagramGenerator

Field Summary
protected static int ARROW_WIDTH
           
protected static Color BOUNDARY_EVENT_COLOR
           
protected static Image BUSINESS_RULE_TASK_IMAGE
           
protected  int canvasHeight
           
protected  int canvasWidth
           
protected  boolean closed
           
protected static Color CONDITIONAL_INDICATOR_COLOR
           
protected static int CONDITIONAL_INDICATOR_WIDTH
           
protected static Stroke END_EVENT_STROKE
           
protected static Image ERROR_CATCH_IMAGE
           
protected static Image ERROR_THROW_IMAGE
           
protected static Stroke EVENT_SUBPROCESS_STROKE
           
protected  FontMetrics fontMetrics
           
protected  Graphics2D g
           
protected static Stroke GATEWAY_TYPE_STROKE
           
protected static Color HIGHLIGHT_COLOR
           
protected static int ICON_SIZE
           
protected static DiagramCanvasLogger LOG
           
protected static Image MANUALTASK_IMAGE
           
protected static int MARKER_WIDTH
           
protected  int minX
           
protected  int minY
           
protected static Stroke MULTI_INSTANCE_STROKE
           
protected  BufferedImage processDiagram
           
protected static Image RECEIVETASK_IMAGE
           
protected static Image SCRIPTTASK_IMAGE
           
protected static Image SENDTASK_IMAGE
           
protected static Image SERVICETASK_IMAGE
           
protected static Image SIGNAL_CATCH_IMAGE
           
protected static Image SIGNAL_THROW_IMAGE
           
protected static Color TASK_COLOR
           
protected static Stroke THICK_TASK_BORDER_STROKE
           
protected static Image TIMER_IMAGE
           
protected static Image USERTASK_IMAGE
           
 
Constructor Summary
ProcessDiagramCanvas(int width, int height)
          Creates an empty canvas with given width and height.
ProcessDiagramCanvas(int width, int height, int minX, int minY)
          Creates an empty canvas with given width and height.
 
Method Summary
 void close()
          Closes the canvas which dissallows further drawing and releases graphical resources.
 void drawActivityMarkers(int x, int y, int width, int height, boolean multiInstanceSequential, boolean multiInstanceParallel, boolean collapsed)
           
 void drawArrowHead(Line2D.Double line)
           
 void drawBusinessRuleTask(String name, int x, int y, int width, int height)
           
 void drawCatchingErroEvent(int x, int y, int width, int height)
           
 void drawCatchingEvent(int x, int y, int width, int height, Image image)
           
 void drawCatchingSignalEvent(int x, int y, int width, int height)
           
 void drawCatchingTimerEvent(int x, int y, int width, int height)
           
 void drawCollapsedCallActivity(String name, int x, int y, int width, int height)
           
 void drawCollapsedMarker(int x, int y, int width, int height)
           
 void drawCollapsedSubProcess(String name, int x, int y, int width, int height, Boolean isTriggeredByEvent)
           
protected  void drawCollapsedTask(String name, int x, int y, int width, int height, boolean thickBorder)
           
 void drawConditionalSequenceFlowIndicator(Line2D.Double line)
           
 void drawErrorEndEvent(int x, int y, int width, int height)
           
 void drawErrorStartEvent(int x, int y, int width, int height)
           
 void drawExclusiveGateway(int x, int y, int width, int height)
           
 void drawExpandedSubProcess(String name, int x, int y, int width, int height, Boolean isTriggeredByEvent)
           
 void drawGateway(int x, int y, int width, int height)
           
 void drawHighLight(int x, int y, int width, int height)
           
 void drawInclusiveGateway(int x, int y, int width, int height)
           
 void drawManualTask(String name, int x, int y, int width, int height)
           
 void drawMultiInstanceMarker(boolean sequential, int x, int y, int width, int height)
           
 void drawNoneEndEvent(int x, int y, int width, int height)
           
 void drawNoneStartEvent(int x, int y, int width, int height)
           
 void drawParallelGateway(int x, int y, int width, int height)
           
 void drawPoolOrLane(String name, int x, int y, int width, int height)
           
 void drawReceiveTask(String name, int x, int y, int width, int height)
           
 void drawScriptTask(String name, int x, int y, int width, int height)
           
 void drawSendTask(String name, int x, int y, int width, int height)
           
 void drawSequenceflow(int srcX, int srcY, int targetX, int targetY, boolean conditional)
           
 void drawSequenceflowWithoutArrow(int srcX, int srcY, int targetX, int targetY, boolean conditional)
           
 void drawServiceTask(String name, int x, int y, int width, int height)
           
 void drawStartEvent(int x, int y, int width, int height, Image image)
           
 void drawTask(String name, int x, int y, int width, int height)
           
protected  void drawTask(String name, int x, int y, int width, int height, boolean thickBorder)
           
 void drawThrowingSignalEvent(int x, int y, int width, int height)
           
 void drawTimerStartEvent(int x, int y, int width, int height)
           
 void drawUserTask(String name, int x, int y, int width, int height)
           
protected  String fitTextToWidth(String original, int width)
           
 InputStream generateImage(String imageType)
          Generates an image of what currently is drawn on the canvas.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final DiagramCanvasLogger LOG

ARROW_WIDTH

protected static final int ARROW_WIDTH
See Also:
Constant Field Values

CONDITIONAL_INDICATOR_WIDTH

protected static final int CONDITIONAL_INDICATOR_WIDTH
See Also:
Constant Field Values

MARKER_WIDTH

protected static final int MARKER_WIDTH
See Also:
Constant Field Values

TASK_COLOR

protected static Color TASK_COLOR

BOUNDARY_EVENT_COLOR

protected static Color BOUNDARY_EVENT_COLOR

CONDITIONAL_INDICATOR_COLOR

protected static Color CONDITIONAL_INDICATOR_COLOR

HIGHLIGHT_COLOR

protected static Color HIGHLIGHT_COLOR

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

ICON_SIZE

protected static int ICON_SIZE

USERTASK_IMAGE

protected static Image USERTASK_IMAGE

SCRIPTTASK_IMAGE

protected static Image SCRIPTTASK_IMAGE

SERVICETASK_IMAGE

protected static Image SERVICETASK_IMAGE

RECEIVETASK_IMAGE

protected static Image RECEIVETASK_IMAGE

SENDTASK_IMAGE

protected static Image SENDTASK_IMAGE

MANUALTASK_IMAGE

protected static Image MANUALTASK_IMAGE

BUSINESS_RULE_TASK_IMAGE

protected static Image BUSINESS_RULE_TASK_IMAGE

TIMER_IMAGE

protected static Image TIMER_IMAGE

ERROR_THROW_IMAGE

protected static Image ERROR_THROW_IMAGE

ERROR_CATCH_IMAGE

protected static Image ERROR_CATCH_IMAGE

SIGNAL_CATCH_IMAGE

protected static Image SIGNAL_CATCH_IMAGE

SIGNAL_THROW_IMAGE

protected static Image 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
Constructor Detail

ProcessDiagramCanvas

public ProcessDiagramCanvas(int width,
                            int height)
Creates an empty canvas with given width and height.


ProcessDiagramCanvas

public ProcessDiagramCanvas(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 Detail

generateImage

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


close

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


drawNoneStartEvent

public void drawNoneStartEvent(int x,
                               int y,
                               int width,
                               int height)

drawTimerStartEvent

public void drawTimerStartEvent(int x,
                                int y,
                                int width,
                                int height)

drawStartEvent

public void drawStartEvent(int x,
                           int y,
                           int width,
                           int height,
                           Image image)

drawNoneEndEvent

public void drawNoneEndEvent(int x,
                             int y,
                             int width,
                             int height)

drawErrorEndEvent

public void drawErrorEndEvent(int x,
                              int y,
                              int width,
                              int height)

drawErrorStartEvent

public void drawErrorStartEvent(int x,
                                int y,
                                int width,
                                int height)

drawCatchingEvent

public void drawCatchingEvent(int x,
                              int y,
                              int width,
                              int height,
                              Image image)

drawCatchingTimerEvent

public void drawCatchingTimerEvent(int x,
                                   int y,
                                   int width,
                                   int height)

drawCatchingErroEvent

public void drawCatchingErroEvent(int x,
                                  int y,
                                  int width,
                                  int height)

drawCatchingSignalEvent

public void drawCatchingSignalEvent(int x,
                                    int y,
                                    int width,
                                    int height)

drawThrowingSignalEvent

public void drawThrowingSignalEvent(int x,
                                    int y,
                                    int width,
                                    int height)

drawSequenceflow

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

drawSequenceflowWithoutArrow

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

drawArrowHead

public void drawArrowHead(Line2D.Double line)

drawConditionalSequenceFlowIndicator

public void drawConditionalSequenceFlowIndicator(Line2D.Double line)

drawTask

public void drawTask(String name,
                     int x,
                     int y,
                     int width,
                     int height)

drawPoolOrLane

public void drawPoolOrLane(String name,
                           int x,
                           int y,
                           int width,
                           int height)

drawTask

protected void drawTask(String name,
                        int x,
                        int y,
                        int width,
                        int height,
                        boolean thickBorder)

fitTextToWidth

protected String fitTextToWidth(String original,
                                int width)

drawUserTask

public void drawUserTask(String name,
                         int x,
                         int y,
                         int width,
                         int height)

drawScriptTask

public void drawScriptTask(String name,
                           int x,
                           int y,
                           int width,
                           int height)

drawServiceTask

public void drawServiceTask(String name,
                            int x,
                            int y,
                            int width,
                            int height)

drawReceiveTask

public void drawReceiveTask(String name,
                            int x,
                            int y,
                            int width,
                            int height)

drawSendTask

public void drawSendTask(String name,
                         int x,
                         int y,
                         int width,
                         int height)

drawManualTask

public void drawManualTask(String name,
                           int x,
                           int y,
                           int width,
                           int height)

drawBusinessRuleTask

public void drawBusinessRuleTask(String name,
                                 int x,
                                 int y,
                                 int width,
                                 int height)

drawExpandedSubProcess

public void drawExpandedSubProcess(String name,
                                   int x,
                                   int y,
                                   int width,
                                   int height,
                                   Boolean isTriggeredByEvent)

drawCollapsedSubProcess

public void drawCollapsedSubProcess(String name,
                                    int x,
                                    int y,
                                    int width,
                                    int height,
                                    Boolean isTriggeredByEvent)

drawCollapsedCallActivity

public void drawCollapsedCallActivity(String name,
                                      int x,
                                      int y,
                                      int width,
                                      int height)

drawCollapsedTask

protected void drawCollapsedTask(String name,
                                 int x,
                                 int y,
                                 int width,
                                 int height,
                                 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(int x,
                        int y,
                        int width,
                        int height)

drawParallelGateway

public void drawParallelGateway(int x,
                                int y,
                                int width,
                                int height)

drawExclusiveGateway

public void drawExclusiveGateway(int x,
                                 int y,
                                 int width,
                                 int height)

drawInclusiveGateway

public void drawInclusiveGateway(int x,
                                 int y,
                                 int width,
                                 int height)

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)


Copyright © 2015 camunda services GmbH. All rights reserved.