001: package com.meterware.httpunit;
002:
003: /********************************************************************************************************************
004: * $Id: AppletStubImpl.java,v 1.2 2002/11/22 17:19:35 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.applet.AppletStub;
024: import java.applet.AppletContext;
025: import java.net.URL;
026:
027: class AppletStubImpl implements AppletStub {
028:
029: private WebApplet _webApplet;
030:
031: AppletStubImpl(WebApplet webApplet) {
032: _webApplet = webApplet;
033: }
034:
035: /**
036: * Determines if the applet is active. An applet is active just
037: * before its <code>start</code> method is called. It becomes
038: * inactive just before its <code>stop</code> method is called.
039: *
040: * @return <code>true</code> if the applet is active;
041: * <code>false</code> otherwise.
042: */
043: public boolean isActive() {
044: return false;
045: }
046:
047: /**
048: * Returns an absolute URL naming the directory of the document in which
049: * the applet is embedded. For example, suppose an applet is contained
050: * within the document:
051: * <blockquote><pre>
052: * http://java.sun.com/products/jdk/1.2/index.html
053: * </pre></blockquote>
054: * The document base is:
055: * <blockquote><pre>
056: * http://java.sun.com/products/jdk/1.2/
057: * </pre></blockquote>
058: *
059: * @return the {@link URL} of the document that contains this
060: * applet.
061: * @see AppletStub#getCodeBase()
062: */
063: public URL getDocumentBase() {
064: return null;
065: }
066:
067: /**
068: * Gets the base URL.
069: *
070: * @return the <code>URL</code> of the applet.
071: */
072: public URL getCodeBase() {
073: return null;
074: }
075:
076: /**
077: * Returns the value of the named parameter in the HTML tag. For
078: * example, if an applet is specified as
079: * <blockquote><pre>
080: * <applet code="Clock" width=50 height=50>
081: * <param name=Color value="blue">
082: * </applet>
083: * </pre></blockquote>
084: * <p>
085: * then a call to <code>getParameter("Color")</code> returns the
086: * value <code>"blue"</code>.
087: *
088: * @param name a parameter name.
089: * @return the value of the named parameter,
090: * or <tt>null</tt> if not set.
091: */
092: public String getParameter(String name) {
093: return _webApplet.getParameter(name);
094: }
095:
096: /**
097: * Gets a handler to the applet's context.
098: *
099: * @return the applet's context.
100: */
101: public AppletContext getAppletContext() {
102: return new AppletContextImpl(_webApplet);
103: }
104:
105: /**
106: * Called when the applet wants to be resized.
107: *
108: * @param width the new requested width for the applet.
109: * @param height the new requested height for the applet.
110: */
111: public void appletResize(int width, int height) {
112: }
113: }
|