- All Superinterfaces:
Cloneable
,CSSPrimitiveValue
,CSSValue
- All Known Subinterfaces:
CSSColorMixFunction
,CSSColorValue
,CSSCountersValue
,CSSCounterValue
,CSSExpressionValue
,CSSFunctionValue
,CSSGradientValue
,CSSMathFunctionValue
,CSSMathValue
,CSSNumberValue
,CSSRatioValue
,CSSTransformFunction
,CSSUnicodeRangeValue
,CSSUnicodeRangeValue.CSSUnicodeValue
,HSLColorValue
,HWBColorValue
,LABColorValue
,LCHColorValue
- All Known Implementing Classes:
CalcValue
,ColorValue
,ExpressionValue
,FunctionValue
,GradientValue
,HSLColorValue
,HWBColorValue
,IdentifierValue
,LABColorValue
,LCHColorValue
,MathFunctionValue
,NumberValue
,PercentageValue
,RatioValue
,RectValue
,RGBColorValue
,StringValue
,SystemDefaultValue
,TransformFunction
,TypedValue
,UnicodeRangeValue
,UnicodeValue
,UnicodeWildcardValue
,UnknownValue
,URIValue
,URIValueWrapper
A typed value.
Typed values include strings, identifiers, lengths, etc.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSValue
CSSValue.CssType, CSSValue.Type
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a copy of this value.default float
If this is a number, get its float value in the current unit.float
getFloatValue
(short unitType) If this is a number, get its float value in the requested unit.default String
If this value represents a string value, get it.default boolean
Test whether this is a numeric value that was the result of acalc()
expression.default boolean
Is this value a number set to a value of zero ?default void
setFloatValue
(short unitType, float floatValue) If this value is numeric, set a float value with the given unit.default void
setStringValue
(CSSValue.Type stringType, String stringValue) If this value is a string, identifier, URI, unicode wildcard or element reference, set its value.default RGBAColor
If this value represents a color, get it or transform to a RGB color.default RGBAColor
Deprecated.Methods inherited from interface io.sf.carte.doc.style.css.CSSPrimitiveValue
getUnitType, isNegativeNumber, isPrimitiveValue, setExpectInteger
Methods inherited from interface io.sf.carte.doc.style.css.CSSValue
getCssText, getCssValueType, getMinifiedCssText, getMinifiedCssText, getPrecedingComments, getPrimitiveType, getTrailingComments, matches, setCssText, writeCssText
-
Method Details
-
setFloatValue
If this value is numeric, set a float value with the given unit.- Parameters:
unitType
- the unit type according toCSSUnit
.floatValue
- the float value.- Throws:
DOMException
- INVALID_ACCESS_ERR if the unit is not aCSSUnit
one, or this value is not a number.
NO_MODIFICATION_ALLOWED_ERR if this value is unmodifiable.
-
getFloatValue
If this is a number, get its float value in the requested unit.- Parameters:
unitType
- the requested unit type.- Returns:
- the float value in the requested unit.
- Throws:
DOMException
- INVALID_ACCESS_ERR if this value is not a number value or it could not be transformed to the desired unit (for example a relative value converted to an absolute one, for which a context is needed).
-
getFloatValue
default float getFloatValue()If this is a number, get its float value in the current unit.- Returns:
- The float value.
- Throws:
DOMException
- INVALID_ACCESS_ERR if this value is not a number value or it could not be transformed to the desired unit (for example a relative value converted to an absolute one, for which a context is needed).
-
setStringValue
If this value is a string, identifier, URI, unicode wildcard or element reference, set its value.The string value has to be supplied unescaped and unquoted. If it is a unicode wildcard, it must not have the preceding
U+
.- Parameters:
stringType
- the type of value.stringValue
- the string value.- Throws:
DOMException
- INVALID_ACCESS_ERR if the requested type of value is different to this one, or this value does not accept strings.
NO_MODIFICATION_ALLOWED_ERR if this value is unmodifiable.
-
getStringValue
If this value represents a string value, get it.This method is useful for values like strings, identifiers, URIs, element references, etc. For functions, it returns the function name.
- Returns:
- the string value.
- Throws:
DOMException
- INVALID_ACCESS_ERR if this value is not a string.
-
toRGBColorValue
Deprecated.If this value represents a color, get it or transform to a RGB color.If the color does not map into the sRGB gamut, it is clamped.
This method was intended to replace the old
getRGBColorValue()
and was named similarly, but to avoid confusions it was deprecated in favor oftoRGBColor()
.- Returns:
- the RGBA color.
- Throws:
DOMException
- INVALID_ACCESS_ERR: if this value can't return a RGB color value (either is not aCOLOR
or not a typed value).
NOT_SUPPORTED_ERR: if the conversion needs device color space information to be performed accurately.- See Also:
-
toRGBColor
If this value represents a color, get it or transform to a RGB color.If the color does not map into the sRGB gamut, it is clamped.
- Returns:
- the RGBA color.
- Throws:
DOMException
- INVALID_ACCESS_ERR: if this value can't return a RGB color value (either is not aCOLOR
or not a typed value).
NOT_SUPPORTED_ERR: if the conversion needs device color space information to be performed accurately.
-
isCalculatedNumber
default boolean isCalculatedNumber()Test whether this is a numeric value that was the result of acalc()
expression.- Returns:
true
if this is a numeric value, and it was produced as the output of a calculation (instead of declared as a plain, constant numeric value).
-
isNumberZero
default boolean isNumberZero()Is this value a number set to a value of zero ?- Returns:
true
if this is a number and is set to zero.
-
clone
CSSTypedValue clone()Description copied from interface:CSSValue
Creates and returns a copy of this value.
-