Class AttributesHelper
- java.lang.Object
-
- net.sourceforge.jeuclid.elements.support.attributes.AttributesHelper
-
public final class AttributesHelper extends java.lang.ObjectClass contains utility methods for working with elements attributes.- Version:
- $Revision: 1e57f05a780b $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOLOR_TRANSPARENTConstant for "Transparent" color.static java.lang.StringINFINITYInfinity.static java.lang.StringMEDIUMMATHSPACEWidth of mediummath space according to 3.3.4.2.static java.lang.StringPTUnit for pt.static java.lang.StringTHICKMATHSPACEWidth of tickmath space according to 3.3.4.2.static java.lang.StringTHINMATHSPACEWidth of thinmath space according to 3.3.4.2.static java.lang.StringVERYTHICKMATHSPACEWidth of verytickmath space according to 3.3.4.2.static java.lang.StringVERYTHINMATHSPACEWidth of verythinmath space according to 3.3.4.2.static java.lang.StringVERYVERYTHICKMATHSPACEWidth of veryverytickmath space according to 3.3.4.2.static java.lang.StringVERYVERYTHINMATHSPACEWidth of veryverythinmath space according to 3.3.4.2.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringcolorTOsRGBString(java.awt.Color color)Creates a re-parsable string representation of the given color.static floatconvertSizeToPt(java.lang.String sizeString, LayoutContext context, java.lang.String defaultUnit)Translates size into pt.static floatparseRelativeSize(java.lang.String sizeString, LayoutContext context, float relativeTo)Parse a size that is relative to a given size.static java.awt.ColorstringToColor(java.lang.String value, java.awt.Color defaultValue)Creates a color from a given string.
-
-
-
Field Detail
-
COLOR_TRANSPARENT
public static final java.lang.String COLOR_TRANSPARENT
Constant for "Transparent" color.- See Also:
- Constant Field Values
-
VERYVERYTHINMATHSPACE
public static final java.lang.String VERYVERYTHINMATHSPACE
Width of veryverythinmath space according to 3.3.4.2.- See Also:
- Constant Field Values
-
VERYTHINMATHSPACE
public static final java.lang.String VERYTHINMATHSPACE
Width of verythinmath space according to 3.3.4.2.- See Also:
- Constant Field Values
-
THINMATHSPACE
public static final java.lang.String THINMATHSPACE
Width of thinmath space according to 3.3.4.2.- See Also:
- Constant Field Values
-
MEDIUMMATHSPACE
public static final java.lang.String MEDIUMMATHSPACE
Width of mediummath space according to 3.3.4.2.- See Also:
- Constant Field Values
-
THICKMATHSPACE
public static final java.lang.String THICKMATHSPACE
Width of tickmath space according to 3.3.4.2.- See Also:
- Constant Field Values
-
VERYTHICKMATHSPACE
public static final java.lang.String VERYTHICKMATHSPACE
Width of verytickmath space according to 3.3.4.2.- See Also:
- Constant Field Values
-
VERYVERYTHICKMATHSPACE
public static final java.lang.String VERYVERYTHICKMATHSPACE
Width of veryverytickmath space according to 3.3.4.2.- See Also:
- Constant Field Values
-
PT
public static final java.lang.String PT
Unit for pt.- See Also:
- Constant Field Values
-
INFINITY
public static final java.lang.String INFINITY
Infinity. Should be reasonably large.- See Also:
- Constant Field Values
-
-
Method Detail
-
parseRelativeSize
public static float parseRelativeSize(java.lang.String sizeString, LayoutContext context, float relativeTo)Parse a size that is relative to a given size.- Parameters:
sizeString- sizeString to parsecontext- Context to use to calculate for absolute sizes.relativeTo- This size is relative to the given size (must be in pt).- Returns:
- a size in pt.
-
convertSizeToPt
public static float convertSizeToPt(java.lang.String sizeString, LayoutContext context, java.lang.String defaultUnit)Translates size into pt.- Parameters:
sizeString- string to convertcontext- LayoutContext this size is relative to. This is usually the context of the parent or the element itself.defaultUnit- default Unit to use in this context. May be px, pt, em, etc.- Returns:
- Translated value of the size attribute into Point (=Java Pixels).
-
stringToColor
public static java.awt.Color stringToColor(java.lang.String value, java.awt.Color defaultValue)Creates a color from a given string.This function supports a wide variety of inputs.
- #RGB (hex 0..f)
- #RGBA (hex 0..f)
- #RRGGBB (hex 00..ff)
- #RRGGBBAA (hex 00..ff)
- rgb(r,g,b) (0..255 or 0%..100%)
- java.awt.Color[r=r,g=g,b=b] (0..255)
- system-color(colorname)
- transparent
- colorname
- Parameters:
value- the string to parse.defaultValue- a default color to use in case of failure.- Returns:
- a Color representing the string if possible
-
colorTOsRGBString
public static java.lang.String colorTOsRGBString(java.awt.Color color)
Creates a re-parsable string representation of the given color.First, the color will be converted into the sRGB colorspace. It will then be printed as #rrggbb, or as #rrrggbbaa if an alpha value is present.
- Parameters:
color- the color to represent.- Returns:
- a re-parsable string representadion.
-
-