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

  1. package netscape.application;
  2.  
  3. import netscape.util.ClassInfo;
  4. import netscape.util.Codable;
  5. import netscape.util.CodingException;
  6. import netscape.util.Decoder;
  7. import netscape.util.Encoder;
  8. import netscape.util.Enumeration;
  9. import netscape.util.Hashtable;
  10. import netscape.util.InconsistencyException;
  11. import netscape.util.Vector;
  12.  
  13. public class View implements Codable {
  14.    View _superview;
  15.    Size _minSize;
  16.    Bitmap drawingBuffer;
  17.    private Vector subviews;
  18.    private Vector kbdOrder;
  19.    LayoutManager layoutManager;
  20.    Hashtable _keyboardBindings;
  21.    public Rect bounds;
  22.    Rect dirtyRect;
  23.    byte resizeInstr;
  24.    int drawingDisabled;
  25.    boolean autoResizeSubviews;
  26.    boolean buffered;
  27.    boolean drawingBufferValid;
  28.    boolean drawingBufferIsBitCache;
  29.    boolean isDirty;
  30.    boolean needFocus;
  31.    boolean focusPaused;
  32.    boolean wantsKeyboardArrow;
  33.    public static final int RIGHT_MARGIN_CAN_CHANGE = 0;
  34.    public static final int LEFT_MARGIN_CAN_CHANGE = 1;
  35.    public static final int WIDTH_CAN_CHANGE = 2;
  36.    public static final int CENTER_HORIZ = 32;
  37.    public static final int BOTTOM_MARGIN_CAN_CHANGE = 4;
  38.    public static final int TOP_MARGIN_CAN_CHANGE = 8;
  39.    public static final int HEIGHT_CAN_CHANGE = 16;
  40.    public static final int CENTER_VERT = 64;
  41.    private static final int DEFAULT_RESIZE_INSTR = 4;
  42.    private static final int VERT_MASK = 92;
  43.    private static final int HORZ_MASK = 35;
  44.    static final String MINSIZE_KEY = "minSize";
  45.    static final String BOUNDS_KEY = "bounds";
  46.    static final String SUBVIEWS_KEY = "subviews";
  47.    static final String RESIZE_KEY = "resizeInstr";
  48.    static final String DRAWINGDISABLED_KEY = "drawingDisabled";
  49.    static final String AUTORESIZE_KEY = "autoResizeSubviews";
  50.    static final String BUFFERED_KEY = "buffered";
  51.    static final String LAYOUTMANAGER_KEY = "layoutManager";
  52.    static final String KEYBOARD_BINDINGS_KEY = "keyboardBindings";
  53.    private static final String KBD_COMMAND_KEY = "kbdCmd";
  54.    private static final String KBD_WHEN = "when";
  55.    private static final String KBD_DATA_KEY = "kbdData";
  56.    static final int DEFAULT_CURSOR = -1;
  57.    public static final int ARROW_CURSOR = 0;
  58.    public static final int CROSSHAIR_CURSOR = 1;
  59.    public static final int TEXT_CURSOR = 2;
  60.    public static final int WAIT_CURSOR = 3;
  61.    public static final int SW_RESIZE_CURSOR = 4;
  62.    public static final int SE_RESIZE_CURSOR = 5;
  63.    public static final int NW_RESIZE_CURSOR = 6;
  64.    public static final int NE_RESIZE_CURSOR = 7;
  65.    public static final int N_RESIZE_CURSOR = 8;
  66.    public static final int S_RESIZE_CURSOR = 9;
  67.    public static final int W_RESIZE_CURSOR = 10;
  68.    public static final int E_RESIZE_CURSOR = 11;
  69.    public static final int HAND_CURSOR = 12;
  70.    public static final int MOVE_CURSOR = 13;
  71.    public static final int WHEN_SELECTED = 0;
  72.    public static final int WHEN_IN_MAIN_WINDOW = 1;
  73.    public static final int ALWAYS = 2;
  74.  
  75.    public View() {
  76.       this(0, 0, 0, 0);
  77.    }
  78.  
  79.    public View(Rect var1) {
  80.       this(var1.x, var1.y, var1.width, var1.height);
  81.    }
  82.  
  83.    public View(int var1, int var2, int var3, int var4) {
  84.       this.bounds = new Rect();
  85.       this.resizeInstr = 4;
  86.       this.autoResizeSubviews = true;
  87.       this._setBounds(var1, var2, var3, var4);
  88.    }
  89.  
  90.    void _setBounds(int var1, int var2, int var3, int var4) {
  91.       this.bounds.setBounds(var1, var2, var3, var4);
  92.    }
  93.  
  94.    int subviewCount() {
  95.       return this.subviews == null ? 0 : this.subviews.count();
  96.    }
  97.  
  98.    public Vector subviews() {
  99.       if (this.subviews == null) {
  100.          this.subviews = new Vector();
  101.       }
  102.  
  103.       return this.subviews;
  104.    }
  105.  
  106.    public Vector peersForSubview(View var1) {
  107.       if (this.subviewCount() != 0 && this.subviews().contains(var1)) {
  108.          Vector var2 = new Vector();
  109.          var2.addElementsIfAbsent(this.subviews);
  110.          return var2;
  111.       } else {
  112.          return new Vector();
  113.       }
  114.    }
  115.  
  116.    public boolean descendsFrom(View var1) {
  117.       if (var1 == this) {
  118.          return true;
  119.       } else if (this._superview != null && var1 != null) {
  120.          return this._superview == var1 ? true : this._superview.descendsFrom(var1);
  121.       } else {
  122.          return false;
  123.       }
  124.    }
  125.  
  126.    public InternalWindow window() {
  127.       return this._superview == null ? null : this._superview.window();
  128.    }
  129.  
  130.    public Rect bounds() {
  131.       return new Rect(this.bounds);
  132.    }
  133.  
  134.    // $FF: renamed from: x () int
  135.    public int method_0() {
  136.       return this.bounds.x;
  137.    }
  138.  
  139.    // $FF: renamed from: y () int
  140.    public int method_1() {
  141.       return this.bounds.y;
  142.    }
  143.  
  144.    public int width() {
  145.       return this.bounds.width;
  146.    }
  147.  
  148.    public int height() {
  149.       return this.bounds.height;
  150.    }
  151.  
  152.    public View superview() {
  153.       return this._superview;
  154.    }
  155.  
  156.    public void setHorizResizeInstruction(int var1) {
  157.       if (var1 != 0 && var1 != 1 && var1 != 2 && var1 != 32) {
  158.          throw new IllegalArgumentException("invalid horz resize instruction " + var1);
  159.       } else {
  160.          this.resizeInstr = (byte)(this.resizeInstr & 92);
  161.          this.resizeInstr = (byte)(this.resizeInstr | var1);
  162.       }
  163.    }
  164.  
  165.    public int horizResizeInstruction() {
  166.       return this.resizeInstr & 35;
  167.    }
  168.  
  169.    public void setVertResizeInstruction(int var1) {
  170.       if (var1 != 4 && var1 != 8 && var1 != 16 && var1 != 64) {
  171.          throw new IllegalArgumentException("invalid vert resize instruction " + var1);
  172.       } else {
  173.          this.resizeInstr = (byte)(this.resizeInstr & 35);
  174.          this.resizeInstr = (byte)(this.resizeInstr | var1);
  175.       }
  176.    }
  177.  
  178.    public int vertResizeInstruction() {
  179.       return this.resizeInstr & 92;
  180.    }
  181.  
  182.    public boolean wantsAutoscrollEvents() {
  183.       return false;
  184.    }
  185.  
  186.    public DragDestination acceptsDrag(DragSession var1, int var2, int var3) {
  187.       return null;
  188.    }
  189.  
  190.    public void setAutoResizeSubviews(boolean var1) {
  191.       this.autoResizeSubviews = var1;
  192.    }
  193.  
  194.    public boolean doesAutoResizeSubviews() {
  195.       return this.autoResizeSubviews;
  196.    }
  197.  
  198.    public void didMoveBy(int var1, int var2) {
  199.    }
  200.  
  201.    public void didSizeBy(int var1, int var2) {
  202.       if (this.autoResizeSubviews) {
  203.          this.layoutView(var1, var2);
  204.       }
  205.    }
  206.  
  207.    public void setBounds(Rect var1) {
  208.       this.setBounds(var1.x, var1.y, var1.width, var1.height);
  209.    }
  210.  
  211.    public void setBounds(int var1, int var2, int var3, int var4) {
  212.       int var5 = var1 - this.bounds.x;
  213.       int var6 = var2 - this.bounds.y;
  214.       int var7 = var3 - this.bounds.width;
  215.       int var8 = var4 - this.bounds.height;
  216.       boolean var9 = var5 != 0 || var6 != 0;
  217.       boolean var10 = var7 != 0 || var8 != 0;
  218.       if (var9 || var10) {
  219.          this._setBounds(var1, var2, var3, var4);
  220.          if (this.buffered && var10) {
  221.             if (this.drawingBuffer != null) {
  222.                this.drawingBuffer.flush();
  223.             }
  224.  
  225.             if (var3 > 0 && var4 > 0) {
  226.                this.drawingBuffer = this.createBuffer();
  227.             } else {
  228.                this.drawingBuffer = null;
  229.             }
  230.  
  231.             this.drawingBufferValid = false;
  232.          }
  233.  
  234.          if (var9) {
  235.             if (this._superview != null) {
  236.                this._superview.subviewDidMove(this);
  237.             }
  238.  
  239.             this.didMoveBy(var5, var6);
  240.          }
  241.  
  242.          if (var10) {
  243.             if (this._superview != null) {
  244.                this._superview.subviewDidResize(this);
  245.             }
  246.  
  247.             this.didSizeBy(var7, var8);
  248.          }
  249.  
  250.       }
  251.    }
  252.  
  253.    public void moveBy(int var1, int var2) {
  254.       this.setBounds(this.bounds.x + var1, this.bounds.y + var2, this.bounds.width, this.bounds.height);
  255.    }
  256.  
  257.    public void moveTo(int var1, int var2) {
  258.       this.setBounds(var1, var2, this.bounds.width, this.bounds.height);
  259.    }
  260.  
  261.    public void sizeBy(int var1, int var2) {
  262.       this.setBounds(this.bounds.x, this.bounds.y, this.bounds.width + var1, this.bounds.height + var2);
  263.    }
  264.  
  265.    public void sizeTo(int var1, int var2) {
  266.       this.setBounds(this.bounds.x, this.bounds.y, var1, var2);
  267.    }
  268.  
  269.    public void setMinSize(int var1, int var2) {
  270.       if (var1 != -1 && var2 != -1) {
  271.          this._minSize = new Size(var1, var2);
  272.       } else {
  273.          this._minSize = null;
  274.       }
  275.    }
  276.  
  277.    public Size minSize() {
  278.       return this._minSize != null ? new Size(this._minSize) : new Size();
  279.    }
  280.  
  281.    public void sizeToMinSize() {
  282.       Size var1 = this.minSize();
  283.       this.sizeTo(var1.width, var1.height);
  284.    }
  285.  
  286.    public void subviewDidResize(View var1) {
  287.       if (this._superview != null) {
  288.          this._superview.subviewDidResize(var1);
  289.       }
  290.  
  291.    }
  292.  
  293.    public void subviewDidMove(View var1) {
  294.       if (this._superview != null) {
  295.          this._superview.subviewDidMove(var1);
  296.       }
  297.  
  298.    }
  299.  
  300.    private void setSuperview(View var1) {
  301.       this._superview = var1;
  302.       this.ancestorWasAddedToViewHierarchy(var1);
  303.       RootView var2 = this.rootView();
  304.       if (var2 != null) {
  305.          var2.updateCursorLater();
  306.          var2.viewHierarchyChanged();
  307.       }
  308.  
  309.    }
  310.  
  311.    public void addSubview(View var1) {
  312.       if (var1 != null) {
  313.          this.invalidateKeyboardSelectionOrder();
  314.          if (this.subviews == null) {
  315.             this.subviews = new Vector();
  316.          } else if (this.subviews.contains(var1)) {
  317.             return;
  318.          }
  319.  
  320.          this.subviews.addElement(var1);
  321.          var1.setSuperview(this);
  322.          if (this.layoutManager != null) {
  323.             this.layoutManager.addSubview(var1);
  324.          }
  325.  
  326.       }
  327.    }
  328.  
  329.    protected void ancestorWasAddedToViewHierarchy(View var1) {
  330.       if (this.buffered) {
  331.          this.setBuffered(true);
  332.       }
  333.  
  334.       if (this.needFocus) {
  335.          this.setFocusedView();
  336.       }
  337.  
  338.       int var3 = this.subviewCount();
  339.  
  340.       while(var3-- > 0) {
  341.          View var2 = (View)this.subviews.elementAt(var3);
  342.          var2.ancestorWasAddedToViewHierarchy(var1);
  343.       }
  344.  
  345.    }
  346.  
  347.    protected void removeSubview(View var1) {
  348.       this.invalidateKeyboardSelectionOrder();
  349.       if (this.subviews != null) {
  350.          this.subviews.removeElement(var1);
  351.       }
  352.  
  353.       if (this.layoutManager != null) {
  354.          this.layoutManager.removeSubview(var1);
  355.       }
  356.  
  357.    }
  358.  
  359.    public void removeFromSuperview() {
  360.       if (this._superview != null) {
  361.          RootView var1 = this.rootView();
  362.          if (var1 != null) {
  363.             var1.updateCursorLater();
  364.          }
  365.  
  366.          this.ancestorWillRemoveFromViewHierarchy(this);
  367.          this._superview.removeSubview(this);
  368.          this._superview = null;
  369.          if (var1 != null) {
  370.             var1.viewHierarchyChanged();
  371.          }
  372.       }
  373.  
  374.    }
  375.  
  376.    protected void ancestorWillRemoveFromViewHierarchy(View var1) {
  377.       if (this.drawingBuffer != null) {
  378.          this.drawingBuffer.flush();
  379.          this.drawingBuffer = null;
  380.       }
  381.  
  382.       RootView var2 = this.rootView();
  383.       if (var2 != null) {
  384.          if (var2.mouseView() == this) {
  385.             var2.setMouseView((View)null);
  386.          }
  387.  
  388.          if (var2._moveView == this) {
  389.             var2._moveView = null;
  390.          }
  391.       }
  392.  
  393.       if (this.isDirty) {
  394.          this.setDirty(false);
  395.       }
  396.  
  397.       int var4 = this.subviewCount();
  398.  
  399.       while(var4-- > 0) {
  400.          View var3 = (View)this.subviews.elementAt(var4);
  401.          var3.ancestorWillRemoveFromViewHierarchy(var1);
  402.       }
  403.  
  404.    }
  405.  
  406.    public boolean containsPoint(int var1, int var2) {
  407.       return Rect.contains(0, 0, this.width(), this.height(), var1, var2);
  408.    }
  409.  
  410.    public boolean containsPointInVisibleRect(int var1, int var2) {
  411.       Rect var3 = Rect.newRect();
  412.       this.computeVisibleRect(var3);
  413.       boolean var4 = var3.contains(var1, var2);
  414.       Rect.returnRect(var3);
  415.       return var4;
  416.    }
  417.  
  418.    View _viewForRect(Rect var1, View var2) {
  419.       View var4 = null;
  420.       if (var1 == null) {
  421.          return null;
  422.       } else {
  423.          Rect var5;
  424.          if (var2 != null) {
  425.             if (!this.bounds.contains(var1)) {
  426.                return null;
  427.             }
  428.  
  429.             var5 = Rect.newRect();
  430.             var2.convertRectToView(this, var1, var5);
  431.          } else {
  432.             var5 = Rect.newRect(var1);
  433.          }
  434.  
  435.          int var6 = this.subviewCount();
  436.  
  437.          while(var6-- > 0) {
  438.             View var3 = (View)this.subviews.elementAt(var6);
  439.             var4 = var3._viewForRect(var5, this);
  440.             if (var4 != null) {
  441.                break;
  442.             }
  443.          }
  444.  
  445.          Rect.returnRect(var5);
  446.          if (var4 != null) {
  447.             return var4;
  448.          } else {
  449.             return this.isTransparent() && var2 != null ? null : this;
  450.          }
  451.       }
  452.    }
  453.  
  454.    public View viewForMouse(int var1, int var2) {
  455.       if (!this.containsPoint(var1, var2)) {
  456.          return null;
  457.       } else {
  458.          int var4 = this.subviewCount();
  459.  
  460.          while(var4-- > 0) {
  461.             View var5 = (View)this.subviews.elementAt(var4);
  462.             if (!(var5 instanceof InternalWindow)) {
  463.                View var3 = var5.viewForMouse(var1 - var5.bounds.x, var2 - var5.bounds.y);
  464.                if (var3 != null) {
  465.                   return var3;
  466.                }
  467.             }
  468.          }
  469.  
  470.          return this;
  471.       }
  472.    }
  473.  
  474.    public int cursorForPoint(int var1, int var2) {
  475.       return 0;
  476.    }
  477.  
  478.    public boolean mouseDown(MouseEvent var1) {
  479.       return false;
  480.    }
  481.  
  482.    public void mouseDragged(MouseEvent var1) {
  483.    }
  484.  
  485.    public void mouseUp(MouseEvent var1) {
  486.    }
  487.  
  488.    public void mouseEntered(MouseEvent var1) {
  489.    }
  490.  
  491.    public void mouseMoved(MouseEvent var1) {
  492.    }
  493.  
  494.    public void mouseExited(MouseEvent var1) {
  495.    }
  496.  
  497.    public void keyDown(KeyEvent var1) {
  498.       if (this._superview != null) {
  499.          this._superview.keyDown(var1);
  500.       }
  501.  
  502.    }
  503.  
  504.    public void keyUp(KeyEvent var1) {
  505.       if (this._superview != null) {
  506.          this._superview.keyUp(var1);
  507.       }
  508.  
  509.    }
  510.  
  511.    View scrollingView() {
  512.       return this._superview != null ? this._superview.scrollingView() : null;
  513.    }
  514.  
  515.    public void scrollRectToVisible(Rect var1) {
  516.       if (this._superview != null) {
  517.          this._superview.scrollRectToVisible(this.convertRectToView(this._superview, var1));
  518.       }
  519.  
  520.    }
  521.  
  522.    public void disableDrawing() {
  523.       ++this.drawingDisabled;
  524.    }
  525.  
  526.    public void reenableDrawing() {
  527.       --this.drawingDisabled;
  528.       if (this.drawingDisabled < 0) {
  529.          this.drawingDisabled = 0;
  530.       }
  531.  
  532.    }
  533.  
  534.    public boolean isDrawingEnabled() {
  535.       return this.drawingDisabled == 0;
  536.    }
  537.  
  538.    public boolean isInViewHierarchy() {
  539.       RootView var1 = this.rootView();
  540.       return var1 != null && var1.isVisible();
  541.    }
  542.  
  543.    public RootView rootView() {
  544.       return this._superview == null ? null : this._superview.rootView();
  545.    }
  546.  
  547.    public boolean canDraw() {
  548.       return this.drawingDisabled <= 0 && this._superview != null ? this._superview.canDraw() : false;
  549.    }
  550.  
  551.    public void computeVisibleRect(Rect var1) {
  552.       if (this._superview == null) {
  553.          var1.setBounds(0, 0, this.width(), this.height());
  554.       } else {
  555.          this._superview.computeVisibleRect(var1);
  556.          this._superview.convertRectToView(this, var1, var1);
  557.          var1.intersectWith(0, 0, this.width(), this.height());
  558.       }
  559.    }
  560.  
  561.    public boolean isTransparent() {
  562.       return true;
  563.    }
  564.  
  565.    public boolean wantsMouseEventCoalescing() {
  566.       return true;
  567.    }
  568.  
  569.    View opaqueAncestor() {
  570.       return this.isTransparent() && this._superview != null ? this._superview.opaqueAncestor() : this;
  571.    }
  572.  
  573.    public void addDirtyRect(Rect var1) {
  574.       if (var1 == null) {
  575.          this.setDirty(true);
  576.       } else {
  577.          if (this.isDirty) {
  578.             if (this.dirtyRect != null) {
  579.                this.dirtyRect.unionWith(var1);
  580.                return;
  581.             }
  582.          } else {
  583.             RootView var2 = this.rootView();
  584.             if (var2 != null) {
  585.                this.dirtyRect = new Rect(var1);
  586.                var2.markDirty(this);
  587.                this.isDirty = true;
  588.             }
  589.          }
  590.  
  591.       }
  592.    }
  593.  
  594.    public void setDirty(boolean var1) {
  595.       if (var1) {
  596.          if (!this.isDirty) {
  597.             RootView var2 = this.rootView();
  598.             if (var2 != null) {
  599.                var2.markDirty(this);
  600.                this.isDirty = true;
  601.             }
  602.          }
  603.       } else if (this.isDirty) {
  604.          RootView var3 = this.rootView();
  605.          if (var3 != null) {
  606.             var3.markClean(this);
  607.             this.isDirty = false;
  608.          }
  609.       }
  610.  
  611.       this.dirtyRect = null;
  612.    }
  613.  
  614.    public boolean isDirty() {
  615.       return this.isDirty;
  616.    }
  617.  
  618.    public void drawView(Graphics var1) {
  619.    }
  620.  
  621.    public void drawSubviews(Graphics var1) {
  622.       Rect var4 = null;
  623.       if (this.drawingDisabled <= 0) {
  624.          Rect var3 = var1.clipRect();
  625.          int var5 = this.subviewCount();
  626.  
  627.          for(int var6 = 0; var6 < var5; ++var6) {
  628.             View var2 = (View)this.subviews.elementAt(var6);
  629.             boolean var7 = var2.isDrawingEnabled();
  630.             if (var4 == null) {
  631.                var4 = Rect.newRect();
  632.             }
  633.  
  634.             this.convertRectToView(var2, var3, var4);
  635.             var4.intersectWith(0, 0, var2.bounds.width, var2.bounds.height);
  636.             if (var7 && !var4.isEmpty()) {
  637.                var2._drawView(var1, var4, false);
  638.             }
  639.          }
  640.  
  641.          if (var4 != null) {
  642.             Rect.returnRect(var4);
  643.          }
  644.  
  645.       }
  646.    }
  647.  
  648.    void _drawView(Graphics var1, Rect var2, boolean var3) {
  649.       if (this.drawingDisabled <= 0) {
  650.          var1.pushState();
  651.          var1.setDebug(this);
  652.          if (!var3) {
  653.             var1.translate(this.bounds.x, this.bounds.y);
  654.          }
  655.  
  656.          if (var2 == null) {
  657.             Rect var4 = Rect.newRect(0, 0, this.width(), this.height());
  658.             var1.setClipRect(var4);
  659.             Rect.returnRect(var4);
  660.          } else {
  661.             var1.setClipRect(var2);
  662.          }
  663.  
  664.          if (this.drawingBuffer != null && var3 && !var1.isDrawingBuffer()) {
  665.             this.drawingBuffer.drawAt(var1, 0, 0);
  666.          } else {
  667.             this.drawView(var1);
  668.             this.drawSubviews(var1);
  669.          }
  670.  
  671.          var1.popState();
  672.       }
  673.    }
  674.  
  675.    void clipAndDrawView(Graphics var1, Rect var2) {
  676.       Rect var12;
  677.       if (var1.isDrawingBuffer()) {
  678.          var12 = Rect.newRect(0, 0, this.width(), this.height());
  679.       } else {
  680.          var12 = Rect.newRect();
  681.          this.computeVisibleRect(var12);
  682.       }
  683.  
  684.       var12.intersectWith(var2);
  685.       Vector var3;
  686.       if ((this != this.rootView() || var12.x != 0 || var12.y != 0 || var12.width != this.width() || var12.height != this.height()) && !var1.isDrawingBuffer()) {
  687.          var3 = this.rootView().windowRects(this.convertRectToView((View)null, var12), this.window());
  688.       } else {
  689.          var3 = null;
  690.       }
  691.  
  692.       if (var3 != null && !var3.isEmpty()) {
  693.          Vector var5 = VectorCache.newVector();
  694.          Vector var4 = VectorCache.newVector();
  695.          var12.x += this.absoluteX();
  696.          var12.y += this.absoluteY();
  697.          var4.addElement(var12);
  698.          Vector var6 = VectorCache.newVector();
  699.          int var13 = var3.count();
  700.  
  701.          while(var13-- > 0) {
  702.             Rect var10 = (Rect)var3.elementAt(var13);
  703.             int var14 = var4.count();
  704.  
  705.             while(var14-- > 0) {
  706.                Rect var9 = (Rect)var4.elementAt(var14);
  707.                var9.computeDisunionRects(var10, var5);
  708.                if (!var5.isEmpty()) {
  709.                   var6.addElementsIfAbsent(var5);
  710.                   var5.removeAllElements();
  711.                } else if (!var10.contains(var9)) {
  712.                   var6.addElement(var9);
  713.                   var4.removeElement(var9);
  714.                }
  715.             }
  716.  
  717.             Vector var7 = var4;
  718.             var4 = var6;
  719.             var6 = var7;
  720.             Rect.returnRects(var7);
  721.          }
  722.  
  723.          VectorCache.returnVector(var5);
  724.          VectorCache.returnVector(var6);
  725.          int var15 = var4.count();
  726.  
  727.          for(int var17 = 0; var17 < var15; ++var17) {
  728.             Rect var8 = (Rect)var4.elementAt(var17);
  729.             int var19 = var15;
  730.  
  731.             while(var19-- > 0) {
  732.                Rect var11 = (Rect)var4.elementAt(var19);
  733.                if (var11 != var8 && var8.contains(var11)) {
  734.                   Rect.returnRect((Rect)var4.removeElementAt(var19));
  735.                   --var15;
  736.                   var17 = -1;
  737.                   break;
  738.                }
  739.             }
  740.          }
  741.  
  742.          var13 = var4.count();
  743.  
  744.          while(var13-- > 0) {
  745.             var2 = (Rect)var4.elementAt(var13);
  746.             if (!var2.isEmpty()) {
  747.                var2.x -= this.absoluteX();
  748.                var2.y -= this.absoluteY();
  749.                this._drawView(var1, var2, true);
  750.             }
  751.          }
  752.  
  753.          Rect.returnRects(var4);
  754.          VectorCache.returnVector(var4);
  755.       } else {
  756.          this._drawView(var1, var12, true);
  757.          Rect.returnRect(var12);
  758.       }
  759.  
  760.       Rect.returnRects(var3);
  761.       VectorCache.returnVector(var3);
  762.    }
  763.  
  764.    void _draw(Graphics var1, Rect var2) {
  765.       boolean var3 = this.drawingBuffer != null && !var1.isDrawingBuffer() ? false : this.isTransparent();
  766.       if (var3 && !(this instanceof InternalWindow)) {
  767.          Rect var4 = Rect.newRect();
  768.          View var5 = this.opaqueAncestor();
  769.          this.convertRectToView(var5, var2, var4);
  770.          var1.pushState();
  771.          var1.translate(var2.x - var4.x, var2.y - var4.y);
  772.          var5.draw(var1, var4);
  773.          Rect.returnRect(var4);
  774.          var1.popState();
  775.       } else {
  776.          this.updateInvalidDrawingBuffers(var2);
  777.          this.clipAndDrawView(var1, var2);
  778.       }
  779.    }
  780.  
  781.    public void draw(Graphics var1, Rect var2) {
  782.       if (var2 != null) {
  783.          var2 = Rect.newRect(var2);
  784.          var2.intersectWith(0, 0, this.width(), this.height());
  785.          if (var2.isEmpty()) {
  786.             Rect.returnRect(var2);
  787.             return;
  788.          }
  789.       } else {
  790.          var2 = Rect.newRect(0, 0, this.width(), this.height());
  791.       }
  792.  
  793.       boolean var7 = this.canDraw();
  794.       if (var1 == null || !var1.isDrawingBuffer()) {
  795.          if (this.drawingBuffer == null) {
  796.             if (!var7) {
  797.                Rect.returnRect(var2);
  798.                return;
  799.             }
  800.  
  801.             View var3 = this.ancestorWithDrawingBuffer();
  802.             if (var3 != null && var3 != this) {
  803.                Rect var4 = Rect.newRect();
  804.                this.computeVisibleRect(var4);
  805.                var4.intersectWith(var2);
  806.                this.convertRectToView(var3, var4, var4);
  807.                var3.drawingBufferValid = false;
  808.                if (var1 == null) {
  809.                   var1 = var3.createGraphics();
  810.                   var3.draw(var1, var4);
  811.                   var1.dispose();
  812.                   Object var13 = null;
  813.                } else {
  814.                   Point var6 = new Point(0, 0);
  815.                   this.convertPointToView(var3, var6, var6);
  816.                   var1.pushState();
  817.  
  818.                   try {
  819.                      var1.translate(-var6.x, -var6.y);
  820.                      var3.draw(var1, var4);
  821.                   } finally {
  822.                      var1.popState();
  823.                   }
  824.                }
  825.  
  826.                Rect.returnRect(var4);
  827.                Rect.returnRect(var2);
  828.                return;
  829.             }
  830.          } else if (!this.drawingBufferIsBitCache) {
  831.             this.updateDrawingBuffer(var2);
  832.          }
  833.  
  834.          Rect var5 = this.convertRectToView(this.rootView(), var2);
  835.          this.rootView().redrawTransparentWindows(var5, this.window());
  836.       }
  837.  
  838.       if (var1 != null && var1.isDrawingBuffer() || var7) {
  839.          if (var1 == null) {
  840.             var1 = this.createGraphics();
  841.             this._draw(var1, var2);
  842.             var1.dispose();
  843.             Object var15 = null;
  844.          } else {
  845.             this._draw(var1, var2);
  846.          }
  847.       }
  848.  
  849.       Rect.returnRect(var2);
  850.    }
  851.  
  852.    public void draw(Rect var1) {
  853.       if (this.isInViewHierarchy()) {
  854.          this.draw((Graphics)null, var1);
  855.       }
  856.  
  857.    }
  858.  
  859.    public void draw() {
  860.       if (this.isInViewHierarchy()) {
  861.          this.draw((Graphics)null, (Rect)null);
  862.       }
  863.  
  864.    }
  865.  
  866.    public void setBuffered(boolean var1) {
  867.       this.buffered = var1;
  868.       if (var1 && this.drawingBuffer == null) {
  869.          if (this.bounds.width != 0 && this.bounds.height != 0) {
  870.             this.drawingBuffer = this.createBuffer();
  871.          }
  872.  
  873.          this.drawingBufferValid = false;
  874.       } else {
  875.          if (!var1 && this.drawingBuffer != null) {
  876.             this.drawingBuffer.flush();
  877.             this.drawingBuffer = null;
  878.          }
  879.  
  880.       }
  881.    }
  882.  
  883.    public boolean isBuffered() {
  884.       return this.buffered;
  885.    }
  886.  
  887.    public Bitmap drawingBuffer() {
  888.       return this.drawingBuffer;
  889.    }
  890.  
  891.    void updateDrawingBuffer(Rect var1) {
  892.       if (var1.intersects(0, 0, this.width(), this.height())) {
  893.          if (this.drawingBuffer != null) {
  894.             Bitmap var3 = this.drawingBuffer;
  895.             synchronized(var3){}
  896.  
  897.             try {
  898.                Graphics var2 = Graphics.newGraphics(this.drawingBuffer);
  899.                this.drawingBufferValid = true;
  900.                var2.setDebugOptions(this.shouldDebugGraphics());
  901.                this.draw(var2, var1);
  902.                if (!this.canDraw()) {
  903.                   this.drawingBufferValid = false;
  904.                }
  905.  
  906.                var2.dispose();
  907.                Object var6 = null;
  908.             } catch (Throwable var5) {
  909.                throw var5;
  910.             }
  911.  
  912.          }
  913.       }
  914.    }
  915.  
  916.    void updateInvalidDrawingBuffers(Rect var1) {
  917.       Rect var3 = null;
  918.       int var4 = this.subviewCount();
  919.  
  920.       while(var4-- > 0) {
  921.          View var2 = (View)this.subviews.elementAt(var4);
  922.          if (var3 == null) {
  923.             var3 = Rect.newRect();
  924.          }
  925.  
  926.          this.convertRectToView(var2, var1, var3);
  927.          if (var3.intersects(0, 0, var2.width(), var2.height())) {
  928.             if (var2.drawingBuffer != null && !var2.drawingBufferValid) {
  929.                var2.updateDrawingBuffer(var3);
  930.             }
  931.  
  932.             var2.updateInvalidDrawingBuffers(var3);
  933.          }
  934.       }
  935.  
  936.       if (var3 != null) {
  937.          Rect.returnRect(var3);
  938.       }
  939.  
  940.    }
  941.  
  942.    View ancestorWithDrawingBuffer() {
  943.       if (this.drawingBuffer != null) {
  944.          return this;
  945.       } else {
  946.          return this._superview == null ? null : this._superview.ancestorWithDrawingBuffer();
  947.       }
  948.    }
  949.  
  950.    void _startFocus() {
  951.       if (this.focusPaused) {
  952.          this.focusPaused = false;
  953.          this.resumeFocus();
  954.       } else {
  955.          this.startFocus();
  956.       }
  957.    }
  958.  
  959.    void _stopFocus() {
  960.       this.focusPaused = false;
  961.       this.stopFocus();
  962.    }
  963.  
  964.    void _pauseFocus() {
  965.       this.focusPaused = true;
  966.       this.pauseFocus();
  967.    }
  968.  
  969.    public void startFocus() {
  970.    }
  971.  
  972.    public void stopFocus() {
  973.    }
  974.  
  975.    public void pauseFocus() {
  976.    }
  977.  
  978.    public void resumeFocus() {
  979.    }
  980.  
  981.    void setFocusedView(View var1) {
  982.       if (this._superview != null) {
  983.          this._superview.setFocusedView(var1);
  984.       }
  985.  
  986.    }
  987.  
  988.    public void setFocusedView() {
  989.       if (this._superview == null || !this.isInViewHierarchy() && this.window() == null) {
  990.          this.needFocus = true;
  991.       } else {
  992.          this._superview.setFocusedView(this);
  993.          this.needFocus = false;
  994.       }
  995.    }
  996.  
  997.    public void describeClassInfo(ClassInfo var1) {
  998.       var1.addClass("netscape.application.View", 2);
  999.       var1.addField("bounds", (byte)18);
  1000.       var1.addField("minSize", (byte)18);
  1001.       var1.addField("subviews", (byte)18);
  1002.       var1.addField("resizeInstr", (byte)4);
  1003.       var1.addField("drawingDisabled", (byte)8);
  1004.       var1.addField("autoResizeSubviews", (byte)0);
  1005.       var1.addField("buffered", (byte)0);
  1006.       var1.addField("layoutManager", (byte)18);
  1007.       var1.addField("keyboardBindings", (byte)18);
  1008.    }
  1009.  
  1010.    public void encode(Encoder var1) throws CodingException {
  1011.       var1.encodeObject("bounds", this.bounds);
  1012.       var1.encodeObject("minSize", this._minSize);
  1013.       if (this.subviewCount() == 0) {
  1014.          var1.encodeObject("subviews", (Object)null);
  1015.       } else {
  1016.          var1.encodeObject("subviews", this.subviews);
  1017.       }
  1018.  
  1019.       var1.encodeByte("resizeInstr", this.resizeInstr);
  1020.       var1.encodeInt("drawingDisabled", this.drawingDisabled);
  1021.       var1.encodeBoolean("autoResizeSubviews", this.autoResizeSubviews);
  1022.       var1.encodeBoolean("buffered", this.buffered);
  1023.       var1.encodeObject("layoutManager", this.layoutManager);
  1024.       var1.encodeObject("keyboardBindings", this._keyboardBindings);
  1025.    }
  1026.  
  1027.    public void decode(Decoder var1) throws CodingException {
  1028.       int var2 = var1.versionForClassName("netscape.application.View");
  1029.       this.bounds = (Rect)var1.decodeObject("bounds");
  1030.       this._minSize = (Size)var1.decodeObject("minSize");
  1031.       Object var3 = var1.decodeObject("subviews");
  1032.       if (var3 != null) {
  1033.          this.subviews = (Vector)var3;
  1034.       }
  1035.  
  1036.       this.resizeInstr = var1.decodeByte("resizeInstr");
  1037.       this.drawingDisabled = var1.decodeInt("drawingDisabled");
  1038.       boolean var4 = var1.decodeBoolean("autoResizeSubviews");
  1039.       if (var4) {
  1040.          this.setAutoResizeSubviews(var4);
  1041.       }
  1042.  
  1043.       var4 = var1.decodeBoolean("buffered");
  1044.       if (var4) {
  1045.          this.setBuffered(var4);
  1046.       }
  1047.  
  1048.       this.layoutManager = (LayoutManager)var1.decodeObject("layoutManager");
  1049.       if (var2 >= 2) {
  1050.          this._keyboardBindings = (Hashtable)var1.decodeObject("keyboardBindings");
  1051.       }
  1052.  
  1053.    }
  1054.  
  1055.    public void finishDecoding() throws CodingException {
  1056.       int var2 = this.subviewCount();
  1057.  
  1058.       while(var2-- > 0) {
  1059.          View var1 = (View)this.subviews.elementAt(var2);
  1060.          var1.setSuperview(this);
  1061.          var1._setBounds(var1.bounds.x, var1.bounds.y, var1.bounds.width, var1.bounds.height);
  1062.       }
  1063.  
  1064.       this._setBounds(this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height);
  1065.    }
  1066.  
  1067.    Application application() {
  1068.       return Application.application();
  1069.    }
  1070.  
  1071.    public void convertToView(View var1, int var2, int var3, Point var4) {
  1072.       int var5 = var2;
  1073.       int var6 = var3;
  1074.       if (this._superview == var1) {
  1075.          var5 = var2 + this.bounds.x;
  1076.          var6 = var3 + this.bounds.y;
  1077.       } else if (var1 != null && var1._superview == this) {
  1078.          var5 = var2 - var1.bounds.x;
  1079.          var6 = var3 - var1.bounds.y;
  1080.       } else {
  1081.          View var7;
  1082.          for(var7 = this; var7._superview != null; var7 = var7._superview) {
  1083.             var5 += var7.bounds.x;
  1084.             var6 += var7.bounds.y;
  1085.          }
  1086.  
  1087.          if (var1 != null) {
  1088.             View var8;
  1089.             for(var8 = var1; var8._superview != null; var8 = var8._superview) {
  1090.                var5 -= var8.bounds.x;
  1091.                var6 -= var8.bounds.y;
  1092.             }
  1093.  
  1094.             if (var7 != var8) {
  1095.                throw new InconsistencyException("Can't convert between " + this + " and " + var1 + ", no common ancestor");
  1096.             }
  1097.          }
  1098.       }
  1099.  
  1100.       var4.x = var5;
  1101.       var4.y = var6;
  1102.    }
  1103.  
  1104.    public Point convertToView(View var1, int var2, int var3) {
  1105.       Point var4 = new Point();
  1106.       this.convertToView(var1, var2, var3, var4);
  1107.       return var4;
  1108.    }
  1109.  
  1110.    public void convertRectToView(View var1, Rect var2, Rect var3) {
  1111.       Point var4 = Point.newPoint();
  1112.       this.convertToView(var1, var2.x, var2.y, var4);
  1113.       var3.setBounds(var4.x, var4.y, var2.width, var2.height);
  1114.       Point.returnPoint(var4);
  1115.    }
  1116.  
  1117.    public void convertPointToView(View var1, Point var2, Point var3) {
  1118.       this.convertToView(var1, var2.x, var2.y, var3);
  1119.    }
  1120.  
  1121.    public Rect convertRectToView(View var1, Rect var2) {
  1122.       Rect var3 = new Rect();
  1123.       this.convertRectToView(var1, var2, var3);
  1124.       return var3;
  1125.    }
  1126.  
  1127.    public Point convertPointToView(View var1, Point var2) {
  1128.       Point var3 = new Point();
  1129.       this.convertPointToView(var1, var2, var3);
  1130.       return var3;
  1131.    }
  1132.  
  1133.    public MouseEvent convertEventToView(View var1, MouseEvent var2) {
  1134.       Point var3 = Point.newPoint();
  1135.       MouseEvent var4 = (MouseEvent)((Event)var2).clone();
  1136.       this.convertToView(var1, var2.x, var2.y, var3);
  1137.       var4.x = var3.x;
  1138.       var4.y = var3.y;
  1139.       Point.returnPoint(var3);
  1140.       return var4;
  1141.    }
  1142.  
  1143.    public void setGraphicsDebugOptions(int var1) {
  1144.       Graphics.setViewDebug(this, var1);
  1145.    }
  1146.  
  1147.    public int graphicsDebugOptions() {
  1148.       return Graphics.viewDebug(this);
  1149.    }
  1150.  
  1151.    int shouldDebugGraphics() {
  1152.       return Graphics.shouldViewDebug(this);
  1153.    }
  1154.  
  1155.    int absoluteX() {
  1156.       int var1 = 0;
  1157.  
  1158.       for(View var2 = this; var2 != null; var2 = var2._superview) {
  1159.          var1 += var2.bounds.x;
  1160.       }
  1161.  
  1162.       return var1;
  1163.    }
  1164.  
  1165.    int absoluteY() {
  1166.       int var1 = 0;
  1167.  
  1168.       for(View var2 = this; var2 != null; var2 = var2._superview) {
  1169.          var1 += var2.bounds.y;
  1170.       }
  1171.  
  1172.       return var1;
  1173.    }
  1174.  
  1175.    public void setLayoutManager(LayoutManager var1) {
  1176.       this.layoutManager = var1;
  1177.    }
  1178.  
  1179.    public LayoutManager layoutManager() {
  1180.       return this.layoutManager;
  1181.    }
  1182.  
  1183.    public void layoutView(int var1, int var2) {
  1184.       if (this.layoutManager == null) {
  1185.          this.relativeLayoutView(var1, var2);
  1186.       } else {
  1187.          this.layoutManager.layoutView(this, var1, var2);
  1188.       }
  1189.    }
  1190.  
  1191.    private void relativeLayoutView(int var1, int var2) {
  1192.       int var4;
  1193.       int var5;
  1194.       int var6;
  1195.       int var7;
  1196.       View var8;
  1197.       for(int var3 = this.subviewCount(); var3-- > 0; var8.setBounds(var4, var5, var6, var7)) {
  1198.          var8 = (View)this.subviews.elementAt(var3);
  1199.          var4 = var8.bounds.x;
  1200.          var5 = var8.bounds.y;
  1201.          var6 = var8.bounds.width;
  1202.          var7 = var8.bounds.height;
  1203.          switch (var8.horizResizeInstruction()) {
  1204.             case 0:
  1205.                break;
  1206.             case 1:
  1207.                var4 += var1;
  1208.                break;
  1209.             case 2:
  1210.                var6 += var1;
  1211.                break;
  1212.             case 32:
  1213.                var4 = (this.bounds.width - var8.bounds.width) / 2;
  1214.                break;
  1215.             default:
  1216.                throw new InconsistencyException("invalid horz resize instruction: " + var8.horizResizeInstruction());
  1217.          }
  1218.  
  1219.          switch (var8.vertResizeInstruction()) {
  1220.             case 4:
  1221.                break;
  1222.             case 8:
  1223.                var5 += var2;
  1224.                break;
  1225.             case 16:
  1226.                var7 += var2;
  1227.                break;
  1228.             case 64:
  1229.                var5 = (this.bounds.height - var8.bounds.height) / 2;
  1230.                break;
  1231.             default:
  1232.                throw new InconsistencyException("invalid vert resize instruction: " + var8.vertResizeInstruction());
  1233.          }
  1234.       }
  1235.  
  1236.    }
  1237.  
  1238.    public Rect localBounds() {
  1239.       return new Rect(0, 0, this.bounds.width, this.bounds.height);
  1240.    }
  1241.  
  1242.    public Graphics createGraphics() {
  1243.       return Graphics.newGraphics(this);
  1244.    }
  1245.  
  1246.    protected Bitmap createBuffer() {
  1247.       return new Bitmap(this.width(), this.height());
  1248.    }
  1249.  
  1250.    public String toString() {
  1251.       return super.toString() + this.bounds.toString();
  1252.    }
  1253.  
  1254.    public boolean canBecomeSelectedView() {
  1255.       return false;
  1256.    }
  1257.  
  1258.    public boolean hidesSubviewsFromKeyboard() {
  1259.       return false;
  1260.    }
  1261.  
  1262.    public View nextSelectableView() {
  1263.       return null;
  1264.    }
  1265.  
  1266.    public View previousSelectableView() {
  1267.       return null;
  1268.    }
  1269.  
  1270.    public void invalidateKeyboardSelectionOrder() {
  1271.       this.kbdOrder = null;
  1272.    }
  1273.  
  1274.    public void willBecomeSelected() {
  1275.       this.wantsKeyboardArrow = true;
  1276.    }
  1277.  
  1278.    public void willBecomeUnselected() {
  1279.       this.wantsKeyboardArrow = false;
  1280.    }
  1281.  
  1282.    public void setCommandForKey(String var1, Object var2, int var3, int var4, int var5) {
  1283.       KeyStroke var6 = new KeyStroke(var3, var4);
  1284.       if (this._keyboardBindings == null) {
  1285.          this._keyboardBindings = new Hashtable();
  1286.       }
  1287.  
  1288.       if (var1 == null) {
  1289.          this._keyboardBindings.remove(var6);
  1290.       } else {
  1291.          Hashtable var7 = new Hashtable();
  1292.          var7.put("kbdCmd", var1);
  1293.          var7.put("when", "" + var5);
  1294.          if (var2 != null) {
  1295.             var7.put("kbdData", var2);
  1296.          }
  1297.  
  1298.          this._keyboardBindings.put(var6, var7);
  1299.       }
  1300.    }
  1301.  
  1302.    public void setCommandForKey(String var1, int var2, int var3) {
  1303.       this.setCommandForKey(var1, this, var2, 0, var3);
  1304.    }
  1305.  
  1306.    public void removeCommandForKey(int var1) {
  1307.       this.setCommandForKey((String)null, (Object)null, var1, 0, 0);
  1308.    }
  1309.  
  1310.    public void removeAllCommandsForKeys() {
  1311.       this._keyboardBindings = null;
  1312.    }
  1313.  
  1314.    boolean hasKeyboardBindings() {
  1315.       return this._keyboardBindings != null && this._keyboardBindings.count() > 0;
  1316.    }
  1317.  
  1318.    boolean performCommandForKeyStroke(KeyStroke var1, int var2) {
  1319.       if (!(this instanceof Target)) {
  1320.          return false;
  1321.       } else {
  1322.          if (this._keyboardBindings != null) {
  1323.             Enumeration var3 = this._keyboardBindings.keys();
  1324.  
  1325.             while(var3.hasMoreElements()) {
  1326.                KeyStroke var4 = (KeyStroke)var3.nextElement();
  1327.                if (var4.equals(var1)) {
  1328.                   boolean var5 = false;
  1329.                   Hashtable var6 = (Hashtable)this._keyboardBindings.get(var4);
  1330.                   String var7 = (String)var6.get("when");
  1331.                   int var8 = Integer.parseInt(var7);
  1332.                   switch (var8) {
  1333.                      case 0:
  1334.                         if (var2 == 0) {
  1335.                            var5 = true;
  1336.                         }
  1337.                         break;
  1338.                      case 1:
  1339.                         if (var2 == 0 || var2 == 1) {
  1340.                            var5 = true;
  1341.                         }
  1342.                         break;
  1343.                      case 2:
  1344.                         var5 = true;
  1345.                         break;
  1346.                      default:
  1347.                         throw new InconsistencyException("Wrong condition:" + var8);
  1348.                   }
  1349.  
  1350.                   if (var5) {
  1351.                      String var9 = (String)var6.get("kbdCmd");
  1352.                      ((Target)this).performCommand(var9, var6.get("kbdData"));
  1353.                      return true;
  1354.                   }
  1355.                }
  1356.             }
  1357.          }
  1358.  
  1359.          return false;
  1360.       }
  1361.    }
  1362.  
  1363.    public Rect keyboardRect() {
  1364.       return this.localBounds();
  1365.    }
  1366.  
  1367.    View _firstSubview(Vector var1) {
  1368.       if (var1.count() == 0) {
  1369.          return null;
  1370.       } else {
  1371.          View var5 = (View)var1.elementAt(0);
  1372.          int var3 = var5.method_1();
  1373.          int var7 = 1;
  1374.  
  1375.          for(int var8 = var1.count(); var7 < var8; ++var7) {
  1376.             View var6 = (View)var1.elementAt(var7);
  1377.             if (var6.method_1() < var3) {
  1378.                var5 = var6;
  1379.                var3 = var6.method_1();
  1380.             }
  1381.          }
  1382.  
  1383.          View var4 = var5;
  1384.          int var2 = var5.method_0();
  1385.          var7 = 0;
  1386.  
  1387.          for(int var11 = var1.count(); var7 < var11; ++var7) {
  1388.             View var9 = (View)var1.elementAt(var7);
  1389.             if (var9 != var4 && (int)Math.sqrt((double)((var9.method_1() - var4.method_1()) * (var9.method_1() - var4.method_1()))) <= 10 && var9.method_0() < var2) {
  1390.                var4 = var9;
  1391.                var2 = var9.method_0();
  1392.             }
  1393.          }
  1394.  
  1395.          return var4;
  1396.       }
  1397.    }
  1398.  
  1399.    private void validateKeyboardOrder() {
  1400.       if (this.kbdOrder == null) {
  1401.          Vector var3 = new Vector();
  1402.          int var1 = 0;
  1403.  
  1404.          for(int var2 = this.subviews.count(); var1 < var2; ++var1) {
  1405.             var3.addElement(this.subviews.elementAt(var1));
  1406.          }
  1407.  
  1408.          this.kbdOrder = new Vector();
  1409.  
  1410.          while(var3.count() > 0) {
  1411.             View var4 = this._firstSubview(var3);
  1412.             this.kbdOrder.addElement(var4);
  1413.             var3.removeElement(var4);
  1414.  
  1415.             View var5;
  1416.             while((var5 = var4.nextSelectableView()) != null && var3.indexOfIdentical(var5) != -1) {
  1417.                this.kbdOrder.addElement(var5);
  1418.                var3.removeElement(var5);
  1419.                var4 = var5;
  1420.             }
  1421.          }
  1422.       }
  1423.  
  1424.    }
  1425.  
  1426.    View firstSubview() {
  1427.       this.validateKeyboardOrder();
  1428.       return this.kbdOrder.count() > 0 ? (View)this.kbdOrder.elementAt(0) : null;
  1429.    }
  1430.  
  1431.    View lastSubview() {
  1432.       this.validateKeyboardOrder();
  1433.       return this.kbdOrder.count() > 0 ? (View)this.kbdOrder.elementAt(this.kbdOrder.count() - 1) : null;
  1434.    }
  1435.  
  1436.    View viewAfter(View var1) {
  1437.       this.validateKeyboardOrder();
  1438.       int var2 = this.kbdOrder.indexOfIdentical(var1);
  1439.       return var2 != -1 && var2 < this.kbdOrder.count() - 1 ? (View)this.kbdOrder.elementAt(var2 + 1) : null;
  1440.    }
  1441.  
  1442.    View viewBefore(View var1) {
  1443.       this.validateKeyboardOrder();
  1444.       int var2 = this.kbdOrder.indexOfIdentical(var1);
  1445.       return var2 > 0 ? (View)this.kbdOrder.elementAt(var2 - 1) : null;
  1446.    }
  1447.  
  1448.    boolean wantsKeyboardArrow() {
  1449.       return this.wantsKeyboardArrow;
  1450.    }
  1451.  
  1452.    void getDirtyRect(Rect var1) {
  1453.       if (this.isDirty() && this.dirtyRect == null) {
  1454.          if (var1.isEmpty()) {
  1455.             var1.setBounds(this.bounds);
  1456.          } else {
  1457.             var1.unionWith(this.bounds);
  1458.          }
  1459.       } else {
  1460.          if (this.dirtyRect != null) {
  1461.             if (var1.isEmpty()) {
  1462.                var1.setBounds(this.dirtyRect.x + this.bounds.x, this.dirtyRect.y + this.bounds.y, this.dirtyRect.width, this.dirtyRect.height);
  1463.             } else {
  1464.                var1.unionWith(this.dirtyRect.x + this.bounds.x, this.dirtyRect.y + this.bounds.y, this.dirtyRect.width, this.dirtyRect.height);
  1465.             }
  1466.          }
  1467.  
  1468.          int var2 = this.subviewCount();
  1469.          if (var2 != 0) {
  1470.             var1.moveBy(-this.bounds.x, -this.bounds.y);
  1471.  
  1472.             while(var2-- > 0) {
  1473.                ((View)this.subviews.elementAt(var2)).getDirtyRect(var1);
  1474.             }
  1475.  
  1476.             var1.moveBy(this.bounds.x, this.bounds.y);
  1477.          }
  1478.  
  1479.       }
  1480.    }
  1481. }
  1482.