home *** CD-ROM | disk | FTP | other *** search
- package netscape.applet;
-
- import java.applet.Applet;
- import java.applet.AppletContext;
- import java.applet.AppletStub;
- import java.awt.BorderLayout;
- import java.awt.Container;
- import java.awt.Dialog;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.EventQueue;
- import java.awt.Toolkit;
- import java.awt.Window;
- import java.io.PrintStream;
- import java.lang.reflect.Constructor;
- import java.net.URL;
- import java.util.Hashtable;
- import java.util.Vector;
-
- class DerivedAppletFrame extends EmbeddedAppletFrame implements AppletStub {
- Integer appletID;
- // $FF: renamed from: eq java.awt.EventQueue
- EventQueue field_0;
- Vector topLevelWindows;
- long timestamp;
- boolean inHistory = false;
- URL documentURL;
- URL codebaseURL;
- URL[] archiveURL;
- Hashtable atts;
- Applet applet;
- int status;
- private AppletEventDispatchThread handler;
- private ThreadGroup handlerThreadGroup;
- AppletHook hook;
- private Object m_statusLock = new Object();
- static final int APPLET_NEW = 1;
- static final int APPLET_LOADED = 2;
- static final int APPLET_STOPPED = 3;
- static final int APPLET_STARTING = 4;
- static final int APPLET_RUNNING = 5;
- static final int APPLET_STOPPING = 6;
- static final int APPLET_DESTROYING = 7;
- static final int APPLET_DESTROYED = 8;
- static final int APPLET_DISPOSED = 9;
- static final int APPLET_ERROR = 0;
- Dimension appletSize = new Dimension(100, 100);
- AppletClassLoader classLoader;
- boolean reloadClasses = false;
- String appletName;
- String currentStatus = "";
- boolean noisy = true;
- String errorReason;
- protected Dialog m_topModalDialog;
-
- DerivedAppletFrame(URL var1, URL var2, URL[] var3, Hashtable var4, MozillaAppletContext var5, Integer var6, boolean var7) {
- this.appletID = var6;
- super.pData = var6;
- super.context = var5;
- this.documentURL = var1;
- this.codebaseURL = var2;
- this.archiveURL = var3;
- this.atts = var4;
- this.status = 1;
- ((Container)this).setLayout(new BorderLayout());
- String var8 = this.getParameter("width");
- if (var8 != null) {
- this.appletSize.width = Integer.valueOf(var8);
- }
-
- var8 = this.getParameter("height");
- if (var8 != null) {
- this.appletSize.height = Integer.valueOf(var8);
- }
-
- this.topLevelWindows = new Vector();
- this.reloadClasses = var7;
- }
-
- void destroy() {
- if (this.status != 9 && MozillaAppletContext.debug >= 7) {
- System.out.println("# Destroying AppletFrame without disposing: " + this);
- }
-
- super.destroy();
- this.appletID = null;
- this.field_0 = null;
- this.topLevelWindows = null;
- this.documentURL = null;
- this.codebaseURL = null;
- this.archiveURL = null;
- this.atts = null;
- this.applet = null;
- this.handler = null;
- this.hook = null;
- this.appletSize = null;
- this.classLoader = null;
- this.appletName = null;
- this.currentStatus = null;
- this.errorReason = null;
- }
-
- protected void finalize() {
- this.destroy();
- }
-
- void dumpState(PrintStream var1, int var2) {
- MozillaAppletContext.indent(var1, var2);
- var1.println("EmbeddedAppletFrame id=" + super.pData + " applet=" + this.applet);
- }
-
- String statusToString(int var1) {
- switch (var1) {
- case 0:
- return "ERROR";
- case 1:
- return "NEW";
- case 2:
- return "LOADED";
- case 3:
- return "STOPPED";
- case 4:
- return "STARTING";
- case 5:
- return "RUNNING";
- case 6:
- return "STOPPING";
- case 7:
- default:
- return Integer.toString(var1, 10);
- case 8:
- return "DESTROYED";
- case 9:
- return "DISPOSED";
- }
- }
-
- public Dimension minimumSize() {
- return new Dimension(this.appletSize.width, this.appletSize.height);
- }
-
- public Dimension preferredSize() {
- return this.minimumSize();
- }
-
- public void requestShutdown() {
- this.stopApplet();
- this.destroyApplet();
- this.disposeApplet();
- }
-
- public void start() {
- SecurityManager.enablePrivilege("UniversalThreadAccess");
- SecurityManager.enablePrivilege("UniversalThreadGroupAccess");
- this.handlerThreadGroup = new AppletThreadGroup("applet-" + this.atts.get("code"), this);
- this.handler = new AppletEventDispatchThread(this, this.handlerThreadGroup);
- String var1 = "noname";
-
- try {
- var1 = Toolkit.getProperty("AWT.EventQueueClass", "java.awt.EventQueue");
- Class[] var2 = new Class[]{Class.forName("java.lang.Thread")};
- Constructor var3 = Class.forName(var1).getConstructor(var2);
- Object[] var4 = new Object[]{this.handler};
- this.field_0 = (EventQueue)var3.newInstance(var4);
- } catch (Exception var5) {
- System.err.println("Failed loading " + var1 + ": " + var5);
- this.field_0 = new EventQueue(this.handler);
- }
-
- this.handler.setEventQueue(this.field_0);
- SecurityManager.revertPrivilege();
- this.handler.start();
- }
-
- public boolean isActive() {
- return this.status == 5;
- }
-
- public String getParameter(String var1) {
- return (String)this.atts.get(var1.toLowerCase());
- }
-
- public URL getDocumentBase() {
- return this.documentURL;
- }
-
- public URL getCodeBase() {
- return this.codebaseURL;
- }
-
- public AppletContext getAppletContext() {
- return super.context;
- }
-
- public void appletResize(int var1, int var2) {
- this.appletSize.width = var1;
- this.appletSize.height = var2;
- this.field_0.postEvent(new ResizeAppletEvent(this, this.preferredSize()));
- }
-
- public void setAppletSize(int var1, int var2, int var3, int var4) {
- }
-
- public String getAppletName() {
- if (this.appletName == null) {
- try {
- if (this.applet != null) {
- this.appletName = this.applet.getParameter("name");
- if (this.appletName == null) {
- this.appletName = this.applet.getClass().getName().toString();
- }
- } else {
- this.appletName = this.getParameter("code");
- int var1 = this.appletName.lastIndexOf(".class");
- if (var1 != -1) {
- this.appletName = this.appletName.substring(0, var1);
- }
- }
- } catch (Exception var2) {
- this.appletName = "?";
- }
- }
-
- return this.appletName;
- }
-
- protected void showAppletStatus(String var1) {
- String var2 = this.getAppletName();
- this.currentStatus = "Applet " + var2 + " " + var1;
- this.getAppletContext().showStatus(this.currentStatus);
- if (MozillaAppletContext.debug >= 1) {
- System.err.println("# " + this.currentStatus);
- }
-
- }
-
- protected void showAppletLog(String var1) {
- if (this.noisy) {
- String var2;
- if (this.applet == null) {
- var2 = "# Applet log: " + var1;
- } else {
- String var3 = this.getAppletName();
- var2 = "# Applet " + var3 + " " + " log: " + var1;
- }
-
- System.err.println(var2);
- }
-
- }
-
- protected void rightState(String var1) {
- this.errorReason = null;
- this.showAppletStatus(var1);
- }
-
- protected void wrongState(String var1, String var2) {
- this.showAppletStatus(var1 + ": " + (this.errorReason != null ? this.errorReason : var2));
- if (MozillaAppletContext.debug >= 7) {
- System.err.println("# status=" + this.status);
- }
-
- }
-
- protected void showAppletException(Throwable var1, String var2) {
- if (this.noisy) {
- super.context.mochaOnLoad(-1);
- if (var2 == null) {
- var2 = var1.toString();
- }
-
- this.errorReason = var2;
- System.err.println("# Applet exception: " + var2);
- var1.printStackTrace();
- this.showAppletStatus(var2);
- }
-
- }
-
- public boolean mouseEnter(Event var1, int var2, int var3) {
- this.getAppletContext().showStatus(this.currentStatus);
- return true;
- }
-
- public boolean mouseExit(Event var1, int var2, int var3) {
- this.getAppletContext().showStatus("");
- return true;
- }
-
- EventQueue getEventQueue() {
- return null;
- }
-
- public void loadApplet() {
- this.field_0.postEvent(new LoadAppletEvent(this, this));
- }
-
- public void initApplet() {
- this.field_0.postEvent(new InitAppletEvent(this));
- }
-
- public void startApplet() {
- this.field_0.postEvent(new StartAppletEvent(this));
- }
-
- public void stopApplet() {
- this.field_0.postEvent(new StopAppletEvent(this));
- }
-
- public void destroyApplet() {
- this.field_0.postEvent(new DestroyAppletEvent(this));
- }
-
- public void disposeApplet() {
- this.field_0.postEvent(new DisposeAppletEvent(this));
- }
-
- public Thread getAppletThread() {
- return this.handler;
- }
-
- public void addTopLevelWindow(Window var1) {
- Vector var2 = this.topLevelWindows;
- synchronized(var2){}
-
- try {
- if (var1 != this) {
- this.topLevelWindows.addElement(var1);
- }
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void removeTopLevelWindow(Window var1) {
- Vector var2 = this.topLevelWindows;
- synchronized(var2){}
-
- try {
- if (var1 != this) {
- this.topLevelWindows.removeElement(var1);
- }
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public Window[] getTopLevelWindows() {
- Vector var2 = this.topLevelWindows;
- synchronized(var2){}
-
- Window[] var1;
- try {
- int var4 = this.topLevelWindows.size();
- Window[] var5 = new Window[var4 + 1];
-
- for(int var6 = 0; var6 < var4; ++var6) {
- var5[var6] = (Window)this.topLevelWindows.elementAt(var6);
- }
-
- var5[var4] = this;
- var1 = var5;
- } catch (Throwable var8) {
- throw var8;
- }
-
- return var1;
- }
-
- public Dialog swapTopModalDialog(Dialog var1) {
- if (var1 != null && !var1.isModal()) {
- throw new IllegalArgumentException("Dialog must be modal.");
- } else {
- Dialog var2 = this.m_topModalDialog;
- this.m_topModalDialog = var1;
- return var2;
- }
- }
-
- protected Thread getThread() {
- return this.handler;
- }
-
- protected ThreadGroup getThreadGroup() {
- return this.handlerThreadGroup;
- }
- }
-