org.w3c.dom.css
Interface CSSPrimitiveValue

All Superinterfaces:
CSSValue sample code for org.w3c.dom.css.CSSValue definition code for org.w3c.dom.css.CSSValue

public interface CSSPrimitiveValue
extends CSSValue sample code for org.w3c.dom.css.CSSValue definition code for org.w3c.dom.css.CSSValue

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.

Since:
DOM Level 2

Field Summary
static short CSS_ATTR sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_ATTR definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_ATTR
          The value is a attribute function.
static short CSS_CM sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_CM definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_CM
          The value is a length (cm).
static short CSS_COUNTER sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_COUNTER definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_COUNTER
          The value is a counter or counters function.
static short CSS_DEG sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_DEG definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_DEG
          The value is an angle (deg).
static short CSS_DIMENSION sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_DIMENSION definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_DIMENSION
          The value is a number with an unknown dimension.
static short CSS_EMS sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_EMS definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_EMS
          The value is a length (ems).
static short CSS_EXS sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_EXS definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_EXS
          The value is a length (exs).
static short CSS_GRAD sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_GRAD definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_GRAD
          The value is an angle (grad).
static short CSS_HZ sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_HZ definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_HZ
          The value is a frequency (Hz).
static short CSS_IDENT sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_IDENT definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_IDENT
          The value is an identifier.
static short CSS_IN sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_IN definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_IN
          The value is a length (in).
static short CSS_KHZ sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_KHZ definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_KHZ
          The value is a frequency (kHz).
static short CSS_MM sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_MM definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_MM
          The value is a length (mm).
static short CSS_MS sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_MS definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_MS
          The value is a time (ms).
static short CSS_NUMBER sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_NUMBER definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_NUMBER
          The value is a simple number.
static short CSS_PC sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PC definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PC
          The value is a length (pc).
static short CSS_PERCENTAGE sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PERCENTAGE definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PERCENTAGE
          The value is a percentage.
static short CSS_PT sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PT definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PT
          The value is a length (pt).
static short CSS_PX sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PX definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PX
          The value is a length (px).
static short CSS_RAD sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_RAD definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_RAD
          The value is an angle (rad).
static short CSS_RECT sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_RECT definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_RECT
          The value is a rect function.
static short CSS_RGBCOLOR sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_RGBCOLOR definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_RGBCOLOR
          The value is a RGB color.
static short CSS_S sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_S definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_S
          The value is a time (s).
static short CSS_STRING sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_STRING definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_STRING
          The value is a STRING.
static short CSS_UNKNOWN sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_UNKNOWN definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_UNKNOWN
          The value is not a recognized CSS2 value.
static short CSS_URI sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_URI definition code for org.w3c.dom.css.CSSPrimitiveValue.CSS_URI
          The value is a URI.
 
Fields inherited from interface org.w3c.dom.css.CSSValue sample code for org.w3c.dom.css.CSSValue definition code for org.w3c.dom.css.CSSValue
CSS_CUSTOM sample code for org.w3c.dom.css.CSSValue.CSS_CUSTOM definition code for org.w3c.dom.css.CSSValue.CSS_CUSTOM , CSS_INHERIT sample code for org.w3c.dom.css.CSSValue.CSS_INHERIT definition code for org.w3c.dom.css.CSSValue.CSS_INHERIT , CSS_PRIMITIVE_VALUE sample code for org.w3c.dom.css.CSSValue.CSS_PRIMITIVE_VALUE definition code for org.w3c.dom.css.CSSValue.CSS_PRIMITIVE_VALUE , CSS_VALUE_LIST sample code for org.w3c.dom.css.CSSValue.CSS_VALUE_LIST definition code for org.w3c.dom.css.CSSValue.CSS_VALUE_LIST
 
Method Summary
 Counter sample code for org.w3c.dom.css.Counter definition code for org.w3c.dom.css.Counter getCounterValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getCounterValue() definition code for org.w3c.dom.css.CSSPrimitiveValue.getCounterValue() ()
          This method is used to get the Counter value.
 float getFloatValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getFloatValue(short) definition code for org.w3c.dom.css.CSSPrimitiveValue.getFloatValue(short) (short unitType)
          This method is used to get a float value in a specified unit.
 short getPrimitiveType sample code for org.w3c.dom.css.CSSPrimitiveValue.getPrimitiveType() definition code for org.w3c.dom.css.CSSPrimitiveValue.getPrimitiveType() ()
          The type of the value as defined by the constants specified above.
 Rect sample code for org.w3c.dom.css.Rect definition code for org.w3c.dom.css.Rect getRectValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getRectValue() definition code for org.w3c.dom.css.CSSPrimitiveValue.getRectValue() ()
          This method is used to get the Rect value.
 RGBColor sample code for org.w3c.dom.css.RGBColor definition code for org.w3c.dom.css.RGBColor getRGBColorValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getRGBColorValue() definition code for org.w3c.dom.css.CSSPrimitiveValue.getRGBColorValue() ()
          This method is used to get the RGB color.
 String sample code for java.lang.String definition code for java.lang.String getStringValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getStringValue() definition code for org.w3c.dom.css.CSSPrimitiveValue.getStringValue() ()
          This method is used to get the string value.
 void setFloatValue sample code for org.w3c.dom.css.CSSPrimitiveValue.setFloatValue(short, float) definition code for org.w3c.dom.css.CSSPrimitiveValue.setFloatValue(short, float) (short unitType, float floatValue)
          A method to set the float value with a specified unit.
 void setStringValue sample code for org.w3c.dom.css.CSSPrimitiveValue.setStringValue(short, java.lang.String) definition code for org.w3c.dom.css.CSSPrimitiveValue.setStringValue(short, java.lang.String) (short stringType, String sample code for java.lang.String definition code for java.lang.String  stringValue)
          A method to set the string value with the specified unit.
 
Methods inherited from interface org.w3c.dom.css.CSSValue sample code for org.w3c.dom.css.CSSValue definition code for org.w3c.dom.css.CSSValue
getCssText sample code for org.w3c.dom.css.CSSValue.getCssText() definition code for org.w3c.dom.css.CSSValue.getCssText() , getCssValueType sample code for org.w3c.dom.css.CSSValue.getCssValueType() definition code for org.w3c.dom.css.CSSValue.getCssValueType() , setCssText sample code for org.w3c.dom.css.CSSValue.setCssText(java.lang.String) definition code for org.w3c.dom.css.CSSValue.setCssText(java.lang.String)
 

Field Detail

CSS_UNKNOWN sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_UNKNOWN

static final short CSS_UNKNOWN
The value is not a recognized CSS2 value. The value can only be obtained by using the cssText attribute.

See Also:
Constant Field Values

CSS_NUMBER sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_NUMBER

static final short CSS_NUMBER
The value is a simple number. The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_PERCENTAGE sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PERCENTAGE

static final short CSS_PERCENTAGE
The value is a percentage. The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_EMS sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_EMS

static final short CSS_EMS
The value is a length (ems). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_EXS sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_EXS

static final short CSS_EXS
The value is a length (exs). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_PX sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PX

static final short CSS_PX
The value is a length (px). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_CM sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_CM

static final short CSS_CM
The value is a length (cm). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_MM sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_MM

static final short CSS_MM
The value is a length (mm). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_IN sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_IN

static final short CSS_IN
The value is a length (in). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_PT sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PT

static final short CSS_PT
The value is a length (pt). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_PC sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_PC

static final short CSS_PC
The value is a length (pc). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_DEG sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_DEG

static final short CSS_DEG
The value is an angle (deg). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_RAD sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_RAD

static final short CSS_RAD
The value is an angle (rad). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_GRAD sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_GRAD

static final short CSS_GRAD
The value is an angle (grad). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_MS sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_MS

static final short CSS_MS
The value is a time (ms). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_S sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_S

static final short CSS_S
The value is a time (s). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_HZ sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_HZ

static final short CSS_HZ
The value is a frequency (Hz). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_KHZ sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_KHZ

static final short CSS_KHZ
The value is a frequency (kHz). The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_DIMENSION sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_DIMENSION

static final short CSS_DIMENSION
The value is a number with an unknown dimension. The value can be obtained by using the getFloatValue method.

See Also:
Constant Field Values

CSS_STRING sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_STRING

static final short CSS_STRING
The value is a STRING. The value can be obtained by using the getStringValue method.

See Also:
Constant Field Values

CSS_URI sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_URI

static final short CSS_URI
The value is a URI. The value can be obtained by using the getStringValue method.

See Also:
Constant Field Values

CSS_IDENT sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_IDENT

static final short CSS_IDENT
The value is an identifier. The value can be obtained by using the getStringValue method.

See Also:
Constant Field Values

CSS_ATTR sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_ATTR

static final short CSS_ATTR
The value is a attribute function. The value can be obtained by using the getStringValue method.

See Also:
Constant Field Values

CSS_COUNTER sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_COUNTER

static final short CSS_COUNTER
The value is a counter or counters function. The value can be obtained by using the getCounterValue method.

See Also:
Constant Field Values

CSS_RECT sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_RECT

static final short CSS_RECT
The value is a rect function. The value can be obtained by using the getRectValue method.

See Also:
Constant Field Values

CSS_RGBCOLOR sample code for org.w3c.dom.css.CSSPrimitiveValue.CSS_RGBCOLOR

static final short CSS_RGBCOLOR
The value is a RGB color. The value can be obtained by using the getRGBColorValue method.

See Also:
Constant Field Values
Method Detail

getPrimitiveType sample code for org.w3c.dom.css.CSSPrimitiveValue.getPrimitiveType() definition code for org.w3c.dom.css.CSSPrimitiveValue.getPrimitiveType()

short getPrimitiveType()
The type of the value as defined by the constants specified above.


setFloatValue sample code for org.w3c.dom.css.CSSPrimitiveValue.setFloatValue(short, float) definition code for org.w3c.dom.css.CSSPrimitiveValue.setFloatValue(short, float)

void setFloatValue(short unitType,
                   float floatValue)
                   throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.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.

Parameters:
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.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - INVALID_ACCESS_ERR: Raised if the attached property doesn't support the float value or the unit type.
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.

getFloatValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getFloatValue(short) definition code for org.w3c.dom.css.CSSPrimitiveValue.getFloatValue(short)

float getFloatValue(short unitType)
                    throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.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.

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 sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.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 sample code for org.w3c.dom.css.CSSPrimitiveValue.setStringValue(short, java.lang.String) definition code for org.w3c.dom.css.CSSPrimitiveValue.setStringValue(short, java.lang.String)

void setStringValue(short stringType,
                    String sample code for java.lang.String definition code for java.lang.String  stringValue)
                    throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.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.

Parameters:
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.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.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.
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.

getStringValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getStringValue() definition code for org.w3c.dom.css.CSSPrimitiveValue.getStringValue()

String sample code for java.lang.String definition code for java.lang.String  getStringValue()
                      throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
This method is used to get the string value. If the CSS value doesn't contain a string value, a DOMException is raised. Some properties (like 'font-family' or 'voice-family') convert a whitespace separated list of idents to a string.

Returns:
The string value in the current unit. The current primitiveType can only be a string unit type (i.e. CSS_STRING, CSS_URI, CSS_IDENT and CSS_ATTR).
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string value.

getCounterValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getCounterValue() definition code for org.w3c.dom.css.CSSPrimitiveValue.getCounterValue()

Counter sample code for org.w3c.dom.css.Counter definition code for org.w3c.dom.css.Counter  getCounterValue()
                        throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.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.

Returns:
The Counter value.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a Counter value (e.g. this is not CSS_COUNTER).

getRectValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getRectValue() definition code for org.w3c.dom.css.CSSPrimitiveValue.getRectValue()

Rect sample code for org.w3c.dom.css.Rect definition code for org.w3c.dom.css.Rect  getRectValue()
                  throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.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.

Returns:
The Rect value.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a Rect value. (e.g. this is not CSS_RECT).

getRGBColorValue sample code for org.w3c.dom.css.CSSPrimitiveValue.getRGBColorValue() definition code for org.w3c.dom.css.CSSPrimitiveValue.getRGBColorValue()

RGBColor sample code for org.w3c.dom.css.RGBColor definition code for org.w3c.dom.css.RGBColor  getRGBColorValue()
                          throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.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.

Returns:
the RGB color value.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - INVALID_ACCESS_ERR: Raised if the attached property can't return a RGB color value (e.g. this is not CSS_RGBCOLOR).