Exemple #1
0
  /** Reload the applet. */
  void appletReload() {
    panel.sendEvent(AppletPanel.APPLET_STOP);
    panel.sendEvent(AppletPanel.APPLET_DESTROY);
    panel.sendEvent(AppletPanel.APPLET_DISPOSE);

    /**
     * Fixed #4501142: Classlaoder sharing policy doesn't take "archive" into account. This will be
     * overridden by Java Plug-in. [stanleyh]
     */
    AppletPanel.flushClassLoader(panel.getClassLoaderCacheKey());

    /*
     * Make sure we don't have two threads running through the event queue
     * at the same time.
     */
    try {
      panel.joinAppletThread();
      panel.release();
    } catch (InterruptedException e) {
      return; // abort the reload
    }

    panel.createAppletThread();
    panel.sendEvent(AppletPanel.APPLET_LOAD);
    panel.sendEvent(AppletPanel.APPLET_INIT);
    panel.sendEvent(AppletPanel.APPLET_START);
  }
Exemple #2
0
  /** Return an enumeration of all the accessible applets on this page. */
  public Enumeration getApplets() {
    AppletSecurity security = (AppletSecurity) System.getSecurityManager();
    Vector v = new Vector();
    SocketPermission panelSp = new SocketPermission(panel.getCodeBase().getHost(), "connect");

    for (Enumeration e = appletPanels.elements(); e.hasMoreElements(); ) {
      AppletPanel p = (AppletPanel) e.nextElement();
      if (p.getDocumentBase().equals(panel.getDocumentBase())) {

        SocketPermission sp = new SocketPermission(p.getCodeBase().getHost(), "connect");
        if (panelSp.implies(sp)) {
          v.addElement(p.applet);
        }
      }
    }
    return v.elements();
  }
Exemple #3
0
  /** Get an applet by name. */
  public Applet getApplet(String name) {
    AppletSecurity security = (AppletSecurity) System.getSecurityManager();
    name = name.toLowerCase();
    SocketPermission panelSp = new SocketPermission(panel.getCodeBase().getHost(), "connect");
    for (Enumeration e = appletPanels.elements(); e.hasMoreElements(); ) {
      AppletPanel p = (AppletPanel) e.nextElement();
      String param = p.getParameter("name");
      if (param != null) {
        param = param.toLowerCase();
      }
      if (name.equals(param) && p.getDocumentBase().equals(panel.getDocumentBase())) {

        SocketPermission sp = new SocketPermission(p.getCodeBase().getHost(), "connect");

        if (panelSp.implies(sp)) {
          return p.applet;
        }
      }
    }
    return null;
  }
Exemple #4
0
      public void appletStateChanged(AppletEvent evt) {
        AppletPanel src = (AppletPanel) evt.getSource();

        switch (evt.getID()) {
          case AppletPanel.APPLET_RESIZE:
            {
              if (src != null) {
                resize(preferredSize());
                validate();
              }
              break;
            }
          case AppletPanel.APPLET_LOADING_COMPLETED:
            {
              Applet a = src.getApplet(); // j86.sun.applet.AppletPanel

              // Fixed #4754451: Applet can have methods running on main
              // thread event queue.
              //
              // The cause of this bug is that the frame of the applet
              // is created in main thread group. Thus, when certain
              // AWT/Swing events are generated, the events will be
              // dispatched through the wrong event dispatch thread.
              //
              // To fix this, we rearrange the AppContext with the frame,
              // so the proper event queue will be looked up.
              //
              // Swing also maintains a Frame list for the AppContext,
              // so we will have to rearrange it as well.
              //
              if (a != null)
                AppletPanel.changeFrameAppContext(frame, SunToolkit.targetToAppContext(a));
              else AppletPanel.changeFrameAppContext(frame, AppContext.getAppContext());

              break;
            }
        }
      }
Exemple #5
0
 /** Shutdown a viewer. Stop, Destroy, Dispose and Quit a viewer */
 private void appletShutdown(AppletPanel p) {
   p.sendEvent(AppletPanel.APPLET_STOP);
   p.sendEvent(AppletPanel.APPLET_DESTROY);
   p.sendEvent(AppletPanel.APPLET_DISPOSE);
   p.sendEvent(AppletPanel.APPLET_QUIT);
 }