Interface ModelDecorator
public interface ModelDecorator
Used to decorate vertices and edges with additional information when
rendering a model.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Rectangle
getClickBounds
(MTCompleteVertex vertex) Returns the bounds which should be clickable for a vertex decoration.getDrawable
(MTCompleteEdge edge) Returns a decorator drawable for a edge or null to not decorate the edge in question.getDrawable
(MTCompleteVertex vertex) Returns a decorator drawable for a vertex or null to not decorate the vertex in question.default Drawable
getHoverDrawable
(MTCompleteVertex vertex, Point p) Returns a drawable for when hovering over a vertex in the editor.getIcon()
Returns a 24x24 icon for representing the decorator.getName()
Returns the name of the decorator.getUUID()
Returns an UUID that uniquely identifies this decorator.default boolean
Returns true if this decorator is available for a given model type.boolean
Returns true if the decorator can be hidden through the model settings.default void
onClick
(MTCompleteVertex vertex, Component invoker, Point p) Called when a vertex decoration is clicked.
-
Method Details
-
getUUID
UUID getUUID()Returns an UUID that uniquely identifies this decorator.- Returns:
- an UUID that uniquely identifies this decorator.
-
getName
String getName()Returns the name of the decorator. This is shown to the user to make it possible to toggle the decorator on/off.- Returns:
- the name of the decorator.
-
getIcon
Icon getIcon()Returns a 24x24 icon for representing the decorator.- Returns:
- a 24x24 icon for representing the decorator.
-
getDrawable
Returns a decorator drawable for a vertex or null to not decorate the vertex in question.- Parameters:
vertex
- The vertex to get a drawable for.- Returns:
- a decorator drawable for a vertex or null to not decorate the vertex in question.
-
getHoverDrawable
Returns a drawable for when hovering over a vertex in the editor.- Parameters:
vertex
- The vertex.p
- The point at which the mouse is hovering, in model coordinates.- Returns:
- A drawable or null to not render anything when hovering.
-
getDrawable
Returns a decorator drawable for a edge or null to not decorate the edge in question.- Parameters:
edge
- The edge to get a drawable for.- Returns:
- Returns a decorator drawable for a edge or null to not decorate the edge in question.
-
isHideable
boolean isHideable()Returns true if the decorator can be hidden through the model settings.- Returns:
- true if the decorator can be hidden through the model settings.
-
getClickBounds
Returns the bounds which should be clickable for a vertex decoration.- Parameters:
vertex
- The vertex.- Returns:
- The click bounds or null if no clicks should be received.
-
onClick
Called when a vertex decoration is clicked. This is only called when the user clicks within the non-null rectangle returned by getClickBounds(vertex).- Parameters:
vertex
- The vertexinvoker
- The component being clicked within.p
- The point relative to the invoker component.
-
isEnabled
Returns true if this decorator is available for a given model type.- Parameters:
modelType
- The model type.- Returns:
- true if this decorator is available for a given model type.
-