Source Code Cross Referenced for ImRServerTableModel.java in  » Collaboration » JacORB » org » jacorb » imr » util » 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 » Collaboration » JacORB » org.jacorb.imr.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *        JacORB - a free Java ORB
003:         *
004:         *   Copyright (C) 1999-2004 Gerald Brose
005:         *
006:         *   This library is free software; you can redistribute it and/or
007:         *   modify it under the terms of the GNU Library General Public
008:         *   License as published by the Free Software Foundation; either
009:         *   version 2 of the License, or (at your option) any later version.
010:         *
011:         *   This library is distributed in the hope that it will be useful,
012:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *   Library General Public License for more details.
015:         *
016:         *   You should have received a copy of the GNU Library General Public
017:         *   License along with this library; if not, write to the Free
018:         *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
019:         *
020:         */
021:        package org.jacorb.imr.util;
022:
023:        import javax.swing.table.*;
024:        import org.jacorb.imr.*;
025:        import javax.swing.event.*;
026:
027:        /**
028:         * This class is the model for the server table.
029:         * On user changes, it writes back its edited cells
030:         * via the IMRModel class.
031:         *
032:         * @author Nicolas Noffke
033:         *
034:         * $Id: ImRServerTableModel.java,v 1.9 2006/06/16 12:36:28 alphonse.bendt Exp $
035:         */
036:
037:        public class ImRServerTableModel extends AbstractTableModel {
038:            private ImRModel m_model;
039:            private static final String[] m_columns = new String[] { "Name",
040:                    "Host", "Command", "active", "holding" };
041:
042:            private ServerInfo[] m_servers;
043:
044:            /**
045:             * The constructor.
046:             *
047:             * @param model the ImRModel to write changes via.
048:             */
049:            public ImRServerTableModel(ImRModel model) {
050:                m_model = model;
051:            }
052:
053:            /**
054:             * Pass in the servers the table should display.
055:             * Notify the JTable of that.
056:             *
057:             * @param servers an array containing the ServerInfo structs of the
058:             * servers to display.
059:             */
060:            public void setServers(ServerInfo[] servers) {
061:                m_servers = servers;
062:                fireTableChanged(new TableModelEvent(this ));
063:            }
064:
065:            /**
066:             * Notify the JTable that a server has been updated.
067:             *
068:             * @param index the servers index in the table.
069:             */
070:            public void serverRefreshed(int index) {
071:                fireTableRowsUpdated(index, index);
072:            }
073:
074:            /**
075:             * Get the number of rows of this table.
076:             *
077:             * @return the number of rows.
078:             */
079:            public int getRowCount() {
080:                return m_servers.length;
081:            }
082:
083:            /**
084:             * Get the number of columns of this table.
085:             *
086:             * @return the number of columns.
087:             */
088:            public int getColumnCount() {
089:                return m_columns.length;
090:            }
091:
092:            /**
093:             * Get the name of a specific column.
094:             *
095:             * @param column the columns index.
096:             * @return String the columns name.
097:             */
098:            public String getColumnName(int column) {
099:                return m_columns[column];
100:            }
101:
102:            /**
103:             * Get the class of a specific column.
104:             *
105:             * @param index the columns index.
106:             * @return the columns Class object.
107:             */
108:            public Class getColumnClass(int index) {
109:                if (index == 0 || index == 1 || index == 2)
110:                    return String.class;
111:
112:                else if (index == 3 || index == 4)
113:                    return Boolean.class;
114:
115:                else
116:                    return Object.class;
117:            }
118:
119:            /**
120:             * Get the value of a specific cell.
121:             *
122:             * @param row the cells row.
123:             * @param column the cells column.
124:             * @return the cells value.
125:             */
126:            public Object getValueAt(int row, int column) {
127:                if (column == 0)
128:                    return m_servers[row].name;
129:
130:                else if (column == 1)
131:                    return m_servers[row].host;
132:
133:                else if (column == 2)
134:                    return m_servers[row].command;
135:
136:                else if (column == 3)
137:                    return Boolean.valueOf(m_servers[row].active);
138:
139:                else if (column == 4)
140:                    return Boolean.valueOf(m_servers[row].holding);
141:
142:                return new Object();
143:            }
144:
145:            /**
146:             * Test, wheter a cell is editable.
147:             *
148:             * @param row the cells row.
149:             * @param column the cells column.
150:             *
151:             * @return true, if the cell is editable.
152:             */
153:            public boolean isCellEditable(int row, int column) {
154:                if (column >= 1) {
155:                    return true;
156:                }
157:                return false;
158:            }
159:
160:            /**
161:             * Set the value of a specific cell, i.e. the user has edited a cell.
162:             *
163:             * @param value the new value.
164:             * @param row the cells row.
165:             * @param column the cells column.
166:             */
167:            public void setValueAt(Object value, int row, int column) {
168:                m_model.updateServer(row, m_columns[column], value);
169:            }
170:        } // ImRServerTableModel
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.