Source Code Cross Referenced for STableColumn.java in  » Swing-Library » wings3 » org » wings » 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 » Swing Library » wings3 » org.wings.table 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2000,2005 wingS development team.
003:         *
004:         * This file is part of wingS (http://wingsframework.org).
005:         *
006:         * wingS is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU Lesser General Public License
008:         * as published by the Free Software Foundation; either version 2.1
009:         * of the License, or (at your option) any later version.
010:         *
011:         * Please see COPYING for the complete licence.
012:         */
013:        package org.wings.table;
014:
015:        import javax.swing.*;
016:        import java.io.Serializable;
017:
018:        /**
019:         * STableColumn
020:         */
021:        public class STableColumn implements  Serializable {
022:            protected int modelIndex;
023:            protected Object identifier;
024:            protected Object headerValue;
025:            protected String width;
026:            protected boolean hidden = false;
027:            protected STableCellRenderer headerRenderer;
028:            protected STableCellRenderer cellRenderer;
029:            protected STableCellEditor cellEditor;
030:
031:            /**
032:             * Empty constructor of a table column. Assumes model index 0.
033:             */
034:            public STableColumn() {
035:                this (0);
036:            }
037:
038:            /**
039:             * Constructs a new table column.
040:             *
041:             * @param modelIndex The index of this column inside the data model.
042:             */
043:            public STableColumn(int modelIndex) {
044:                this (modelIndex, null, null, null);
045:            }
046:
047:            /**
048:             * Constructs a new table column.
049:             *
050:             * @param modelIndex The index of this column inside the data model.
051:             * @param width The desired width of this column as relative weight. (1 = default)
052:             */
053:            public STableColumn(int modelIndex, String width) {
054:                this (modelIndex, width, null, null);
055:            }
056:
057:            /**
058:             * Constructs a new table column.
059:             *
060:             * @param modelIndex The index of this column inside the data model.
061:             * @param width The desired width of this column in px.
062:             * @param cellRenderer The renderer for cells in this column
063:             * @param cellEditor The editor for cells in this column
064:             */
065:            public STableColumn(int modelIndex, String width,
066:                    STableCellRenderer cellRenderer, STableCellEditor cellEditor) {
067:                super ();
068:                this .modelIndex = modelIndex;
069:                this .width = width;
070:
071:                this .cellRenderer = cellRenderer;
072:                this .cellEditor = cellEditor;
073:                headerValue = null;
074:            }
075:
076:            /**
077:             * Sets the cmp2 index for this column. The cmp2 index is the
078:             * index of the column in the cmp2 that will be displayed by this
079:             * <code>STableColumn</code>. As the <code>STableColumn</code>
080:             * is moved around in the view the cmp2 index remains constant.
081:             *
082:             * @param modelIndex the new modelIndex
083:             * bound: true
084:             * description: The cmp2 index.
085:             */
086:            public void setModelIndex(int modelIndex) {
087:                this .modelIndex = modelIndex;
088:            }
089:
090:            /**
091:             * Returns the cmp2 index for this column.
092:             *
093:             * @return the <code>modelIndex</code> property
094:             */
095:            public int getModelIndex() {
096:                return modelIndex;
097:            }
098:
099:            /**
100:             * Sets the <code>STableColumn</code>'s identifier to
101:             * <code>anIdentifier</code>. <p>
102:             * Note: identifiers are not used by the <code>JTable</code>,
103:             * they are purely a
104:             * convenience for the external tagging and location of columns.
105:             *
106:             * @param identifier an identifier for this column
107:             * @see #getIdentifier
108:             *      bound: true
109:             *      description: A unique identifier for this column.
110:             */
111:            public void setIdentifier(Object identifier) {
112:                this .identifier = identifier;
113:            }
114:
115:            /**
116:             * Returns the <code>identifier</code> object for this column.
117:             * Note identifiers are not used by <code>JTable</code>,
118:             * they are purely a convenience for external use.
119:             * If the <code>identifier</code> is <code>null</code>,
120:             * <code>getIdentifier()</code> returns <code>getHeaderValue</code>
121:             * as a default.
122:             *
123:             * @return the <code>identifier</code> property
124:             * @see #setIdentifier
125:             */
126:            public Object getIdentifier() {
127:                return (identifier != null) ? identifier : getHeaderValue();
128:            }
129:
130:            /**
131:             * Returns the <code>Object</code> used as the value for the header
132:             * renderer.
133:             *
134:             * @return the <code>headerValue</code> property
135:             * @see #setHeaderValue
136:             */
137:            public Object getHeaderValue() {
138:                return headerValue;
139:            }
140:
141:            /**
142:             * Sets the <code>Object</code> whose string representation will be
143:             * used as the value for the header for this column.
144:             */
145:            public void setHeaderValue(Object headerValue) {
146:                this .headerValue = headerValue;
147:            }
148:
149:            //
150:            // Renderers and Editors
151:            //
152:
153:            /**
154:             * Sets the <code>TableCellRenderer</code> used to draw the
155:             * <code>STableColumn</code>'s header to <code>headerRenderer</code>.
156:             *
157:             * @param headerRenderer the new headerRenderer
158:             * @see #getHeaderRenderer
159:             *      bound: true
160:             *      description: The header renderer.
161:             */
162:            public void setHeaderRenderer(STableCellRenderer headerRenderer) {
163:                this .headerRenderer = headerRenderer;
164:            }
165:
166:            /**
167:             * Returns the <code>TableCellRenderer</code> used to draw the header of the
168:             * <code>STableColumn</code>. When the <code>headerRenderer</code> is
169:             * <code>null</code>, the <code>JTableHeader</code>
170:             * uses its <code>defaultRenderer</code>. The default value for a
171:             * <code>headerRenderer</code> is <code>null</code>.
172:             *
173:             * @return the <code>headerRenderer</code> property
174:             * @see #setHeaderRenderer
175:             * @see #setHeaderValue
176:             * @see javax.swing.table.JTableHeader#getDefaultRenderer()
177:             */
178:            public STableCellRenderer getHeaderRenderer() {
179:                return headerRenderer;
180:            }
181:
182:            /**
183:             * Sets the <code>TableCellRenderer</code> used by <code>JTable</code>
184:             * to draw individual values for this column.
185:             *
186:             * @param cellRenderer the new cellRenderer
187:             * @see #getCellRenderer bound: true
188:             *      description: The renderer to use for cell values.
189:             */
190:            public void setCellRenderer(STableCellRenderer cellRenderer) {
191:                this .cellRenderer = cellRenderer;
192:            }
193:
194:            /**
195:             * Returns the <code>TableCellRenderer</code> used by the
196:             * <code>JTable</code> to draw
197:             * values for this column.  The <code>cellRenderer</code> of the column
198:             * not only controls the visual look for the column, but is also used to
199:             * interpret the value object supplied by the <code>TableModel</code>.
200:             * When the <code>cellRenderer</code> is <code>null</code>,
201:             * the <code>JTable</code> uses a default renderer based on the
202:             * class of the cells in that column. The default value for a
203:             * <code>cellRenderer</code> is <code>null</code>.
204:             *
205:             * @return the <code>cellRenderer</code> property
206:             * @see #setCellRenderer
207:             * @see JTable#setDefaultRenderer
208:             */
209:            public STableCellRenderer getCellRenderer() {
210:                return cellRenderer;
211:            }
212:
213:            /**
214:             * Sets the editor to used by when a cell in this column is edited.
215:             *
216:             * @param cellEditor the new cellEditor
217:             * @see #getCellEditor bound: true
218:             *      description: The editor to use for cell values.
219:             */
220:            public void setCellEditor(STableCellEditor cellEditor) {
221:                this .cellEditor = cellEditor;
222:            }
223:
224:            /**
225:             * Returns the <code>TableCellEditor</code> used by the
226:             * <code>JTable</code> to edit values for this column.  When the
227:             * <code>cellEditor</code> is <code>null</code>, the <code>JTable</code>
228:             * uses a default editor based on the
229:             * class of the cells in that column. The default value for a
230:             * <code>cellEditor</code> is <code>null</code>.
231:             *
232:             * @return the <code>cellEditor</code> property
233:             * @see #setCellEditor
234:             * @see JTable#setDefaultEditor
235:             */
236:            public STableCellEditor getCellEditor() {
237:                return cellEditor;
238:            }
239:
240:            /**
241:             * The widht for this column including the unit
242:             *
243:             * @param width The width
244:             */
245:            public void setWidth(String width) {
246:                this .width = width;
247:            }
248:
249:            /**
250:             * @return The widht of this column including the unit.
251:             */
252:            public String getWidth() {
253:                return width;
254:            }
255:
256:            /**
257:             * Indicates if this column is hidden
258:             *
259:             * @return <code>true</code> if this column is invisible
260:             */
261:            public boolean isHidden() {
262:                return hidden;
263:            }
264:
265:            /**
266:             * Indicates if this column should be hidden
267:             *
268:             * @param hidden <code>true</code> if this column should be invisible
269:             */
270:            public void setHidden(boolean hidden) {
271:                this.hidden = hidden;
272:            }
273:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.