1 | /* AppletContext.java -- access the applet's runtime environment
|
---|
2 | Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
---|
3 |
|
---|
4 | This file is part of GNU Classpath.
|
---|
5 |
|
---|
6 | GNU Classpath is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | any later version.
|
---|
10 |
|
---|
11 | GNU Classpath is distributed in the hope that it will be useful, but
|
---|
12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
14 | General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with GNU Classpath; see the file COPYING. If not, write to the
|
---|
18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
---|
19 | 02111-1307 USA.
|
---|
20 |
|
---|
21 | Linking this library statically or dynamically with other modules is
|
---|
22 | making a combined work based on this library. Thus, the terms and
|
---|
23 | conditions of the GNU General Public License cover the whole
|
---|
24 | combination.
|
---|
25 |
|
---|
26 | As a special exception, the copyright holders of this library give you
|
---|
27 | permission to link this library with independent modules to produce an
|
---|
28 | executable, regardless of the license terms of these independent
|
---|
29 | modules, and to copy and distribute the resulting executable under
|
---|
30 | terms of your choice, provided that you also meet, for each linked
|
---|
31 | independent module, the terms and conditions of the license of that
|
---|
32 | module. An independent module is a module which is not derived from
|
---|
33 | or based on this library. If you modify this library, you may extend
|
---|
34 | this exception to your version of the library, but you are not
|
---|
35 | obligated to do so. If you do not wish to do so, delete this
|
---|
36 | exception statement from your version. */
|
---|
37 |
|
---|
38 |
|
---|
39 | package java.applet;
|
---|
40 |
|
---|
41 | import java.awt.Image;
|
---|
42 | import java.io.InputStream;
|
---|
43 | import java.io.IOException;
|
---|
44 | import java.net.URL;
|
---|
45 | import java.util.Enumeration;
|
---|
46 | import java.util.Iterator;
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * This interface allows an applet access to the browser to retrieve
|
---|
50 | * additional data files and display documents. It also allows the
|
---|
51 | * applet to find out other applets in the same document.
|
---|
52 | *
|
---|
53 | * @author Aaron M. Renn (arenn@urbanophile.com)
|
---|
54 | * @since 1.0
|
---|
55 | * @status updated to 1.4
|
---|
56 | */
|
---|
57 | public interface AppletContext
|
---|
58 | {
|
---|
59 | /**
|
---|
60 | * Returns an audio clip from the specified URL.
|
---|
61 | *
|
---|
62 | * @param url the URL of the audio clip
|
---|
63 | * @return the retrieved audio clip
|
---|
64 | * @throws NullPointerException if url is null
|
---|
65 | */
|
---|
66 | AudioClip getAudioClip(URL url);
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Returns an image from the specified URL. Note that the image is not
|
---|
70 | * actually retrieved until the applet attempts to display it, so this
|
---|
71 | * method returns immediately.
|
---|
72 | *
|
---|
73 | * @param url the absolute URL of the image
|
---|
74 | * @return the retrieved image
|
---|
75 | * @throws NullPointerException if url is null
|
---|
76 | */
|
---|
77 | Image getImage(URL url);
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Returns the applet in the document for this object that has the
|
---|
81 | * specified name.
|
---|
82 | *
|
---|
83 | * @param name the applet name
|
---|
84 | * @return the requested applet, or <code>null</code> if not found
|
---|
85 | */
|
---|
86 | Applet getApplet(String name);
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Returns a list of all the applets in the document for this object.
|
---|
90 | *
|
---|
91 | * @return a list of all the applets
|
---|
92 | */
|
---|
93 | Enumeration getApplets();
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * Displays the web page pointed to by the specified URL in the window
|
---|
97 | * for this object. This page replaces the document that is currently
|
---|
98 | * there.
|
---|
99 | *
|
---|
100 | * @param url the URL of the web page to load; unspecified on an error
|
---|
101 | */
|
---|
102 | void showDocument(URL url);
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * Displays the web page pointed to be the sepcified URL in the window
|
---|
106 | * with the specified name. The standard names "_top", "_blank",
|
---|
107 | * "_parent", and "_self" are allowed. An applet viewer may disregard
|
---|
108 | * this request.
|
---|
109 | *
|
---|
110 | * @param url the URL of the web page to load
|
---|
111 | * @param target the target window
|
---|
112 | */
|
---|
113 | void showDocument(URL url, String target);
|
---|
114 |
|
---|
115 | /**
|
---|
116 | * Displays the specified message in the status window if that window
|
---|
117 | * exists.
|
---|
118 | *
|
---|
119 | * @param message the status message, may be null
|
---|
120 | */
|
---|
121 | void showStatus(String message);
|
---|
122 |
|
---|
123 | /**
|
---|
124 | * Associate a stream to a key for this applet context, possibly replacing
|
---|
125 | * the old value. Stream associations are local to the applet context, for
|
---|
126 | * security purposes.
|
---|
127 | *
|
---|
128 | * @param key the key to associate with
|
---|
129 | * @param stream the stream value to tie to the key, or null to remove
|
---|
130 | * @throws IOException if the stream is too large
|
---|
131 | * @since 1.4
|
---|
132 | */
|
---|
133 | void setStream(String key, InputStream stream) throws IOException;
|
---|
134 |
|
---|
135 | /**
|
---|
136 | * Return the stream associated with a given key in this applet context, or
|
---|
137 | * null if nothing is associated. Stream associations are local to the
|
---|
138 | * applet context, for security purposes.
|
---|
139 | *
|
---|
140 | * @param key the key to look up
|
---|
141 | * @return the associated stream, or null
|
---|
142 | * @since 1.4
|
---|
143 | */
|
---|
144 | InputStream getStream(String key);
|
---|
145 |
|
---|
146 | /**
|
---|
147 | * Iterate over all keys that have associated streams. Stream associated
|
---|
148 | * are local to the applet context, for security purposes.
|
---|
149 | *
|
---|
150 | * @return an iterator over the association keys
|
---|
151 | * @since 1.4
|
---|
152 | */
|
---|
153 | Iterator getStreamKeys();
|
---|
154 | } // interface AppletContext
|
---|