Package org.apache.batik.anim.dom
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 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, thereset()
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, therevalidate()
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
AbstractSVGLength.DefaultContext
To resolve the units.
-
Field Summary
Fields Modifier and Type Field Description 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.
-
Constructor Summary
Constructors Constructor Description AbstractSVGLength(short direction)
Creates a new AbstractSVGLength.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
convertToSpecifiedUnits(short unit)
DOM: ImplementsSVGLength.convertToSpecifiedUnits(short)
.protected abstract SVGOMElement
getAssociatedElement()
Return the SVGElement associated to this length.short
getUnitType()
DOM: ImplementsSVGLength.getUnitType()
.float
getValue()
DOM: ImplementsSVGLength.getValue()
.java.lang.String
getValueAsString()
DOM: ImplementsSVGLength.getValueAsString()
.float
getValueInSpecifiedUnits()
DOM: ImplementsSVGLength.getValueInSpecifiedUnits()
.void
newValueSpecifiedUnits(short unit, float value)
DOM: ImplementsSVGLength.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: ImplementsSVGLength.setValue(float)
.void
setValueAsString(java.lang.String value)
DOM: ImplementsSVGLength.setValueAsString(String)
.void
setValueInSpecifiedUnits(float value)
DOM: ImplementsSVGLength.setValueInSpecifiedUnits(float)
.
-
-
-
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.
-
-
Method Detail
-
getAssociatedElement
protected abstract SVGOMElement getAssociatedElement()
Return the SVGElement associated to this length.
-
getUnitType
public short getUnitType()
DOM: ImplementsSVGLength.getUnitType()
.- Specified by:
getUnitType
in interfaceorg.w3c.dom.svg.SVGLength
-
getValue
public float getValue()
DOM: ImplementsSVGLength.getValue()
.- Specified by:
getValue
in interfaceorg.w3c.dom.svg.SVGLength
-
setValue
public void setValue(float value) throws org.w3c.dom.DOMException
DOM: ImplementsSVGLength.setValue(float)
.- Specified by:
setValue
in interfaceorg.w3c.dom.svg.SVGLength
- Throws:
org.w3c.dom.DOMException
-
getValueInSpecifiedUnits
public float getValueInSpecifiedUnits()
DOM: ImplementsSVGLength.getValueInSpecifiedUnits()
.- Specified by:
getValueInSpecifiedUnits
in interfaceorg.w3c.dom.svg.SVGLength
-
setValueInSpecifiedUnits
public void setValueInSpecifiedUnits(float value) throws org.w3c.dom.DOMException
DOM: ImplementsSVGLength.setValueInSpecifiedUnits(float)
.- Specified by:
setValueInSpecifiedUnits
in interfaceorg.w3c.dom.svg.SVGLength
- Throws:
org.w3c.dom.DOMException
-
getValueAsString
public java.lang.String getValueAsString()
DOM: ImplementsSVGLength.getValueAsString()
.- Specified by:
getValueAsString
in interfaceorg.w3c.dom.svg.SVGLength
-
setValueAsString
public void setValueAsString(java.lang.String value) throws org.w3c.dom.DOMException
DOM: ImplementsSVGLength.setValueAsString(String)
.- Specified by:
setValueAsString
in interfaceorg.w3c.dom.svg.SVGLength
- Throws:
org.w3c.dom.DOMException
-
newValueSpecifiedUnits
public void newValueSpecifiedUnits(short unit, float value)
DOM: ImplementsSVGLength.newValueSpecifiedUnits(short,float)
.- Specified by:
newValueSpecifiedUnits
in interfaceorg.w3c.dom.svg.SVGLength
-
convertToSpecifiedUnits
public void convertToSpecifiedUnits(short unit)
DOM: ImplementsSVGLength.convertToSpecifiedUnits(short)
.- Specified by:
convertToSpecifiedUnits
in interfaceorg.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.
-
-