Source Code Cross Referenced for XMLBaseForCollectionAndComplex.java in  » Workflow-Engines » JaWE » org » enhydra » shark » xpdl » 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 » Workflow Engines » JaWE » org.enhydra.shark.xpdl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.enhydra.shark.xpdl;
002:
003:        import java.util.ArrayList;
004:        import java.util.Iterator;
005:
006:        import org.enhydra.shark.utilities.SequencedHashMap;
007:
008:        /**
009:         *  Base class for implementing XMLComplexElement and XMLCollection classes.
010:         * 
011:         *  @author Sasa Bojanic
012:         */
013:        public abstract class XMLBaseForCollectionAndComplex extends XMLElement {
014:
015:            protected SequencedHashMap elementMap;
016:            protected ArrayList elements;
017:
018:            protected transient boolean cachesInitialized = false;
019:
020:            public XMLBaseForCollectionAndComplex(XMLElement parent,
021:                    boolean isRequired) {
022:                super (parent, isRequired);
023:                elements = new ArrayList();
024:                elementMap = new SequencedHashMap();
025:            }
026:
027:            public XMLBaseForCollectionAndComplex(XMLElement parent,
028:                    String name, boolean isRequired) {
029:                super (parent, name, isRequired);
030:                elements = new ArrayList();
031:                elementMap = new SequencedHashMap();
032:            }
033:
034:            public void setValue(String v) {
035:                throw new RuntimeException(
036:                        "Can't set value for this type of element!");
037:            }
038:
039:            /**
040:             * Sets this element, and all contained elements to be read only or not.
041:             */
042:            public void setReadOnly(boolean ro) {
043:                super .setReadOnly(ro);
044:                Iterator it = elements.iterator();
045:                while (it.hasNext()) {
046:                    XMLElement el = (XMLElement) it.next();
047:                    el.setReadOnly(ro);
048:                }
049:                if (!ro) {
050:                    clearCaches();
051:                }
052:            }
053:
054:            public void setNotifyMainListeners(boolean notify) {
055:                super .setNotifyMainListeners(notify);
056:                Iterator it = elements.iterator();
057:                while (it.hasNext()) {
058:                    XMLElement el = (XMLElement) it.next();
059:                    el.setNotifyMainListeners(notify);
060:                }
061:            }
062:
063:            public void setNotifyListeners(boolean notify) {
064:                super .setNotifyListeners(notify);
065:                Iterator it = elements.iterator();
066:                while (it.hasNext()) {
067:                    XMLElement el = (XMLElement) it.next();
068:                    el.setNotifyListeners(notify);
069:                }
070:            }
071:
072:            /** 
073:             * Initializes caches in read-only mode. If mode is not read-only,
074:             * throws RuntimeException.
075:             */
076:            public void initCaches() {
077:                if (!isReadOnly) {
078:                    throw new RuntimeException(
079:                            toName()
080:                                    + ": Caches can be initialized only in read-only mode!");
081:                }
082:                clearCaches();
083:                Iterator it = elements.iterator();
084:                while (it.hasNext()) {
085:                    XMLElement el = (XMLElement) it.next();
086:                    if (el instanceof  XMLBaseForCollectionAndComplex) {
087:                        ((XMLBaseForCollectionAndComplex) el).initCaches();
088:                    } else if (el instanceof  XMLComplexChoice) {
089:                        ((XMLComplexChoice) el).initCaches();
090:                    }
091:                }
092:                cachesInitialized = true;
093:            }
094:
095:            public void clearCaches() {
096:                Iterator it = elements.iterator();
097:                while (it.hasNext()) {
098:                    XMLElement el = (XMLElement) it.next();
099:                    if (el instanceof  XMLBaseForCollectionAndComplex) {
100:                        ((XMLBaseForCollectionAndComplex) el).clearCaches();
101:                    } else if (el instanceof  XMLComplexChoice) {
102:                        ((XMLComplexChoice) el).clearCaches();
103:                    }
104:                }
105:                cachesInitialized = false;
106:            }
107:
108:            /** Adds new element. */
109:            protected abstract void add(XMLElement el);
110:
111:            /** Adds new element to a certain position */
112:            protected abstract boolean add(int no, XMLElement el);
113:
114:            /** Returns true if there is such element in collection. */
115:            public boolean contains(XMLElement el) {
116:                return elements.contains(el);
117:            }
118:
119:            /** Gets the element from specified location. */
120:            public XMLElement get(int no) {
121:                if (no < 0 || no >= size())
122:                    throw new RuntimeException(
123:                            "There is no element at position " + no + "!");
124:
125:                return (XMLElement) elements.get(no);
126:            }
127:
128:            /** Returns the number of elements. */
129:            public int size() {
130:                return elements.size();
131:            }
132:
133:            /** Returns the copy of the list all elements within collection. */
134:            public ArrayList toElements() {
135:                return new ArrayList(elements);
136:            }
137:
138:            /** Returns the copy of the map of all elements within collection. */
139:            public SequencedHashMap toElementMap() {
140:                return new SequencedHashMap(elementMap);
141:            }
142:
143:            public boolean equals(Object e) {
144:                boolean equals = super .equals(e);
145:                if (equals) {
146:                    XMLBaseForCollectionAndComplex el = (XMLBaseForCollectionAndComplex) e;
147:                    equals = (this .elements.equals(el.elements));
148:                    //         System.out.println("The subelements equal - "+equals);
149:                    //return (this.elements.equals(el.elements));
150:                }
151:                return equals;
152:            }
153:
154:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.