java.lang.Object
io.sf.carte.doc.style.css.property.StyleValue
io.sf.carte.doc.style.css.property.PrimitiveValue
- All Implemented Interfaces:
CSSPrimitiveValue2
,ExtendedCSSPrimitiveValue
,ExtendedCSSValue
,Cloneable
,CSSPrimitiveValue
,CSSValue
- Direct Known Subclasses:
AttrValue
,ColorValue
,CustomPropertyValue
,EnvVariableValue
,ExpressionValue
,FunctionValue
,IdentifierValue
,NumberValue
,RatioValue
,StringValue
,SystemDefaultValue
,UnicodeRangeValue
,UnicodeValue
,UnicodeWildcardValue
,UnknownValue
Base implementation for CSS primitive values.
-
Field Summary
Fields inherited from interface org.w3c.dom.css.CSSPrimitiveValue
CSS_ATTR, CSS_CM, CSS_COUNTER, CSS_DEG, CSS_DIMENSION, CSS_EMS, CSS_EXS, CSS_GRAD, CSS_HZ, CSS_IDENT, CSS_IN, CSS_KHZ, CSS_MM, CSS_MS, CSS_NUMBER, CSS_PC, CSS_PERCENTAGE, CSS_PT, CSS_PX, CSS_RAD, CSS_RECT, CSS_RGBCOLOR, CSS_S, CSS_STRING, CSS_UNKNOWN, CSS_URI
Fields inherited from interface io.sf.carte.doc.style.css.CSSPrimitiveValue2
CSS_CAP, CSS_CH, CSS_COUNTERS, CSS_CUSTOM_PROPERTY, CSS_DPCM, CSS_DPI, CSS_DPPX, CSS_ELEMENT_REFERENCE, CSS_ENV_VAR, CSS_EXPRESSION, CSS_FR, CSS_FUNCTION, CSS_GRADIENT, CSS_IC, CSS_LH, CSS_QUARTER_MM, CSS_RATIO, CSS_REM, CSS_RLH, CSS_TURN, CSS_UNICODE_CHARACTER, CSS_UNICODE_RANGE, CSS_UNICODE_WILDCARD, CSS_VB, CSS_VH, CSS_VI, CSS_VMAX, CSS_VMIN, CSS_VW
Fields inherited from interface org.w3c.dom.css.CSSValue
CSS_CUSTOM, CSS_INHERIT, CSS_PRIMITIVE_VALUE, CSS_VALUE_LIST
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
PrimitiveValue
(short unitType) protected
PrimitiveValue
(PrimitiveValue copied) -
Method Summary
Modifier and TypeMethodDescriptionabstract PrimitiveValue
clone()
Creates and returns a copy of this object.boolean
float
getFloatValue
(short unitType) This method is used to get a float value in a specified unit.short
Get the RGBA color.int
hashCode()
boolean
Test whether this is a numeric value that was the result of acalc()
expression.boolean
Test whether this is a numeric value that is less than zero.boolean
Is this value a number set to a value of zero, or an absolute value less than 1e-5 ?boolean
Is this a subproperty that has been set by a shorthand?void
void
setFloatValue
(short unitType, float floatValue) void
setStringValue
(short stringType, String stringValue) void
setSubproperty
(boolean subp) Methods inherited from class io.sf.carte.doc.style.css.property.StyleValue
getCssText, getCssValueType, getMinifiedCssText, isSystemDefault, setCssText, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.w3c.dom.css.CSSValue
getCssText, getCssValueType, setCssText
Methods inherited from interface io.sf.carte.doc.style.css.ExtendedCSSValue
getMinifiedCssText, writeCssText
-
Constructor Details
-
PrimitiveValue
protected PrimitiveValue(short unitType) -
PrimitiveValue
protected PrimitiveValue() -
PrimitiveValue
-
-
Method Details
-
getPrimitiveType
public short getPrimitiveType()- Specified by:
getPrimitiveType
in interfaceCSSPrimitiveValue
-
setFloatValue
- Specified by:
setFloatValue
in interfaceCSSPrimitiveValue
- Throws:
DOMException
-
getFloatValue
This method is used to get a float value in a specified unit. If this CSS value doesn't contain a float value or can't be converted into the specified unit, aDOMException
is raised.- Specified by:
getFloatValue
in interfaceCSSPrimitiveValue
- Parameters:
unitType
- A unit code to get the float value. The unit code can only be a float unit type (i.e.CSS_NUMBER
,CSS_PERCENTAGE
,CSS_EMS
,CSS_EXS
,CSS_PX
,CSS_CM
,CSS_MM
,CSS_IN
,CSS_PT
,CSS_PC
,CSS_DEG
,CSS_RAD
,CSS_GRAD
,CSS_MS
,CSS_S
,CSS_HZ
,CSS_KHZ
,CSS_DIMENSION
).- Returns:
- The float value in the specified unit.
- Throws:
DOMException
- INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a float value or if the float value can't be converted into the specified unit.
-
setStringValue
- Specified by:
setStringValue
in interfaceCSSPrimitiveValue
- Throws:
DOMException
-
getStringValue
- Specified by:
getStringValue
in interfaceCSSPrimitiveValue
- Throws:
DOMException
-
getCounterValue
- Specified by:
getCounterValue
in interfaceCSSPrimitiveValue
- Throws:
DOMException
-
getRectValue
- Specified by:
getRectValue
in interfaceCSSPrimitiveValue
- Throws:
DOMException
-
getRGBColorValue
Description copied from interface:CSSPrimitiveValue2
Get the RGBA color. If this CSS value doesn't contain a RGB color value, aDOMException
is raised.- Specified by:
getRGBColorValue
in interfaceCSSPrimitiveValue
- Specified by:
getRGBColorValue
in interfaceCSSPrimitiveValue2
- Returns:
- the RGBA color value.
- Throws:
DOMException
- INVALID_ACCESS_ERR: Raised if the attached property can't return a RGB color value (e.g. this is notCSS_RGBCOLOR
).
-
setSubproperty
public void setSubproperty(boolean subp) -
isSubproperty
public boolean isSubproperty()Description copied from class:StyleValue
Is this a subproperty that has been set by a shorthand?- Overrides:
isSubproperty
in classStyleValue
- Returns:
true
if this a subproperty that has been set by a shorthand,false
otherwise.
-
isCalculatedNumber
public boolean isCalculatedNumber()Description copied from interface:CSSPrimitiveValue2
Test whether this is a numeric value that was the result of acalc()
expression.- Specified by:
isCalculatedNumber
in interfaceCSSPrimitiveValue2
- 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).
-
isNegativeNumber
public boolean isNegativeNumber()Description copied from interface:CSSPrimitiveValue2
Test whether this is a numeric value that is less than zero.- Specified by:
isNegativeNumber
in interfaceCSSPrimitiveValue2
- Returns:
true
if this is a numeric value and its value is negative.
-
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:
isNumberZero
in interfaceExtendedCSSPrimitiveValue
- Returns:
true
if this is a number and is set to zero (or equivalently small value).
-
setExpectInteger
public void setExpectInteger() -
hashCode
public int hashCode()- Overrides:
hashCode
in classStyleValue
-
equals
- Overrides:
equals
in classStyleValue
-
clone
Creates and returns a copy of this object.The object will be the same except for the
subproperty
flag, that will be disabled in the clone object.- Specified by:
clone
in interfaceExtendedCSSValue
- Specified by:
clone
in classStyleValue
- Returns:
- a copy of this object.
-