Class MainAppletContext


  • public class MainAppletContext
    extends java.lang.Object
    This class provides a means whereby tools can temporarily give access to a shared AppletContext and applet instance(s) which will be used in AppletContext tests.

    With hindsight, this code should probably be in com.sun.javatest.agent but the tests expect the class to be here in com.sun.javatest.util.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.applet.Applet getAgentApplet()
      Get the applet that has been identified as the JT Harness Agent applet.
      static java.applet.Applet getApplet​(java.lang.String name)
      Get the applet that has been registered with a given name.
      static java.applet.AppletContext getAppletContext()
      Get the current AppletContext.
      static java.util.Set<java.lang.String> getAppletNames()
      Get an enumeration of all the names that have been used to register applets.
      static boolean isStarted()
      Check the flag that indicates whether the agent applet has been started.
      static void putApplet​(java.lang.String name, java.applet.Applet applet)
      Register an applet in a table of applets.
      static void setAgentApplet​(java.applet.Applet applet)
      Set the applet to be identified as the JT Harness Agent applet.
      static void setAppletContext​(java.applet.AppletContext ctx)
      Set the AppletContext in use, so that it might be shared.
      static void setStarted​(boolean value)
      Set a flag to indicate that the agent applet has been started.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MainAppletContext

        public MainAppletContext()
    • Method Detail

      • getAppletContext

        public static java.applet.AppletContext getAppletContext()
        Get the current AppletContext.
        Returns:
        the current AppletContext, or null if it has been set.
        See Also:
        setAppletContext(java.applet.AppletContext)
      • setAppletContext

        public static void setAppletContext​(java.applet.AppletContext ctx)
        Set the AppletContext in use, so that it might be shared.
        Parameters:
        ctx - the AppletContext to be shared.
        See Also:
        getAppletContext()
      • putApplet

        public static void putApplet​(java.lang.String name,
                                     java.applet.Applet applet)
        Register an applet in a table of applets.
        Parameters:
        name - the name with which to register the applet
        applet - the applet to be registered
        See Also:
        getApplet(java.lang.String), getAppletNames()
      • getApplet

        public static java.applet.Applet getApplet​(java.lang.String name)
        Get the applet that has been registered with a given name.
        Parameters:
        name - the name of the applet to return
        Returns:
        the applet that has been registered with the given name
      • getAppletNames

        public static java.util.Set<java.lang.String> getAppletNames()
        Get an enumeration of all the names that have been used to register applets.
        Returns:
        an enumeration of all the names that have been used to register applets
      • getAgentApplet

        public static java.applet.Applet getAgentApplet()
        Get the applet that has been identified as the JT Harness Agent applet.
        Returns:
        the Javatest Agent applet
        See Also:
        setAgentApplet(java.applet.Applet)
      • setAgentApplet

        public static void setAgentApplet​(java.applet.Applet applet)
        Set the applet to be identified as the JT Harness Agent applet.
        Parameters:
        applet - the Javatest Agent applet
        See Also:
        getAgentApplet()
      • isStarted

        public static boolean isStarted()
        Check the flag that indicates whether the agent applet has been started.
        Returns:
        a boolean value indicating whether the agent applet has been started or not.
      • setStarted

        public static void setStarted​(boolean value)
        Set a flag to indicate that the agent applet has been started.
        Parameters:
        value - a boolean value indicating whether the agent applet has been started or not.