Package org.flowable.dmn.image.impl
Class DefaultDecisionRequirementsDiagramCanvas
java.lang.Object
org.flowable.dmn.image.impl.DefaultDecisionRequirementsDiagramCanvas
Represents a canvas on which DMN 1.2 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:
- Yvo Swillens, Tijs Rademakers
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected static Fontprotected Stringprotected static final intprotected intprotected intprotected booleanprotected static final Colorprotected ClassLoaderprotected static BufferedImageprotected BufferedImageprotected static final intprotected static final intprotected FontMetricsprotected Graphics2Dprotected static final Colorprotected static final intprotected static final Colorprotected static Fontprotected Stringprotected static final org.slf4j.Loggerprotected static final intprotected intprotected intprotected static final Colorprotected static final Colorprotected static final intprotected static final Stroke -
Constructor Summary
ConstructorsConstructorDescriptionDefaultDecisionRequirementsDiagramCanvas(int width, int height, int minX, int minY, String imageType) Creates an empty canvas with given width and height.DefaultDecisionRequirementsDiagramCanvas(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 TypeMethodDescriptionvoidclose()Closes the canvas which disallows further drawing and releases graphical resources.connectionPerfectionizer(DefaultDecisionRequirementsDiagramCanvas.SHAPE_TYPE sourceShapeType, DefaultDecisionRequirementsDiagramCanvas.SHAPE_TYPE targetShapeType, GraphicInfo sourceGraphicInfo, GraphicInfo targetGraphicInfo, List<GraphicInfo> graphicInfoList) This method makes coordinates of connection flow better.voiddrawArrowHead(Line2D.Double line, double scaleFactor) voiddrawConnection(int[] xPoints, int[] yPoints, String connectionType, double scaleFactor) voiddrawDecision(BufferedImage icon, String name, GraphicInfo graphicInfo, double scaleFactor) protected voiddrawDecision(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor) voiddrawDecision(String name, GraphicInfo graphicInfo, double scaleFactor) voiddrawDecisionService(String name, GraphicInfo graphicInfo, List<GraphicInfo> dividerGraphicInfos, double scaleFactor) voiddrawHighLight(int x, int y, int width, int height) voiddrawInformationRequirement(int[] xPoints, int[] yPoints, 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) protected StringfitTextToWidth(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.voidinitialize(String imageType)
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
ARROW_WIDTH
protected static final int ARROW_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:
-
TASK_BOX_COLOR
-
CONNECTION_COLOR
-
HIGHLIGHT_COLOR
-
LABEL_COLOR
-
TASK_BORDER_COLOR
-
LABEL_FONT
-
ANNOTATION_FONT
-
THICK_TASK_BORDER_STROKE
-
ICON_PADDING
protected static final int ICON_PADDING- See Also:
-
DECISION_IMAGE
-
canvasWidth
protected int canvasWidth -
canvasHeight
protected int canvasHeight -
minX
protected int minX -
minY
protected int minY -
decisionRequirementsDiagram
-
g
-
fontMetrics
-
closed
protected boolean closed -
customClassLoader
-
activityFontName
-
labelFontName
-
annotationFontName
-
-
Constructor Details
-
DefaultDecisionRequirementsDiagramCanvas
public DefaultDecisionRequirementsDiagramCanvas(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. -
DefaultDecisionRequirementsDiagramCanvas
public DefaultDecisionRequirementsDiagramCanvas(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
-
generateImage
Generates an image of what currently is drawn on the canvas. Throws anFlowableImageExceptionwhenclose()is already called. -
generateBufferedImage
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. -
drawInformationRequirement
public void drawInformationRequirement(int[] xPoints, int[] yPoints, double scaleFactor) -
drawConnection
-
drawArrowHead
-
drawDecision
public void drawDecision(BufferedImage icon, String name, GraphicInfo graphicInfo, double scaleFactor) -
drawDecision
-
drawDecisionService
public void drawDecisionService(String name, GraphicInfo graphicInfo, List<GraphicInfo> dividerGraphicInfos, double scaleFactor) -
drawDecision
protected void drawDecision(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor) -
drawMultilineCentredText
-
drawMultilineAnnotationText
-
drawMultilineText
protected void drawMultilineText(String text, int x, int y, int boxWidth, int boxHeight, boolean centered) -
fitTextToWidth
-
drawHighLight
public void drawHighLight(int x, int y, int width, int height) -
connectionPerfectionizer
public List<GraphicInfo> connectionPerfectionizer(DefaultDecisionRequirementsDiagramCanvas.SHAPE_TYPE sourceShapeType, DefaultDecisionRequirementsDiagramCanvas.SHAPE_TYPE targetShapeType, GraphicInfo sourceGraphicInfo, GraphicInfo targetGraphicInfo, List<GraphicInfo> graphicInfoList) This method makes coordinates of connection flow better.- Parameters:
sourceShapeType-targetShapeType-sourceGraphicInfo-targetGraphicInfo-graphicInfoList-
-