home *** CD-ROM | disk | FTP | other *** search
- package netscape.applet;
-
- import java.io.PrintStream;
- import java.util.Enumeration;
- import java.util.Vector;
-
- class MozillaFrame {
- int MWContext;
- int oldMWContext;
- MozillaWindow window;
- Vector history;
- HistoryElement current;
-
- MozillaFrame(MozillaWindow window, int MWContext) {
- if (MozillaAppletContext.debug > 0) {
- System.err.println("# New frame " + MWContext);
- }
-
- this.MWContext = MWContext;
- this.window = window;
- window.add(this);
- this.history = new Vector();
- }
-
- void setCurrent(HistoryElement h) {
- this.current = h;
- }
-
- void add(HistoryElement h) {
- this.history.addElement(h);
- }
-
- void remove(HistoryElement h) {
- this.history.removeElement(h);
- if (h == this.current) {
- this.current = null;
- }
-
- if (this.history.size() == 0) {
- if (MozillaAppletContext.debug > 0) {
- System.err.println("# Destroy frame " + this.MWContext + " (old=" + this.oldMWContext + ")");
- }
-
- this.MWContext = this.oldMWContext;
- this.window.remove(this);
- }
-
- }
-
- void setMWContext(int newFrameMWContext) {
- if (newFrameMWContext != this.MWContext) {
- if (newFrameMWContext == 0) {
- this.oldMWContext = this.MWContext;
- this.MWContext = 0;
- return;
- }
-
- if (this.oldMWContext != newFrameMWContext) {
- this.window.change(this, this.oldMWContext, newFrameMWContext);
- }
-
- this.MWContext = newFrameMWContext;
- this.oldMWContext = 0;
- }
-
- }
-
- void dumpState(PrintStream out, int i) {
- MozillaWindow.indent(out, i);
- out.println("MozillaFrame MWContext=" + this.MWContext + " oldMWContext=" + this.oldMWContext + " (" + this.history.size() + " history elements) current=" + (this.current != null ? this.current.id : -1));
- Enumeration e = this.history.elements();
-
- while(e.hasMoreElements()) {
- HistoryElement h = (HistoryElement)e.nextElement();
- h.dumpState(out, i + 1);
- }
-
- }
- }
-