Source Code Cross Referenced for CheckableTreeArray.java in  » Ajax » zk » org » zkoss » util » 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 » Ajax » zk » org.zkoss.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* CheckableTreeArray.java
002:
003:        {{IS_NOTE
004:
005:        	Purpose: 
006:        	Description: 
007:        	History:
008:        	2001/10/05 14:43:05, Create, Tom M. Yeh.
009:        }}IS_NOTE
010:
011:        Copyright (C) 2001 Potix Corporation. All Rights Reserved.
012:
013:        {{IS_RIGHT
014:        	This program is distributed under GPL Version 2.0 in the hope that
015:        	it will be useful, but WITHOUT ANY WARRANTY.
016:        }}IS_RIGHT
017:         */
018:        package org.zkoss.util;
019:
020:        import java.util.Collection;
021:        import java.util.Iterator;
022:
023:        /**
024:         * The checkable TreeArray. It extends TreeArray such that deriving
025:         * classes could add validation when an element is added, removed or set.
026:         * It is also useful to maintain the modification flag.
027:         *
028:         * @author tomyeh
029:         */
030:        public abstract class CheckableTreeArray extends TreeArray {
031:            protected CheckableTreeArray() {
032:            }
033:
034:            protected CheckableTreeArray(Collection c) {
035:                super (c);
036:            }
037:
038:            //-- deriving to override --//
039:            /** Called each time an new element is about being added into the array.
040:             *
041:             * <p>Deriving classes usually put checking codes here.
042:             * And, throws exception if failure and nothing will be affected.
043:             *
044:             * @param newElement the element to be added
045:             * @param followingElement the elment that will 'follow' the new element.
046:             * In other words, newElement will be inserted <b>before</b>
047:             * followingElement. If null, it means newElement is appended at the end
048:             */
049:            protected void onAdd(Object newElement, Object followingElement) {
050:            }
051:
052:            /** Called each time an element is about being assigned into the array
053:             * and replace an existence one (by ListIterator.set).
054:             *
055:             * <p>Deriving classes usually put checking codes here.
056:             * And, throws exception if failure and nothing will be affected.
057:             *
058:             * @param newElement the element to be added
059:             * @param replaced the element to be replaced
060:             */
061:            protected void onSet(Object newElement, Object replaced) {
062:            }
063:
064:            /** Called each time an element is about being removed from the array.
065:             * Deriving classes usually put checking codes here.
066:             * And, throws exception if failure.
067:             */
068:            protected void onRemove(Object element) {
069:            }
070:
071:            //-- TreeArray --//
072:            protected RbEntry newEntry(Object element) {
073:                return new CkEntry(element);
074:            }
075:
076:            protected class CkEntry extends RbEntry {
077:                protected CkEntry(Object element) {
078:                    super (element);
079:                }
080:
081:                public void setElement(Object element) {
082:                    onSet(element, this .element);
083:                    super .setElement(element);
084:                }
085:            }
086:
087:            protected RbEntry insert(RbEntry insertBefore, final RbEntry p) {
088:                onAdd(p.element, insertBefore != null ? insertBefore.element
089:                        : null);
090:                return super .insert(insertBefore, p);
091:            }
092:
093:            protected void delete(RbEntry p) {
094:                onRemove(p.element);
095:                super .delete(p);
096:            }
097:
098:            public void clear() {
099:                for (final Iterator iter = iterator(); iter.hasNext();)
100:                    onRemove(iter.next());
101:                super.clear();
102:            }
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.