- All Superinterfaces:
Cloneable
,CSSPrimitiveValue
,CSSValue
- All Known Subinterfaces:
CSSColorMixFunction
,CSSColorValue
,CSSCountersValue
,CSSCounterValue
,CSSExpressionValue
,CSSFunctionValue
,CSSGradientValue
,CSSMathFunctionValue
,CSSRatioValue
,CSSUnicodeRangeValue
,CSSUnicodeRangeValue.CSSUnicodeValue
,HSLColorValue
,HWBColorValue
,LABColorValue
,LCHColorValue
- All Known Implementing Classes:
CalcValue
,ColorValue
,ExpressionValue
,FunctionValue
,GradientValue
,HSLColorValue
,HWBColorValue
,IdentifierValue
,LABColorValue
,LCHColorValue
,NumberValue
,PercentageValue
,RatioValue
,RectValue
,RGBColorValue
,StringValue
,SystemDefaultValue
,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 TypeMethodDescriptionfloat
getFloatValue
(short unitType) If this is a number, get its float value in the requested unit.If this value represents a string value, get it.boolean
Test whether this is a numeric value that was the result of acalc()
expression.boolean
Is this value a number set to a value of zero ?void
setFloatValue
(short unitType, float floatValue) If this value is numeric, set a float value with the given unit.void
setStringValue
(CSSValue.Type stringType, String stringValue) If this value is a string, identifier, URI, unicode wildcard or element reference, set its value.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, setExpectInteger
Methods inherited from interface io.sf.carte.doc.style.css.CSSValue
clone, getCssText, getCssValueType, getMinifiedCssText, getPrimitiveType, 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. If the type isCSS_OTHER
, the value shall be returned as is, regardless of the unit that was set with.- 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).
-
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
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
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.
-