Class PresentationElementRenderer
- java.lang.Object
-
- com.nomagic.magicdraw.uml.symbols.PresentationElementRenderer
-
- Direct Known Subclasses:
PathElementRenderer
,PathRenderer
,ShapeRenderer
@OpenApiAll public abstract class PresentationElementRenderer extends java.lang.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
, andPathElementRenderer
. Renderers are registered byPresentationElementRendererManager
.
-
-
Constructor Summary
Constructors Constructor Description PresentationElementRenderer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
afterUpdate(PresentationElement presentationElement)
Invoked right after presentation element update.void
beforeUpdate(PresentationElement presentationElement)
Invoked right before presentation element update.java.awt.Point
getCenterlinePoint(PresentationElement presentationElement)
Returns a point for centerline drawing.java.awt.Color
getColor(PresentationElement presentationElement, PresentationElementColorEnum colorEnum)
Provides the color used to draw presentation element.FontProvider
getFontProvider(PresentationElement presentationElement)
Returns the font provider.java.lang.String
getText(PresentationElement presentationElement, PresentationElementTextEnum textEnum)
Provides the displayable text for the given presentation element.void
propertiesChanged(PresentationElement presentationElement)
Invoked when presentation element properties were changed.protected abstract void
updateText(PresentationElement presentationElement)
Update the given presentation element text.
-
-
-
Method Detail
-
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 java.lang.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:
PresentationElementTextEnum
-
getColor
public java.awt.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:
PresentationElementColorEnum
-
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:
FontProvider
-
getCenterlinePoint
public java.awt.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
-
-
-