Source Code Cross Referenced for TableColumn.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.beans.PropertyChangeListener;
033:        import java.beans.PropertyChangeSupport;
034:        import java.io.Serializable;
035:
036:        import nextapp.echo2.app.Extent;
037:
038:        /**
039:         * A description of a single column of a <code>Table</code>.
040:         */
041:        public class TableColumn implements  Serializable {
042:
043:            public static final String CELL_RENDERER_CHANGED_PROPERTY = "cellRenderer";
044:            public static final String HEADER_RENDERER_CHANGED_PROPERTY = "headerRenderer";
045:            public static final String HEADER_VALUE_CHANGED_PROPERTY = "headerValue";
046:            public static final String IDENTIFIER_CHANGED_PROPERTY = "identifier";
047:            public static final String MODEL_INDEX_CHANGED_PROPERTY = "modelIndex";
048:            public static final String WIDTH_CHANGED_PROPERTY = "width";
049:
050:            private Extent width;
051:            private TableCellRenderer cellRenderer;
052:            private TableCellRenderer headerRenderer;
053:            private Object headerValue;
054:            private int modelIndex;
055:            private Object identifier;
056:            private PropertyChangeSupport pcs = new PropertyChangeSupport(this );
057:
058:            /**
059:             * Creates a <code>TableColumn</code> with the specified model index, 
060:             * undefined width, and undefined cell and header renderers.
061:             *
062:             * @param modelIndex the column index of model data visualized by this 
063:             *        column
064:             */
065:            public TableColumn(int modelIndex) {
066:                this (modelIndex, null, null, null);
067:            }
068:
069:            /**
070:             * Creates a TableColumn with the specified model index and width, 
071:             * and undefined cell and header renderers.
072:             * 
073:             * @param modelIndex the column index of model data visualized by this 
074:             *        column
075:             * @param width the column width
076:             */
077:            public TableColumn(int modelIndex, Extent width) {
078:                this (modelIndex, width, null, null);
079:            }
080:
081:            /**
082:             * Creates a TableColumn with the specified model index, width, 
083:             * and cell and header renderers.
084:             * 
085:             * @param modelIndex the column index of model data visualized by this 
086:             *        column
087:             * @param width the column width
088:             * @param cellRenderer the renderer to use for rendering model values
089:             * @param headerRenderer the renderer to use for rendering the header cell
090:             */
091:            public TableColumn(int modelIndex, Extent width,
092:                    TableCellRenderer cellRenderer,
093:                    TableCellRenderer headerRenderer) {
094:                super ();
095:
096:                this .modelIndex = modelIndex;
097:                this .width = width;
098:                setCellRenderer(cellRenderer);
099:                setHeaderRenderer(headerRenderer);
100:            }
101:
102:            /**
103:             * Adds a <code>PropertyChangeListener</code> to be notified
104:             * of property changes to the column.
105:             *
106:             * @param l the listener to add
107:             */
108:            public void addPropertyChangeListener(PropertyChangeListener l) {
109:                pcs.addPropertyChangeListener(l);
110:            }
111:
112:            /** 
113:             * Retrieves the <code>TableCellRenderer</code> used to render values
114:             * contained in the column.  The value of this property may be null,
115:             * in which case the table should revert to using its default cell
116:             * renderer.
117:             *
118:             * @return the cell renderer for this column
119:             */
120:            public TableCellRenderer getCellRenderer() {
121:                return cellRenderer;
122:            }
123:
124:            /**
125:             * Returns the <code>TableCellRenderer</code> used to render the
126:             * header cell of this column.  The value of this property may be null,
127:             * in which case the table should revert to using its default cell
128:             * renderer.
129:             *
130:             * @return the header cell renderer for this column
131:             */
132:            public TableCellRenderer getHeaderRenderer() {
133:                return headerRenderer;
134:            }
135:
136:            /** 
137:             * Returns the header value for this column.  The header value is the 
138:             * object that will be provided to the header renderer to produce
139:             * a component that will be used as the table header for this column.
140:             *
141:             * @return the header value for this column
142:             */
143:            public Object getHeaderValue() {
144:                return headerValue;
145:            }
146:
147:            /**
148:             * Returns the identifier for this column.   Each table column may have
149:             * an identifier.  Identifiers are provided as a convenience to the
150:             * application developer, and are neither used nor required by the
151:             * <code>Table</code> component.
152:             *
153:             * @return the identifier for this column
154:             */
155:            public Object getIdentifier() {
156:                return identifier;
157:            }
158:
159:            /**
160:             * Returns the column index of the model which this 
161:             * <code>TableColumn</code> represents.  
162:             * This value is independent of the column's position within the column 
163:             * model, such that columns may be displayed in an arbitrary order.
164:             *
165:             * @return the index of the column in the model
166:             */
167:            public int getModelIndex() {
168:                return modelIndex;
169:            }
170:
171:            /** 
172:             * Returns the width of the column.
173:             * This property supports <code>Extent</code>s with
174:             * fixed or percentile units.
175:             *
176:             * @return the width
177:             */
178:            public Extent getWidth() {
179:                return width;
180:            }
181:
182:            /**
183:             * Removes a <code>PropertyChangeListener</code> from being notified
184:             * of property changes to the column. 
185:             *
186:             * @param l the listener to remove
187:             */
188:            public void removePropertyChangeListener(PropertyChangeListener l) {
189:                pcs.removePropertyChangeListener(l);
190:            }
191:
192:            /** 
193:             * Sets the <code>TableCellRenderer</code> used to render values
194:             * contained in the column.  The value of this property may be null,
195:             * in which case the table should revert to using its default cell
196:             * renderer.
197:             *
198:             * @param newValue the new cell renderer
199:             */
200:            public void setCellRenderer(TableCellRenderer newValue) {
201:                TableCellRenderer oldValue = cellRenderer;
202:                cellRenderer = newValue;
203:                pcs.firePropertyChange(CELL_RENDERER_CHANGED_PROPERTY,
204:                        oldValue, newValue);
205:            }
206:
207:            /** 
208:             * Sets the <code>TableCellRenderer</code> used to render the
209:             * header cell of this column.  The value of this property may be null,
210:             * in which case the table should revert to using its default cell
211:             * renderer.
212:             *
213:             * @param newValue the new header cell renderer
214:             */
215:            public void setHeaderRenderer(TableCellRenderer newValue) {
216:                TableCellRenderer oldValue = headerRenderer;
217:                headerRenderer = newValue;
218:                pcs.firePropertyChange(HEADER_RENDERER_CHANGED_PROPERTY,
219:                        oldValue, newValue);
220:            }
221:
222:            /** 
223:             * Sets the header value for this column.  The header value is the 
224:             * object that will be provided to the header renderer to produce
225:             * a component that will be used as the table header for this column.
226:             *
227:             * @param newValue the new header value
228:             */
229:            public void setHeaderValue(Object newValue) {
230:                Object oldValue = headerValue;
231:                headerValue = newValue;
232:                pcs.firePropertyChange(HEADER_VALUE_CHANGED_PROPERTY, oldValue,
233:                        newValue);
234:            }
235:
236:            /**
237:             * Sets the identifier for this column.  Each table column may have
238:             * an identifier.  Identifiers are provided as a convenience to the
239:             * application developer, and are neither used nor required by the
240:             * Table component.
241:             *
242:             * @param newValue The new identifier for this column.
243:             */
244:            public void setIdentifier(Object newValue) {
245:                Object oldValue = identifier;
246:                identifier = newValue;
247:                pcs.firePropertyChange(IDENTIFIER_CHANGED_PROPERTY, oldValue,
248:                        newValue);
249:            }
250:
251:            /**
252:             * Sets the index of the column in the <code>TableModel</code> which
253:             * this <code>TableColumn</code> object represents.  This value is
254:             * independent of the column's position within the column model, such that
255:             * columns may be displayed in an arbitrary order.
256:             *
257:             * @param newValue the index of the column in the model
258:             */
259:            public void setModelIndex(int newValue) {
260:                int oldValue = modelIndex;
261:                modelIndex = newValue;
262:                pcs.firePropertyChange(MODEL_INDEX_CHANGED_PROPERTY, oldValue,
263:                        newValue);
264:            }
265:
266:            /** 
267:             * Sets the width of the column.
268:             * This property supports <code>Extent</code>s with
269:             * fixed or percentile units.
270:             *
271:             * @param newValue the new width
272:             */
273:            public void setWidth(Extent newValue) {
274:                Extent oldValue = width;
275:                width = newValue;
276:                pcs.firePropertyChange(WIDTH_CHANGED_PROPERTY, oldValue,
277:                        newValue);
278:            }
279:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.