info.informatica.doc.style.css.property
Class AbstractCSSPrimitiveValue

java.lang.Object
  extended by info.informatica.doc.style.css.property.AbstractCSSValue
      extended by info.informatica.doc.style.css.property.AbstractCSSPrimitiveValue
All Implemented Interfaces:
StyleDatabaseAware, org.w3c.dom.css.CSSPrimitiveValue, org.w3c.dom.css.CSSValue
Direct Known Subclasses:
CSSNumberValue, CSSStringValue, DOMCSSColorValue, DOMCSSCounterValue, DOMCSSRectValue

public class AbstractCSSPrimitiveValue
extends AbstractCSSValue
implements org.w3c.dom.css.CSSPrimitiveValue, StyleDatabaseAware

Implementation of CSSPrimitiveValue.

Author:
Carlos Amengual (amengual at informatica.info)

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 org.w3c.dom.css.CSSValue
CSS_CUSTOM, CSS_INHERIT, CSS_PRIMITIVE_VALUE, CSS_VALUE_LIST
 
Constructor Summary
protected AbstractCSSPrimitiveValue()
           
protected AbstractCSSPrimitiveValue(short unitType)
           
 
Method Summary
protected static short domPrimitiveType(int sacType)
          Translate a SAC lexical type into a CSS primitive unit type.
 org.w3c.dom.css.Counter getCounterValue()
           
 float getFloatValue(short unitType)
          This method is used to get a float value in a specified unit.
 org.w3c.css.sac.LexicalUnit getLexicalUnit()
           
 short getPrimitiveType()
           
 org.w3c.dom.css.Rect getRectValue()
           
 org.w3c.dom.css.RGBColor getRGBColorValue()
           
 String getStringValue()
           
 StyleDatabase getStyleDatabase()
          Gets the style database.
 boolean isSubproperty()
           
 org.w3c.dom.css.CSSPrimitiveValue nextPrimitiveValue()
          Retrieves the next CSS primitive value from the current lexical unit, ignoring commas, etc.
protected  void setCSSUnitType(short cssUnitType)
           
 void setFloatValue(short unitType, float floatValue)
           
 void setStringValue(short stringType, String stringValue)
           
 void setStyleDatabase(StyleDatabase styleDb)
          Sets the style database.
 void setSubproperty(boolean subp)
           
 
Methods inherited from class info.informatica.doc.style.css.property.AbstractCSSValue
createCSSValue, createCSSValue, getCssText, getCssValueType, setCssText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.css.CSSValue
getCssText, getCssValueType, setCssText
 

Constructor Detail

AbstractCSSPrimitiveValue

protected AbstractCSSPrimitiveValue(short unitType)

AbstractCSSPrimitiveValue

protected AbstractCSSPrimitiveValue()
Method Detail

getPrimitiveType

public short getPrimitiveType()
Specified by:
getPrimitiveType in interface org.w3c.dom.css.CSSPrimitiveValue

setFloatValue

public void setFloatValue(short unitType,
                          float floatValue)
                   throws DOMException
Specified by:
setFloatValue in interface org.w3c.dom.css.CSSPrimitiveValue
Throws:
DOMException

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.

Specified by:
getFloatValue in interface org.w3c.dom.css.CSSPrimitiveValue
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

public void setStringValue(short stringType,
                           String stringValue)
                    throws DOMException
Specified by:
setStringValue in interface org.w3c.dom.css.CSSPrimitiveValue
Throws:
DOMException

getStringValue

public String getStringValue()
                      throws DOMException
Specified by:
getStringValue in interface org.w3c.dom.css.CSSPrimitiveValue
Throws:
DOMException

getCounterValue

public org.w3c.dom.css.Counter getCounterValue()
                                        throws DOMException
Specified by:
getCounterValue in interface org.w3c.dom.css.CSSPrimitiveValue
Throws:
DOMException

getRectValue

public org.w3c.dom.css.Rect getRectValue()
                                  throws DOMException
Specified by:
getRectValue in interface org.w3c.dom.css.CSSPrimitiveValue
Throws:
DOMException

getRGBColorValue

public org.w3c.dom.css.RGBColor getRGBColorValue()
                                          throws DOMException
Specified by:
getRGBColorValue in interface org.w3c.dom.css.CSSPrimitiveValue
Throws:
DOMException

getStyleDatabase

public StyleDatabase getStyleDatabase()
Description copied from interface: StyleDatabaseAware
Gets the style database.

Specified by:
getStyleDatabase in interface StyleDatabaseAware
Returns:
the style database, or null if no database is set.

setStyleDatabase

public void setStyleDatabase(StyleDatabase styleDb)
Description copied from interface: StyleDatabaseAware
Sets the style database.

Specified by:
setStyleDatabase in interface StyleDatabaseAware
Parameters:
styleDb - the style database.

setSubproperty

public void setSubproperty(boolean subp)

isSubproperty

public boolean isSubproperty()

setCSSUnitType

protected void setCSSUnitType(short cssUnitType)

getLexicalUnit

public org.w3c.css.sac.LexicalUnit getLexicalUnit()

nextPrimitiveValue

public org.w3c.dom.css.CSSPrimitiveValue nextPrimitiveValue()
Retrieves the next CSS primitive value from the current lexical unit, ignoring commas, etc.

Returns:
the next CSS primitive value, or null if none.

domPrimitiveType

protected static short domPrimitiveType(int sacType)
Translate a SAC lexical type into a CSS primitive unit type.

Parameters:
sacType - the lexical type.
Returns:
the unit type according to CSSPrimitiveValue.


Copyright © 2011 informatica.info. All Rights Reserved.