org.apache.batik.bridge

Class SVGAnimationElementBridge

public abstract class SVGAnimationElementBridge extends AbstractSVGBridge implements GenericBridge, BridgeUpdateHandler, SVGAnimationContext, AnimatableElement

An abstract base class for the SVG animation element bridges.
Nested Class Summary
protected classSVGAnimationElementBridge.SVGTimedElement
A TimedElement class for SVG animation elements.
Field Summary
protected AbstractAnimationanimation
The animation object that provides the values for the animation.
protected AnimationTargetanimationTarget
The AnimationTarget the provides a context to the animation engine.
protected shortanimationType
The animation type.
protected StringattributeLocalName
The local name of the attribute or the name of the property being animated.
protected StringattributeNamespaceURI
The namespace URI of the attribute being animated.
protected BridgeContextctx
The BridgeContext to be used.
protected SVGOMElementelement
The animation element.
protected SVGAnimationEngineeng
The AnimationEngine that manages all of the animations in the document.
protected SVGOMElementtargetElement
The target element of the animation.
protected TimedElementtimedElement
The TimedElement object that provides the timing for the animation.
Method Summary
voidaddTargetListener(String pn, AnimationTargetListener l)
Adds a listener for changes to the given attribute value.
booleanbeginElement()
DOM: Implements {@link org.w3c.dom.smil.ElementTimeControl#beginElement()}.
booleanbeginElementAt(float offset)
DOM: Implements {@link org.w3c.dom.smil.ElementTimeControl#beginElementAt(float)}.
protected abstract booleancanAnimateType(int type)
Returns whether the animation element being handled by this bridge can animate attributes of the specified type.
protected booleancheckValueType(AnimatableValue v)
Returns whether the specified {@link AnimatableValue} is of a type allowed by this animation.
protected abstract AbstractAnimationcreateAnimation(AnimationTarget t)
Creates the animation object for the animation element.
protected TimedElementcreateTimedElement()
Creates a TimedElement for the animation element.
voiddispose()
Disposes this BridgeUpdateHandler and releases all resources.
booleanendElement()
DOM: Implements {@link org.w3c.dom.smil.ElementTimeControl#endElement()}.
booleanendElementAt(float offset)
DOM: Implements {@link org.w3c.dom.smil.ElementTimeControl#endElementAt(float)}.
Rectangle2DgetBBox()
AffineTransformgetCTM()
floatgetCurrentTime()
DOM: Implements {@link org.w3c.dom.svg.SVGAnimationElement#getCurrentTime()}.
floatgetFontSize()
AffineTransformgetGlobalTransform()
floatgetPixelToMM()
Returns the size of a px CSS unit in millimeters.
floatgetPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters.
AffineTransformgetScreenTransform()
floatgetSimpleDuration()
DOM: Implements {@link org.w3c.dom.svg.SVGAnimationElement#getSimpleDuration()}.
floatgetStartTime()
DOM: Implements {@link org.w3c.dom.svg.SVGAnimationElement#getStartTime()}.
SVGElementgetTargetElement()
DOM: Implements {@link org.w3c.dom.svg.SVGAnimationElement#getTargetElement()}.
TimedElementgetTimedElement()
Returns the TimedElement for the animation.
AnimatableValuegetUnderlyingValue()
Returns the underlying value of the animated attribute.
floatgetViewportHeight()
floatgetViewportWidth()
voidhandleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)
Invoked when the animated value of an animatable attribute has changed.
voidhandleCSSEngineEvent(CSSEngineEvent evt)
Invoked when an CSSEngineEvent is fired.
voidhandleDOMAttrModifiedEvent(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMAttrModified' is fired.
voidhandleDOMCharacterDataModified(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired.
voidhandleDOMNodeInsertedEvent(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
voidhandleDOMNodeRemovedEvent(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.
voidhandleElement(BridgeContext ctx, Element e)
Handles this animation element.
voidhandleOtherAnimationChanged(String type)
Invoked when an 'other' animation value has changed.
protected voidinitializeAnimation()
Parses the animation element's target attributes and adds it to the document's AnimationEngine.
protected voidinitializeTimedElement()
Parses the animation element's timing attributes and initializes the {@link TimedElement} object.
protected voidinitializeTimedElement(TimedElement timedElement)
Initializes the timing attributes of the timed element.
protected booleanisConstantAnimation()
Returns whether this is a constant animation (i.e., a 'set' animation).
protected AnimatableValueparseAnimatableValue(String an)
Parses an attribute as an AnimatableValue.
voidremoveTargetListener(String pn, AnimationTargetListener l)
Removes a listener for changes to the given attribute value.
voidsetScreenTransform(AffineTransform at)
floatsvgToUserSpace(float v, int type, int pcInterp)

Field Detail

animation

protected AbstractAnimation animation
The animation object that provides the values for the animation.

animationTarget

protected AnimationTarget animationTarget
The AnimationTarget the provides a context to the animation engine.

animationType

protected short animationType
The animation type. Must be one of the ANIM_TYPE_* constants defined in {@link AnimationEngine}.

attributeLocalName

protected String attributeLocalName
The local name of the attribute or the name of the property being animated.

attributeNamespaceURI

protected String attributeNamespaceURI
The namespace URI of the attribute being animated.

ctx

protected BridgeContext ctx
The BridgeContext to be used.

element

protected SVGOMElement element
The animation element.

eng

protected SVGAnimationEngine eng
The AnimationEngine that manages all of the animations in the document.

targetElement

protected SVGOMElement targetElement
The target element of the animation.

timedElement

protected TimedElement timedElement
The TimedElement object that provides the timing for the animation.

Method Detail

addTargetListener

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

beginElement

public boolean beginElement()
DOM: Implements {@link org.w3c.dom.smil.ElementTimeControl#beginElement()}.

beginElementAt

public boolean beginElementAt(float offset)
DOM: Implements {@link org.w3c.dom.smil.ElementTimeControl#beginElementAt(float)}.

canAnimateType

protected abstract boolean canAnimateType(int type)
Returns whether the animation element being handled by this bridge can animate attributes of the specified type.

Parameters: type one of the TYPE_ constants defined in {@link SVGTypes}.

checkValueType

protected boolean checkValueType(AnimatableValue v)
Returns whether the specified {@link AnimatableValue} is of a type allowed by this animation.

createAnimation

protected abstract AbstractAnimation createAnimation(AnimationTarget t)
Creates the animation object for the animation element.

createTimedElement

protected TimedElement createTimedElement()
Creates a TimedElement for the animation element.

dispose

public void dispose()
Disposes this BridgeUpdateHandler and releases all resources.

endElement

public boolean endElement()
DOM: Implements {@link org.w3c.dom.smil.ElementTimeControl#endElement()}.

endElementAt

public boolean endElementAt(float offset)
DOM: Implements {@link org.w3c.dom.smil.ElementTimeControl#endElementAt(float)}.

getBBox

public Rectangle2D getBBox()

getCTM

public AffineTransform getCTM()

getCurrentTime

public float getCurrentTime()
DOM: Implements {@link org.w3c.dom.svg.SVGAnimationElement#getCurrentTime()}.

getFontSize

public float getFontSize()

getGlobalTransform

public AffineTransform getGlobalTransform()

getPixelToMM

public float getPixelToMM()
Returns the size of a px CSS unit in millimeters. This will be removed after next release.

See Also: getPixelUnitToMillimeter

getPixelUnitToMillimeter

public float getPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters.

getScreenTransform

public AffineTransform getScreenTransform()

getSimpleDuration

public float getSimpleDuration()
DOM: Implements {@link org.w3c.dom.svg.SVGAnimationElement#getSimpleDuration()}. With the difference that an indefinite simple duration is returned as {@link TimedElement#INDEFINITE}, rather than throwing an exception.

getStartTime

public float getStartTime()
DOM: Implements {@link org.w3c.dom.svg.SVGAnimationElement#getStartTime()}.

getTargetElement

public SVGElement getTargetElement()
DOM: Implements {@link org.w3c.dom.svg.SVGAnimationElement#getTargetElement()}.

getTimedElement

public TimedElement getTimedElement()
Returns the TimedElement for the animation.

getUnderlyingValue

public AnimatableValue getUnderlyingValue()
Returns the underlying value of the animated attribute. Used for composition of additive animations. This should be overridden in descendant classes that are for 'other' animations.

getViewportHeight

public float getViewportHeight()

getViewportWidth

public float getViewportWidth()

handleAnimatedAttributeChanged

public void handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)
Invoked when the animated value of an animatable attribute has changed.

handleCSSEngineEvent

public void handleCSSEngineEvent(CSSEngineEvent evt)
Invoked when an CSSEngineEvent is fired.

handleDOMAttrModifiedEvent

public void handleDOMAttrModifiedEvent(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMAttrModified' is fired.

handleDOMCharacterDataModified

public void handleDOMCharacterDataModified(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired.

handleDOMNodeInsertedEvent

public void handleDOMNodeInsertedEvent(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.

handleDOMNodeRemovedEvent

public void handleDOMNodeRemovedEvent(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.

handleElement

public void handleElement(BridgeContext ctx, Element e)
Handles this animation element.

Parameters: ctx the bridge context to use e the element being handled

handleOtherAnimationChanged

public void handleOtherAnimationChanged(String type)
Invoked when an 'other' animation value has changed.

initializeAnimation

protected void initializeAnimation()
Parses the animation element's target attributes and adds it to the document's AnimationEngine.

initializeTimedElement

protected void initializeTimedElement()
Parses the animation element's timing attributes and initializes the {@link TimedElement} object.

initializeTimedElement

protected void initializeTimedElement(TimedElement timedElement)
Initializes the timing attributes of the timed element.

isConstantAnimation

protected boolean isConstantAnimation()
Returns whether this is a constant animation (i.e., a 'set' animation).

parseAnimatableValue

protected AnimatableValue parseAnimatableValue(String an)
Parses an attribute as an AnimatableValue.

removeTargetListener

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

setScreenTransform

public void setScreenTransform(AffineTransform at)

svgToUserSpace

public float svgToUserSpace(float v, int type, int pcInterp)
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.