Source Code Cross Referenced for SubnodeList.java in  » Web-Framework » helma » helma » objectmodel » db » 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 » Web Framework » helma » helma.objectmodel.db 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Helma License Notice
003:         *
004:         * The contents of this file are subject to the Helma License
005:         * Version 2.0 (the "License"). You may not use this file except in
006:         * compliance with the License. A copy of the License is available at
007:         * http://adele.helma.org/download/helma/license.txt
008:         *
009:         * Copyright 1998-2003 Helma Software. All Rights Reserved.
010:         *
011:         * $RCSfile$
012:         * $Author: hannes $
013:         * $Revision: 8729 $
014:         * $Date: 2007-12-21 10:13:52 +0100 (Fre, 21 Dez 2007) $
015:         */
016:
017:        package helma.objectmodel.db;
018:
019:        import java.util.ArrayList;
020:        import java.util.List;
021:        import java.util.HashMap;
022:        import java.util.Iterator;
023:
024:        /**
025:         * A subclass of ArrayList that adds an addSorted(Object) method to
026:         */
027:        public class SubnodeList extends ArrayList {
028:
029:            transient WrappedNodeManager nmgr;
030:            transient HashMap views = null;
031:            transient Relation rel;
032:
033:            /**
034:             * Hide/disable zero argument constructor for subclasses
035:             */
036:            private SubnodeList() {
037:            }
038:
039:            /**
040:             * Creates a new subnode list
041:             * @param nmgr
042:             */
043:            public SubnodeList(WrappedNodeManager nmgr, Relation rel) {
044:                this .nmgr = nmgr;
045:                this .rel = rel;
046:            }
047:
048:            /**
049:             * Inserts the specified element at the specified position in this
050:             * list without performing custom ordering
051:             *
052:             * @param obj element to be inserted.
053:             */
054:            public boolean addSorted(Object obj) {
055:                return add(obj);
056:            }
057:
058:            /**
059:             * Adds the specified object to this list performing
060:             * custom ordering
061:             *
062:             * @param obj element to be inserted.
063:             */
064:            public boolean add(Object obj) {
065:                addToViews(obj);
066:                return super .add(obj);
067:            }
068:
069:            /**
070:             * Adds the specified object to the list at the given position
071:             * @param idx the index to insert the element at
072:             * @param obj the object t add
073:             */
074:            public void add(int idx, Object obj) {
075:                addToViews(obj);
076:                super .add(idx, obj);
077:            }
078:
079:            /**
080:             * remove the object specified by the given index-position
081:             * @param idx the index-position of the NodeHandle to remove
082:             */
083:            public Object remove(int idx) {
084:                Object obj = get(idx);
085:                if (obj != null) {
086:                    removeFromViews(obj);
087:                }
088:                return super .remove(idx);
089:            }
090:
091:            /**
092:             * remove the given Object from this List
093:             * @param obj the NodeHandle to remove
094:             */
095:            public boolean remove(Object obj) {
096:                removeFromViews(obj);
097:                return super .remove(obj);
098:            }
099:
100:            protected void removeFromViews(Object obj) {
101:                if (views == null || views.isEmpty())
102:                    return;
103:                for (Iterator i = views.values().iterator(); i.hasNext();) {
104:                    OrderedSubnodeList osl = (OrderedSubnodeList) i.next();
105:                    osl.remove(obj);
106:                }
107:            }
108:
109:            public List getOrderedView(String order) {
110:                String key = order.trim().toLowerCase();
111:                // long start = System.currentTimeMillis();
112:                if (views == null) {
113:                    views = new HashMap();
114:                }
115:                OrderedSubnodeList osl = (OrderedSubnodeList) views.get(key);
116:                if (osl == null) {
117:                    osl = new OrderedSubnodeList(nmgr, rel, this , order);
118:                    views.put(key, osl);
119:                }
120:                return osl;
121:            }
122:
123:            protected void addToViews(Object obj) {
124:                if (views == null || views.isEmpty())
125:                    return;
126:                for (Iterator i = views.values().iterator(); i.hasNext();) {
127:                    OrderedSubnodeList osl = (OrderedSubnodeList) i.next();
128:                    osl.sortIn(obj);
129:                }
130:            }
131:
132:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.