Source Code Cross Referenced for AbstractTreeModel.java in  » Database-Client » iSQL-Viewer » org » isqlviewer » swing » 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 Client » iSQL Viewer » org.isqlviewer.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the Mozilla Public License
003:         * Version 1.1 (the "License"); you may not use this file except in
004:         * compliance with the License. You may obtain a copy of the License at
005:         * http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
009:         * License for the specific language governing rights and limitations
010:         * under the License.
011:         * 
012:         * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
013:         *
014:         * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
015:         * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
016:         *
017:         * Contributor(s): 
018:         *  Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
019:         *  
020:         * If you didn't download this code from the following link, you should check
021:         * if you aren't using an obsolete version: http://www.isqlviewer.com
022:         */
023:        package org.isqlviewer.swing;
024:
025:        import javax.swing.event.EventListenerList;
026:        import javax.swing.event.TreeModelEvent;
027:        import javax.swing.event.TreeModelListener;
028:        import javax.swing.tree.TreeModel;
029:
030:        import org.isqlviewer.util.LoggableObject;
031:
032:        /**
033:         * Base class for tree models.
034:         * <p>
035:         * Since the JDK does not provide any kind of abstract tree model where it really just implements the model listener
036:         * code, i.e. AbstractTableModel. This class is here to remedy that lacking, since often the DefaultTreeModel is
037:         * cumbersome to work with dealing with all those TreeNode classes.
038:         * <p>
039:         * All this class does implements is your basic fireXXXX methods for TreeModelListeners and has the implementation for
040:         * adding and removing those listeners from the model every thing else is up to childeren of this class.
041:         * 
042:         * @author Markus A. Kobold &lt;mkobold at sprintpcs dot com&gt;
043:         */
044:        public abstract class AbstractTreeModel extends LoggableObject
045:                implements  TreeModel {
046:
047:            protected transient EventListenerList eventListeners = new EventListenerList();
048:
049:            public synchronized final void removeTreeModelListener(
050:                    TreeModelListener l) {
051:
052:                eventListeners.remove(TreeModelListener.class, l);
053:            }
054:
055:            public synchronized final void addTreeModelListener(
056:                    TreeModelListener l) {
057:
058:                eventListeners.add(TreeModelListener.class, l);
059:            }
060:
061:            /**
062:             * Utility method for notifying listeners that the enitre tree has been reloaded.
063:             * <p>
064:             * All this method does is dispatch a TreeModelEvent with the root node of this model.
065:             * 
066:             * @see #fireTreeStructureChanged(TreeModelEvent)
067:             */
068:            public void reload() {
069:
070:                fireTreeStructureChanged(new TreeModelEvent(this ,
071:                        new Object[] { getRoot() }, null, null));
072:            }
073:
074:            /**
075:             * Notifies the model listeners of a treeNodesChanged event.
076:             * <p>
077:             * Iterates through the current listener list, and calls the treeNodesChanged method for the listener. If the model
078:             * listener throws an an exception or error it will be silently ignored and this method will continue to dispatch
079:             * the event until all listeners have been notified.
080:             * 
081:             * @see TreeModelListener#treeNodesChanged(javax.swing.event.TreeModelEvent)
082:             * @param e TreeModelEvent to dispatch.
083:             */
084:            protected void fireTreeNodesChanged(TreeModelEvent e) {
085:
086:                TreeModelListener[] listenerList = eventListeners
087:                        .getListeners(TreeModelListener.class);
088:                if (listenerList != null) {
089:                    for (int i = 0; i < listenerList.length; i++) {
090:                        try {
091:
092:                            listenerList[i].treeNodesChanged(e);
093:                        } catch (Exception error) {
094:                            error("Error Dispatching TreeEvent(" + e + ")",
095:                                    error);
096:                        }
097:                    }
098:                }
099:            }
100:
101:            /**
102:             * Notifies the model listeners of a treeNodesInserted event.
103:             * <p>
104:             * Iterates through the current listener list, and calls the treeNodesInserted method for the listener. If the model
105:             * listener throws an an exception or error it will be silently ignored and this method will continue to dispatch
106:             * the event until all listeners have been notified.
107:             * 
108:             * @see TreeModelListener#treeNodesInserted(javax.swing.event.TreeModelEvent)
109:             * @param e TreeModelEvent to dispatch.
110:             */
111:            protected void fireTreeNodesInserted(TreeModelEvent e) {
112:
113:                TreeModelListener[] listenerList = eventListeners
114:                        .getListeners(TreeModelListener.class);
115:                if (listenerList != null) {
116:                    for (int i = 0; i < listenerList.length; i++) {
117:                        try {
118:                            listenerList[i].treeNodesInserted(e);
119:                        } catch (Exception error) {
120:                            error("Error Dispatching TreeEvent(" + e + ")",
121:                                    error);
122:                        }
123:                    }
124:                }
125:            }
126:
127:            /**
128:             * Notifies the model listeners of a treeNodesRemoved event.
129:             * <p>
130:             * Iterates through the current listener list, and calls the treeNodesRemoved method for the listener. If the model
131:             * listener throws an an exception or error it will be silently ignored and this method will continue to dispatch
132:             * the event until all listeners have been notified.
133:             * 
134:             * @see TreeModelListener#treeNodesRemoved(javax.swing.event.TreeModelEvent)
135:             * @param e TreeModelEvent to dispatch.
136:             */
137:            protected void fireTreeNodesRemoved(TreeModelEvent e) {
138:
139:                TreeModelListener[] listenerList = eventListeners
140:                        .getListeners(TreeModelListener.class);
141:                if (listenerList != null) {
142:                    for (int i = 0; i < listenerList.length; i++) {
143:                        try {
144:                            listenerList[i].treeNodesRemoved(e);
145:                        } catch (Exception error) {
146:                            error("Error Dispatching TreeEvent(" + e + ")",
147:                                    error);
148:                        }
149:                    }
150:                }
151:            }
152:
153:            /**
154:             * Notifies the model listeners of a treeStructureChanged event.
155:             * <p>
156:             * Iterates through the current listener list, and calls the treeStructureChanged method for the listener. If the
157:             * model listener throws an an exception or error it will be silently ignored and this method will continue to
158:             * dispatch the event until all listeners have been notified.
159:             * 
160:             * @see TreeModelListener#treeStructureChanged(javax.swing.event.TreeModelEvent)
161:             * @param e TreeModelEvent to dispatch.
162:             */
163:            protected void fireTreeStructureChanged(TreeModelEvent e) {
164:
165:                TreeModelListener[] listenerList = eventListeners
166:                        .getListeners(TreeModelListener.class);
167:                if (listenerList != null) {
168:                    for (int i = 0; i < listenerList.length; i++) {
169:                        try {
170:                            listenerList[i].treeStructureChanged(e);
171:                        } catch (Exception error) {
172:                            error("Error Dispatching TreeEvent(" + e + ")",
173:                                    error);
174:                        }
175:                    }
176:                }
177:            }
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.