org.apache.batik.dom.svg

Class SVGOMElement

public abstract class SVGOMElement extends AbstractElement implements SVGElement, SVGConstants, ExtendedTraitAccess, AnimationTarget

This class implements the {@link SVGElement} interface.
Nested Class Summary
protected classSVGOMElement.UnitContext
To resolve the units.
Field Summary
protected Stringprefix
The element prefix.
protected booleanreadonly
Is this element immutable?
protected SVGContextsvgContext
The SVG context to get SVG specific informations.
protected DoublyIndexedTabletargetListeners
Table mapping namespaceURI/local name pairs to {@link LinkedList}s of {@link AnimationTargetListener}s.
protected UnitProcessor.ContextunitContext
The context used to resolve the units.
protected static DoublyIndexedTablexmlTraitInformation
Table mapping XML attribute names to TraitInformation objects.
Constructor Summary
protected SVGOMElement()
Creates a new Element object.
protected SVGOMElement(String prefix, AbstractDocument owner)
Creates a new Element object.
Method Summary
voidaddTargetListener(String ns, String an, boolean isCSS, AnimationTargetListener l)
Adds a listener for changes to the given attribute value.
protected NodecopyInto(Node n)
Copy the fields of the current node into the given node.
protected SVGOMAnimatedBooleancreateLiveAnimatedBoolean(String ns, String ln, boolean def)
Creates a new {@link SVGOMAnimatedBoolean} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedEnumerationcreateLiveAnimatedEnumeration(String ns, String ln, String[] val, short def)
Creates a new {@link SVGOMAnimatedEnumeration} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedIntegercreateLiveAnimatedInteger(String ns, String ln, int def)
Creates a new {@link SVGOMAnimatedInteger} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedLengthcreateLiveAnimatedLength(String ns, String ln, String val, short dir, boolean nonneg)
Creates a new {@link SVGOMAnimatedLength} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedLengthListcreateLiveAnimatedLengthList(String ns, String ln, String def, boolean emptyAllowed, short dir)
Creates a new {@link SVGOMAnimatedLengthList} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedMarkerOrientValuecreateLiveAnimatedMarkerOrientValue(String ns, String ln)
Creates a new {@link SVGOMAnimatedMarkerOrientValue} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedNumbercreateLiveAnimatedNumber(String ns, String ln, float def)
Creates a new {@link SVGOMAnimatedNumber} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedNumbercreateLiveAnimatedNumber(String ns, String ln, float def, boolean allowPercentage)
Creates a new {@link SVGOMAnimatedNumber} that can be parsed as a percentage and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedNumberListcreateLiveAnimatedNumberList(String ns, String ln, String def, boolean canEmpty)
Creates a new {@link SVGOMAnimatedNumberList} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedPathDatacreateLiveAnimatedPathData(String ns, String ln, String def)
Creates a new {@link SVGOMAnimatedPathData} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedPointscreateLiveAnimatedPoints(String ns, String ln, String def)
Creates a new {@link SVGOMAnimatedPoints} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedPreserveAspectRatiocreateLiveAnimatedPreserveAspectRatio()
Creates a new {@link SVGOMAnimatedPreserveAspectRatio} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedStringcreateLiveAnimatedString(String ns, String ln)
Creates a new {@link SVGOMAnimatedString} and stores it in this element's LiveAttributeValue table.
protected SVGOMAnimatedTransformListcreateLiveAnimatedTransformList(String ns, String ln, String def)
Creates a new {@link SVGOMAnimatedTransformList} and stores it in this element's LiveAttributeValue table.
SVGExceptioncreateSVGException(short type, String key, Object[] args)
Creates an SVGException with the appropriate error message.
protected NodedeepCopyInto(Node n)
Deeply copy the fields of the current node into the given node.
protected NodedeepExport(Node n, AbstractDocument d)
Deeply exports this node to the given document.
protected Nodeexport(Node n, AbstractDocument d)
Exports this node to the given document.
protected shortgetAttributePercentageInterpretation(String ns, String ln)
Gets how percentage values are interpreted by the given attribute.
intgetAttributeType(String ns, String ln)
Returns the type of the given attribute.
protected AnimatableValuegetBaseValue(SVGAnimatedInteger n, SVGAnimatedInteger on)
Returns an AnimatableNumberOptionalNumberValue for the base value of the given two SVGAnimatedIntegers.
protected AnimatableValuegetBaseValue(SVGAnimatedNumber n, SVGAnimatedNumber on)
Returns an AnimatableNumberOptionalNumberValue for the base value of the given two SVGAnimatedNumbers.
protected StringgetCascadedXMLBase(Node node)
Returns the xml:base attribute value of the given element, resolving any dependency on parent bases if needed.
ElementgetElement()
Returns the element.
StringgetId()
DOM: Implements {@link SVGElement#getId()}.
StringgetNamespaceURI()
DOM: Implements {@link Node#getNamespaceURI()}.
StringgetNodeName()
DOM: Implements {@link Node#getNodeName()}.
SVGSVGElementgetOwnerSVGElement()
DOM: Implements {@link SVGElement#getOwnerSVGElement()}.
shortgetPercentageInterpretation(String ns, String an, boolean isCSS)
Gets how percentage values are interpreted by the given attribute or property.
intgetPropertyType(String pn)
Returns the type of the given property.
SVGContextgetSVGContext()
Returns the SVG context used to get SVG specific informations.
protected DoublyIndexedTablegetTraitInformationTable()
Returns the table of TraitInformation objects for this element.
AnimatableValuegetUnderlyingValue(String ns, String ln)
Returns the underlying value of an animatable XML attribute.
SVGElementgetViewportElement()
DOM: Implements {@link SVGElement#getViewportElement()}.
StringgetXMLbase()
DOM: Implements {@link SVGElement#getXMLbase()}.
booleanhasProperty(String pn)
Returns whether the given CSS property is available on this element.
booleanhasTrait(String ns, String ln)
Returns whether the given trait is available on this element.
protected voidinitializeAllLiveAttributes()
Initializes all live attributes for this element.
booleanisAttributeAdditive(String ns, String ln)
Returns whether the given XML attribute is additive.
booleanisAttributeAnimatable(String ns, String ln)
Returns whether the given XML attribute is animatable.
booleanisPropertyAdditive(String pn)
Returns whether the given CSS property is additive.
booleanisPropertyAnimatable(String pn)
Returns whether the given CSS property is animatable.
booleanisReadonly()
Tests whether this node is readonly.
booleanisTraitAdditive(String ns, String tn)
Returns whether the given trait is additive.
booleanisTraitAnimatable(String ns, String tn)
Returns whether the given trait is animatable.
voidremoveTargetListener(String ns, String an, boolean isCSS, AnimationTargetListener l)
Removes a listener for changes to the given attribute value.
voidsetId(String id)
DOM: Implements {@link SVGElement#setId(String)}.
voidsetPrefix(String prefix)
DOM: Implements {@link Node#setPrefix(String)}.
voidsetReadonly(boolean v)
Sets this node readonly attribute.
voidsetSVGContext(SVGContext ctx)
Sets the SVG context to use to get SVG specific informations.
voidsetXMLbase(String xmlbase)
DOM: Implements {@link SVGElement#setXMLbase(String)}.
floatsvgToUserSpace(float v, short type, short pcInterp)
Converts the given SVG length into user units.
voidupdateAttributeValue(String ns, String ln, AnimatableValue val)
Updates an attribute value in this target.
voidupdateOtherValue(String type, AnimatableValue val)
Updates a 'other' animation value in this target.
voidupdatePropertyValue(String pn, AnimatableValue val)
Updates a property value in this target.
booleanuseLinearRGBColorInterpolation()
Returns whether color interpolations should be done in linear RGB color space rather than sRGB.

Field Detail

prefix

protected String prefix
The element prefix.

readonly

protected transient boolean readonly
Is this element immutable?

svgContext

protected transient SVGContext svgContext
The SVG context to get SVG specific informations.

targetListeners

protected DoublyIndexedTable targetListeners
Table mapping namespaceURI/local name pairs to {@link LinkedList}s of {@link AnimationTargetListener}s.

unitContext

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

xmlTraitInformation

protected static DoublyIndexedTable xmlTraitInformation
Table mapping XML attribute names to TraitInformation objects.

Constructor Detail

SVGOMElement

protected SVGOMElement()
Creates a new Element object.

SVGOMElement

protected SVGOMElement(String prefix, AbstractDocument owner)
Creates a new Element object.

Parameters: prefix The namespace prefix. owner The owner document.

Method Detail

addTargetListener

public void addTargetListener(String ns, String an, boolean isCSS, AnimationTargetListener l)
Adds a listener for changes to the given attribute value.

copyInto

protected Node copyInto(Node n)
Copy the fields of the current node into the given node.

Parameters: n a node of the type of this.

createLiveAnimatedBoolean

protected SVGOMAnimatedBoolean createLiveAnimatedBoolean(String ns, String ln, boolean def)
Creates a new {@link SVGOMAnimatedBoolean} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedEnumeration

protected SVGOMAnimatedEnumeration createLiveAnimatedEnumeration(String ns, String ln, String[] val, short def)
Creates a new {@link SVGOMAnimatedEnumeration} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedInteger

protected SVGOMAnimatedInteger createLiveAnimatedInteger(String ns, String ln, int def)
Creates a new {@link SVGOMAnimatedInteger} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedLength

protected SVGOMAnimatedLength createLiveAnimatedLength(String ns, String ln, String val, short dir, boolean nonneg)
Creates a new {@link SVGOMAnimatedLength} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedLengthList

protected SVGOMAnimatedLengthList createLiveAnimatedLengthList(String ns, String ln, String def, boolean emptyAllowed, short dir)
Creates a new {@link SVGOMAnimatedLengthList} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedMarkerOrientValue

protected SVGOMAnimatedMarkerOrientValue createLiveAnimatedMarkerOrientValue(String ns, String ln)
Creates a new {@link SVGOMAnimatedMarkerOrientValue} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedNumber

protected SVGOMAnimatedNumber createLiveAnimatedNumber(String ns, String ln, float def)
Creates a new {@link SVGOMAnimatedNumber} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedNumber

protected SVGOMAnimatedNumber createLiveAnimatedNumber(String ns, String ln, float def, boolean allowPercentage)
Creates a new {@link SVGOMAnimatedNumber} that can be parsed as a percentage and stores it in this element's LiveAttributeValue table.

createLiveAnimatedNumberList

protected SVGOMAnimatedNumberList createLiveAnimatedNumberList(String ns, String ln, String def, boolean canEmpty)
Creates a new {@link SVGOMAnimatedNumberList} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedPathData

protected SVGOMAnimatedPathData createLiveAnimatedPathData(String ns, String ln, String def)
Creates a new {@link SVGOMAnimatedPathData} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedPoints

protected SVGOMAnimatedPoints createLiveAnimatedPoints(String ns, String ln, String def)
Creates a new {@link SVGOMAnimatedPoints} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedPreserveAspectRatio

protected SVGOMAnimatedPreserveAspectRatio createLiveAnimatedPreserveAspectRatio()
Creates a new {@link SVGOMAnimatedPreserveAspectRatio} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedString

protected SVGOMAnimatedString createLiveAnimatedString(String ns, String ln)
Creates a new {@link SVGOMAnimatedString} and stores it in this element's LiveAttributeValue table.

createLiveAnimatedTransformList

protected SVGOMAnimatedTransformList createLiveAnimatedTransformList(String ns, String ln, String def)
Creates a new {@link SVGOMAnimatedTransformList} and stores it in this element's LiveAttributeValue table.

createSVGException

public SVGException createSVGException(short type, String key, Object[] args)
Creates an SVGException with the appropriate error message.

deepCopyInto

protected Node deepCopyInto(Node n)
Deeply copy the fields of the current node into the given node.

Parameters: n a node of the type of this.

deepExport

protected Node deepExport(Node n, AbstractDocument d)
Deeply exports this node to the given document.

export

protected Node export(Node n, AbstractDocument d)
Exports this node to the given document.

getAttributePercentageInterpretation

protected final short getAttributePercentageInterpretation(String ns, String ln)
Gets how percentage values are interpreted by the given attribute.

getAttributeType

public final int getAttributeType(String ns, String ln)
Returns the type of the given attribute.

getBaseValue

protected AnimatableValue getBaseValue(SVGAnimatedInteger n, SVGAnimatedInteger on)
Returns an AnimatableNumberOptionalNumberValue for the base value of the given two SVGAnimatedIntegers.

getBaseValue

protected AnimatableValue getBaseValue(SVGAnimatedNumber n, SVGAnimatedNumber on)
Returns an AnimatableNumberOptionalNumberValue for the base value of the given two SVGAnimatedNumbers.

getCascadedXMLBase

protected String getCascadedXMLBase(Node node)
Returns the xml:base attribute value of the given element, resolving any dependency on parent bases if needed. Follows shadow trees when moving to parent nodes.

getElement

public Element getElement()
Returns the element.

getId

public String getId()
DOM: Implements {@link SVGElement#getId()}.

getNamespaceURI

public String getNamespaceURI()
DOM: Implements {@link Node#getNamespaceURI()}.

getNodeName

public String getNodeName()
DOM: Implements {@link Node#getNodeName()}.

getOwnerSVGElement

public SVGSVGElement getOwnerSVGElement()
DOM: Implements {@link SVGElement#getOwnerSVGElement()}.

getPercentageInterpretation

public short getPercentageInterpretation(String ns, String an, boolean isCSS)
Gets how percentage values are interpreted by the given attribute or property.

getPropertyType

public int getPropertyType(String pn)
Returns the type of the given property.

getSVGContext

public SVGContext getSVGContext()
Returns the SVG context used to get SVG specific informations.

getTraitInformationTable

protected DoublyIndexedTable getTraitInformationTable()
Returns the table of TraitInformation objects for this element.

getUnderlyingValue

public AnimatableValue getUnderlyingValue(String ns, String ln)
Returns the underlying value of an animatable XML attribute.

getViewportElement

public SVGElement getViewportElement()
DOM: Implements {@link SVGElement#getViewportElement()}.

getXMLbase

public String getXMLbase()
DOM: Implements {@link SVGElement#getXMLbase()}.

hasProperty

public boolean hasProperty(String pn)
Returns whether the given CSS property is available on this element.

hasTrait

public boolean hasTrait(String ns, String ln)
Returns whether the given trait is available on this element.

initializeAllLiveAttributes

protected void initializeAllLiveAttributes()
Initializes all live attributes for this element.

isAttributeAdditive

public boolean isAttributeAdditive(String ns, String ln)
Returns whether the given XML attribute is additive.

isAttributeAnimatable

public final boolean isAttributeAnimatable(String ns, String ln)
Returns whether the given XML attribute is animatable.

isPropertyAdditive

public boolean isPropertyAdditive(String pn)
Returns whether the given CSS property is additive.

isPropertyAnimatable

public boolean isPropertyAnimatable(String pn)
Returns whether the given CSS property is animatable.

isReadonly

public boolean isReadonly()
Tests whether this node is readonly.

isTraitAdditive

public boolean isTraitAdditive(String ns, String tn)
Returns whether the given trait is additive.

isTraitAnimatable

public boolean isTraitAnimatable(String ns, String tn)
Returns whether the given trait is animatable.

removeTargetListener

public void removeTargetListener(String ns, String an, boolean isCSS, AnimationTargetListener l)
Removes a listener for changes to the given attribute value.

setId

public void setId(String id)
DOM: Implements {@link SVGElement#setId(String)}.

setPrefix

public void setPrefix(String prefix)
DOM: Implements {@link Node#setPrefix(String)}.

setReadonly

public void setReadonly(boolean v)
Sets this node readonly attribute.

setSVGContext

public void setSVGContext(SVGContext ctx)
Sets the SVG context to use to get SVG specific informations.

Parameters: ctx the SVG context

setXMLbase

public void setXMLbase(String xmlbase)
DOM: Implements {@link SVGElement#setXMLbase(String)}.

svgToUserSpace

public float svgToUserSpace(float v, short type, short pcInterp)
Converts the given SVG length into user units.

Parameters: v the SVG length value type the SVG length units (one of the {@link SVGLength}.SVG_LENGTH_* constants) pcInterp how to interpretet percentage values (one of the {@link SVGContext}.PERCENTAGE_* constants)

Returns: the SVG value in user units

updateAttributeValue

public void updateAttributeValue(String ns, String ln, AnimatableValue val)
Updates an attribute value in this target.

updateOtherValue

public void updateOtherValue(String type, AnimatableValue val)
Updates a 'other' animation value in this target.

updatePropertyValue

public void updatePropertyValue(String pn, AnimatableValue val)
Updates a property value in this target. Ignored for non-stylable elements. Overridden in {@link SVGStylableElement} to actually update properties.

useLinearRGBColorInterpolation

public boolean useLinearRGBColorInterpolation()
Returns whether color interpolations should be done in linear RGB color space rather than sRGB. Overriden in {@link SVGStylableElement} to actually look up the 'color-interpolation' property.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.