01: /*
02:
03: Licensed to the Apache Software Foundation (ASF) under one or more
04: contributor license agreements. See the NOTICE file distributed with
05: this work for additional information regarding copyright ownership.
06: The ASF licenses this file to You under the Apache License, Version 2.0
07: (the "License"); you may not use this file except in compliance with
08: the License. You may obtain a copy of the License at
09:
10: http://www.apache.org/licenses/LICENSE-2.0
11:
12: Unless required by applicable law or agreed to in writing, software
13: distributed under the License is distributed on an "AS IS" BASIS,
14: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: See the License for the specific language governing permissions and
16: limitations under the License.
17:
18: */
19: package org.apache.batik.bridge;
20:
21: import org.apache.batik.anim.AbstractAnimation;
22: import org.apache.batik.dom.anim.AnimationTarget;
23: import org.apache.batik.anim.SetAnimation;
24: import org.apache.batik.anim.values.AnimatableValue;
25:
26: /**
27: * A bridge class for the 'set' animation element.
28: *
29: * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
30: * @version $Id: SVGSetElementBridge.java 478160 2006-11-22 13:35:06Z dvholten $
31: */
32: public class SVGSetElementBridge extends SVGAnimationElementBridge {
33:
34: /**
35: * Returns 'set'.
36: */
37: public String getLocalName() {
38: return SVG_SET_TAG;
39: }
40:
41: /**
42: * Returns a new instance of this bridge.
43: */
44: public Bridge getInstance() {
45: return new SVGSetElementBridge();
46: }
47:
48: /**
49: * Creates the animation object for the animation element.
50: */
51: protected AbstractAnimation createAnimation(AnimationTarget target) {
52: AnimatableValue to = parseAnimatableValue(SVG_TO_ATTRIBUTE);
53: return new SetAnimation(timedElement, this , to);
54: }
55:
56: /**
57: * Returns whether the animation element being handled by this bridge can
58: * animate attributes of the specified type.
59: * @param type one of the TYPE_ constants defined in {@link org.apache.batik.util.SVGTypes}.
60: */
61: protected boolean canAnimateType(int type) {
62: return true;
63: }
64:
65: /**
66: * Returns whether this is a constant animation (i.e., a 'set' animation).
67: */
68: protected boolean isConstantAnimation() {
69: return true;
70: }
71: }
|