Source Code Cross Referenced for AbstractTreeTableModel.java in  » ERP-CRM-Financial » Personal-Finance-Manager » br » com » gfpshare » beans » table » 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 » ERP CRM Financial » Personal Finance Manager » br.com.gfpshare.beans.table 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved. Redistribution and use in source and binary
003:         * forms, with or without modification, are permitted provided that the following conditions are met: -
004:         * Redistributions of source code must retain the above copyright notice, this list of conditions and the
005:         * following disclaimer. - Redistribution in binary form must reproduce the above copyright notice, this list
006:         * of conditions and the following disclaimer in the documentation and/or other materials provided with the
007:         * distribution. Neither the name of Sun Microsystems, Inc. or the names of contributors may be used to
008:         * endorse or promote products derived from this software without specific prior written permission. This
009:         * software is provided "AS IS," without a warranty of any kind. ALL EXPRESS OR IMPLIED CONDITIONS,
010:         * REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
011:         * PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
012:         * OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THIS
013:         * SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
014:         * OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED
015:         * AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
016:         * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You acknowledge that this software is not
017:         * designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear
018:         * facility.
019:         */
020:
021:        package br.com.gfpshare.beans.table;
022:
023:        import javax.swing.event.EventListenerList;
024:        import javax.swing.event.TreeModelEvent;
025:        import javax.swing.event.TreeModelListener;
026:        import javax.swing.tree.TreePath;
027:
028:        /**
029:         * @version 1.2 10/27/98 An abstract implementation of the TreeTableModel interface, handling the list of
030:         *          listeners.
031:         * @author Philip Milne
032:         */
033:
034:        public abstract class AbstractTreeTableModel implements  TreeTableModel {
035:            protected Object root;
036:
037:            protected EventListenerList listenerList = new EventListenerList();
038:
039:            /**
040:             * Construtor
041:             * @param root Dado Root
042:             */
043:            public AbstractTreeTableModel(Object root) {
044:                this .root = root;
045:            }
046:
047:            /**
048:             * Construtor
049:             */
050:            public AbstractTreeTableModel() {
051:                //Nada
052:            }
053:
054:            //
055:            // Default implementations for methods in the TreeModel interface.
056:            //
057:
058:            /**
059:             * @see javax.swing.tree.TreeModel#getRoot()
060:             */
061:            public Object getRoot() {
062:                return root;
063:            }
064:
065:            protected void setRoot(Object root) {
066:                this .root = root;
067:            }
068:
069:            /**
070:             * @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object)
071:             */
072:            public boolean isLeaf(Object node) {
073:                return getChildCount(node) == 0;
074:            }
075:
076:            /**
077:             * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object)
078:             */
079:            public void valueForPathChanged(TreePath path, Object newValue) {
080:                //Não implementado
081:            }
082:
083:            /**
084:             * @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object)
085:             */
086:            public int getIndexOfChild(Object parent, Object child) {
087:                // This is not called in the JTree's default mode:
088:                // use a naive implementation.
089:                for (int i = 0; i < getChildCount(parent); i++) {
090:                    if (getChild(parent, i).equals(child)) {
091:                        return i;
092:                    }
093:                }
094:                return -1;
095:            }
096:
097:            /**
098:             * @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener)
099:             */
100:            public void addTreeModelListener(TreeModelListener l) {
101:                listenerList.add(TreeModelListener.class, l);
102:            }
103:
104:            /**
105:             * @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener)
106:             */
107:            public void removeTreeModelListener(TreeModelListener l) {
108:                listenerList.remove(TreeModelListener.class, l);
109:            }
110:
111:            /**
112:             * Notifies all listeners that have registered interest for notification on this event type. The event
113:             * instance is lazily created using the parameters passed into the fire method.
114:             * @param source
115:             * @param path
116:             * @param childIndices
117:             * @param children
118:             * 
119:             * @see EventListenerList
120:             */
121:            protected void fireTreeNodesChanged(Object source, Object[] path,
122:                    int[] childIndices, Object[] children) {
123:                // Guaranteed to return a non-null array
124:                Object[] listeners = listenerList.getListenerList();
125:                TreeModelEvent e = null;
126:                // Process the listeners last to first, notifying
127:                // those that are interested in this event
128:                for (int i = listeners.length - 2; i >= 0; i -= 2) {
129:                    if (listeners[i] == TreeModelListener.class) {
130:                        // Lazily create the event:
131:                        if (e == null)
132:                            e = new TreeModelEvent(source, path, childIndices,
133:                                    children);
134:                        ((TreeModelListener) listeners[i + 1])
135:                                .treeNodesChanged(e);
136:                    }
137:                }
138:            }
139:
140:            /**
141:             * Notifies all listeners that have registered interest for notification on this event type. The event
142:             * instance is lazily created using the parameters passed into the fire method.
143:             * @param source
144:             * @param path
145:             * @param childIndices
146:             * @param children
147:             * 
148:             * @see EventListenerList
149:             */
150:            protected void fireTreeNodesInserted(Object source, Object[] path,
151:                    int[] childIndices, Object[] children) {
152:                // Guaranteed to return a non-null array
153:                Object[] listeners = listenerList.getListenerList();
154:                TreeModelEvent e = null;
155:                // Process the listeners last to first, notifying
156:                // those that are interested in this event
157:                for (int i = listeners.length - 2; i >= 0; i -= 2) {
158:                    if (listeners[i] == TreeModelListener.class) {
159:                        // Lazily create the event:
160:                        if (e == null)
161:                            e = new TreeModelEvent(source, path, childIndices,
162:                                    children);
163:                        ((TreeModelListener) listeners[i + 1])
164:                                .treeNodesInserted(e);
165:                    }
166:                }
167:            }
168:
169:            /**
170:             * Notifies all listeners that have registered interest for notification on this event type. The event
171:             * instance is lazily created using the parameters passed into the fire method.
172:             * @param source
173:             * @param path
174:             * @param childIndices
175:             * @param children
176:             * 
177:             * @see EventListenerList
178:             */
179:            protected void fireTreeNodesRemoved(Object source, Object[] path,
180:                    int[] childIndices, Object[] children) {
181:                // Guaranteed to return a non-null array
182:                Object[] listeners = listenerList.getListenerList();
183:                TreeModelEvent e = null;
184:                // Process the listeners last to first, notifying
185:                // those that are interested in this event
186:                for (int i = listeners.length - 2; i >= 0; i -= 2) {
187:                    if (listeners[i] == TreeModelListener.class) {
188:                        // Lazily create the event:
189:                        if (e == null)
190:                            e = new TreeModelEvent(source, path, childIndices,
191:                                    children);
192:                        ((TreeModelListener) listeners[i + 1])
193:                                .treeNodesRemoved(e);
194:                    }
195:                }
196:            }
197:
198:            /**
199:             * Notifies all listeners that have registered interest for notification on this event type. The event
200:             * instance is lazily created using the parameters passed into the fire method.
201:             * @param source
202:             * @param path
203:             * @param childIndices
204:             * @param children
205:             * 
206:             * @see EventListenerList
207:             */
208:            protected void fireTreeStructureChanged(Object source,
209:                    Object[] path, int[] childIndices, Object[] children) {
210:                // Guaranteed to return a non-null array
211:                Object[] listeners = listenerList.getListenerList();
212:                TreeModelEvent e = null;
213:                // Process the listeners last to first, notifying
214:                // those that are interested in this event
215:                for (int i = listeners.length - 2; i >= 0; i -= 2) {
216:                    if (listeners[i] == TreeModelListener.class) {
217:                        // Lazily create the event:
218:                        if (e == null)
219:                            e = new TreeModelEvent(source, path, childIndices,
220:                                    children);
221:                        ((TreeModelListener) listeners[i + 1])
222:                                .treeStructureChanged(e);
223:                    }
224:                }
225:            }
226:
227:            //
228:            // Default impelmentations for methods in the TreeTableModel interface.
229:            //
230:
231:            /**
232:             * @see br.com.gfpshare.beans.table.TreeTableModel#getColumnClass(int)
233:             */
234:            public Class getColumnClass(int column) {
235:                return Object.class;
236:            }
237:
238:            /**
239:             * By default, make the column with the Tree in it the only editable one. Making this column editable
240:             * causes the JTable to forward mouse and keyboard events in the Tree column to the underlying JTree.
241:             * @param node
242:             * @param column
243:             * @return True se for editavel
244:             */
245:            public boolean isCellEditable(Object node, int column) {
246:                return getColumnClass(column) == TreeTableModel.class;
247:            }
248:
249:            /**
250:             * @see br.com.gfpshare.beans.table.TreeTableModel#setValueAt(java.lang.Object, java.lang.Object, int)
251:             */
252:            public void setValueAt(Object aValue, Object node, int column) {
253:                //Não setamos valor
254:            }
255:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.