Class StyleConstants
java.lang.Object
org.graphstream.ui.graphicGraph.stylesheet.StyleConstants
- Direct Known Subclasses:
Style
public class StyleConstants extends Object
The various constants and static constant conversion methods used for
styling.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStyleConstants.ArrowShapePossible shapes for arrows on edges.static classStyleConstants.FillModeHow to fill the contents of the element.static classStyleConstants.IconModeWhere to place the icon around the text (or instead of the text).static classStyleConstants.JComponentsPossible JComponents.static classStyleConstants.ShadowModeHow to draw the shadow of the element.static classStyleConstants.ShapePossible shapes for elements.static classStyleConstants.ShapeKindstatic classStyleConstants.SizeModeHow to set the size of the element.static classStyleConstants.SpriteOrientationOrientation of a sprite toward its attachment point.static classStyleConstants.StrokeModeHow to draw the contour of the element.static classStyleConstants.TextAlignmentHow to align words around their attach point.static classStyleConstants.TextBackgroundModestatic classStyleConstants.TextModeHow to draw the text of an element.static classStyleConstants.TextStyleVariant of the font.static classStyleConstants.TextVisibilityModeHow to show the text of an element.static classStyleConstants.UnitsThe available units for numerical values.static classStyleConstants.VisibilityModeHow to show an element. -
Constructor Summary
Constructors Constructor Description StyleConstants() -
Method Summary
Modifier and Type Method Description static ColorconvertColor(Object anyValue)Try to convert the given string value to a colour.static StringconvertLabel(Object value)Check if the given value is an instance of CharSequence (String is) and return it as a string.static ValueconvertValue(Object value)Convert an object to a value with units.static floatconvertWidth(Object value)Try to convert an arbitrary value to a float.
-
Constructor Details
-
StyleConstants
public StyleConstants()
-
-
Method Details
-
convertColor
Try to convert the given string value to a colour. It understands the 600 colour names of the X11 RGB data base. It also understands colours given in the "#FFFFFF" format and the hexadecimal "0xFFFFFF" format. Finally, it understands colours given as a "rgb(1,10,100)", CSS-like format. If the input value is null, the result is null.- Parameters:
anyValue- The value to convert.- Returns:
- the converted colour or null if the conversion failed.
-
convertLabel
Check if the given value is an instance of CharSequence (String is) and return it as a string. Else return null. If the input value is null, the return value is null. If the value returned is larger than 128 characters, this method cuts it to 128 characters. TODO: allow to set the max length of these strings.- Parameters:
value- The value to convert.- Returns:
- The corresponding string, or null.
-
convertWidth
Try to convert an arbitrary value to a float. If it is a descendant of Number, the float value is returned. If it is a string, a conversion is tried to change it into a number and if successful, this number is returned as a float. Else, the -1 value is returned as no width can be negative to indicate the conversion failed. If the input is null, the return value is -1.- Parameters:
value- The input to convert.- Returns:
- The value or -1 if the conversion failed. TODO should be named convertNumber
-
convertValue
Convert an object to a value with units. The object can be a number, in which case the value returned contains this number in pixel units. The object can be a string. In this case the strings understood by this method are of the form (spaces, number, spaces, unit, spaces). For example "3px", "45gu", "5.5%", " 25.3 gu ", "4", " 28.1 ".- Parameters:
value- A Number or a CharSequence.- Returns:
- A value.
-