/*
* Jacareto Copyright (c) 2002-2005
* Applied Computer Science Research Group, Darmstadt University of
* Technology, Institute of Mathematics & Computer Science,
* Ludwigsburg University of Education, and Computer Based
* Learning Research Group, Aachen University. All rights reserved.
*
* Jacareto is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* Jacareto is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with Jacareto; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
package jacareto.starter;
import jacareto.system.Environment;
import jacareto.system.EnvironmentMember;
import java.applet.Applet;
import java.applet.AppletContext;
import java.applet.AudioClip;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
/**
* An applet context created in an applet starter.
*
* @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
* @version 1.00
*/
public class JacaretoAppletContext extends EnvironmentMember implements AppletContext {
/** The applets. */
private Hashtable applets;
/** The streams. */
private Hashtable streams;
/**
* Creates a new applet context.
*
* @param env DOCUMENT ME!
*/
public JacaretoAppletContext (Environment env) {
super(env);
applets = new Hashtable();
streams = new Hashtable();
}
/**
* Returns the applet with the given name.
*
* @param name DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public Applet getApplet (String name) {
return (Applet) applets.get (name);
}
/**
* Returns all applets.
*
* @return all applets
*/
public Enumeration getApplets () {
return (new Vector(applets.values ())).elements ();
}
/**
* Creates an audio clip.
*
* @param url the URL of the audio clip
*
* @return the audio clip
*/
public AudioClip getAudioClip (URL url) {
return Applet.newAudioClip (url);
}
/**
* Creates an image.
*
* @param url DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public Image getImage (URL url) {
return Toolkit.getDefaultToolkit ().getImage (url);
}
/**
* Returns a stream.
*
* @param key DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public InputStream getStream (String key) {
return (InputStream) streams.get (key);
}
/**
* Returns the stream keys.
*
* @return DOCUMENT ME!
*/
public Iterator getStreamKeys () {
return (new Vector(streams.values ())).iterator ();
}
/**
* Sets a stream.
*
* @param key DOCUMENT ME!
* @param stream DOCUMENT ME!
*/
public void setStream (String key, InputStream stream) {
streams.put (key, stream);
}
/**
* Replaces the Web page currently being viewed with the given URL.
*
* @param url DOCUMENT ME!
*/
public void showDocument (URL url) {
}
/**
* Replaces the Web page currently being viewed with the given URL.
*
* @param url DOCUMENT ME!
* @param target DOCUMENT ME!
*/
public void showDocument (URL url, String target) {
}
/**
* Requests that the argument string be displayed in the "status window".
*
* @param status DOCUMENT ME!
*/
public void showStatus (String status) {
}
}
|