Class PathElementRenderer


  • @OpenApiAll
    public abstract class PathElementRenderer
    extends PresentationElementRenderer
    Path element renderer allows to customize (change) the default view of PathElement. Path decoration methods are called even when the path is being drawn/created in a diagram, and supplier or client not yet connected, breakpoints are not yet set.
    See Also:
    PresentationElementRenderer, ShapeRenderer
    • Constructor Detail

      • PathElementRenderer

        public PathElementRenderer()
    • Method Detail

      • getClientEndPreferredSize

        protected int getClientEndPreferredSize​(PathElement pathElement,
                                                @CheckForNull
                                                PresentationElement client)
        The path client end preferred size. End size is used when drawing adornment on path end (e.g. arrow on the end). Override to change the client end size.
        Parameters:
        pathElement - path element
        client - client end of the path element. It might not be actually connected to the path. Should be used instead of PathElement.getClient()
        Returns:
        end size, or 0 to use default end size
      • getSupplierEndPreferredSize

        protected int getSupplierEndPreferredSize​(PathElement pathElement,
                                                  @CheckForNull
                                                  PresentationElement supplier)
        The path supplier end preferred size. End size is used when drawing adornment on path end (e.g. arrow on the end). Override to change the supplier end size.
        Parameters:
        pathElement - path element
        supplier - supplier end of the path. Might be null when the path is being newly created. Should be used instead of PathElement.getSupplier()
        Returns:
        end size, or 0 to use default end size
      • getClientEndRenderer

        @CheckForNull
        protected PathEndRenderer getClientEndRenderer​(PathElement pathElement,
                                                       @CheckForNull
                                                       PresentationElement client)
        Provides the path client end renderer. Override the method to return the custom path end renderer.
        Parameters:
        pathElement - path element
        client - client end of the path element. It might not be actually connected to the path. Should be used instead of PathElement.getClient()
        Returns:
        custom renderer, or null to use default end renderer
        See Also:
        PathEndRenderer
      • getSupplierEndRenderer

        @CheckForNull
        protected PathEndRenderer getSupplierEndRenderer​(PathElement pathElement,
                                                         @CheckForNull
                                                         PresentationElement supplier)
        Provides the path supplier end renderer. Override the method to return the custom path end renderer.
        Parameters:
        pathElement - path element
        supplier - supplier end of the path. Might be null when the path is being newly created. Should be used instead of PathElement.getSupplier()
        Returns:
        custom renderer, or null to use default end renderer
        See Also:
        PathEndRenderer
      • getLineWidth

        public int getLineWidth​(PathElement pathElement)
        Returns path line width Override to use the custom line width
        Parameters:
        pathElement - path to draw.
        Returns:
        line width, or 0 to use default line width.
      • drawPathAdornment

        @OpenApi
        protected void drawPathAdornment​(java.awt.Graphics g,
                                         PathElement pathElement,
                                         java.awt.Point supplierPoint,
                                         java.awt.Point clientPoint,
                                         java.util.List<java.awt.Point> breakPoints,
                                         @CheckForNull
                                         PresentationElement supplier,
                                         @CheckForNull
                                         PresentationElement client)
        Draws the path adornment. By default draws no adornment. Override the method to add the custom adornment drawing.
        Parameters:
        g - graphics where path is drawn
        pathElement - path to draw adornment for
        supplierPoint - point where the supplier end should be painted. Should be used instead of PathElement.getSupplierDrawPoint()
        clientPoint - point where the client end should be painted. Should be used instead of PathElement.getClientDrawPoint() ()}
        breakPoints - breakpoints between the supplier and client points, in that order. Should be used instead of PathElement.getBreakPoints()
        supplier - supplier end of the path. Might be null when the path is being newly created. Should be used instead of PathElement.getSupplier()
        client - client end of the path element. It might not be actually connected to the path. Should be used instead of PathElement.getClient()