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_URIFields 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_VWFields inherited from interface org.w3c.dom.css.CSSValue
CSS_CUSTOM, CSS_INHERIT, CSS_PRIMITIVE_VALUE, CSS_VALUE_LIST -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedPrimitiveValue(short unitType) protectedPrimitiveValue(PrimitiveValue copied) -
Method Summary
Modifier and TypeMethodDescriptionabstract PrimitiveValueclone()Creates and returns a copy of this object.booleanfloatgetFloatValue(short unitType) This method is used to get a float value in a specified unit.shortGet the RGBA color.inthashCode()booleanTest whether this is a numeric value that was the result of acalc()expression.booleanTest whether this is a numeric value that is less than zero.booleanIs this value a number set to a value of zero, or an absolute value less than 1e-5 ?booleanIs this a subproperty that has been set by a shorthand?voidvoidsetFloatValue(short unitType, float floatValue) voidsetStringValue(short stringType, String stringValue) voidsetSubproperty(boolean subp) Methods inherited from class io.sf.carte.doc.style.css.property.StyleValue
getCssText, getCssValueType, getMinifiedCssText, isSystemDefault, setCssText, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.w3c.dom.css.CSSValue
getCssText, getCssValueType, setCssTextMethods 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:
getPrimitiveTypein interfaceCSSPrimitiveValue
-
setFloatValue
- Specified by:
setFloatValuein 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, aDOMExceptionis raised.- Specified by:
getFloatValuein 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:
setStringValuein interfaceCSSPrimitiveValue- Throws:
DOMException
-
getStringValue
- Specified by:
getStringValuein interfaceCSSPrimitiveValue- Throws:
DOMException
-
getCounterValue
- Specified by:
getCounterValuein interfaceCSSPrimitiveValue- Throws:
DOMException
-
getRectValue
- Specified by:
getRectValuein interfaceCSSPrimitiveValue- Throws:
DOMException
-
getRGBColorValue
Description copied from interface:CSSPrimitiveValue2Get the RGBA color. If this CSS value doesn't contain a RGB color value, aDOMExceptionis raised.- Specified by:
getRGBColorValuein interfaceCSSPrimitiveValue- Specified by:
getRGBColorValuein 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:StyleValueIs this a subproperty that has been set by a shorthand?- Overrides:
isSubpropertyin classStyleValue- Returns:
trueif this a subproperty that has been set by a shorthand,falseotherwise.
-
isCalculatedNumber
public boolean isCalculatedNumber()Description copied from interface:CSSPrimitiveValue2Test whether this is a numeric value that was the result of acalc()expression.- Specified by:
isCalculatedNumberin interfaceCSSPrimitiveValue2- Returns:
trueif 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:CSSPrimitiveValue2Test whether this is a numeric value that is less than zero.- Specified by:
isNegativeNumberin interfaceCSSPrimitiveValue2- Returns:
trueif 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:
isNumberZeroin interfaceExtendedCSSPrimitiveValue- Returns:
trueif this is a number and is set to zero (or equivalently small value).
-
setExpectInteger
public void setExpectInteger() -
hashCode
public int hashCode()- Overrides:
hashCodein classStyleValue
-
equals
- Overrides:
equalsin classStyleValue
-
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 interfaceExtendedCSSValue- Specified by:
clonein classStyleValue- Returns:
- a copy of this object.
-