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
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
Nested ClassesModifier and TypeClassDescriptionprotected classTo resolve the units. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected UnitProcessor.ContextThe context used to resolve the units.protected shortThis length's direction.static final shortThis constant represents horizontal lengths.static final shortThis constant represents other lengths.protected static final String[]The unit string representations.protected shortThe type of this length.protected floatThe value of this length.static final shortThis 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidconvertToSpecifiedUnits(short unit) DOM: ImplementsSVGLength.convertToSpecifiedUnits(short).protected abstract SVGOMElementReturn the SVGElement associated to this length.shortDOM: ImplementsSVGLength.getUnitType().floatgetValue()DOM: ImplementsSVGLength.getValue().DOM: ImplementsSVGLength.getValueAsString().floatDOM: ImplementsSVGLength.getValueInSpecifiedUnits().voidnewValueSpecifiedUnits(short unit, float value) DOM: ImplementsSVGLength.newValueSpecifiedUnits(short,float).protected voidParse a String value as a SVGLength.protected voidreset()Callback method after changes made to this length.protected voidCallback method before any value is return from this length.voidsetValue(float value) DOM: ImplementsSVGLength.setValue(float).voidsetValueAsString(String value) DOM: ImplementsSVGLength.setValueAsString(String).voidsetValueInSpecifiedUnits(float value) DOM: ImplementsSVGLength.setValueInSpecifiedUnits(float).
-
Field Details
-
HORIZONTAL_LENGTH
public static final short HORIZONTAL_LENGTHThis constant represents horizontal lengths.- See Also:
-
VERTICAL_LENGTH
public static final short VERTICAL_LENGTHThis constant represents vertical lengths.- See Also:
-
OTHER_LENGTH
public static final short OTHER_LENGTHThis constant represents other lengths.- See Also:
-
unitType
protected short unitTypeThe type of this length. -
value
protected float valueThe value of this length. -
direction
protected short directionThis length's direction. -
context
The context used to resolve the units. -
UNITS
The unit string representations.
-
-
Constructor Details
-
AbstractSVGLength
public AbstractSVGLength(short direction) Creates a new AbstractSVGLength.
-
-
Method Details
-
getAssociatedElement
Return the SVGElement associated to this length. -
getUnitType
public short getUnitType()DOM: ImplementsSVGLength.getUnitType().- Specified by:
getUnitTypein interfaceorg.w3c.dom.svg.SVGLength
-
getValue
public float getValue()DOM: ImplementsSVGLength.getValue().- Specified by:
getValuein interfaceorg.w3c.dom.svg.SVGLength
-
setValue
DOM: ImplementsSVGLength.setValue(float).- Specified by:
setValuein interfaceorg.w3c.dom.svg.SVGLength- Throws:
DOMException
-
getValueInSpecifiedUnits
public float getValueInSpecifiedUnits()DOM: ImplementsSVGLength.getValueInSpecifiedUnits().- Specified by:
getValueInSpecifiedUnitsin interfaceorg.w3c.dom.svg.SVGLength
-
setValueInSpecifiedUnits
DOM: ImplementsSVGLength.setValueInSpecifiedUnits(float).- Specified by:
setValueInSpecifiedUnitsin interfaceorg.w3c.dom.svg.SVGLength- Throws:
DOMException
-
getValueAsString
DOM: ImplementsSVGLength.getValueAsString().- Specified by:
getValueAsStringin interfaceorg.w3c.dom.svg.SVGLength
-
setValueAsString
DOM: ImplementsSVGLength.setValueAsString(String).- Specified by:
setValueAsStringin interfaceorg.w3c.dom.svg.SVGLength- Throws:
DOMException
-
newValueSpecifiedUnits
public void newValueSpecifiedUnits(short unit, float value) DOM: ImplementsSVGLength.newValueSpecifiedUnits(short,float).- Specified by:
newValueSpecifiedUnitsin interfaceorg.w3c.dom.svg.SVGLength
-
convertToSpecifiedUnits
public void convertToSpecifiedUnits(short unit) DOM: ImplementsSVGLength.convertToSpecifiedUnits(short).- Specified by:
convertToSpecifiedUnitsin 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
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.
-