## org.apache.batik.dom.svg
Class AbstractSVGLength

    java.lang.Object
      org.apache.batik.dom.svg.AbstractSVGLength

All Implemented Interfaces:
  org.w3c.dom.svg.SVGLength

Direct Known Subclasses:
  AbstractSVGAnimatedLength.AnimSVGLength, AbstractSVGAnimatedLength.BaseSVGLength, AbstractSVGLengthList.SVGLengthItem, SVGOMLength

    public abstract class AbstractSVGLength

extends java.lang.Object
implements org.w3c.dom.svg.SVGLength

Default implementation for SVGLength. This implementation provides the basic functionalities of SVGLength. To have a complete implementation, an element is required to resolve the units. According to the usage of this AbstractSVGLength, the `reset()` method is after changes being made to the unitType or the value of this length. Before any values are return to the user of the AbstractSVGLength, the `revalidate()` method is being called to insure the validity of the value and unit type held by this object.

Nested Class Summary
`protected class` `AbstractSVGLength.DefaultContext` To resolve the units.

Field Summary
`protected UnitProcessor.Context` `context` The context used to resolve the units.
`protected short` `direction` This length's direction.
`static short` `HORIZONTAL_LENGTH` This constant represents horizontal lengths.
`static short` `OTHER_LENGTH` This constant represents other lengths.
`protected static java.lang.String[]` `UNITS` The unit string representations.
`protected short` `unitType` The type of this length.
`protected float` `value` The value of this length.
`static short` `VERTICAL_LENGTH` This constant represents vertical lengths.

Fields inherited from interface org.w3c.dom.svg.SVGLength
`SVG_LENGTHTYPE_CM, SVG_LENGTHTYPE_EMS, SVG_LENGTHTYPE_EXS, SVG_LENGTHTYPE_IN, SVG_LENGTHTYPE_MM, SVG_LENGTHTYPE_NUMBER, SVG_LENGTHTYPE_PC, SVG_LENGTHTYPE_PERCENTAGE, SVG_LENGTHTYPE_PT, SVG_LENGTHTYPE_PX, SVG_LENGTHTYPE_UNKNOWN`

Constructor Summary
`AbstractSVGLength(short direction)` Creates a new AbstractSVGLength.

Method Summary
`void` `convertToSpecifiedUnits(short unit)` DOM: Implements `SVGLength.convertToSpecifiedUnits(short)`.
`protected abstract SVGOMElement` `getAssociatedElement()` Return the SVGElement associated to this length.
`short` `getUnitType()` DOM: Implements `SVGLength.getUnitType()`.
`float` `getValue()` DOM: Implements `SVGLength.getValue()`.
`java.lang.String` `getValueAsString()` DOM: Implements `SVGLength.getValueAsString()`.
`float` `getValueInSpecifiedUnits()` DOM: Implements `SVGLength.getValueInSpecifiedUnits()`.
`void` `newValueSpecifiedUnits(short unit, float value)` DOM: Implements `SVGLength.newValueSpecifiedUnits(short,float)`.
`protected void` `parse(java.lang.String s)` Parse a String value as a SVGLength.
`protected void` `reset()` Callback method after changes made to this length.
`protected void` `revalidate()` Callback method before any value is return from this length.
`void` `setValue(float value)` DOM: Implements `SVGLength.setValue(float)`.
`void` `setValueAsString(java.lang.String value)` DOM: Implements `SVGLength.setValueAsString(String)`.
`void` `setValueInSpecifiedUnits(float value)` DOM: Implements `SVGLength.setValueInSpecifiedUnits(float)`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HORIZONTAL_LENGTH

    public static final short HORIZONTAL_LENGTH

  This constant represents horizontal lengths.

  See Also:
    Constant Field Values

### VERTICAL_LENGTH

    public static final short VERTICAL_LENGTH

  This constant represents vertical lengths.

  See Also:
    Constant Field Values

### OTHER_LENGTH

    public static final short OTHER_LENGTH

  This constant represents other lengths.

  See Also:
    Constant Field Values

### unitType

    protected short unitType

  The type of this length.

### value

    protected float value

  The value of this length.

### direction

    protected short direction

  This length's direction.

### context

    protected UnitProcessor.Context context

  The context used to resolve the units.

### UNITS

    protected static final java.lang.String[] UNITS

  The unit string representations.

Constructor Detail

### AbstractSVGLength

    public AbstractSVGLength(short direction)

  Creates a new AbstractSVGLength.

Method Detail

### getAssociatedElement

    protected abstract SVGOMElement getAssociatedElement()

  Return the SVGElement associated to this length.

### getUnitType

    public short getUnitType()

  DOM: Implements `SVGLength.getUnitType()`.

  Specified by:
    `getUnitType` in interface `org.w3c.dom.svg.SVGLength`

### getValue

    public float getValue()

  DOM: Implements `SVGLength.getValue()`.

  Specified by:
    `getValue` in interface `org.w3c.dom.svg.SVGLength`

### setValue

    public void setValue(float value)
                  throws org.w3c.dom.DOMException

  DOM: Implements `SVGLength.setValue(float)`.

  Specified by:
    `setValue` in interface `org.w3c.dom.svg.SVGLength`
  Throws:
    `org.w3c.dom.DOMException`

### getValueInSpecifiedUnits

    public float getValueInSpecifiedUnits()

  DOM: Implements `SVGLength.getValueInSpecifiedUnits()`.

  Specified by:
    `getValueInSpecifiedUnits` in interface `org.w3c.dom.svg.SVGLength`

### setValueInSpecifiedUnits

    public void setValueInSpecifiedUnits(float value)
                                  throws org.w3c.dom.DOMException

  DOM: Implements `SVGLength.setValueInSpecifiedUnits(float)`.

  Specified by:
    `setValueInSpecifiedUnits` in interface `org.w3c.dom.svg.SVGLength`
  Throws:
    `org.w3c.dom.DOMException`

### getValueAsString

    public java.lang.String getValueAsString()

  DOM: Implements `SVGLength.getValueAsString()`.

  Specified by:
    `getValueAsString` in interface `org.w3c.dom.svg.SVGLength`

### setValueAsString

    public void setValueAsString(java.lang.String value)
                          throws org.w3c.dom.DOMException

  DOM: Implements `SVGLength.setValueAsString(String)`.

  Specified by:
    `setValueAsString` in interface `org.w3c.dom.svg.SVGLength`
  Throws:
    `org.w3c.dom.DOMException`

### newValueSpecifiedUnits

    public void newValueSpecifiedUnits(short unit,
                                       float value)

  DOM: Implements `SVGLength.newValueSpecifiedUnits(short,float)`.

  Specified by:
    `newValueSpecifiedUnits` in interface `org.w3c.dom.svg.SVGLength`

### convertToSpecifiedUnits

    public void convertToSpecifiedUnits(short unit)

  DOM: Implements `SVGLength.convertToSpecifiedUnits(short)`.

  Specified by:
    `convertToSpecifiedUnits` in interface `org.w3c.dom.svg.SVGLength`

### reset

    protected void reset()

  Callback method after changes made to this length. The default implementation does nothing.

### revalidate

    protected void revalidate()

  Callback method before any value is return from this length. The default implementation does nothing.

### parse

    protected void parse(java.lang.String s)

  Parse a String value as a SVGLength. Initialize this length with the result of the parsing of this value.

  Parameters:
    `s` - String representation of a SVGlength.

Copyright © 2008 Apache Software Foundation. All Rights Reserved.