org.apache.batik.dom.svg

Class AbstractSVGLength

public abstract class AbstractSVGLength extends Object implements 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 classAbstractSVGLength.DefaultContext
To resolve the units.
Field Summary
protected UnitProcessor.Contextcontext
The context used to resolve the units.
protected shortdirection
This length's direction.
static shortHORIZONTAL_LENGTH
This constant represents horizontal lengths.
static shortOTHER_LENGTH
This constant represents other lengths.
protected shortunitType
The type of this length.
protected static String[]UNITS
The unit string representations.
protected floatvalue
The value of this length.
static shortVERTICAL_LENGTH
This constant represents vertical lengths.
Constructor Summary
AbstractSVGLength(short direction)
Creates a new AbstractSVGLength.
Method Summary
voidconvertToSpecifiedUnits(short unit)
DOM: Implements {@link SVGLength#convertToSpecifiedUnits(short)}.
protected abstract SVGOMElementgetAssociatedElement()
Return the SVGElement associated to this length.
shortgetUnitType()
DOM: Implements {@link SVGLength#getUnitType()}.
floatgetValue()
DOM: Implements {@link SVGLength#getValue()}.
StringgetValueAsString()
DOM: Implements {@link SVGLength#getValueAsString()}.
floatgetValueInSpecifiedUnits()
DOM: Implements {@link SVGLength#getValueInSpecifiedUnits()}.
voidnewValueSpecifiedUnits(short unit, float value)
DOM: Implements {@link SVGLength#newValueSpecifiedUnits(short,float)}.
protected voidparse(String s)
Parse a String value as a SVGLength.
protected voidreset()
Callback method after changes made to this length.
protected voidrevalidate()
Callback method before any value is return from this length.
voidsetValue(float value)
DOM: Implements {@link SVGLength#setValue(float)}.
voidsetValueAsString(String value)
DOM: Implements {@link SVGLength#setValueAsString(String)}.
voidsetValueInSpecifiedUnits(float value)
DOM: Implements {@link SVGLength#setValueInSpecifiedUnits(float)}.

Field Detail

context

protected UnitProcessor.Context context
The context used to resolve the units.

direction

protected short direction
This length's direction.

HORIZONTAL_LENGTH

public static final short HORIZONTAL_LENGTH
This constant represents horizontal lengths.

OTHER_LENGTH

public static final short OTHER_LENGTH
This constant represents other lengths.

unitType

protected short unitType
The type of this length.

UNITS

protected static final String[] UNITS
The unit string representations.

value

protected float value
The value of this length.

VERTICAL_LENGTH

public static final short VERTICAL_LENGTH
This constant represents vertical lengths.

Constructor Detail

AbstractSVGLength

public AbstractSVGLength(short direction)
Creates a new AbstractSVGLength.

Method Detail

convertToSpecifiedUnits

public void convertToSpecifiedUnits(short unit)
DOM: Implements {@link SVGLength#convertToSpecifiedUnits(short)}.

getAssociatedElement

protected abstract SVGOMElement getAssociatedElement()
Return the SVGElement associated to this length.

getUnitType

public short getUnitType()
DOM: Implements {@link SVGLength#getUnitType()}.

getValue

public float getValue()
DOM: Implements {@link SVGLength#getValue()}.

getValueAsString

public String getValueAsString()
DOM: Implements {@link SVGLength#getValueAsString()}.

getValueInSpecifiedUnits

public float getValueInSpecifiedUnits()
DOM: Implements {@link SVGLength#getValueInSpecifiedUnits()}.

newValueSpecifiedUnits

public void newValueSpecifiedUnits(short unit, float value)
DOM: Implements {@link SVGLength#newValueSpecifiedUnits(short,float)}.

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.

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.

setValue

public void setValue(float value)
DOM: Implements {@link SVGLength#setValue(float)}.

setValueAsString

public void setValueAsString(String value)
DOM: Implements {@link SVGLength#setValueAsString(String)}.

setValueInSpecifiedUnits

public void setValueInSpecifiedUnits(float value)
DOM: Implements {@link SVGLength#setValueInSpecifiedUnits(float)}.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.