Source Code Cross Referenced for FormsModel.java in  » Swing-Library » abeille-forms-designer » com » jeta » swingbuilder » gui » formmgr » 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 » abeille forms designer » com.jeta.swingbuilder.gui.formmgr 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2005 Jeff Tassin
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2.1 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:
019:        package com.jeta.swingbuilder.gui.formmgr;
020:
021:        import java.util.ArrayList;
022:        import java.util.Collection;
023:        import java.util.Iterator;
024:
025:        import javax.swing.table.AbstractTableModel;
026:
027:        import com.jeta.forms.gui.form.FormComponent;
028:        import com.jeta.forms.gui.formmgr.FormManager;
029:        import com.jeta.open.i18n.I18N;
030:        import com.jeta.open.registry.JETARegistry;
031:
032:        /**
033:         * This class is the table model for the FormManagerView. It gets the list of
034:         * forms from the FormManager and stores them in this model. This is mainly used
035:         * to help debugging.
036:         * 
037:         * @author Jeff Tassin
038:         */
039:        public class FormsModel extends AbstractTableModel {
040:            /** an array of Trigger object */
041:            private ArrayList m_data;
042:
043:            /** an array of column names for the table */
044:            private String[] m_colnames;
045:
046:            /** an array of column types for the table */
047:            private Class[] m_coltypes;
048:
049:            /** column definitions */
050:            static final int EMBEDDED_COLUMN = 0;
051:            static final int ID_COLUMN = 1;
052:            static final int NAME_COLUMN = 2;
053:            static final int PARENT_COLUMN = 3;
054:
055:            /**
056:             * ctor.
057:             */
058:            public FormsModel() {
059:                super ();
060:
061:                m_data = new ArrayList();
062:
063:                String[] values = { I18N.getLocalizedMessage("Embedded"),
064:                        I18N.getLocalizedMessage("Form Id"),
065:                        I18N.getLocalizedMessage("Name"),
066:                        I18N.getLocalizedMessage("Parent Form Id") };
067:
068:                m_colnames = values;
069:
070:                Class[] types = { Boolean.class, String.class, String.class,
071:                        String.class };
072:                m_coltypes = types;
073:                reload();
074:            }
075:
076:            /**
077:             * Adds the given trigger object to the table
078:             */
079:            public void addRow(FormComponent fc) {
080:                if (m_data == null)
081:                    m_data = new ArrayList();
082:
083:                m_data.add(fc);
084:                fireTableRowsInserted(m_data.size() - 1, m_data.size() - 1);
085:            }
086:
087:            /**
088:             * @return the number of columns in this model
089:             */
090:            public int getColumnCount() {
091:                return m_colnames.length;
092:            }
093:
094:            /**
095:             * @return the number of rows objects in this model
096:             */
097:            public int getRowCount() {
098:                return m_data.size();
099:            }
100:
101:            /**
102:             * @return the name of a column at a given index
103:             */
104:            public String getColumnName(int column) {
105:                return m_colnames[column];
106:            }
107:
108:            /**
109:             * @return the type of column at a given index
110:             */
111:            public Class getColumnClass(int column) {
112:                return m_coltypes[column];
113:            }
114:
115:            /**
116:             * @return the object at the given row in the model
117:             */
118:            public FormComponent getRow(int row) {
119:                if (row >= 0 && row < m_data.size())
120:                    return (FormComponent) m_data.get(row);
121:                else
122:                    return null;
123:            }
124:
125:            /**
126:             * @return the column value at the given row
127:             */
128:            public Object getValueAt(int row, int column) {
129:                /** "Embedded", "Form Id", "Name", "Parent Id" */
130:                FormComponent fc = getRow(row);
131:                if (column == EMBEDDED_COLUMN) {
132:                    return Boolean.valueOf(fc.isEmbedded());
133:                } else if (column == ID_COLUMN) {
134:                    return fc.getId();
135:                } else if (column == NAME_COLUMN) {
136:                    return fc.getChildView().getName();
137:                } else if (column == PARENT_COLUMN) {
138:                    FormComponent parent = fc.getParentForm();
139:                    if (parent == null)
140:                        return "null";
141:                    else
142:                        return parent.getId();
143:                } else
144:                    return "";
145:            }
146:
147:            /**
148:             * Reload the model
149:             */
150:            public void reload() {
151:                removeAll();
152:                FormManager fm = (FormManager) JETARegistry
153:                        .lookup(FormManager.COMPONENT_ID);
154:                Collection form_ids = fm.getForms();
155:                Iterator iter = form_ids.iterator();
156:                while (iter.hasNext()) {
157:                    String form_id = (String) iter.next();
158:                    addRow(fm.getForm(form_id));
159:                }
160:            }
161:
162:            /**
163:             * Remove all data items from this model
164:             */
165:            public void removeAll() {
166:                m_data.clear();
167:            }
168:
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.