Source Code Cross Referenced for AppletContextImpl.java in  » Testing » HttpUnit » com » meterware » httpunit » 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 » Testing » HttpUnit » com.meterware.httpunit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.meterware.httpunit;
002:
003:        /********************************************************************************************************************
004:         * $Id: AppletContextImpl.java,v 1.2 2002/11/15 01:22:37 russgold Exp $
005:         *
006:         * Copyright (c) 2002, Russell Gold
007:         *
008:         * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
009:         * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
010:         * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
011:         * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
012:         *
013:         * The above copyright notice and this permission notice shall be included in all copies or substantial portions
014:         * of the Software.
015:         *
016:         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
017:         * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018:         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
019:         * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
020:         * DEALINGS IN THE SOFTWARE.
021:         *
022:         *******************************************************************************************************************/
023:        import java.util.*;
024:        import java.applet.AppletContext;
025:        import java.applet.AudioClip;
026:        import java.applet.Applet;
027:        import java.net.URL;
028:        import java.awt.*;
029:        import java.io.InputStream;
030:        import java.io.IOException;
031:
032:        /**
033:         *
034:         * @author <a href="mailto:russgold@httpunit.org">Russell Gold</a>
035:         **/
036:        class AppletContextImpl implements  AppletContext {
037:
038:            private WebApplet _webApplet;
039:
040:            AppletContextImpl(WebApplet webApplet) {
041:                _webApplet = webApplet;
042:            }
043:
044:            /**
045:             * Creates an audio clip.
046:             *
047:             * @param   url   an absolute URL giving the location of the audio clip.
048:             * @return  the audio clip at the specified URL.
049:             */
050:            public AudioClip getAudioClip(URL url) {
051:                return null;
052:            }
053:
054:            /**
055:             * Returns an <code>Image</code> object that can then be painted on
056:             * the screen. The <code>url</code> argument<code> </code>that is
057:             * passed as an argument must specify an absolute URL.
058:             * <p>
059:             * This method always returns immediately, whether or not the image
060:             * exists. When the applet attempts to draw the image on the screen,
061:             * the data will be loaded. The graphics primitives that draw the
062:             * image will incrementally paint on the screen.
063:             *
064:             * @param   url   an absolute URL giving the location of the image.
065:             * @return  the image at the specified URL.
066:             * @see     Image
067:             */
068:            public Image getImage(URL url) {
069:                return null;
070:            }
071:
072:            /**
073:             * Finds and returns the applet in the document represented by this
074:             * applet context with the given name. The name can be set in the
075:             * HTML tag by setting the <code>name</code> attribute.
076:             *
077:             * @param   name   an applet name.
078:             * @return  the applet with the given name, or <code>null</code> if
079:             *          not found.
080:             */
081:            public Applet getApplet(String name) {
082:                try {
083:                    WebApplet[] webApplets = _webApplet.getAppletsInPage();
084:                    for (int i = 0; i < webApplets.length; i++) {
085:                        if (webApplets[i].getName().equals(name))
086:                            return webApplets[i].getApplet();
087:                    }
088:                } catch (Exception e) {
089:                }
090:                return null;
091:            }
092:
093:            /**
094:             * Finds all the applets in the document represented by this applet
095:             * context.
096:             *
097:             * @return  an enumeration of all applets in the document represented by
098:             *          this applet context.
099:             */
100:            public Enumeration getApplets() {
101:                WebApplet[] webApplets = _webApplet.getAppletsInPage();
102:                Vector v = new Vector();
103:                try {
104:                    for (int i = 0; i < webApplets.length; i++) {
105:                        v.add(webApplets[i].getApplet());
106:                    }
107:                } catch (Exception e) {
108:                    e.printStackTrace();
109:                    throw new RuntimeException(e.toString());
110:                }
111:                return v.elements();
112:            }
113:
114:            /**
115:             * Replaces the Web page currently being viewed with the given URL.
116:             * This method may be ignored by applet contexts that are not
117:             * browsers.
118:             *
119:             * @param   url   an absolute URL giving the location of the document.
120:             */
121:            public void showDocument(URL url) {
122:                showDocument(url, _webApplet.getBaseTarget());
123:            }
124:
125:            /**
126:             * Requests that the browser or applet viewer show the Web page
127:             * indicated by the <code>url</code> argument. The
128:             * <code>target</code> argument indicates in which HTML frame the
129:             * document is to be displayed.
130:             * The target argument is interpreted as follows:
131:             * <p>
132:             * <center><table border="3">
133:             * <tr><td><code>"_self"</code>  <td>Show in the window and frame that
134:             *                                   contain the applet.</tr>
135:             * <tr><td><code>"_parent"</code><td>Show in the applet's parent frame. If
136:             *                                   the applet's frame has no parent frame,
137:             *                                   acts the same as "_self".</tr>
138:             * <tr><td><code>"_top"</code>   <td>Show in the top-level frame of the applet's
139:             *                                   window. If the applet's frame is the
140:             *                                   top-level frame, acts the same as "_self".</tr>
141:             * <tr><td><code>"_blank"</code> <td>Show in a new, unnamed
142:             *                                   top-level window.</tr>
143:             * <tr><td><i>name</i><td>Show in the frame or window named <i>name</i>. If
144:             *                        a target named <i>name</i> does not already exist, a
145:             *                        new top-level window with the specified name is created,
146:             *                        and the document is shown there.</tr>
147:             * </table> </center>
148:             * <p>
149:             * An applet viewer or browser is free to ignore <code>showDocument</code>.
150:             *
151:             * @param   url   an absolute URL giving the location of the document.
152:             * @param   target   a <code>String</code> indicating where to display
153:             *                   the page.
154:             */
155:            public void showDocument(URL url, String target) {
156:                _webApplet.sendRequest(url, target);
157:            }
158:
159:            /**
160:             * Requests that the argument string be displayed in the
161:             * "status window". Many browsers and applet viewers
162:             * provide such a window, where the application can inform users of
163:             * its current state.
164:             *
165:             * @param   status   a string to display in the status window.
166:             */
167:            public void showStatus(String status) {
168:            }
169:
170:            /**
171:             * Returns the stream to which specified key is associated within this
172:             * applet context. Returns <tt>null</tt> if the applet context contains
173:             * no stream for this key.
174:             * <p>
175:             * For security reasons, mapping of streams and keys exists for each
176:             * codebase. In other words, applet from one codebase cannot access
177:             * the streams created by an applet from a different codebase
178:             * <p>
179:             * @return the stream to which this applet context maps the key
180:             * @param key key whose associated stream is to be returned.
181:             * @since JDK1.4
182:             */
183:            public InputStream getStream(String key) {
184:                return null;
185:            }
186:
187:            /**
188:             * Finds all the keys of the streams in this applet context.
189:             * <p>
190:             * For security reasons, mapping of streams and keys exists for each
191:             * codebase. In other words, applet from one codebase cannot access
192:             * the streams created by an applet from a different codebase
193:             * <p>
194:             * @return  an Iterator of all the names of the streams in this applet
195:             *          context.
196:             * @since JDK1.4
197:             */
198:            public Iterator getStreamKeys() {
199:                return null;
200:            }
201:
202:            /**
203:             * Associates the specified stream with the specified key in this
204:             * applet context. If the applet context previously contained a mapping
205:             * for this key, the old value is replaced.
206:             * <p>
207:             * For security reasons, mapping of streams and keys exists for each
208:             * codebase. In other words, applet from one codebase cannot access
209:             * the streams created by an applet from a different codebase
210:             * <p>
211:             * @param key key with which the specified value is to be associated.
212:             * @param stream stream to be associated with the specified key. If this
213:             *               parameter is <code>null<code>, the specified key is removed
214:             *               in this applet context.
215:             * @throws <code>IOException</code> if the stream size exceeds a certain
216:             *         size limit. Size limit is decided by the implementor of this
217:             *         interface.
218:             * @since JDK1.4
219:             */
220:            public void setStream(String key, InputStream stream)
221:                    throws IOException {
222:            }
223:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.