Source Code Cross Referenced for DCollection.java in  » Database-ORM » tro-community-7.2-1 » discRack » presentation » delements » 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 » Database ORM » tro community 7.2 1 » discRack.presentation.delements 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package discRack.presentation.delements;
002:
003:        import discRack.presentation.dpanels.*;
004:
005:        import java.util.*;
006:
007:        /**
008:         * Represents collection of elements which must be instances of
009:         * DCollectionElement class.
010:         *
011:         * @author Sasa Bojanic
012:         * @version 1.0
013:         */
014:        public class DCollection extends DSimpleElement {
015:
016:            /** The collection of elements. */
017:            protected ArrayList refCollectionElements = new ArrayList();
018:
019:            protected transient DPanel controlledPanel;
020:
021:            protected transient DControlPanel controlPanel;
022:
023:            public DCollection(String name) {
024:                super (name);
025:            }
026:
027:            /** Adds new element to collection. */
028:            public void add(DSimpleElement el) {
029:                refCollectionElements.add(el);
030:            }
031:
032:            /** Removes specified element from collection. */
033:            public void remove(Object el) {
034:                refCollectionElements.remove(el);
035:            }
036:
037:            /** Gets the element that is placed at specified no. from collection. */
038:            public Object get(int no) {
039:                try {
040:                    return refCollectionElements.get(no);
041:                } catch (Exception ex) {
042:                    return null;
043:                }
044:            }
045:
046:            /** Returns the number of elements within collection. */
047:            public int size() {
048:                return refCollectionElements.size();
049:            }
050:
051:            /** Clears the collection. */
052:            public void clear() {
053:                refCollectionElements.clear();
054:            }
055:
056:            /**
057:             * Refreshes the collection.
058:             *
059:             * @param elementsToAddOrRemove Set of elements that has to be added to or
060:             *                              removed from collection.
061:             * @param append                <tt>true</tt> if adding elements to collection,
062:             *                              <tt>false</tt> otherwise.
063:             */
064:            public void refreshCollection(Set elementsToAddOrRemove,
065:                    boolean append) {
066:                if (append) {
067:                    refCollectionElements.addAll(elementsToAddOrRemove);
068:                } else {
069:                    refCollectionElements.removeAll(elementsToAddOrRemove);
070:                }
071:            }
072:
073:            /**
074:             * Returns the element specified by ID.
075:             *
076:             * @param ID ID of wanted element.
077:             * @return Wanted element if exist, null otherwise.
078:             */
079:            public DCollectionElement getCollectionElement(String ID) {
080:                DCollectionElement ce = null;
081:                String ceID;
082:                Iterator it = refCollectionElements.iterator();
083:                while (it.hasNext()) {
084:                    DCollectionElement cetmp = (DCollectionElement) it.next();
085:                    ceID = cetmp.getID();
086:                    if (ceID.equals(ID)) {
087:                        ce = cetmp;
088:                        break;
089:                    }
090:                }
091:                return ce;
092:            }
093:
094:            /**
095:             * Gets the structure of elements contained within collection,
096:             * that is the all elements that element is made of.
097:             */
098:            public Collection getElementStructure() {
099:                DSimpleElement el = generateNewElement();
100:                if (el instanceof  DComplexElement) {
101:                    return ((DComplexElement) el).toComplexType();
102:                } else {
103:                    java.util.List l = new ArrayList();
104:                    l.add(el);
105:                    return l;
106:                }
107:            }
108:
109:            /**
110:             * Sets the collection and all contained elements to be read only or not.
111:             */
112:            public void setReadOnly(boolean ro) {
113:                isReadOnly = ro;
114:                Iterator it = refCollectionElements.iterator();
115:                while (it.hasNext()) {
116:                    DSimpleElement el = (DSimpleElement) it.next();
117:                    el.setReadOnly(ro);
118:                }
119:            }
120:
121:            /** Returns the collection of all elements within collection. */
122:            public Collection toCollection() {
123:                return refCollectionElements;
124:            }
125:
126:            /**
127:             * Gets elements that can be choosed within table. Default
128:             * implementation returns all elements within collection.
129:             */
130:            public Collection getTableElements() {
131:                return refCollectionElements;
132:            }
133:
134:            /**
135:             * Generates the new element that made collection. Derived classes
136:             * has to implement this method to create it's collection element.
137:             */
138:            public DSimpleElement generateNewElement() {
139:                return new DSimpleElement(name);
140:            }
141:
142:            /**
143:             * Some specific things to be done after some action is canceled.
144:             * Default implementation is nothing to do, and derived classes
145:             * should implement it's specific actions.
146:             */
147:            public void onActionCanceled(DSimpleElement el, int act) {
148:                return;
149:            }
150:
151:            /**
152:             * Some specific things to be done after element is created.
153:             * Default implementation is nothing to do, and derived classes
154:             * should implement it's specific actions.
155:             */
156:            public void onElementCreated(DSimpleElement el) {
157:                return;
158:            }
159:
160:            /**
161:             * Some specific things to be done after element from collection
162:             * is modified. Default implementation is nothing to do, and derived
163:             * classes should implement it's specific actions.
164:             */
165:            public void onElementModified(DSimpleElement el) {
166:                return;
167:            }
168:
169:            /**
170:             * Some specific things to be done after element is deleted from
171:             * collection. Default implementation is nothing to do, and derived
172:             * classes should implement it's specific actions.
173:             */
174:            public void onElementDeleted(DSimpleElement el) throws Exception {
175:                return;
176:            }
177:
178:            public DPanel getControlledPanel() {
179:                return controlledPanel;
180:            }
181:
182:            public DPanel getControlPanel() {
183:                return controlPanel;
184:            }
185:
186:            /**
187:             * Returns <tt>true</tt> if there is no elements within collection.
188:             */
189:            public boolean isEmpty() {
190:                return size() == 0;
191:            }
192:
193:            // First, the controlled panel must be created, and then the control panel
194:            public DPanel getPanel() {
195:                controlledPanel = new DTablePanel(this , "", false);
196:                controlPanel = new DTableControlPanel(this , "", true, false);
197:                return new DGroupPanel(this , new DPanel[] { controlledPanel,
198:                        controlPanel }, toName(), false, true);
199:            }
200:
201:            public String toString() {
202:                return name;
203:            }
204:
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.