Source Code Cross Referenced for TableColumnModel.java in  » XML-UI » SwingML » org » swingml » model » 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 » XML UI » SwingML » org.swingml.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * SwingML Copyright (C) 2002 SwingML Team
003:         * 
004:         * This library is free software; you can redistribute it and/or modify it under
005:         * the terms of the GNU Lesser General Public License as published by the Free
006:         * Software Foundation; either version 2 of the License, or (at your option) any
007:         * later version.
008:         * 
009:         * This library is distributed in the hope that it will be useful, but WITHOUT
010:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011:         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012:         * details.
013:         * 
014:         * You should have received a copy of the GNU Lesser General Public License
015:         * along with this library; if not, write to the Free Software Foundation, Inc.,
016:         * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017:         * 
018:         * Authors: Ezequiel Cuellar <ecuellar@crosslogic.com> Farid Ibrahim
019:         * <faridibrahim@lycos.com>
020:         */
021:        package org.swingml.model;
022:
023:        import java.util.*;
024:
025:        import javax.swing.*;
026:        import javax.swing.table.*;
027:
028:        import org.swingml.*;
029:        import org.swingml.component.*;
030:        import org.swingml.system.*;
031:        import org.swingml.tablebrowser.ext.*;
032:
033:        public class TableColumnModel extends SwingMLModel {
034:
035:            private String alignment = Constants.LEFT;
036:            private TableCellEditor cellEditor;
037:            private SwingMLModel cellEditorModel;
038:            private int columnOrder = -1;
039:            private Vector items;
040:            private boolean sortable = true;
041:            private Object type;
042:            private int width = -1;
043:
044:            public TableColumnModel() {
045:                super ();
046:            }
047:
048:            public void addChild(Object aChild) {
049:
050:                if (aChild instanceof  SwingMLModel) {
051:                    setCellEditorModel((SwingMLModel) aChild);
052:                }
053:            }
054:
055:            public String getAlignment() {
056:                return alignment;
057:            }
058:
059:            public TableCellEditor getCellEditor() {
060:                return cellEditor;
061:            }
062:
063:            public SwingMLModel getCellEditorModel() {
064:                return cellEditorModel;
065:            }
066:
067:            /**
068:             * @return Returns the columnOrder.
069:             */
070:            public int getColumnOrder() {
071:                return columnOrder;
072:            }
073:
074:            public TableCellEditor getCustomEditor() {
075:                if (getCellEditor() == null) {
076:                    if (getCellEditorModel() != null) {
077:                        SwingMLModel ceModel = getCellEditorModel();
078:                        if (ceModel instanceof  JComboBoxModel) {
079:                            JComboBoxModel m = (JComboBoxModel) ceModel;
080:                            setCellEditor(new DefaultCellEditor(
081:                                    new JComboBoxComponent(m)));
082:                        } else if (ceModel instanceof  JFormattedTextFieldModel) {
083:                            JFormattedTextFieldModel m = (JFormattedTextFieldModel) ceModel;
084:                            setCellEditor(new TableBrowserCellEditor(
085:                                    new DefaultCellEditor(
086:                                            new JFormattedTextFieldComponent(m))));
087:                        } else if (ceModel instanceof  IconModel) {
088:                            setCellEditor(new IconComponentCellEditor());
089:                        }
090:                    }
091:                }
092:                return getCellEditor();
093:            }
094:
095:            public Vector getItems() {
096:                return this .items;
097:            }
098:
099:            public Object getType() {
100:                return this .type;
101:            }
102:
103:            /**
104:             * @return Returns the width.
105:             */
106:            public int getWidth() {
107:                return width;
108:            }
109:
110:            /**
111:             * Returns whether or not this column is a hidden column.
112:             * 
113:             * @return true if hidden
114:             */
115:            public boolean isHidden() {
116:                return !isVisible();
117:            }
118:
119:            public boolean isSortable() {
120:                return sortable;
121:            }
122:
123:            public void setAlignment(String anAlignment) {
124:                this .alignment = anAlignment;
125:            }
126:
127:            public void setCellEditor(TableCellEditor anEditor) {
128:                this .cellEditor = anEditor;
129:            }
130:
131:            public void setCellEditorModel(SwingMLModel aModel) {
132:                this .cellEditorModel = aModel;
133:            }
134:
135:            /**
136:             * @param order The columnOrder to set.
137:             */
138:            public void setColumnOrder(int order) {
139:                this .columnOrder = order;
140:            }
141:
142:            /**
143:             * Sets whether or not this column is a hidden column.
144:             * 
145:             * @param hidden
146:             */
147:            public void setHidden(boolean hidden) {
148:                setVisible(!hidden);
149:            }
150:
151:            public void setItems(Vector aItems) {
152:                this .items = aItems;
153:            }
154:
155:            public void setSortable(boolean isSortable) {
156:                this .sortable = isSortable;
157:            }
158:
159:            public void setType(Object aType) {
160:                this .type = aType;
161:            }
162:
163:            /**
164:             * @param aWidth The width to set.
165:             */
166:            public void setWidth(int aWidth) {
167:                this .width = aWidth;
168:            }
169:
170:            public void validate() {
171:                if (this .getType().getClass().equals(Boolean.class)
172:                        && this .getItems() != null) {
173:                    SwingMLLogger
174:                            .getInstance()
175:                            .log(
176:                                    "Syntax error: The parameter ITEMS in the element TC with text "
177:                                            + super .getText()
178:                                            + " should not be used since its TYPE is BOOLEAN.");
179:                }
180:                if ((this .getType().getClass().equals(JComboBox.class) || this 
181:                        .getType().getClass().equals(ColorComponent.class))
182:                        && this .getItems() == null) {
183:                    SwingMLLogger
184:                            .getInstance()
185:                            .log(
186:                                    "Syntax error: The parameter ITEMS in the element TC with text "
187:                                            + super .getText()
188:                                            + " should be used since its TYPE is either COMBO or COLOR.");
189:                }
190:                if (this .getType().getClass().equals(ColorComponent.class)
191:                        && this .getItems() != null) {
192:                    Object theColor = null;
193:                    String theColorName = null;
194:                    Iterator theItems = items.iterator();
195:                    while (theItems.hasNext()) {
196:                        theColorName = (String) theItems.next();
197:                        theColor = ColorComponent.getColorByName(theColorName);
198:                        if (theColor == null) {
199:                            SwingMLLogger
200:                                    .getInstance()
201:                                    .log(
202:                                            "Syntax error: The color "
203:                                                    + theColorName
204:                                                    + " specified in the ITEMS parameter in the element TC with text"
205:                                                    + super .getText()
206:                                                    + " is not supported. Verify the name of the color "
207:                                                    + theColorName + ".");
208:                        }
209:                    }
210:                }
211:            }
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.