|
||||||||
| PREV CLASS NEXT CLASS | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
The CSSPrimitiveValue interface represents a single
CSS
value. This interface may be used to determine the value of a
specific style property currently set in a block or to set a
specific style property explicitly within the block. An instance of
this interface might be obtained from the
getPropertyCSSValue method of the
CSSStyleDeclaration interface. A
CSSPrimitiveValue object only occurs in a context of a
CSS property.
Conversions are allowed between absolute values (from
millimeters to centimeters, from degrees to radians, and so on) but
not between relative values. (For example, a pixel value cannot be
converted to a centimeter value.) Percentage values can't be
converted since they are relative to the parent value (or another
property value). There is one exception for color percentage
values: since a color percentage value is relative to the range
0-255, a color percentage value can be converted to a number; (see
also the RGBColor interface).
See also the Document Object Model (DOM) Level 2 Style Specification.
| Field Summary | |
static short |
CSS_ATTRThe value is a attribute function. |
static short |
CSS_CMThe value is a length (cm). |
static short |
CSS_COUNTERThe value is a counter or counters function. |
static short |
CSS_DEGThe value is an angle (deg). |
static short |
CSS_DIMENSIONThe value is a number with an unknown dimension. |
static short |
CSS_EMSThe value is a length (ems). |
static short |
CSS_EXSThe value is a length (exs). |
static short |
CSS_GRADThe value is an angle (grad). |
static short |
CSS_HZThe value is a frequency (Hz). |
static short |
CSS_IDENTThe value is an identifier. |
static short |
CSS_INThe value is a length (in). |
static short |
CSS_KHZThe value is a frequency (kHz). |
static short |
CSS_MMThe value is a length (mm). |
static short |
CSS_MSThe value is a time (ms). |
static short |
CSS_NUMBERThe value is a simple number. |
static short |
CSS_PCThe value is a length (pc). |
static short |
CSS_PERCENTAGEThe value is a percentage. |
static short |
CSS_PTThe value is a length (pt). |
static short |
CSS_PXThe value is a length (px). |
static short |
CSS_RADThe value is an angle (rad). |
static short |
CSS_RECTThe value is a rect function. |
static short |
CSS_RGBCOLORThe value is a RGB color. |
static short |
CSS_SThe value is a time (s). |
static short |
CSS_STRINGThe value is a STRING. |
static short |
CSS_UNKNOWNThe value is not a recognized CSS2 value. |
static short |
CSS_URIThe value is a URI. |
| Fields inherited from interface org.w3c.dom.css.CSSValue |
CSS_CUSTOM,
CSS_INHERIT,
CSS_PRIMITIVE_VALUE,
CSS_VALUE_LIST |
| Method Summary | |
Counter |
getCounterValue()This method is used to get the Counter value. |
float |
getFloatValue(short unitType)This method is used to get a float value in a specified unit. |
short |
getPrimitiveType()The type of the value as defined by the constants specified above. |
Rect |
getRectValue()This method is used to get the Rect value. |
RGBColor |
getRGBColorValue()This method is used to get the RGB color. |
java.lang.String |
getStringValue()This method is used to get the string value. |
void |
setFloatValue(short unitType,
float floatValue)A method to set the float value with a specified unit. |
void |
setStringValue(short stringType,
java.lang.String stringValue)A method to set the string value with the specified unit. |
| Methods inherited from interface org.w3c.dom.css.CSSValue |
getCssText,
getCssValueType,
setCssText |
| Field Detail |
public static final short CSS_ATTR
getStringValue method.public static final short CSS_CM
getFloatValue method.public static final short CSS_COUNTER
getCounterValue method.public static final short CSS_DEG
getFloatValue method.public static final short CSS_DIMENSION
getFloatValue method.public static final short CSS_EMS
getFloatValue method.public static final short CSS_EXS
getFloatValue method.public static final short CSS_GRAD
getFloatValue method.public static final short CSS_HZ
getFloatValue method.public static final short CSS_IDENT
getStringValue method.public static final short CSS_IN
getFloatValue method.public static final short CSS_KHZ
getFloatValue method.public static final short CSS_MM
getFloatValue method.public static final short CSS_MS
getFloatValue method.public static final short CSS_NUMBER
getFloatValue
method.public static final short CSS_PC
getFloatValue method.public static final short CSS_PERCENTAGE
getFloatValue method.public static final short CSS_PT
getFloatValue method.public static final short CSS_PX
getFloatValue method.public static final short CSS_RAD
getFloatValue method.public static final short CSS_RECT
getRectValue method.public static final short CSS_RGBCOLOR
getRGBColorValue method.public static final short CSS_S
getFloatValue method.public static final short CSS_STRING
getStringValue
method.public static final short CSS_UNKNOWN
cssText attribute.public static final short CSS_URI
getStringValue
method.| Method Detail |
public Counter getCounterValue()
throws DOMException
DOMException is
raised. Modification to the corresponding style property can be
achieved using the Counter interface.DOMException
- INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a
Counter value (e.g. this is not CSS_COUNTER).
public float getFloatValue(short unitType)
throws DOMException
DOMException is
raised.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).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.public short getPrimitiveType()
public Rect getRectValue()
throws DOMException
DOMException is
raised. Modification to the corresponding style property can be
achieved using the Rect interface.DOMException
- INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a
Rect value. (e.g. this is not CSS_RECT).
public RGBColor getRGBColorValue()
throws DOMException
DOMException is
raised. Modification to the corresponding style property can be
achieved using the RGBColor interface.DOMException
- INVALID_ACCESS_ERR: Raised if the attached property can't return
a RGB color value (e.g. this is not
CSS_RGBCOLOR).
public java.lang.String getStringValue()
throws DOMException
DOMException is
raised.
Note: Some properties (like 'font-family' or 'voice-family') convert a whitespace separated list of idents to a string.
primitiveType can only be a string unit type (i.e.
CSS_STRING, CSS_URI,
CSS_IDENT and CSS_ATTR).DOMException
- INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a
string value.
public void setFloatValue(short unitType,
float floatValue)
throws DOMException
DOMException will be raised.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.DOMException
- INVALID_ACCESS_ERR: Raised if the attached property doesn't
support the float value or the unit type.
public void setStringValue(short stringType,
java.lang.String stringValue)
throws DOMException
DOMException will be raised.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.DOMException
- INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a
string value or if the string value can't be converted into the
specified unit.
|
||||||||
| PREV CLASS NEXT CLASS | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Copyright © 2003 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public and Member privacy statements.