Source Code Cross Referenced for JonasAdminUtils.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » jonasadmin » test » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.jonasadmin.test.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 2005 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or 1any 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:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: JonasAdminUtils.java 7196 2005-08-10 14:36:20Z kemlerp $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.jonasadmin.test.util;
025:
026:        import org.xml.sax.SAXException;
027:
028:        import com.meterware.httpunit.TableCell;
029:        import com.meterware.httpunit.WebResponse;
030:        import com.meterware.httpunit.WebTable;
031:
032:        /**
033:         * Utils
034:         * @author kemlerp
035:         *
036:         */
037:        public class JonasAdminUtils {
038:
039:            /**
040:             * A class which represents the row and the column of a cell
041:             * @author kemlerp
042:             *
043:             */
044:            public class CoordCell {
045:
046:                /**
047:                 * Row of the cell
048:                 */
049:                private Integer row = null;
050:
051:                /**
052:                 * Column of the cell
053:                 */
054:                private Integer column = null;
055:
056:                /**
057:                 * Constructor
058:                 * @param row a positive integer
059:                 * @param column a positive integer
060:                 */
061:                public CoordCell(Integer row, Integer column) {
062:                    this .row = row;
063:                    this .column = column;
064:                }
065:
066:                /**
067:                 * Get column
068:                 * @return column number
069:                 */
070:                public Integer getColumn() {
071:                    return column;
072:                }
073:
074:                /**
075:                 * Set column
076:                 * @param column a positive integer
077:                 */
078:                public void setColumn(Integer column) {
079:                    this .column = column;
080:                }
081:
082:                /**
083:                 * Get row
084:                 * @return row number
085:                 */
086:                public Integer getRow() {
087:                    return row;
088:                }
089:
090:                /**
091:                 * Set row
092:                 * @param row a positive integer
093:                 */
094:                public void setRow(Integer row) {
095:                    this .row = row;
096:                }
097:            }
098:
099:            /**
100:             * Get the last row of table where text is found in the first column
101:             * @param text title of the row
102:             * @param table the table which contains text
103:             * @return -1 if the text was not found in the first column else an integer
104:             */
105:            public Integer getRow(String text, WebTable table) {
106:                Integer row = new Integer(-1);
107:                TableCell cell;
108:                for (int i = 0; i < table.getRowCount(); i++) {
109:                    cell = table.getTableCell(i, 0);
110:                    if (cell.getText().indexOf(text) != -1) {
111:                        row = new Integer(i);
112:                    }
113:                }
114:                return row;
115:            }
116:
117:            /**
118:             * Get the first row of table where text is found in the given column
119:             * @param text title of the row
120:             * @param table the table which contains text
121:             * @param column the column
122:             * @return -1 if the text was not found in the first column else an integer
123:             */
124:            public Integer getFirstRow(String text, WebTable table, int column) {
125:                boolean found = false;
126:                Integer row = new Integer(-1);
127:                TableCell cell;
128:                int i = 0;
129:                while (i < table.getRowCount() && !found) {
130:                    cell = table.getTableCell(i, column);
131:                    if (cell != null && cell.getText().indexOf(text) != -1) {
132:                        row = new Integer(i);
133:                        found = true;
134:                    }
135:                    i++;
136:                }
137:                return row;
138:            }
139:
140:            /**
141:             * Get the last row of table where text is found in the given column
142:             * @param text title of the row
143:             * @param table the table which contains text
144:             * @param column the column
145:             * @return -1 if the text was not found in the first column else an integer
146:             */
147:            public Integer getRow(String text, WebTable table, int column) {
148:                Integer row = new Integer(-1);
149:                TableCell cell;
150:                for (int i = 0; i < table.getRowCount(); i++) {
151:                    cell = table.getTableCell(i, column);
152:                    if (cell.getText().indexOf(text) != -1) {
153:                        row = new Integer(i);
154:                    }
155:                }
156:                return row;
157:            }
158:
159:            /**
160:             * Get the last column of table where text is found in the first row
161:             * @param text title of the column
162:             * @param table the table which contains text
163:             * @return -1 if the text was not found in the first row else an integer
164:             */
165:            public Integer getColumn(String text, WebTable table) {
166:                Integer column = new Integer(-1);
167:                TableCell cell;
168:                for (int i = 0; i < table.getColumnCount(); i++) {
169:                    cell = table.getTableCell(0, i);
170:                    if (cell.getText().indexOf(text) != -1) {
171:                        column = new Integer(i);
172:                    }
173:                }
174:                return column;
175:            }
176:
177:            /**
178:             * Get the row and the column of the cell which contains selected item
179:             * @param table tree Table
180:             * @return Null if no item is selected, else the row and the column
181:             */
182:            public CoordCell getSelectedItemRow(WebTable table) {
183:                Integer row = null;
184:                Integer column = null;
185:                TableCell cell = null;
186:                CoordCell coord = null;
187:                String attribut;
188:                boolean found = false;
189:                int i = 0;
190:                int j = 0;
191:
192:                while (i < table.getRowCount() && !found) {
193:                    j = 0;
194:                    while (j < table.getColumnCount() && !found) {
195:                        cell = table.getTableCell(i, j);
196:                        if (cell.getElementsWithAttribute("class",
197:                                "tree-control-selected").length == 1) {
198:                            found = true;
199:                            row = new Integer(i);
200:                            column = new Integer(j);
201:                            coord = new CoordCell(row, column);
202:                        }
203:                        j++;
204:                    }
205:                    i++;
206:                }
207:                return coord;
208:            }
209:
210:            /**
211:             * Get table num
212:             * @param contentFrame the content frame
213:             * @param num integer between 0 and number of tables in the cell
214:             * @return table
215:             * @throws SAXException if a table or a cell doesn't match.
216:             */
217:            public WebTable getTable(WebResponse contentFrame, int num)
218:                    throws SAXException {
219:                WebTable table = contentFrame.getTables()[1];
220:                TableCell cell = table.getTableCell(1, 0);
221:                table = cell.getTables()[0];
222:                cell = table.getTableCell(0, 0);
223:                table = cell.getTables()[0];
224:                cell = table.getTableCell(0, 0);
225:                // Get the (num+1)th table
226:                table = cell.getTables()[num];
227:                return table;
228:            }
229:
230:            /**
231:             * Get table of tabs
232:             * @param contentFrame the content frame
233:             * @return table of tabs
234:             * @throws SAXException if a table or a cell doesn't match.
235:             */
236:            public WebTable getTabTable(WebResponse contentFrame)
237:                    throws SAXException {
238:                WebTable table = contentFrame.getTables()[1];
239:                TableCell cell = table.getTableCell(0, 0);
240:                table = cell.getTables()[0];
241:                return table;
242:            }
243:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.