Class AttributesHelper
java.lang.Object
net.sourceforge.jeuclid.elements.support.attributes.AttributesHelper
Class contains utility methods for working with elements attributes.
- Version:
- $Revision: 1e57f05a780b $
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant for "Transparent" color.static final StringInfinity.static final StringWidth of mediummath space according to 3.3.4.2.static final StringUnit for pt.static final StringWidth of tickmath space according to 3.3.4.2.static final StringWidth of thinmath space according to 3.3.4.2.static final StringWidth of verytickmath space according to 3.3.4.2.static final StringWidth of verythinmath space according to 3.3.4.2.static final StringWidth of veryverytickmath space according to 3.3.4.2.static final StringWidth of veryverythinmath space according to 3.3.4.2. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcolorTOsRGBString(Color color) Creates a re-parsable string representation of the given color.static floatconvertSizeToPt(String sizeString, LayoutContext context, String defaultUnit) Translates size into pt.static floatparseRelativeSize(String sizeString, LayoutContext context, float relativeTo) Parse a size that is relative to a given size.static ColorstringToColor(String value, Color defaultValue) Creates a color from a given string.
-
Field Details
-
COLOR_TRANSPARENT
Constant for "Transparent" color.- See Also:
-
VERYVERYTHINMATHSPACE
Width of veryverythinmath space according to 3.3.4.2.- See Also:
-
VERYTHINMATHSPACE
Width of verythinmath space according to 3.3.4.2.- See Also:
-
THINMATHSPACE
Width of thinmath space according to 3.3.4.2.- See Also:
-
MEDIUMMATHSPACE
Width of mediummath space according to 3.3.4.2.- See Also:
-
THICKMATHSPACE
Width of tickmath space according to 3.3.4.2.- See Also:
-
VERYTHICKMATHSPACE
Width of verytickmath space according to 3.3.4.2.- See Also:
-
VERYVERYTHICKMATHSPACE
Width of veryverytickmath space according to 3.3.4.2.- See Also:
-
PT
Unit for pt.- See Also:
-
INFINITY
Infinity. Should be reasonably large.- See Also:
-
-
Method Details
-
parseRelativeSize
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
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
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
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.
-