Source Code Cross Referenced for SVGOMAnimatedBoolean.java in  » Graphic-Library » batik » org » apache » batik » dom » svg » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Graphic Library » batik » org.apache.batik.dom.svg 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Licensed to the Apache Software Foundation (ASF) under one or more
004:           contributor license agreements.  See the NOTICE file distributed with
005:           this work for additional information regarding copyright ownership.
006:           The ASF licenses this file to You under the Apache License, Version 2.0
007:           (the "License"); you may not use this file except in compliance with
008:           the License.  You may obtain a copy of the License at
009:
010:               http://www.apache.org/licenses/LICENSE-2.0
011:
012:           Unless required by applicable law or agreed to in writing, software
013:           distributed under the License is distributed on an "AS IS" BASIS,
014:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:           See the License for the specific language governing permissions and
016:           limitations under the License.
017:
018:         */
019:        package org.apache.batik.dom.svg;
020:
021:        import org.apache.batik.anim.values.AnimatableBooleanValue;
022:        import org.apache.batik.anim.values.AnimatableValue;
023:        import org.apache.batik.dom.anim.AnimationTarget;
024:
025:        import org.w3c.dom.Attr;
026:        import org.w3c.dom.DOMException;
027:        import org.w3c.dom.svg.SVGAnimatedBoolean;
028:
029:        /**
030:         * This class implements the {@link SVGAnimatedBoolean} interface.
031:         *
032:         * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
033:         * @version $Id: SVGOMAnimatedBoolean.java 490655 2006-12-28 05:19:44Z cam $
034:         */
035:        public class SVGOMAnimatedBoolean extends AbstractSVGAnimatedValue
036:                implements  SVGAnimatedBoolean {
037:
038:            /**
039:             * The default value.
040:             */
041:            protected boolean defaultValue;
042:
043:            /**
044:             * Whether the base value is valid.
045:             */
046:            protected boolean valid;
047:
048:            /**
049:             * The current base value.
050:             */
051:            protected boolean baseVal;
052:
053:            /**
054:             * The current animated value.
055:             */
056:            protected boolean animVal;
057:
058:            /**
059:             * Whether the value is changing.
060:             */
061:            protected boolean changing;
062:
063:            /**
064:             * Creates a new SVGOMAnimatedBoolean.
065:             * @param elt The associated element.
066:             * @param ns The attribute's namespace URI.
067:             * @param ln The attribute's local name.
068:             * @param val The default value, if the attribute is not specified.
069:             */
070:            public SVGOMAnimatedBoolean(AbstractElement elt, String ns,
071:                    String ln, boolean val) {
072:                super (elt, ns, ln);
073:                defaultValue = val;
074:            }
075:
076:            /**
077:             * <b>DOM</b>: Implements {@link SVGAnimatedBoolean#getBaseVal()}.
078:             */
079:            public boolean getBaseVal() {
080:                if (!valid) {
081:                    update();
082:                }
083:                return baseVal;
084:            }
085:
086:            /**
087:             * Updates the base value from the attribute.
088:             */
089:            protected void update() {
090:                Attr attr = element.getAttributeNodeNS(namespaceURI, localName);
091:                if (attr == null) {
092:                    baseVal = defaultValue;
093:                } else {
094:                    baseVal = attr.getValue().equals("true");
095:                }
096:                valid = true;
097:            }
098:
099:            /**
100:             * <b>DOM</b>: Implements {@link SVGAnimatedBoolean#setBaseVal(boolean)}.
101:             */
102:            public void setBaseVal(boolean baseVal) throws DOMException {
103:                try {
104:                    this .baseVal = baseVal;
105:                    valid = true;
106:                    changing = true;
107:                    element.setAttributeNS(namespaceURI, localName, String
108:                            .valueOf(baseVal));
109:                } finally {
110:                    changing = false;
111:                }
112:            }
113:
114:            /**
115:             * <b>DOM</b>: Implements {@link SVGAnimatedBoolean#getAnimVal()}.
116:             */
117:            public boolean getAnimVal() {
118:                if (hasAnimVal) {
119:                    return animVal;
120:                }
121:                if (!valid) {
122:                    update();
123:                }
124:                return baseVal;
125:            }
126:
127:            /**
128:             * Sets the animated value.
129:             */
130:            public void setAnimatedValue(boolean animVal) {
131:                hasAnimVal = true;
132:                this .animVal = animVal;
133:                fireAnimatedAttributeListeners();
134:            }
135:
136:            /**
137:             * Updates the animated value with the given {@link AnimatableValue}.
138:             */
139:            protected void updateAnimatedValue(AnimatableValue val) {
140:                if (val == null) {
141:                    hasAnimVal = false;
142:                } else {
143:                    hasAnimVal = true;
144:                    this .animVal = ((AnimatableBooleanValue) val).getValue();
145:                }
146:                fireAnimatedAttributeListeners();
147:            }
148:
149:            /**
150:             * Returns the base value of the attribute as an {@link AnimatableValue}.
151:             */
152:            public AnimatableValue getUnderlyingValue(AnimationTarget target) {
153:                return new AnimatableBooleanValue(target, getBaseVal());
154:            }
155:
156:            /**
157:             * Called when an Attr node has been added.
158:             */
159:            public void attrAdded(Attr node, String newv) {
160:                if (!changing) {
161:                    valid = false;
162:                }
163:                fireBaseAttributeListeners();
164:                if (!hasAnimVal) {
165:                    fireAnimatedAttributeListeners();
166:                }
167:            }
168:
169:            /**
170:             * Called when an Attr node has been modified.
171:             */
172:            public void attrModified(Attr node, String oldv, String newv) {
173:                if (!changing) {
174:                    valid = false;
175:                }
176:                fireBaseAttributeListeners();
177:                if (!hasAnimVal) {
178:                    fireAnimatedAttributeListeners();
179:                }
180:            }
181:
182:            /**
183:             * Called when an Attr node has been removed.
184:             */
185:            public void attrRemoved(Attr node, String oldv) {
186:                if (!changing) {
187:                    valid = false;
188:                }
189:                fireBaseAttributeListeners();
190:                if (!hasAnimVal) {
191:                    fireAnimatedAttributeListeners();
192:                }
193:            }
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.