Class Style
java.lang.Object
org.graphstream.ui.graphicGraph.stylesheet.StyleConstants
org.graphstream.ui.graphicGraph.stylesheet.Style
- Direct Known Subclasses:
StyleGroup
public class Style extends StyleConstants
A style is a whole set of settings for a graphic element.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.ui.graphicGraph.stylesheet.StyleConstants
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 Summary
-
Method Summary
Modifier and Type Method Description voidaddAlternateStyle(String event, Rule alternateStyle)Add an alternative style for specific events.voidaugment(Style other)Copy all the settings of the other style that are set, excepted the parent.StringgetArrowImage()Image to use for the arrow.StyleConstants.ArrowShapegetArrowShape()The shape of edges arrows.ValuesgetArrowSize()Edge arrow dimensions.ColorsgetCanvasColor()Colour of all non-graph, non-edge, non-node, non-sprite things.ColorgetCanvasColor(int i)intgetCanvasColorCount()ColorgetFillColor(int i)intgetFillColorCount()ColorsgetFillColors()Which color(s) to use for fill modes that use it.StringgetFillImage()Which image to use when filling the element contents with it.StyleConstants.FillModegetFillMode()How to fill the content of an element.StringgetIcon()The icon image to use.StyleConstants.IconModegetIconMode()How to draw the icon around the text (or instead of the text).StyleConstants.JComponentsgetJComponent()The element JComponent type if available.ValuesgetPadding()Additional space to add inside the element between its contour and its contents.RulegetParent()The parent style.ColorgetShadowColor(int i)intgetShadowColorCount()ColorsgetShadowColors()Color(s) of the element shadow.StyleConstants.ShadowModegetShadowMode()How to draw the shadow of the element.ValuesgetShadowOffset()Offset of the element shadow centre according to the element centre.ValuegetShadowWidth()Width of the element shadow.StyleConstants.ShapegetShape()The element shape.ValuesgetShapePoints()The element polygonal shape.ValuesgetSize()The element dimensions.StyleConstants.SizeModegetSizeMode()How to size the element.StyleConstants.SpriteOrientationgetSpriteOrientation()How to orient a sprite according to its attachement.ColorsgetStrokeColor()How to color the element contour.ColorgetStrokeColor(int i)intgetStrokeColorCount()StyleConstants.StrokeModegetStrokeMode()How to draw the element contour.ValuegetStrokeWidth()Width of the element contour.StyleConstants.TextAlignmentgetTextAlignment()How to align the text according to the element centre.ColorsgetTextBackgroundColor()ColorgetTextBackgroundColor(int i)StyleConstants.TextBackgroundModegetTextBackgroundMode()ColorsgetTextColor()The text color(s).ColorgetTextColor(int i)intgetTextColorCount()StringgetTextFont()The text font.StyleConstants.TextModegetTextMode()How to draw the text of the element.ValuesgetTextOffset()Offset of the text from its computed position.ValuesgetTextPadding()Padding of the text inside its background, if any.ValuegetTextSize()The text size in points.StyleConstants.TextStylegetTextStyle()The text font style variation.ValuesgetTextVisibility()Visibility values if the text visibility changes.StyleConstants.TextVisibilityModegetTextVisibilityMode()How and when to show the text of the element.ObjectgetValue(String property, String... events)Get the value of a given property.ValuesgetVisibility()The element visibility if it is variable.StyleConstants.VisibilityModegetVisibilityMode()How and when to show the element.IntegergetZIndex()booleanhasValue(String field, String... events)True if the given field exists in this style only (not the parents).voidreparent(Rule parent)Set or change the parent of the style.voidsetDefaults()Set the default values for each setting.voidsetValue(String field, Object value)StringtoString()StringtoString(int level)Methods inherited from class org.graphstream.ui.graphicGraph.stylesheet.StyleConstants
convertColor, convertLabel, convertValue, convertWidth
-
Constructor Details
-
Style
public Style()New style with all settings to a special value meaning "unset". In this modeField, all the settings are inherited from the parent (when set). -
Style
New style with all settings to a special value meaning "unset". In this modeField, all the settings are inherited from the parent.- Parameters:
parent- The parent style.
-
-
Method Details
-
getParent
The parent style.- Returns:
- a style from which some settings are inherited.
-
getValue
Get the value of a given property. This code is the same for all "getX" methods so we explain it once here. This is the implementation of style inheritance. First if some event is actually occurring, the alternative styles are searched first. If these events have unset values for the property, their parent are then searched. If the value for the property is not found in the alternative styles, alternative styles parents, or if there is no event occurring actually, this style is checked. If its value is unset, the parents of this style are checked. Classes are not checked here, they are processed in theStyleGroupclass.- Parameters:
property- The style property the value is searched for.
-
hasValue
True if the given field exists in this style only (not the parents).- Parameters:
field- The field to test.- Returns:
- True if this style has a value for the given field.
-
getFillMode
How to fill the content of an element. -
getFillColors
Which color(s) to use for fill modes that use it. -
getFillColorCount
public int getFillColorCount() -
getFillColor
-
getFillImage
Which image to use when filling the element contents with it. -
getStrokeMode
How to draw the element contour. -
getStrokeColor
How to color the element contour. -
getStrokeColorCount
public int getStrokeColorCount() -
getStrokeColor
-
getStrokeWidth
Width of the element contour. -
getShadowMode
How to draw the shadow of the element. -
getShadowColors
Color(s) of the element shadow. -
getShadowColorCount
public int getShadowColorCount() -
getShadowColor
-
getShadowWidth
Width of the element shadow. -
getShadowOffset
Offset of the element shadow centre according to the element centre. -
getPadding
Additional space to add inside the element between its contour and its contents. -
getTextMode
How to draw the text of the element. -
getTextVisibilityMode
How and when to show the text of the element. -
getTextVisibility
Visibility values if the text visibility changes. -
getTextColor
The text color(s). -
getTextColorCount
public int getTextColorCount() -
getTextColor
-
getTextStyle
The text font style variation. -
getTextFont
The text font. -
getTextSize
The text size in points. -
getIconMode
How to draw the icon around the text (or instead of the text). -
getIcon
The icon image to use. -
getVisibilityMode
How and when to show the element. -
getVisibility
The element visibility if it is variable. -
getSizeMode
How to size the element. -
getSize
The element dimensions. -
getShapePoints
The element polygonal shape. -
getTextAlignment
How to align the text according to the element centre. -
getTextBackgroundMode
-
getTextBackgroundColor
-
getTextBackgroundColor
-
getTextOffset
Offset of the text from its computed position. -
getTextPadding
Padding of the text inside its background, if any. -
getShape
The element shape. -
getJComponent
The element JComponent type if available. -
getSpriteOrientation
How to orient a sprite according to its attachement. -
getArrowShape
The shape of edges arrows. -
getArrowImage
Image to use for the arrow. -
getArrowSize
Edge arrow dimensions. -
getCanvasColor
Colour of all non-graph, non-edge, non-node, non-sprite things. -
getCanvasColorCount
public int getCanvasColorCount() -
getCanvasColor
-
getZIndex
-
setDefaults
public void setDefaults()Set the default values for each setting. -
augment
Copy all the settings of the other style that are set, excepted the parent. Only the settings that have a value (different from "unset") are copied. The parent field is never copied.- Parameters:
other- Another style.
-
reparent
Set or change the parent of the style.- Parameters:
parent- The new parent.
-
addAlternateStyle
Add an alternative style for specific events.- Parameters:
event- The event that triggers the alternate style.alternateStyle- The alternative style.
-
setValue
-
toString
-
toString
-