Package org.flowable.cmmn.image.impl
Class DefaultCaseDiagramCanvas
- java.lang.Object
-
- org.flowable.cmmn.image.impl.DefaultCaseDiagramCanvas
-
public class DefaultCaseDiagramCanvas extends Object
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:
DefaultCaseDiagramGenerator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultCaseDiagramCanvas.SHAPE_TYPE
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DefaultCaseDiagramCanvas(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the canvas which disallows further drawing and releases graphical resources.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.voiddrawArrowHead(Line2D.Double line, double scaleFactor)voiddrawAssociation(int[] xPoints, int[] yPoints, double scaleFactor)voiddrawCaseTask(String name, GraphicInfo graphicInfo, double scaleFactor)voiddrawConnection(int[] xPoints, int[] yPoints, String connectionType, double scaleFactor)voiddrawCriterion(GraphicInfo graphicInfo, boolean fillShape)voiddrawDecisionTask(String name, GraphicInfo graphicInfo, double scaleFactor)voiddrawEntryCriterion(GraphicInfo graphicInfo)voiddrawEventListener(GraphicInfo graphicInfo, BufferedImage image, double scaleFactor)voiddrawExitCriterion(GraphicInfo graphicInfo)voiddrawGenericEventListener(GraphicInfo graphicInfo, double scaleFactor)voiddrawHighLight(int x, int y, int width, int height)protected voiddrawMilestone(String name, GraphicInfo graphicInfo, double scaleFactor)protected voiddrawMultilineAnnotationText(String text, int x, int y, int boxWidth, int boxHeight)protected voiddrawMultilineCentredText(String text, int x, int y, int boxWidth, int boxHeight)protected voiddrawMultilineText(String text, int x, int y, int boxWidth, int boxHeight, boolean centered)voiddrawProcessTask(String name, GraphicInfo graphicInfo, double scaleFactor)voiddrawSendEventTask(String name, GraphicInfo graphicInfo, double scaleFactor)voiddrawServiceTask(String name, GraphicInfo graphicInfo, double scaleFactor)voiddrawStage(String name, GraphicInfo graphicInfo, double scaleFactor)voiddrawTask(BufferedImage icon, String name, GraphicInfo graphicInfo, double scaleFactor)protected voiddrawTask(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor)voiddrawTask(String name, GraphicInfo graphicInfo, double scaleFactor)voiddrawTimerEventListener(GraphicInfo graphicInfo, double scaleFactor)voiddrawUserEventListener(GraphicInfo graphicInfo, double scaleFactor)voiddrawUserTask(String name, GraphicInfo graphicInfo, double scaleFactor)voiddrawVariableEventListener(GraphicInfo graphicInfo, double scaleFactor)protected StringfitTextToWidth(String original, int width)BufferedImagegenerateBufferedImage(String imageType)Generates an image of what currently is drawn on the canvas.InputStreamgenerateImage(String imageType)Generates an image of what currently is drawn on the canvas.voidinitialize(String imageType)
-
-
-
Field Detail
-
LOGGER
protected static final org.slf4j.Logger LOGGER
-
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
-
DEFAULT_INDICATOR_WIDTH
protected static final int DEFAULT_INDICATOR_WIDTH
- See Also:
- Constant Field Values
-
MARKER_WIDTH
protected static final int MARKER_WIDTH
- See Also:
- Constant Field Values
-
FONT_SIZE
protected static final int FONT_SIZE
- See Also:
- Constant Field Values
-
FONT_SPACING
protected static final int FONT_SPACING
- See Also:
- Constant Field Values
-
TEXT_PADDING
protected static final int TEXT_PADDING
- See Also:
- Constant Field Values
-
ANNOTATION_TEXT_PADDING
protected static final int ANNOTATION_TEXT_PADDING
- See Also:
- Constant Field Values
-
LINE_HEIGHT
protected static final int LINE_HEIGHT
- See Also:
- Constant Field Values
-
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
-
STAGE_BORDER_COLOR
protected static final Color STAGE_BORDER_COLOR
-
EVENT_BORDER_COLOR
protected static final Color EVENT_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
-
ASSOCIATION_STROKE
protected static final Stroke ASSOCIATION_STROKE
-
ICON_PADDING
protected static final int ICON_PADDING
- See Also:
- Constant Field Values
-
TIMER_IMAGE
protected static BufferedImage TIMER_IMAGE
-
USERLISTENER_IMAGE
protected static BufferedImage USERLISTENER_IMAGE
-
VARIABLELISTENER_IMAGE
protected static BufferedImage VARIABLELISTENER_IMAGE
-
USERTASK_IMAGE
protected static BufferedImage USERTASK_IMAGE
-
SERVICETASK_IMAGE
protected static BufferedImage SERVICETASK_IMAGE
-
CASETASK_IMAGE
protected static BufferedImage CASETASK_IMAGE
-
PROCESSTASK_IMAGE
protected static BufferedImage PROCESSTASK_IMAGE
-
DECISIONTASK_IMAGE
protected static BufferedImage DECISIONTASK_IMAGE
-
SENDEVENTTASK_IMAGE
protected static BufferedImage SENDEVENTTASK_IMAGE
-
canvasWidth
protected int canvasWidth
-
canvasHeight
protected int canvasHeight
-
minX
protected int minX
-
minY
protected int minY
-
caseDiagram
protected BufferedImage caseDiagram
-
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 Detail
-
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
public DefaultCaseDiagramCanvas(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 Detail
-
initialize
public void initialize(String imageType)
-
generateImage
public InputStream generateImage(String imageType)
Generates an image of what currently is drawn on the canvas. Throws anFlowableImageExceptionwhenclose()is already called.
-
generateBufferedImage
public BufferedImage generateBufferedImage(String imageType)
Generates an image of what currently is drawn on the canvas. Throws anFlowableImageExceptionwhenclose()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
public void drawConnection(int[] xPoints, int[] yPoints, String connectionType, double scaleFactor)
-
drawArrowHead
public void drawArrowHead(Line2D.Double line, double scaleFactor)
-
drawGenericEventListener
public void drawGenericEventListener(GraphicInfo graphicInfo, double scaleFactor)
-
drawTimerEventListener
public void drawTimerEventListener(GraphicInfo graphicInfo, double scaleFactor)
-
drawUserEventListener
public void drawUserEventListener(GraphicInfo graphicInfo, double scaleFactor)
-
drawVariableEventListener
public void drawVariableEventListener(GraphicInfo graphicInfo, double scaleFactor)
-
drawEventListener
public void drawEventListener(GraphicInfo graphicInfo, BufferedImage image, double scaleFactor)
-
drawTask
public void drawTask(BufferedImage icon, String name, GraphicInfo graphicInfo, double scaleFactor)
-
drawTask
public void drawTask(String name, GraphicInfo graphicInfo, double scaleFactor)
-
drawStage
public void drawStage(String name, GraphicInfo graphicInfo, double scaleFactor)
-
drawTask
protected void drawTask(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor)
-
drawMilestone
protected void drawMilestone(String name, GraphicInfo graphicInfo, 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)
-
drawUserTask
public void drawUserTask(String name, GraphicInfo graphicInfo, double scaleFactor)
-
drawServiceTask
public void drawServiceTask(String name, GraphicInfo graphicInfo, double scaleFactor)
-
drawSendEventTask
public void drawSendEventTask(String name, GraphicInfo graphicInfo, double scaleFactor)
-
drawCaseTask
public void drawCaseTask(String name, GraphicInfo graphicInfo, double scaleFactor)
-
drawProcessTask
public void drawProcessTask(String name, GraphicInfo graphicInfo, double scaleFactor)
-
drawDecisionTask
public void drawDecisionTask(String name, GraphicInfo graphicInfo, double scaleFactor)
-
drawCriterion
public void drawCriterion(GraphicInfo graphicInfo, boolean fillShape)
-
drawEntryCriterion
public void drawEntryCriterion(GraphicInfo graphicInfo)
-
drawExitCriterion
public void drawExitCriterion(GraphicInfo graphicInfo)
-
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-
-
-