Class PresentationElementRenderer

java.lang.Object
com.nomagic.magicdraw.uml.symbols.PresentationElementRenderer
Direct Known Subclasses:
PathElementRenderer, PathRenderer, ShapeRenderer

@OpenApiAll public abstract class PresentationElementRenderer extends Object
Base class for presentation element renderer. Presentation element renderer allows to customize (change) the default view of element. E.g. change the displayed text, font, color.

There two types of renderers - ShapeRenderer, and PathElementRenderer. Renderers are registered by PresentationElementRendererManager.

See Also:
  • Constructor Details

    • PresentationElementRenderer

      public PresentationElementRenderer()
  • Method Details

    • beforeUpdate

      public void beforeUpdate(PresentationElement presentationElement)
      Invoked right before presentation element update.
      Parameters:
      presentationElement - updating element.
    • afterUpdate

      public void afterUpdate(PresentationElement presentationElement)
      Invoked right after presentation element update.
      Parameters:
      presentationElement - updating element.
    • propertiesChanged

      public void propertiesChanged(PresentationElement presentationElement)
      Invoked when presentation element properties were changed.
      Parameters:
      presentationElement - properties of this element were updated.
    • getText

      public String getText(PresentationElement presentationElement, PresentationElementTextEnum textEnum)
      Provides the displayable text for the given presentation element. Override the method to display the custom text.
      Parameters:
      presentationElement - element to display text for.
      textEnum - describes the displayable text purpose (text is displayed as name, stereotypes, tags, or constraints).
      Returns:
      displayble text, or null to use the predefined text.
      See Also:
    • getColor

      public Color getColor(PresentationElement presentationElement, PresentationElementColorEnum colorEnum)
      Provides the color used to draw presentation element. Override the method to use the custom color.
      Parameters:
      presentationElement - element to draw.
      colorEnum - describes the color purpose (color is used to draw lines, text, or fill shape).
      Returns:
      color, or null to use the predefined color.
      See Also:
    • getFontProvider

      public FontProvider getFontProvider(PresentationElement presentationElement)
      Returns the font provider. Provided font is used to display text. Override the method to use custom font.
      Parameters:
      presentationElement - presentation element to use font for.
      Returns:
      custom font provider, or null to use predefined font.
      See Also:
    • getCenterlinePoint

      public Point getCenterlinePoint(PresentationElement presentationElement)
      Returns a point for centerline drawing. Override the method to use custom centerline point.
      Parameters:
      presentationElement - - element for which centerline point has to be retrieved.
      Returns:
      centerline point, or null to use predefined point.
    • updateText

      protected abstract void updateText(PresentationElement presentationElement)
      Update the given presentation element text.
      Parameters:
      presentationElement -