home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Java / CFJava.cab / CFJavaRuntime.cab / netscape / application / FoundationPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-10-01  |  4.8 KB  |  178 lines

  1. package netscape.application;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Event;
  6. import java.awt.Frame;
  7. import java.awt.Graphics;
  8. import java.awt.Panel;
  9.  
  10. public class FoundationPanel extends Panel {
  11.    RootView rootView;
  12.  
  13.    public FoundationPanel() {
  14.       this.setRootView(new RootView());
  15.    }
  16.  
  17.    public FoundationPanel(int var1, int var2) {
  18.       this.setRootView(new RootView(0, 0, var1, var2));
  19.       this.resize(var1, var2);
  20.    }
  21.  
  22.    public RootView rootView() {
  23.       return this.rootView;
  24.    }
  25.  
  26.    public void setRootView(RootView var1) {
  27.       Application var2 = Application.application();
  28.       if (this.rootView != null) {
  29.          var2.removeRootView(this.rootView);
  30.       }
  31.  
  32.       this.rootView = var1;
  33.       var1.setPanel(this);
  34.       var1.setVisible(!var2.isPaused);
  35.       var2.addRootView(var1);
  36.    }
  37.  
  38.    public void resize(int var1, int var2) {
  39.       Application var3 = Application.application();
  40.       super.resize(var1, var2);
  41.       if (var3 != null && var3.eventLoop.shouldProcessSynchronously()) {
  42.          this.rootView.processEvent(ApplicationEvent.newResizeEvent(var1, var2));
  43.       } else {
  44.          this.addEvent(ApplicationEvent.newResizeEvent(var1, var2));
  45.       }
  46.    }
  47.  
  48.    public void reshape(int var1, int var2, int var3, int var4) {
  49.       Application var5 = Application.application();
  50.       super.reshape(var1, var2, var3, var4);
  51.       if (var5 != null && var5.eventLoop.shouldProcessSynchronously()) {
  52.          this.rootView.processEvent(ApplicationEvent.newResizeEvent(var3, var4));
  53.       } else {
  54.          this.addEvent(ApplicationEvent.newResizeEvent(var3, var4));
  55.       }
  56.    }
  57.  
  58.    public void update(Graphics var1) {
  59.       this.paint(var1);
  60.    }
  61.  
  62.    public void paint(Graphics var1) {
  63.       if (JDK11AirLock.isPrintGraphics(var1)) {
  64.          Application var2 = Application.application();
  65.          if (var2 != null) {
  66.             if (var2.eventLoop.shouldProcessSynchronously()) {
  67.                Rect var5 = new Rect(0, 0, this.rootView.width(), this.rootView.height());
  68.                netscape.application.Graphics var4 = new netscape.application.Graphics(var5, var1);
  69.                this.rootView.redraw(var4, var5);
  70.                this.rootView.redrawTransparentWindows(var4, var5, (InternalWindow)null);
  71.             } else {
  72.                ApplicationEvent var3 = ApplicationEvent.newPrintEvent(var1);
  73.                var3.processor = this.rootView;
  74.                var2.eventLoop().addEventAndWait(var3);
  75.             }
  76.          } else {
  77.             System.err.println("Can't print with no application");
  78.          }
  79.       } else {
  80.          this.addEvent(ApplicationEvent.newUpdateEvent(var1));
  81.          super.paint(var1);
  82.       }
  83.    }
  84.  
  85.    public boolean mouseDown(Event var1, int var2, int var3) {
  86.       ((Component)this).requestFocus();
  87.       this.addEvent(new MouseEvent(var1.when, -1, var2, var3, var1.modifiers));
  88.       return true;
  89.    }
  90.  
  91.    public boolean mouseDrag(Event var1, int var2, int var3) {
  92.       this.addEvent(new MouseEvent(var1.when, -2, var2, var3, var1.modifiers));
  93.       return true;
  94.    }
  95.  
  96.    public boolean mouseUp(Event var1, int var2, int var3) {
  97.       this.addEvent(new MouseEvent(var1.when, -3, var2, var3, var1.modifiers));
  98.       return true;
  99.    }
  100.  
  101.    public boolean mouseEnter(Event var1, int var2, int var3) {
  102.       this.addEvent(new MouseEvent(var1.when, -4, var2, var3, var1.modifiers));
  103.       return true;
  104.    }
  105.  
  106.    public boolean mouseMove(Event var1, int var2, int var3) {
  107.       this.addEvent(new MouseEvent(var1.when, -5, var2, var3, var1.modifiers));
  108.       return true;
  109.    }
  110.  
  111.    public boolean mouseExit(Event var1, int var2, int var3) {
  112.       this.addEvent(new MouseEvent(var1.when, -6, var2, var3, var1.modifiers));
  113.       return true;
  114.    }
  115.  
  116.    public boolean keyDown(Event var1, int var2) {
  117.       if (var1.target == this) {
  118.          this.addEvent(new KeyEvent(var1.when, var2, var1.modifiers, true));
  119.          return true;
  120.       } else {
  121.          return super.keyDown(var1, var2);
  122.       }
  123.    }
  124.  
  125.    public boolean keyUp(Event var1, int var2) {
  126.       if (var1.target == this) {
  127.          this.addEvent(new KeyEvent(var1.when, var2, var1.modifiers, false));
  128.          return true;
  129.       } else {
  130.          return super.keyUp(var1, var2);
  131.       }
  132.    }
  133.  
  134.    public synchronized boolean lostFocus(Event var1, Object var2) {
  135.       this.addEvent(ApplicationEvent.newFocusEvent(false));
  136.       return true;
  137.    }
  138.  
  139.    public boolean gotFocus(Event var1, Object var2) {
  140.       this.addEvent(ApplicationEvent.newFocusEvent(true));
  141.       return true;
  142.    }
  143.  
  144.    private synchronized void addEvent(netscape.application.Event var1) {
  145.       if (var1.processor() == null) {
  146.          var1.setProcessor(this.rootView);
  147.       }
  148.  
  149.       if (this.rootView != null && this.rootView.application() != null) {
  150.          this.rootView.application().eventLoop().addEvent(var1);
  151.       }
  152.  
  153.    }
  154.  
  155.    Frame frame() {
  156.       Container var1;
  157.       for(var1 = ((Component)this).getParent(); var1 != null && !(var1 instanceof Frame); var1 = ((Component)var1).getParent()) {
  158.       }
  159.  
  160.       return var1 != null ? (Frame)var1 : null;
  161.    }
  162.  
  163.    public void setCursor(int var1) {
  164.       Frame var2 = this.frame();
  165.       if (var2 != null) {
  166.          var2.setCursor(var1);
  167.       }
  168.  
  169.    }
  170.  
  171.    public void layout() {
  172.    }
  173.  
  174.    public void printAll(Graphics var1) {
  175.       this.paint(var1);
  176.    }
  177. }
  178.