java.lang.Object
io.sf.carte.doc.style.css.property.StyleValue
io.sf.carte.doc.style.css.property.PrimitiveValue
io.sf.carte.doc.style.css.property.TypedValue
- All Implemented Interfaces:
CSSPrimitiveValue,CSSTypedValue,CSSValue,Serializable,Cloneable
- Direct Known Subclasses:
ColorValue,ExpressionValue,FunctionValue,IdentifierValue,NumberValue,RatioValue,RectValue,StringValue,SystemDefaultValue,UnicodeRangeValue,UnicodeValue,UnicodeWildcardValue,UnknownValue
Base implementation for CSS typed values.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSValue
CSSValue.CssType, CSSValue.Type -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTypedValue(CSSValue.Type unitType) protectedTypedValue(TypedValue copied) -
Method Summary
Modifier and TypeMethodDescriptionabstract TypedValueclone()Creates and returns a copy of this object.getComponent(int index) Get the component atindex.intGet the number of components of this value.Get the general category to which this value belongs.floatgetFloatValue(short unitType) If this is a number, get its float value in the requested unit.booleanIs this value a number set to a value of zero, or an absolute value less than 1e-5 ?voidsetComponent(int index, StyleValue component) If this value has components, set the component atindex.Methods inherited from class io.sf.carte.doc.style.css.property.PrimitiveValue
equals, getPrecedingComments, getPrimitiveType, getTrailingComments, hashCode, isPrimitiveValue, isSubproperty, setExpectInteger, setSubpropertyMethods inherited from class io.sf.carte.doc.style.css.property.StyleValue
getCssText, getMinifiedCssText, isSystemDefault, matches, setCssText, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.sf.carte.doc.style.css.CSSPrimitiveValue
getUnitType, isNegativeNumber, isPrimitiveValue, setExpectIntegerMethods inherited from interface io.sf.carte.doc.style.css.CSSTypedValue
getFloatValue, getStringValue, isCalculatedNumber, setFloatValue, setStringValue, toRGBColor, toRGBColorValueMethods inherited from interface io.sf.carte.doc.style.css.CSSValue
getCssText, getMinifiedCssText, getMinifiedCssText, getPrecedingComments, getPrimitiveType, getTrailingComments, matches, setCssText, writeCssText
-
Constructor Details
-
TypedValue
-
TypedValue
-
-
Method Details
-
getCssValueType
Description copied from interface:CSSValueGet the general category to which this value belongs.- Specified by:
getCssValueTypein interfaceCSSValue- Returns:
- the general value type.
-
getFloatValue
Description copied from interface:CSSTypedValueIf this is a number, get its float value in the requested unit.- Specified by:
getFloatValuein interfaceCSSTypedValue- 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).
-
isNumberZero
public boolean isNumberZero()Is this value a number set to a value of zero, or an absolute value less than 1e-5 ?- Specified by:
isNumberZeroin interfaceCSSTypedValue- Returns:
trueif this is a number and is set to zero (or equivalently small value).
-
getComponent
Get the component atindex.This method allows to access the components regardless of them being indexed or not. It is convenient to perform common tasks at the components (like when computing values).
- Parameters:
index- the index. For colors, index0is always the alpha channel.- Returns:
- the component, or
nullif the index is incorrect.
-
setComponent
If this value has components, set the component atindex.This method allows to access the components regardless of them being formally indexed or not. It is convenient to perform common tasks at the components (like when computing values).
- Parameters:
index- the index. For colors, index0is always the alpha channel. Setting a component at an index that does not exist has no effect.component- the new component. Cannot be aKEYWORDnor aSHORTHAND. For colors, must be a primitive value (that is, eitherTYPEDor aPROXY).- Throws:
DOMException- TYPE_MISMATCH_ERR if the value is of the wrong type.NullPointerException- if the index is valid but thecomponentcannot benull.
-
getComponentCount
public int getComponentCount()Get the number of components of this value.- Returns:
- the number of components,
0if none.
-
clone
Creates and returns a copy of this object.The object will be the same except for the
subpropertyflag, that will be disabled in the clone object.- Specified by:
clonein interfaceCSSTypedValue- Specified by:
clonein interfaceCSSValue- Specified by:
clonein classPrimitiveValue- Returns:
- a copy of this object.
-