Interface Drawable
- All Known Implementing Classes:
AbstractDrawable
public interface Drawable
A drawable is a visual representation of an object of type T. It contains of
a list of shapes that can have different visual properties.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Each shape can have a fill paint, a stroke paint and a text paint.static enum
static enum
static enum
-
Method Summary
Modifier and TypeMethodDescriptiongetFillImage
(int index, MTLanguage lang) Returns the image that fills the shape.getId()
getOutline
(Rectangle bounds) Returns the outline of the drawable.getPaint
(Drawable.PaintMode paintMode, int index, Rectangle bounds) Returns a paint for a given shape and paint mode.Returns a shape in the drawable.int
getShapeCount
(Rectangle bounds) Returns the number of shapes that this drawable contains (not counting the outline shape).getStroke
(int index) Returns the stroke of the edge around the shape.getText
(int index, MTLanguage lang) Returns the text that lies in the shape.getTextDirection
(int index) getTextFont
(int index) Returns the font of the shape's text.getTextHorizontalAlign
(int index) getTextVerticalAlign
(int index) boolean
Returns true if a shadow should be rendered below the drawable.boolean
hasText
(int index) Returns true if the shape has text in it.boolean
isBorder
(int index) Returns true if the shape is a border.boolean
isFillImage
(int index) Returns true if the shape has a fill image.boolean
isPaintTransformable
(Drawable.PaintMode paintMode, int index) This can returnfalse
to indicate that the paint cannot be transformed in any way for this shape, e.g.default boolean
useHyphenation
(int index) Returns true if the text at index should be hyphenated.
-
Method Details
-
getId
String getId() -
isPaintTransformable
This can returnfalse
to indicate that the paint cannot be transformed in any way for this shape, e.g. if the user has created a color scheme and this is one of the shapes in a drawable for a vertex it will have the same color regardless of the settings in the color scheme iftrue
is returned.- Parameters:
paintMode
- The paint mode used.index
- The index of the shape.- Returns:
- true to never transform the paint of the given paint mode, of the shape at the given index, false to allow paint transformation of the given paint mode and shape.
- See Also:
-
hasShadow
boolean hasShadow()Returns true if a shadow should be rendered below the drawable.- Returns:
- true if a shadow should be rendered below the drawable.
-
getShapeCount
Returns the number of shapes that this drawable contains (not counting the outline shape).- Parameters:
bounds
- The outer bounds that this drawable should fill up.- Returns:
- the number of shapes in the drawable
-
getOutline
Returns the outline of the drawable. This is the area that marks the outer limit of the drawable, where edges will stop.- Parameters:
bounds
- The outer bounds that the drawable should fill up- Returns:
- The outline of the drawable.
-
getShape
Returns a shape in the drawable.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
bounds
- The outer bounds that the drawable should fill up- Returns:
- a shape that is part of the drawable
-
isBorder
boolean isBorder(int index) Returns true if the shape is a border. A border's outline can be changed if the user indicates that this drawable should have another border or if the drawable is selected in the UI. If isBorder() is true getOutlinePaint() and getOutlineStroke() can be ignored by the renderer.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
- Returns:
- true if the shape is a border
-
isFillImage
boolean isFillImage(int index) Returns true if the shape has a fill image.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
- Returns:
- true if the shape has a fill image
-
getPaint
Returns a paint for a given shape and paint mode.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
paintMode
- The paint mode.bounds
- The bounds in which the drawable will be drawn.- Returns:
- the fill paint of the shape, null if no fill paint
- See Also:
-
getStroke
Returns the stroke of the edge around the shape.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
- Returns:
- the outline stroke of the shape or null for no stroking of the shape.
-
getFillImage
Returns the image that fills the shape. The shape will be stretched to fill the shape.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
lang
- The language to get the image for.- Returns:
- the shape's fill image
-
hasText
boolean hasText(int index) Returns true if the shape has text in it.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
- Returns:
- true if the shape has text.
-
getText
Returns the text that lies in the shape.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
lang
- The language to get the text for.- Returns:
- the shape's text, or null if no text is available
-
getTextFont
Returns the font of the shape's text.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
- Returns:
- the shape's font
-
getTextDirection
-
getTextHorizontalAlign
-
getTextVerticalAlign
-
useHyphenation
default boolean useHyphenation(int index) Returns true if the text at index should be hyphenated. Hyphenation will occur at '-', soft-hyphens or if a hyphenation dictionary is installed.- Parameters:
index
- the index of the shape,0 <= i < getShapeCount()
- Returns:
- see method description
-