Source Code Cross Referenced for AbstractTableModel.java in  » Ajax » NextApp-Echo2 » nextapp » echo2 » app » 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 » Ajax » NextApp Echo2 » nextapp.echo2.app.table 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * This file is part of the Echo Web Application Framework (hereinafter "Echo").
003:         * Copyright (C) 2002-2005 NextApp, Inc.
004:         *
005:         * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006:         *
007:         * The contents of this file are subject to the Mozilla Public License Version
008:         * 1.1 (the "License"); you may not use this file except in compliance with
009:         * the License. You may obtain a copy of the License at
010:         * http://www.mozilla.org/MPL/
011:         *
012:         * Software distributed under the License is distributed on an "AS IS" basis,
013:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014:         * for the specific language governing rights and limitations under the
015:         * License.
016:         *
017:         * Alternatively, the contents of this file may be used under the terms of
018:         * either the GNU General Public License Version 2 or later (the "GPL"), or
019:         * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020:         * in which case the provisions of the GPL or the LGPL are applicable instead
021:         * of those above. If you wish to allow use of your version of this file only
022:         * under the terms of either the GPL or the LGPL, and not to allow others to
023:         * use your version of this file under the terms of the MPL, indicate your
024:         * decision by deleting the provisions above and replace them with the notice
025:         * and other provisions required by the GPL or the LGPL. If you do not delete
026:         * the provisions above, a recipient may use your version of this file under
027:         * the terms of any one of the MPL, the GPL or the LGPL.
028:         */
029:
030:        package nextapp.echo2.app.table;
031:
032:        import java.io.Serializable;
033:        import java.util.EventListener;
034:
035:        import nextapp.echo2.app.event.EventListenerList;
036:        import nextapp.echo2.app.event.TableModelEvent;
037:        import nextapp.echo2.app.event.TableModelListener;
038:
039:        /**
040:         * An abstract implementation of a <code>TableModel</code>.  
041:         * This class provides the following conveniences for <code>TableModel</code>
042:         * implementation development:
043:         * <ul>
044:         *  <li>event listener management and notification</li>
045:         *  <li>a generic implementation of <code>getColumnClass()</code> which 
046:         *      returns <code>Object.class</code></li>
047:         *  <li>a generic implementation of <code>getColumnName()</code> which
048:         *      returns "spreadsheet-style" column names, i.e., 
049:         *      A, B, C...Y, Z, AA, AB, AC....</li>
050:         * </ul>
051:         * 
052:         * @see DefaultTableModel
053:         */
054:        public abstract class AbstractTableModel implements  Serializable,
055:                TableModel {
056:
057:            private EventListenerList listenerList = new EventListenerList();
058:
059:            /** 
060:             * Default constructor.
061:             */
062:            public AbstractTableModel() {
063:                super ();
064:            }
065:
066:            /**
067:             * @see nextapp.echo2.app.table.TableModel#addTableModelListener(nextapp.echo2.app.event.TableModelListener)
068:             */
069:            public void addTableModelListener(TableModelListener l) {
070:                listenerList.addListener(TableModelListener.class, l);
071:            }
072:
073:            /**
074:             * Notifies <code>TableModelListener</code>s that the contents of the cell 
075:             * at the specified coordinate were changed.
076:             *
077:             * @param column the column index
078:             * @param row the row index
079:             */
080:            public void fireTableCellUpdated(int column, int row) {
081:                fireTableChanged(new TableModelEvent(this , column, row, row,
082:                        TableModelEvent.UPDATE));
083:            }
084:
085:            /**
086:             * Notifies  <code>TableModelListener</code>s that the content of the table 
087:             * (possibly including the number of rows) was changed, but that the table's 
088:             * structure has remained intact.
089:             */
090:            public void fireTableDataChanged() {
091:                fireTableChanged(new TableModelEvent(this ));
092:            }
093:
094:            /**
095:             * Notifies <code>TableModelListener</code>s that rows from
096:             * <code>firstRow</code> to <code>lastRow</code> were deleted.
097:             *
098:             * @param firstRow the index of the first deleted row
099:             * @param lastRow the index of the last deleted row
100:             */
101:            public void fireTableRowsDeleted(int firstRow, int lastRow) {
102:                fireTableChanged(new TableModelEvent(this ,
103:                        TableModelEvent.ALL_COLUMNS, firstRow, lastRow,
104:                        TableModelEvent.DELETE));
105:            }
106:
107:            /**
108:             * Notifies <code>TableModelListener</code>s that the rows from
109:             * <code>firstRow</code> to <code>lastRow</code> were inserted. 
110:             *
111:             * @param firstRow the index of the first inserted row
112:             * @param lastRow the index of the last inserted row
113:             */
114:            public void fireTableRowsInserted(int firstRow, int lastRow) {
115:                fireTableChanged(new TableModelEvent(this ,
116:                        TableModelEvent.ALL_COLUMNS, firstRow, lastRow,
117:                        TableModelEvent.INSERT));
118:            }
119:
120:            /**
121:             * Notifies <code>TableModelListener</code>s that the data in the rows
122:             * from <code>firstRow</code> to <code>lastRow</code> was updated. 
123:             * in the specified rows was updated.
124:             *
125:             * @param firstRow the index of the first inserted row
126:             * @param lastRow the index of the last inserted row
127:             */
128:            public void fireTableRowsUpdated(int firstRow, int lastRow) {
129:                fireTableChanged(new TableModelEvent(this ,
130:                        TableModelEvent.ALL_COLUMNS, firstRow, lastRow,
131:                        TableModelEvent.UPDATE));
132:            }
133:
134:            /**
135:             * Notifies <code>TableModelListener</code> that all data in the table may
136:             * have changed, including the size and structure of the table.
137:             */
138:            public void fireTableStructureChanged() {
139:                fireTableChanged(new TableModelEvent(this ,
140:                        TableModelEvent.ALL_COLUMNS,
141:                        TableModelEvent.HEADER_ROW, TableModelEvent.HEADER_ROW,
142:                        TableModelEvent.STRUCTURE_CHANGED));
143:            }
144:
145:            /**
146:             * Notifies <code>TableModelListener</code>s of the specified event.
147:             *
148:             * @param e the event
149:             */
150:            public void fireTableChanged(TableModelEvent e) {
151:                EventListener[] listeners = listenerList
152:                        .getListeners(TableModelListener.class);
153:
154:                for (int index = 0; index < listeners.length; ++index) {
155:                    ((TableModelListener) listeners[index]).tableChanged(e);
156:                }
157:            }
158:
159:            /**
160:             * Returns <code>Object.class</code>
161:             * 
162:             * @see nextapp.echo2.app.table.TableModel#getColumnClass(int)
163:             */
164:            public Class getColumnClass(int column) {
165:                return Object.class;
166:            }
167:
168:            /**
169:             * Returns column names using a "spreadsheet-style" convention, i.e., 
170:             * A, B, C...Y, Z, AA, AB, AC...
171:             * 
172:             * @see nextapp.echo2.app.table.TableModel#getColumnName(int)
173:             */
174:            public String getColumnName(int column) {
175:                StringBuffer sb = new StringBuffer();
176:                int value = column;
177:                do {
178:                    int digit = value % 26;
179:                    sb.insert(0, (char) ('A' + digit));
180:                    value = value / 26 - 1;
181:                } while (value >= 0);
182:
183:                return sb.toString();
184:            }
185:
186:            /**
187:             * Returns the <code>EventListenerList</code> used to register listeners.
188:             * 
189:             * @return the <code>EventListenerList</code>
190:             */
191:            public EventListenerList getEventListenerList() {
192:                return listenerList;
193:            }
194:
195:            /**
196:             * @see nextapp.echo2.app.table.TableModel#removeTableModelListener(nextapp.echo2.app.event.TableModelListener)
197:             */
198:            public void removeTableModelListener(TableModelListener l) {
199:                listenerList.removeListener(TableModelListener.class, l);
200:            }
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.