Package org.flowable.cmmn.image.impl
Class DefaultCaseDiagramCanvas
java.lang.Object
org.flowable.cmmn.image.impl.DefaultCaseDiagramCanvas
Represents a canvas on which CMMN 1.1 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:
- Tijs Rademakers
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected static Font
protected static final int
protected String
protected static final int
protected static final Stroke
protected int
protected int
protected BufferedImage
protected static BufferedImage
protected boolean
protected static final Color
protected static final int
protected static final Color
protected ClassLoader
protected static BufferedImage
protected static final int
protected static final Color
protected static final Color
protected static final int
protected static final int
protected FontMetrics
protected Graphics2D
protected static final Stroke
protected static final Color
protected static final int
protected static final Color
protected static Font
protected String
protected static final int
protected static final org.slf4j.Logger
protected static final int
protected int
protected int
protected static BufferedImage
protected static BufferedImage
protected static BufferedImage
protected static final Color
protected static final Color
protected static final Color
protected static final Color
protected static final int
protected static final Stroke
protected static BufferedImage
protected static BufferedImage
protected static BufferedImage
protected static BufferedImage
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCaseDiagramCanvas
(int width, int height, int minX, int minY, String imageType) Creates an empty canvas with given width and height.DefaultCaseDiagramCanvas
(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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the canvas which disallows further drawing and releases graphical resources.connectionPerfectionizer
(DefaultCaseDiagramCanvas.SHAPE_TYPE sourceShapeType, DefaultCaseDiagramCanvas.SHAPE_TYPE targetShapeType, GraphicInfo sourceGraphicInfo, GraphicInfo targetGraphicInfo, List<GraphicInfo> graphicInfoList) This method makes coordinates of connection flow better.void
drawArrowHead
(Line2D.Double line, double scaleFactor) void
drawAssociation
(int[] xPoints, int[] yPoints, double scaleFactor) void
drawCaseTask
(String name, GraphicInfo graphicInfo, double scaleFactor) void
drawConnection
(int[] xPoints, int[] yPoints, String connectionType, double scaleFactor) void
drawCriterion
(GraphicInfo graphicInfo, boolean fillShape) void
drawDecisionTask
(String name, GraphicInfo graphicInfo, double scaleFactor) void
drawEntryCriterion
(GraphicInfo graphicInfo) void
drawEventListener
(GraphicInfo graphicInfo, BufferedImage image, double scaleFactor) void
drawExitCriterion
(GraphicInfo graphicInfo) void
drawGenericEventListener
(GraphicInfo graphicInfo, double scaleFactor) void
drawHighLight
(int x, int y, int width, int height) protected void
drawMilestone
(String name, GraphicInfo graphicInfo, double scaleFactor) protected void
drawMultilineAnnotationText
(String text, int x, int y, int boxWidth, int boxHeight) protected void
drawMultilineCentredText
(String text, int x, int y, int boxWidth, int boxHeight) protected void
drawMultilineText
(String text, int x, int y, int boxWidth, int boxHeight, boolean centered) void
drawProcessTask
(String name, GraphicInfo graphicInfo, double scaleFactor) void
drawSendEventTask
(String name, GraphicInfo graphicInfo, double scaleFactor) void
drawServiceTask
(String name, GraphicInfo graphicInfo, double scaleFactor) void
drawStage
(String name, GraphicInfo graphicInfo, double scaleFactor) void
drawTask
(BufferedImage icon, String name, GraphicInfo graphicInfo, double scaleFactor) protected void
drawTask
(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor) void
drawTask
(String name, GraphicInfo graphicInfo, double scaleFactor) void
drawTimerEventListener
(GraphicInfo graphicInfo, double scaleFactor) void
drawUserEventListener
(GraphicInfo graphicInfo, double scaleFactor) void
drawUserTask
(String name, GraphicInfo graphicInfo, double scaleFactor) void
drawVariableEventListener
(GraphicInfo graphicInfo, double scaleFactor) protected String
fitTextToWidth
(String original, int width) generateBufferedImage
(String imageType) Generates an image of what currently is drawn on the canvas.generateImage
(String imageType) Generates an image of what currently is drawn on the canvas.void
initialize
(String imageType)
-
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
-
SUBPROCESS_BOX_COLOR
-
EVENT_COLOR
-
CONNECTION_COLOR
-
CONDITIONAL_INDICATOR_COLOR
-
HIGHLIGHT_COLOR
-
LABEL_COLOR
-
TASK_BORDER_COLOR
-
STAGE_BORDER_COLOR
-
EVENT_BORDER_COLOR
-
LABEL_FONT
-
ANNOTATION_FONT
-
THICK_TASK_BORDER_STROKE
-
GATEWAY_TYPE_STROKE
-
ASSOCIATION_STROKE
-
ICON_PADDING
protected static final int ICON_PADDING- See Also:
-
TIMER_IMAGE
-
USERLISTENER_IMAGE
-
VARIABLELISTENER_IMAGE
-
USERTASK_IMAGE
-
SERVICETASK_IMAGE
-
CASETASK_IMAGE
-
PROCESSTASK_IMAGE
-
DECISIONTASK_IMAGE
-
SENDEVENTTASK_IMAGE
-
canvasWidth
protected int canvasWidth -
canvasHeight
protected int canvasHeight -
minX
protected int minX -
minY
protected int minY -
caseDiagram
-
g
-
fontMetrics
-
closed
protected boolean closed -
customClassLoader
-
activityFontName
-
labelFontName
-
annotationFontName
-
-
Constructor Details
-
DefaultCaseDiagramCanvas
public DefaultCaseDiagramCanvas(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. -
DefaultCaseDiagramCanvas
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
-
generateImage
Generates an image of what currently is drawn on the canvas. Throws anFlowableImageException
whenclose()
is already called. -
generateBufferedImage
Generates an image of what currently is drawn on the canvas. Throws anFlowableImageException
whenclose()
is already called. -
close
public void close()Closes the canvas which disallows further drawing and releases graphical resources. -
drawAssociation
public void drawAssociation(int[] xPoints, int[] yPoints, double scaleFactor) -
drawConnection
-
drawArrowHead
-
drawGenericEventListener
-
drawTimerEventListener
-
drawUserEventListener
-
drawVariableEventListener
-
drawEventListener
-
drawTask
-
drawTask
-
drawStage
-
drawTask
protected void drawTask(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor) -
drawMilestone
-
drawMultilineCentredText
-
drawMultilineAnnotationText
-
drawMultilineText
protected void drawMultilineText(String text, int x, int y, int boxWidth, int boxHeight, boolean centered) -
fitTextToWidth
-
drawUserTask
-
drawServiceTask
-
drawSendEventTask
-
drawCaseTask
-
drawProcessTask
-
drawDecisionTask
-
drawCriterion
-
drawEntryCriterion
-
drawExitCriterion
-
drawHighLight
public void drawHighLight(int x, int y, int width, int height) -
connectionPerfectionizer
public List<GraphicInfo> connectionPerfectionizer(DefaultCaseDiagramCanvas.SHAPE_TYPE sourceShapeType, DefaultCaseDiagramCanvas.SHAPE_TYPE targetShapeType, GraphicInfo sourceGraphicInfo, GraphicInfo targetGraphicInfo, List<GraphicInfo> graphicInfoList) This method makes coordinates of connection flow better.- Parameters:
sourceShapeType
-targetShapeType
-sourceGraphicInfo
-targetGraphicInfo
-graphicInfoList
-
-