Source Code Cross Referenced for AbstractTreeTableModel.java in  » Code-Analyzer » checkstyle » com » puppycrawl » tools » checkstyle » gui » 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 » Code Analyzer » checkstyle » com.puppycrawl.tools.checkstyle.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        ////////////////////////////////////////////////////////////////////////////////
002:        // checkstyle: Checks Java source code for adherence to a set of rules.
003:        // Copyright (C) 2001-2002  Oliver Burn
004:        //
005:        // This library is free software; you can redistribute it and/or
006:        // modify it under the terms of the GNU Lesser General Public
007:        // License as published by the Free Software Foundation; either
008:        // version 2.1 of the License, or (at your option) any later version.
009:        //
010:        // This library is distributed in the hope that it will be useful,
011:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
012:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:        // Lesser General Public License for more details.
014:        //
015:        // You should have received a copy of the GNU Lesser General Public
016:        // License along with this library; if not, write to the Free Software
017:        // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018:        ////////////////////////////////////////////////////////////////////////////////
019:
020:        /*
021:         * @(#)AbstractTreeTableModel.java	1.2 98/10/27
022:         *
023:         * Copyright 1997, 1998 by Sun Microsystems, Inc.,
024:         * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
025:         * All rights reserved.
026:         *
027:         * This software is the confidential and proprietary information
028:         * of Sun Microsystems, Inc. ("Confidential Information").  You
029:         * shall not disclose such Confidential Information and shall use
030:         * it only in accordance with the terms of the license agreement
031:         * you entered into with Sun.
032:         */
033:
034:        package com.puppycrawl.tools.checkstyle.gui;
035:
036:        import javax.swing.tree.*;
037:        import javax.swing.event.*;
038:
039:        /**
040:         * @version 1.2 10/27/98
041:         * An abstract implementation of the TreeTableModel interface, handling the list
042:         * of listeners.
043:         * @author Philip Milne
044:         */
045:
046:        public abstract class AbstractTreeTableModel implements  TreeTableModel {
047:            private Object mRoot;
048:            private final EventListenerList mListenerList = new EventListenerList();
049:
050:            public AbstractTreeTableModel(Object root) {
051:                this .mRoot = root;
052:            }
053:
054:            //
055:            // Default implmentations for methods in the TreeModel interface.
056:            //
057:
058:            public Object getRoot() {
059:                return mRoot;
060:            }
061:
062:            public boolean isLeaf(Object node) {
063:                return getChildCount(node) == 0;
064:            }
065:
066:            public void valueForPathChanged(TreePath path, Object newValue) {
067:            }
068:
069:            // This is not called in the JTree's default mode: use a naive implementation.
070:            public int getIndexOfChild(Object parent, Object child) {
071:                for (int i = 0; i < getChildCount(parent); i++) {
072:                    if (getChild(parent, i).equals(child)) {
073:                        return i;
074:                    }
075:                }
076:                return -1;
077:            }
078:
079:            public void addTreeModelListener(TreeModelListener l) {
080:                mListenerList.add(TreeModelListener.class, l);
081:            }
082:
083:            public void removeTreeModelListener(TreeModelListener l) {
084:                mListenerList.remove(TreeModelListener.class, l);
085:            }
086:
087:            /*
088:             * Notify all listeners that have registered interest for
089:             * notification on this event type.  The event instance
090:             * is lazily created using the parameters passed into
091:             * the fire method.
092:             * @see EventListenerList
093:             */
094:            protected void fireTreeNodesChanged(Object source, Object[] path,
095:                    int[] childIndices, Object[] children) {
096:                // Guaranteed to return a non-null array
097:                final Object[] listeners = mListenerList.getListenerList();
098:                TreeModelEvent e = null;
099:                // Process the listeners last to first, notifying
100:                // those that are interested in this event
101:                for (int i = listeners.length - 2; i >= 0; i -= 2) {
102:                    if (listeners[i] == TreeModelListener.class) {
103:                        // Lazily create the event:
104:                        if (e == null)
105:                            e = new TreeModelEvent(source, path, childIndices,
106:                                    children);
107:                        ((TreeModelListener) listeners[i + 1])
108:                                .treeNodesChanged(e);
109:                    }
110:                }
111:            }
112:
113:            /*
114:             * Notify all listeners that have registered interest for
115:             * notification on this event type.  The event instance
116:             * is lazily created using the parameters passed into
117:             * the fire method.
118:             * @see EventListenerList
119:             */
120:            protected void fireTreeNodesInserted(Object source, Object[] path,
121:                    int[] childIndices, Object[] children) {
122:                // Guaranteed to return a non-null array
123:                final Object[] listeners = mListenerList.getListenerList();
124:                TreeModelEvent e = null;
125:                // Process the listeners last to first, notifying
126:                // those that are interested in this event
127:                for (int i = listeners.length - 2; i >= 0; i -= 2) {
128:                    if (listeners[i] == TreeModelListener.class) {
129:                        // Lazily create the event:
130:                        if (e == null)
131:                            e = new TreeModelEvent(source, path, childIndices,
132:                                    children);
133:                        ((TreeModelListener) listeners[i + 1])
134:                                .treeNodesInserted(e);
135:                    }
136:                }
137:            }
138:
139:            /*
140:             * Notify all listeners that have registered interest for
141:             * notification on this event type.  The event instance
142:             * is lazily created using the parameters passed into
143:             * the fire method.
144:             * @see EventListenerList
145:             */
146:            protected void fireTreeNodesRemoved(Object source, Object[] path,
147:                    int[] childIndices, Object[] children) {
148:                // Guaranteed to return a non-null array
149:                final Object[] listeners = mListenerList.getListenerList();
150:                TreeModelEvent e = null;
151:                // Process the listeners last to first, notifying
152:                // those that are interested in this event
153:                for (int i = listeners.length - 2; i >= 0; i -= 2) {
154:                    if (listeners[i] == TreeModelListener.class) {
155:                        // Lazily create the event:
156:                        if (e == null)
157:                            e = new TreeModelEvent(source, path, childIndices,
158:                                    children);
159:                        ((TreeModelListener) listeners[i + 1])
160:                                .treeNodesRemoved(e);
161:                    }
162:                }
163:            }
164:
165:            /*
166:             * Notify all listeners that have registered interest for
167:             * notification on this event type.  The event instance
168:             * is lazily created using the parameters passed into
169:             * the fire method.
170:             * @see EventListenerList
171:             */
172:            protected void fireTreeStructureChanged(Object source,
173:                    Object[] path, int[] childIndices, Object[] children) {
174:                // Guaranteed to return a non-null array
175:                final Object[] listeners = mListenerList.getListenerList();
176:                TreeModelEvent e = null;
177:                // Process the listeners last to first, notifying
178:                // those that are interested in this event
179:                for (int i = listeners.length - 2; i >= 0; i -= 2) {
180:                    if (listeners[i] == TreeModelListener.class) {
181:                        // Lazily create the event:
182:                        if (e == null)
183:                            e = new TreeModelEvent(source, path, childIndices,
184:                                    children);
185:                        ((TreeModelListener) listeners[i + 1])
186:                                .treeStructureChanged(e);
187:                    }
188:                }
189:            }
190:
191:            //
192:            // Default impelmentations for methods in the TreeTableModel interface.
193:            //
194:
195:            public Class getColumnClass(int column) {
196:                return Object.class;
197:            }
198:
199:            /** By default, make the column with the Tree in it the only editable one.
200:             *  Making this column editable causes the JTable to forward mouse
201:             *  and keyboard events in the Tree column to the underlying JTree.
202:             */
203:            public boolean isCellEditable(Object node, int column) {
204:                return getColumnClass(column) == TreeTableModel.class;
205:            }
206:
207:            public void setValueAt(Object aValue, Object node, int column) {
208:            }
209:
210:            // Left to be implemented in the subclass:
211:
212:            /*
213:             *   public Object getChild(Object parent, int index)
214:             *   public int getChildCount(Object parent)
215:             *   public int getColumnCount()
216:             *   public String getColumnName(Object node, int column)
217:             *   public Object getValueAt(Object node, int column)
218:             */
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.