Source Code Cross Referenced for FuncTestNotBrowserExample.java in  » Ajax » ItsNat » org » itsnat » feashow » features » components » functest » 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 » Ajax » ItsNat » org.itsnat.feashow.features.components.functest 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is not part of the ItsNat framework.
003:         *
004:         * Original source code use and closed source derivatives are authorized
005:         * to third parties with no restriction or fee.
006:         * The original source code is owned by the author.
007:         *
008:         * This program is distributed AS IS in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
011:         *
012:         * Author: Jose Maria Arranz Santamaria
013:         * (C) Innowhere Software Services S.L., Spanish company, year 2007
014:         */
015:
016:        package org.itsnat.feashow.features.components.functest;
017:
018:        import javax.swing.ListModel;
019:        import org.itsnat.core.ItsNatDocument;
020:        import org.itsnat.core.domutil.ItsNatTreeWalker;
021:        import org.itsnat.core.event.DOMEvent;
022:        import org.w3c.dom.Element;
023:        import org.w3c.dom.events.Event;
024:
025:        public class FuncTestNotBrowserExample {
026:            protected FuncTestNotBrowserTreeNode treeNode;
027:            protected FuncTestNotBrowserUtil util;
028:
029:            public FuncTestNotBrowserExample(FuncTestNotBrowserTreeNode treeNode) {
030:                this .treeNode = treeNode;
031:                this .util = new FuncTestNotBrowserUtil(getItsNatDocument());
032:            }
033:
034:            public ItsNatDocument getItsNatDocument() {
035:                return treeNode.getItsNatDocument();
036:            }
037:
038:            public void startTest() {
039:                ItsNatDocument itsNatDoc = getItsNatDocument();
040:
041:                removeAll(); // clears a previous bad test
042:
043:                // In alfabetical order
044:                insertCity("Barcelona", 0);
045:                insertCity("Madrid", 1);
046:                insertCity("Sevilla", 2);
047:                insertCity("Segovia", 3);
048:                insertCity("Valencia", 4);
049:                insertCity("Oviedores", 5);
050:
051:                // Uh!, "Valencia" is not in alfabetical order
052:                removeCity(4);
053:
054:                insertCity("Valencia", 5);
055:
056:                // Ah! "Oviedores" is wrong
057:                updateCity("Oviedorio", 4);
058:
059:                // Oh No! "Oviedorio" is wrong too!
060:                updateCityInPlace("Oviedo", 4);
061:
062:                boolean res = checkResult();
063:
064:                removeAll(); // clears
065:
066:                logResult(res);
067:            }
068:
069:            public void insertCity(String city, int pos) {
070:                fillCityInputBox(city);
071:                fillPosInputBox(pos);
072:                pushInsertButton();
073:            }
074:
075:            public void updateCity(String city, int pos) {
076:                fillCityInputBox(city);
077:                fillPosInputBox(pos);
078:                pushUpdateButton();
079:            }
080:
081:            public void updateCityInPlace(String city, int pos) {
082:                Element elem = editInPlace(pos);
083:                updateInputBoxInPlace(elem, city);
084:            }
085:
086:            public Element editInPlace(int pos) {
087:                ItsNatDocument itsNatDoc = getItsNatDocument();
088:                Element elem = treeNode.getList().getItsNatListMultSelUI()
089:                        .getContentElementAt(pos);
090:
091:                util.sendMouseEvent(elem, "dblclick");
092:                return elem;
093:            }
094:
095:            public void updateInputBoxInPlace(Element parent, String value) {
096:                Element inputElem = ItsNatTreeWalker
097:                        .getFirstChildElement(parent);
098:                fillTextInput(inputElem, value);
099:                util.sendHTMLEvent(inputElem, "blur");
100:            }
101:
102:            public void removeCity(int pos) {
103:                selectCity(pos);
104:                pushRemoveButton();
105:            }
106:
107:            public void fillCityInputBox(String city) {
108:                fillTextInput(treeNode.getItemInput().getHTMLInputElement(),
109:                        city);
110:            }
111:
112:            public void fillPosInputBox(int pos) {
113:                fillTextInput(treeNode.getPosInput().getHTMLInputElement(),
114:                        Integer.toString(pos));
115:            }
116:
117:            public void fillTextInput(Element elem, String value) {
118:                ItsNatDocument itsNatDoc = getItsNatDocument();
119:
120:                Event event = util.createHTMLEvent("change");
121:                ((DOMEvent) event).setExtraParam("value", value); // ItsNatHTMLInputText transports the new value by this way
122:                util.dispatchEvent(elem, event);
123:            }
124:
125:            public void pushInsertButton() {
126:                util.clickElement(treeNode.getInsertButton()
127:                        .getHTMLInputElement());
128:            }
129:
130:            public void pushUpdateButton() {
131:                util.clickElement(treeNode.getUpdateButton()
132:                        .getHTMLInputElement());
133:            }
134:
135:            public void pushRemoveButton() {
136:                util.clickElement(treeNode.getRemoveButton()
137:                        .getHTMLInputElement());
138:            }
139:
140:            public void selectCity(int pos) {
141:                selectCity(pos, false);
142:            }
143:
144:            public void selectCity(int pos, boolean shiftKey) {
145:                ItsNatDocument itsNatDoc = getItsNatDocument();
146:                Event event;
147:
148:                Element cityElem = treeNode.getList().getItsNatListMultSelUI()
149:                        .getContentElementAt(pos);
150:
151:                util.sendMouseEvent(cityElem, "click", shiftKey);
152:            }
153:
154:            public void removeAll() {
155:                ItsNatDocument itsNatDoc = getItsNatDocument();
156:                int size = treeNode.getList().getItsNatListMultSelUI()
157:                        .getLength();
158:
159:                if (size == 0)
160:                    return;
161:
162:                selectCity(0, false);
163:                selectCity(size - 1, true);
164:
165:                pushRemoveButton();
166:            }
167:
168:            public boolean checkResult() {
169:                ItsNatDocument itsNatDoc = getItsNatDocument();
170:
171:                ListModel model = treeNode.getList().getListModel();
172:                int size = model.getSize();
173:                if (size != 6)
174:                    return false;
175:                String city = (String) model.getElementAt(4);
176:                return city.equals("Oviedo");
177:            }
178:
179:            public void logResult(boolean res) {
180:                String msg;
181:                if (res)
182:                    msg = "Test OK";
183:                else
184:                    msg = "Test WRONG! Don't touch anything!";
185:
186:                ItsNatDocument itsNatDoc = getItsNatDocument();
187:                itsNatDoc.addCodeToSend("alert(\"" + msg + "\");");
188:            }
189:
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.