public class Style extends StyleConstants
Styles inherit each others. By default a style is all set to invalid values meaning "unset". This means that the value is to be taken from the parent. The getters are able to resolve this process by themselves and therefore must be used instead of a direct access to fields.
StyleConstants.ArrowShape, StyleConstants.FillMode, StyleConstants.IconMode, StyleConstants.JComponents, StyleConstants.ShadowMode, StyleConstants.Shape, StyleConstants.ShapeKind, StyleConstants.SizeMode, StyleConstants.SpriteOrientation, StyleConstants.StrokeMode, StyleConstants.TextAlignment, StyleConstants.TextBackgroundMode, StyleConstants.TextMode, StyleConstants.TextStyle, StyleConstants.TextVisibilityMode, StyleConstants.Units, StyleConstants.VisibilityMode
Constructor and Description |
---|
Style()
New style with all settings to a special value meaning "unset".
|
Style(Rule parent)
New style with all settings to a special value meaning "unset".
|
Modifier and Type | Method and Description |
---|---|
void |
addAlternateStyle(java.lang.String event,
Rule alternateStyle)
Add an alternative style for specific events.
|
void |
augment(Style other)
Copy all the settings of the other style that are set, excepted the parent.
|
java.lang.String |
getArrowImage()
Image to use for the arrow.
|
StyleConstants.ArrowShape |
getArrowShape()
The shape of edges arrows.
|
Values |
getArrowSize()
Edge arrow dimensions.
|
Colors |
getCanvasColor()
Colour of all non-graph, non-edge, non-node, non-sprite things.
|
Color |
getCanvasColor(int i) |
int |
getCanvasColorCount() |
Color |
getFillColor(int i) |
int |
getFillColorCount() |
Colors |
getFillColors()
Which color(s) to use for fill modes that use it.
|
java.lang.String |
getFillImage()
Which image to use when filling the element contents with it.
|
StyleConstants.FillMode |
getFillMode()
How to fill the content of an element.
|
java.lang.String |
getIcon()
The icon image to use.
|
StyleConstants.IconMode |
getIconMode()
How to draw the icon around the text (or instead of the text).
|
StyleConstants.JComponents |
getJComponent()
The element JComponent type if available.
|
Values |
getPadding()
Additional space to add inside the element between its contour and its
contents.
|
Rule |
getParent()
The parent style.
|
Color |
getShadowColor(int i) |
int |
getShadowColorCount() |
Colors |
getShadowColors()
Color(s) of the element shadow.
|
StyleConstants.ShadowMode |
getShadowMode()
How to draw the shadow of the element.
|
Values |
getShadowOffset()
Offset of the element shadow centre according to the element centre.
|
Value |
getShadowWidth()
Width of the element shadow.
|
StyleConstants.Shape |
getShape()
The element shape.
|
Values |
getShapePoints()
The element polygonal shape.
|
Values |
getSize()
The element dimensions.
|
StyleConstants.SizeMode |
getSizeMode()
How to size the element.
|
StyleConstants.SpriteOrientation |
getSpriteOrientation()
How to orient a sprite according to its attachement.
|
Colors |
getStrokeColor()
How to color the element contour.
|
Color |
getStrokeColor(int i) |
int |
getStrokeColorCount() |
StyleConstants.StrokeMode |
getStrokeMode()
How to draw the element contour.
|
Value |
getStrokeWidth()
Width of the element contour.
|
StyleConstants.TextAlignment |
getTextAlignment()
How to align the text according to the element centre.
|
Colors |
getTextBackgroundColor() |
Color |
getTextBackgroundColor(int i) |
StyleConstants.TextBackgroundMode |
getTextBackgroundMode() |
Colors |
getTextColor()
The text color(s).
|
Color |
getTextColor(int i) |
int |
getTextColorCount() |
java.lang.String |
getTextFont()
The text font.
|
StyleConstants.TextMode |
getTextMode()
How to draw the text of the element.
|
Values |
getTextOffset()
Offset of the text from its computed position.
|
Values |
getTextPadding()
Padding of the text inside its background, if any.
|
Value |
getTextSize()
The text size in points.
|
StyleConstants.TextStyle |
getTextStyle()
The text font style variation.
|
Values |
getTextVisibility()
Visibility values if the text visibility changes.
|
StyleConstants.TextVisibilityMode |
getTextVisibilityMode()
How and when to show the text of the element.
|
java.lang.Object |
getValue(java.lang.String property,
java.lang.String... events)
Get the value of a given property.
|
Values |
getVisibility()
The element visibility if it is variable.
|
StyleConstants.VisibilityMode |
getVisibilityMode()
How and when to show the element.
|
java.lang.Integer |
getZIndex() |
boolean |
hasValue(java.lang.String field,
java.lang.String... events)
True if the given field exists in this style only (not the parents).
|
void |
reparent(Rule parent)
Set or change the parent of the style.
|
void |
setDefaults()
Set the default values for each setting.
|
void |
setValue(java.lang.String field,
java.lang.Object value) |
java.lang.String |
toString() |
java.lang.String |
toString(int level) |
convertColor, convertLabel, convertValue, convertWidth
public Style()
public Style(Rule parent)
parent
- The parent style.public Rule getParent()
public java.lang.Object getValue(java.lang.String property, java.lang.String... events)
StyleGroup
class.property
- The style property the value is searched for.public boolean hasValue(java.lang.String field, java.lang.String... events)
field
- The field to test.public StyleConstants.FillMode getFillMode()
public Colors getFillColors()
public int getFillColorCount()
public Color getFillColor(int i)
public java.lang.String getFillImage()
public StyleConstants.StrokeMode getStrokeMode()
public Colors getStrokeColor()
public int getStrokeColorCount()
public Color getStrokeColor(int i)
public Value getStrokeWidth()
public StyleConstants.ShadowMode getShadowMode()
public Colors getShadowColors()
public int getShadowColorCount()
public Color getShadowColor(int i)
public Value getShadowWidth()
public Values getShadowOffset()
public Values getPadding()
public StyleConstants.TextMode getTextMode()
public StyleConstants.TextVisibilityMode getTextVisibilityMode()
public Values getTextVisibility()
public Colors getTextColor()
public int getTextColorCount()
public Color getTextColor(int i)
public StyleConstants.TextStyle getTextStyle()
public java.lang.String getTextFont()
public Value getTextSize()
public StyleConstants.IconMode getIconMode()
public java.lang.String getIcon()
public StyleConstants.VisibilityMode getVisibilityMode()
public Values getVisibility()
public StyleConstants.SizeMode getSizeMode()
public Values getSize()
public Values getShapePoints()
public StyleConstants.TextAlignment getTextAlignment()
public StyleConstants.TextBackgroundMode getTextBackgroundMode()
public Colors getTextBackgroundColor()
public Color getTextBackgroundColor(int i)
public Values getTextOffset()
public Values getTextPadding()
public StyleConstants.Shape getShape()
public StyleConstants.JComponents getJComponent()
public StyleConstants.SpriteOrientation getSpriteOrientation()
public StyleConstants.ArrowShape getArrowShape()
public java.lang.String getArrowImage()
public Values getArrowSize()
public Colors getCanvasColor()
public int getCanvasColorCount()
public Color getCanvasColor(int i)
public java.lang.Integer getZIndex()
public void setDefaults()
public void augment(Style other)
other
- Another style.public void reparent(Rule parent)
parent
- The new parent.public void addAlternateStyle(java.lang.String event, Rule alternateStyle)
event
- The event that triggers the alternate style.alternateStyle
- The alternative style.public void setValue(java.lang.String field, java.lang.Object value)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int level)