com.steadystate.css.dom
Class CSSValueImpl
java.lang.Object
com.steadystate.css.dom.CSSValueImpl
- CSSPrimitiveValue, CSSValue, CSSValueList, Serializable
public class CSSValueImpl
extends java.lang.Object
The CSSValueImpl
class can represent either a
CSSPrimitiveValue
or a CSSValueList
so that
the type can successfully change when using setCssText
.
TO DO:
Float unit conversions,
A means of checking valid primitive types for properties
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 |
CSSValueImpl
public CSSValueImpl(LexicalUnit value,
boolean forcePrimitive)
Constructor
getCounterValue
public Counter getCounterValue()
throws DOMException
This method is used to get the Counter value. If this CSS value
doesn't contain a counter value, a DOMException
is
raised. Modification to the corresponding style property can be
achieved using the Counter
interface.
- getCounterValue in interface CSSPrimitiveValue
getFloatValue
public float getFloatValue(short unitType)
throws DOMException
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, a DOMException
is raised.
- getFloatValue in interface CSSPrimitiveValue
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
).
- The float value in the specified unit.
getRGBColorValue
public RGBColor getRGBColorValue()
throws DOMException
This method is used to get the RGB color. If this CSS value doesn't
contain a RGB color value, a DOMException
is raised.
Modification to the corresponding style property can be achieved
using the RGBColor
interface.
- getRGBColorValue in interface CSSPrimitiveValue
getRectValue
public Rect getRectValue()
throws DOMException
This method is used to get the Rect value. If this CSS value doesn't
contain a rect value, a DOMException
is raised.
Modification to the corresponding style property can be achieved
using the Rect
interface.
- getRectValue in interface CSSPrimitiveValue
setCssText
public void setCssText(String cssText)
throws DOMException
- setCssText in interface CSSValue
setFloatValue
public void setFloatValue(short unitType,
float floatValue)
throws DOMException
A method to set the float value with a specified unit. If the property
attached with this value can not accept the specified unit or the
float value, the value will be unchanged and a
DOMException
will be raised.
- setFloatValue in interface CSSPrimitiveValue
unitType
- A unit code as defined above. 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
).floatValue
- The new float value.
setStringValue
public void setStringValue(short stringType,
String stringValue)
throws DOMException
A method to set the string value with the specified unit. If the
property attached to this value can't accept the specified unit or
the string value, the value will be unchanged and a
DOMException
will be raised.
- setStringValue in interface CSSPrimitiveValue
stringType
- A string code as defined above. The string code can
only be a string unit type (i.e. CSS_STRING
,
CSS_URI
, CSS_IDENT
, and
CSS_ATTR
).stringValue
- The new string value.
toString
public String toString()