Class AbstractSVGLength

java.lang.Object
org.apache.batik.anim.dom.AbstractSVGLength
All Implemented Interfaces:
org.w3c.dom.svg.SVGLength
Direct Known Subclasses:
AbstractSVGAnimatedLength.AnimSVGLength, AbstractSVGAnimatedLength.BaseSVGLength, AbstractSVGLengthList.SVGLengthItem, SVGOMLength

public abstract class AbstractSVGLength extends 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.
Version:
$Id: AbstractSVGLength.java 1733416 2016-03-03 07:07:13Z gadams $
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
    To resolve the units.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The context used to resolve the units.
    protected short
    This length's direction.
    static final short
    This constant represents horizontal lengths.
    static final short
    This constant represents other lengths.
    protected static final String[]
    The unit string representations.
    protected short
    The type of this length.
    protected float
    The value of this length.
    static final short
    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

    Constructors
    Constructor
    Description
    AbstractSVGLength(short direction)
    Creates a new AbstractSVGLength.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    DOM: Implements SVGLength.convertToSpecifiedUnits(short).
    protected abstract SVGOMElement
    Return the SVGElement associated to this length.
    short
    DOM: Implements SVGLength.getUnitType().
    float
    DOM: Implements SVGLength.getValue().
    DOM: Implements SVGLength.getValueAsString().
    float
    DOM: Implements SVGLength.getValueInSpecifiedUnits().
    void
    newValueSpecifiedUnits(short unit, float value)
    DOM: Implements SVGLength.newValueSpecifiedUnits(short,float).
    protected void
    Parse a String value as a SVGLength.
    protected void
    Callback method after changes made to this length.
    protected void
    Callback method before any value is return from this length.
    void
    setValue(float value)
    DOM: Implements SVGLength.setValue(float).
    void
    DOM: Implements SVGLength.setValueAsString(String).
    void
    DOM: Implements SVGLength.setValueInSpecifiedUnits(float).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • HORIZONTAL_LENGTH

      public static final short HORIZONTAL_LENGTH
      This constant represents horizontal lengths.
      See Also:
    • VERTICAL_LENGTH

      public static final short VERTICAL_LENGTH
      This constant represents vertical lengths.
      See Also:
    • OTHER_LENGTH

      public static final short OTHER_LENGTH
      This constant represents other lengths.
      See Also:
    • 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 String[] UNITS
      The unit string representations.
  • Constructor Details

    • AbstractSVGLength

      public AbstractSVGLength(short direction)
      Creates a new AbstractSVGLength.
  • Method Details

    • 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 DOMException
      DOM: Implements SVGLength.setValue(float).
      Specified by:
      setValue in interface org.w3c.dom.svg.SVGLength
      Throws:
      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 DOMException
      DOM: Implements SVGLength.setValueInSpecifiedUnits(float).
      Specified by:
      setValueInSpecifiedUnits in interface org.w3c.dom.svg.SVGLength
      Throws:
      DOMException
    • getValueAsString

      public String getValueAsString()
      DOM: Implements SVGLength.getValueAsString().
      Specified by:
      getValueAsString in interface org.w3c.dom.svg.SVGLength
    • setValueAsString

      public void setValueAsString(String value) throws DOMException
      DOM: Implements SVGLength.setValueAsString(String).
      Specified by:
      setValueAsString in interface org.w3c.dom.svg.SVGLength
      Throws:
      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(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.