Class DefaultDecisionRequirementsDiagramCanvas


  • public class DefaultDecisionRequirementsDiagramCanvas
    extends Object
    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:
    DefaultDecisionRequirementsDiagramGenerator
    • Field Detail

      • LOGGER

        protected static final org.slf4j.Logger LOGGER
      • TASK_BOX_COLOR

        protected static final Color TASK_BOX_COLOR
      • CONNECTION_COLOR

        protected static final Color CONNECTION_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
      • 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
      • canvasWidth

        protected int canvasWidth
      • canvasHeight

        protected int canvasHeight
      • minX

        protected int minX
      • minY

        protected int minY
      • decisionRequirementsDiagram

        protected BufferedImage decisionRequirementsDiagram
      • closed

        protected boolean closed
      • customClassLoader

        protected ClassLoader customClassLoader
      • activityFontName

        protected String activityFontName
      • labelFontName

        protected String labelFontName
      • annotationFontName

        protected String annotationFontName
    • Constructor Detail

      • 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 Detail

      • initialize

        public void initialize​(String imageType)
      • 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

        public void drawConnection​(int[] xPoints,
                                   int[] yPoints,
                                   String connectionType,
                                   double scaleFactor)
      • drawArrowHead

        public void drawArrowHead​(Line2D.Double line,
                                  double scaleFactor)
      • drawDecision

        public void drawDecision​(String name,
                                 GraphicInfo graphicInfo,
                                 double scaleFactor)
      • drawDecision

        protected void drawDecision​(String name,
                                    GraphicInfo graphicInfo,
                                    boolean thickBorder,
                                    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)
      • fitTextToWidth

        protected String fitTextToWidth​(String original,
                                        int width)
      • drawHighLight

        public void drawHighLight​(int x,
                                  int y,
                                  int width,
                                  int height)