org.apache.batik.parser.style
Class CSSFloatValue

java.lang.Object
  |
  +--org.apache.batik.parser.style.AbstractCSSValue
        |
        +--org.apache.batik.parser.style.CSSFloatValue
All Implemented Interfaces:
CSSPrimitiveValue, CSSValue, CSSValueList

public class CSSFloatValue
extends AbstractCSSValue

This class represents CSS float values


Field Summary
protected  float floatValue
          The float value
protected static java.lang.String[] UNITS
          The unit types representations
protected  short unitType
          The unit type
 
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
CSSFloatValue(short unitType, float floatValue)
          Creates a new value.
 
Method Summary
 java.lang.String getCssText()
          DOM: Implements CSSValue.getCssText().
 short getCssValueType()
          DOM: Implements CSSValue.getCssValueType().
 float getFloatValue(short unitType)
          DOM: Implements CSSPrimitiveValue.getFloatValue(short).
 short getPrimitiveType()
          DOM: Implements CSSPrimitiveValue.getPrimitiveType().
protected  java.lang.String getUnitRepresentation(short unitType)
          Returns the representation for the given unit type.
protected  float toCentimeters()
          Converts the current value into centimeters.
protected  float toDegrees()
          Converts the current value into degrees.
protected  float toGradians()
          Converts the current value into gradians.
protected  float toHertz()
          Converts the current value into Hertz.
protected  float toInches()
          Converts the current value into inches.
protected  float tokHertz()
          Converts the current value into kHertz.
protected  float toMillimeters()
          Converts the current value into millimeters.
protected  float toMilliseconds()
          Converts the current value into milliseconds.
protected  float toPicas()
          Converts the current value into picas.
protected  float toPoints()
          Converts the current value into points.
protected  float toRadians()
          Converts the current value into radians.
protected  float toSeconds()
          Converts the current value into seconds.
 
Methods inherited from class org.apache.batik.parser.style.AbstractCSSValue
getCounterValue, getLength, getRectValue, getRGBColorValue, getStringValue, item, setCssText, setFloatValue, setStringValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNITS

protected static final java.lang.String[] UNITS
The unit types representations

floatValue

protected float floatValue
The float value

unitType

protected short unitType
The unit type
Constructor Detail

CSSFloatValue

public CSSFloatValue(short unitType,
                     float floatValue)
Creates a new value.
Method Detail

getCssValueType

public short getCssValueType()
DOM: Implements CSSValue.getCssValueType().

getPrimitiveType

public short getPrimitiveType()
DOM: Implements CSSPrimitiveValue.getPrimitiveType().
Overrides:
getPrimitiveType in class AbstractCSSValue

getCssText

public java.lang.String getCssText()
DOM: Implements CSSValue.getCssText().
Following copied from interface: org.w3c.dom.css.CSSValue
Throws:
DOMException - SYNTAX_ERR: Raised if the specified CSS string value has a syntax error (according to the attached property) or is unparsable.
INVALID_MODIFICATION_ERR: Raised if the specified CSS string value represents a different type of values than the values allowed by the CSS property.
NO_MODIFICATION_ALLOWED_ERR: Raised if this value is readonly.

getFloatValue

public float getFloatValue(short unitType)
                    throws DOMException
DOM: Implements CSSPrimitiveValue.getFloatValue(short).
Overrides:
getFloatValue in class AbstractCSSValue
Following copied from 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.

getUnitRepresentation

protected java.lang.String getUnitRepresentation(short unitType)
                                          throws DOMException
Returns the representation for the given unit type.
Parameters:
unitType - The unit type like specified in the CSSPrimitiveValue interface.

toCentimeters

protected float toCentimeters()
Converts the current value into centimeters.

toInches

protected float toInches()
Converts the current value into inches.

toMillimeters

protected float toMillimeters()
Converts the current value into millimeters.

toPoints

protected float toPoints()
Converts the current value into points.

toPicas

protected float toPicas()
Converts the current value into picas.

toDegrees

protected float toDegrees()
Converts the current value into degrees.

toRadians

protected float toRadians()
Converts the current value into radians.

toGradians

protected float toGradians()
Converts the current value into gradians.

toMilliseconds

protected float toMilliseconds()
Converts the current value into milliseconds.

toSeconds

protected float toSeconds()
Converts the current value into seconds.

toHertz

protected float toHertz()
Converts the current value into Hertz.

tokHertz

protected float tokHertz()
Converts the current value into kHertz.


Copyright © 2001 Apache Software Foundation. All Rights Reserved.