home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Java / CFJava.cab / CFJavaRuntime.cab / netscape / application / InternalWindow.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-10-01  |  27.9 KB  |  1,346 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.InconsistencyException;
  9. import netscape.util.Vector;
  10.  
  11. public class InternalWindow extends View implements Window {
  12.    RootView rootView;
  13.    WindowOwner _owner;
  14.    WindowContentView _contentView;
  15.    View _focusedView;
  16.    View _defaultSelectedView;
  17.    Button _closeButton;
  18.    MenuView menuView;
  19.    Font _titleFont;
  20.    String _title;
  21.    Border _border;
  22.    int _layer;
  23.    int _type;
  24.    int _lastX;
  25.    int _lastY;
  26.    int _resizePart;
  27.    boolean _closeable;
  28.    boolean _resizable;
  29.    boolean _canBecomeMain;
  30.    boolean _containsDocument;
  31.    boolean _drewOnLastDrag;
  32.    boolean _drawToBackingStore;
  33.    boolean _dragStart;
  34.    boolean _onscreen;
  35.    boolean _createdDrawingBuffer;
  36.    boolean transparent;
  37.    boolean scrollToVisible;
  38.    static Vector _resizeWindowVector = new Vector();
  39.    static final int ABOVE = 0;
  40.    static final int BEHIND = 1;
  41.    static final int NO_PART = 0;
  42.    static final int LEFT_PART = 1;
  43.    static final int MIDDLE_PART = 2;
  44.    static final int RIGHT_PART = 3;
  45.    static final String ownerKey = "owner";
  46.    static final String contentViewKey = "contentView";
  47.    static final String focusedViewKey = "focusedView";
  48.    static final String closeButtonKey = "closeButton";
  49.    static final String titleFontKey = "titleFont";
  50.    static final String titleKey = "title";
  51.    static final String borderKey = "border";
  52.    static final String layerKey = "layer";
  53.    static final String typeKey = "type";
  54.    static final String closeableKey = "closeable";
  55.    static final String resizableKey = "resizeable";
  56.    static final String canBecomeMainKey = "canBecomeMain";
  57.    static final String containsDocumentKey = "canBecomeDocument";
  58.    static final String onscreenKey = "onscreen";
  59.    static final String transparentKey = "transparent";
  60.    static final String scrollToVisibleKey = "scrollToVisible";
  61.    static final String defaultSelectedViewKey = "defaultSelectedView";
  62.    static final String menuViewKey = "menuView";
  63.    public static final int DEFAULT_LAYER = 0;
  64.    public static final int PALETTE_LAYER = 100;
  65.    public static final int MODAL_LAYER = 200;
  66.    public static final int POPUP_LAYER = 300;
  67.    public static final int DRAG_LAYER = 400;
  68.    public static final int IGNORE_WINDOW_CLIPVIEW_LAYER = 500;
  69.  
  70.    public InternalWindow() {
  71.       this(0, 0, 0, 0);
  72.    }
  73.  
  74.    public InternalWindow(Rect var1) {
  75.       this(var1.x, var1.y, var1.width, var1.height);
  76.    }
  77.  
  78.    public InternalWindow(int var1, int var2, int var3, int var4) {
  79.       this(1, var1, var2, var3, var4);
  80.    }
  81.  
  82.    public InternalWindow(int var1, int var2, int var3, int var4, int var5) {
  83.       super(var2, var3, var4, var5);
  84.       this._title = "";
  85.       this._type = 1;
  86.       this._canBecomeMain = true;
  87.       this._containsDocument = false;
  88.       this._onscreen = true;
  89.       this.transparent = false;
  90.       this.rootView = ((View)this).application().mainRootView();
  91.       this._titleFont = Font.fontNamed("Helvetica", 1, 12);
  92.       this._contentView = new WindowContentView(0, 0, 1, 1);
  93.       this._contentView.setHorizResizeInstruction(2);
  94.       this._contentView.setVertResizeInstruction(16);
  95.       this.addSubviewToWindow(this._contentView);
  96.       this._layer = 0;
  97.       this._border = new InternalWindowBorder(this);
  98.       this.layoutParts();
  99.       this.setType(var1);
  100.       this._defaultSelectedView = this;
  101.    }
  102.  
  103.    int menuViewHeight() {
  104.       return this.menuView == null ? 0 : this.menuView.height();
  105.    }
  106.  
  107.    int titleBarMargin() {
  108.       return this._type == 0 ? 0 : this._border.topMargin();
  109.    }
  110.  
  111.    int leftBorderMargin() {
  112.       return this._type == 0 ? 0 : this._border.leftMargin();
  113.    }
  114.  
  115.    int rightBorderMargin() {
  116.       return this._type == 0 ? 0 : this._border.rightMargin();
  117.    }
  118.  
  119.    int bottomBorderMargin() {
  120.       return this._type == 0 ? 0 : this._border.bottomMargin();
  121.    }
  122.  
  123.    public WindowContentView contentView() {
  124.       return this._contentView;
  125.    }
  126.  
  127.    public Size contentSize() {
  128.       return this._contentView == null ? null : new Size(this._contentView.bounds.width, this._contentView.bounds.height);
  129.    }
  130.  
  131.    public void layoutParts() {
  132.       if (this._contentView != null) {
  133.          this._contentView.setAutoResizeSubviews(false);
  134.          this._contentView.setBounds(this.leftBorderMargin(), this.titleBarMargin() + this.menuViewHeight(), super.bounds.width - (this.leftBorderMargin() + this.rightBorderMargin()), super.bounds.height - (this.titleBarMargin() + this.menuViewHeight() + this.bottomBorderMargin()));
  135.          this._contentView.setAutoResizeSubviews(true);
  136.       }
  137.  
  138.       if (this._closeButton != null) {
  139.          this._closeButton.removeFromSuperview();
  140.          this._closeButton.moveTo(0, 2 + (this.titleBarMargin() - 4 - this._closeButton.bounds.height) / 2);
  141.          if (this._closeable) {
  142.             this.addSubview(this._closeButton);
  143.          }
  144.       }
  145.  
  146.    }
  147.  
  148.    public void addSubview(View var1) {
  149.       if (var1 != this._contentView && var1 != this._closeButton) {
  150.          if (this._contentView != null) {
  151.             this._contentView.addSubview(var1);
  152.          }
  153.  
  154.       } else {
  155.          this.addSubviewToWindow(var1);
  156.       }
  157.    }
  158.  
  159.    public void addSubviewToWindow(View var1) {
  160.       super.addSubview(var1);
  161.    }
  162.  
  163.    public void setRootView(RootView var1) {
  164.       if (this.rootView != var1 && this.rootView != null && super._superview != null) {
  165.          this.rootView.removeWindow(this);
  166.       }
  167.  
  168.       this.rootView = var1;
  169.    }
  170.  
  171.    public void show() {
  172.       if (this.rootView == null) {
  173.          throw new InconsistencyException("Can't show Window.  No RootView");
  174.       } else {
  175.          if (this._owner == null || this._owner.windowWillShow(this)) {
  176.             if (super._superview == null) {
  177.                this.rootView.addWindowRelativeTo(this, 0, (InternalWindow)null);
  178.             } else {
  179.                this.rootView.makeWindowVisible(this, 0, (InternalWindow)null);
  180.             }
  181.  
  182.             if (this._owner != null) {
  183.                this._owner.windowDidShow(this);
  184.             }
  185.          }
  186.  
  187.       }
  188.    }
  189.  
  190.    public void showModally() {
  191.       Application var1 = Application.application();
  192.       EventLoop var3 = var1.eventLoop();
  193.       int var4 = this.layer();
  194.       if (var4 < 200) {
  195.          this.setLayer(200);
  196.       }
  197.  
  198.       this.show();
  199.       ((View)this).rootView()._setMainWindow(this);
  200.       var1.beginModalSessionForView(this);
  201.       var1.drawAllDirtyViews();
  202.  
  203.       while(this.isVisible()) {
  204.          Event var2 = var3.getNextEvent();
  205.  
  206.          try {
  207.             var3.processEvent(var2);
  208.          } catch (Exception var6) {
  209.             System.err.println("Uncaught Exception.");
  210.             ((Throwable)var6).printStackTrace(System.err);
  211.             System.err.println("Restarting modal EventLoop.");
  212.          }
  213.       }
  214.  
  215.       var1.endModalSessionForView(this);
  216.       if (var4 != this.layer()) {
  217.          this.setLayer(var4);
  218.       }
  219.  
  220.    }
  221.  
  222.    public void showInFrontOf(InternalWindow var1) {
  223.       if (var1.rootView != this.rootView) {
  224.          this.setRootView(var1.rootView);
  225.          this.rootView.addWindowRelativeTo(this, 0, var1);
  226.       } else if (super._superview == null) {
  227.          this.rootView.addWindowRelativeTo(this, 0, var1);
  228.       } else {
  229.          this.rootView.makeWindowVisible(this, 0, var1);
  230.       }
  231.    }
  232.  
  233.    public void showBehind(InternalWindow var1) {
  234.       if (var1.rootView != this.rootView) {
  235.          this.setRootView(var1.rootView);
  236.          this.rootView.addWindowRelativeTo(this, 1, var1);
  237.       } else {
  238.          if (super._superview == null) {
  239.             this.rootView.addWindowRelativeTo(this, 1, var1);
  240.          }
  241.  
  242.       }
  243.    }
  244.  
  245.    public void moveToFront() {
  246.       if (this.isVisible()) {
  247.          InternalWindow var1 = this.rootView.frontWindowWithLayer(this.layer());
  248.          if (var1 != null && var1 != this) {
  249.             this.rootView.makeWindowVisible(this, 0, var1);
  250.          }
  251.  
  252.       }
  253.    }
  254.  
  255.    public void moveToBack() {
  256.       if (this.isVisible()) {
  257.          InternalWindow var1 = this.rootView.backWindowWithLayer(this.layer());
  258.          if (var1 != null && var1 != this) {
  259.             this.rootView.makeWindowVisible(this, 1, var1);
  260.          }
  261.  
  262.       }
  263.    }
  264.  
  265.    public void hide() {
  266.       if (this.isVisible() && (this._owner == null || this._owner.windowWillHide(this))) {
  267.          if (this.containsDocument() && this.isCurrentDocument()) {
  268.             Application.application().chooseNextCurrentDocumentWindow(this);
  269.          }
  270.  
  271.          RootView var1 = ((View)this).rootView();
  272.          if (var1 != null) {
  273.             var1.removeWindow(this);
  274.          }
  275.  
  276.          if (this._owner != null) {
  277.             this._owner.windowDidHide(this);
  278.          }
  279.       }
  280.  
  281.    }
  282.  
  283.    public void setCanBecomeMain(boolean var1) {
  284.       this._canBecomeMain = var1;
  285.       if (this.isMain() && !this._canBecomeMain && this.rootView != null) {
  286.          this.rootView._setMainWindow((InternalWindow)null);
  287.       }
  288.  
  289.    }
  290.  
  291.    public boolean canBecomeMain() {
  292.       return this._canBecomeMain;
  293.    }
  294.  
  295.    public boolean isVisible() {
  296.       return super._superview != null;
  297.    }
  298.  
  299.    public void setOnscreenAtStartup(boolean var1) {
  300.       this._onscreen = var1;
  301.    }
  302.  
  303.    public boolean onscreenAtStartup() {
  304.       return this._onscreen;
  305.    }
  306.  
  307.    public boolean isMain() {
  308.       return this.rootView != null && this.rootView.mainWindow() == this;
  309.    }
  310.  
  311.    protected Button createCloseButton() {
  312.       Button var1 = new Button(0, 0, 1, 1);
  313.       var1.setImage(Bitmap.bitmapNamed("netscape/application/CloseButton.gif"));
  314.       var1.setAltImage(Bitmap.bitmapNamed("netscape/application/CloseButtonActive.gif"));
  315.       var1.setTransparent(true);
  316.       ((View)var1).sizeToMinSize();
  317.       ((View)var1).setHorizResizeInstruction(0);
  318.       ((View)var1).setVertResizeInstruction(4);
  319.       ((View)var1).moveTo(0, 2 + (this.titleBarMargin() - 4 - var1.bounds.height) / 2);
  320.       var1.setTarget(this);
  321.       var1.setCommand("hide");
  322.       ((View)var1).removeAllCommandsForKeys();
  323.       return var1;
  324.    }
  325.  
  326.    public void setCloseable(boolean var1) {
  327.       this._closeable = var1;
  328.       if (this._type == 0) {
  329.          this._closeable = false;
  330.       }
  331.  
  332.       if (this._closeable && this._closeButton == null) {
  333.          this._closeButton = this.createCloseButton();
  334.       }
  335.  
  336.       if (this._closeable) {
  337.          this.addSubviewToWindow(this._closeButton);
  338.       } else {
  339.          if (this._closeButton != null) {
  340.             this._closeButton.removeFromSuperview();
  341.          }
  342.  
  343.       }
  344.    }
  345.  
  346.    public boolean isCloseable() {
  347.       return this._closeable;
  348.    }
  349.  
  350.    public void setResizable(boolean var1) {
  351.       if (var1 != this._resizable) {
  352.          this._resizable = var1;
  353.          if (this._resizable) {
  354.             this._contentView.setHorizResizeInstruction(2);
  355.             this._contentView.setVertResizeInstruction(16);
  356.          }
  357.  
  358.          if (this._type == 1) {
  359.             this.drawBottomBorder();
  360.             this.layoutParts();
  361.          }
  362.       }
  363.  
  364.    }
  365.  
  366.    public boolean isResizable() {
  367.       return this._resizable;
  368.    }
  369.  
  370.    int resizePartWidth() {
  371.       return this._border instanceof InternalWindowBorder ? ((InternalWindowBorder)this._border).resizePartWidth() : 0;
  372.    }
  373.  
  374.    public Size windowSizeForContentSize(int var1, int var2) {
  375.       return new Size(var1 + this.leftBorderMargin() + this.rightBorderMargin(), var2 + this.titleBarMargin() + this.menuViewHeight() + this.bottomBorderMargin());
  376.    }
  377.  
  378.    public void setTitle(String var1) {
  379.       if (this._title == null || var1 == null || !this._title.equals(var1)) {
  380.          this._title = var1;
  381.          this.drawTitleBar();
  382.       }
  383.    }
  384.  
  385.    public String title() {
  386.       return this._title;
  387.    }
  388.  
  389.    public void setBorder(Border var1) {
  390.       this._border = var1;
  391.    }
  392.  
  393.    public Border border() {
  394.       return this._border;
  395.    }
  396.  
  397.    public void setLayer(int var1) {
  398.       this._layer = var1;
  399.    }
  400.  
  401.    public int layer() {
  402.       return this._layer;
  403.    }
  404.  
  405.    public Size minSize() {
  406.       if (super._minSize != null) {
  407.          return new Size(super._minSize);
  408.       } else {
  409.          ((View)this).setMinSize(this.resizePartWidth() * 2 + 1, this.titleBarMargin() + this.menuViewHeight() + 2);
  410.          if (this._type == 0) {
  411.             super._minSize.width = 0;
  412.             super._minSize.height = 0;
  413.             return super._minSize;
  414.          } else {
  415.             if (super._minSize.width < this.leftBorderMargin() + this.rightBorderMargin()) {
  416.                super._minSize.width = this.leftBorderMargin() + this.rightBorderMargin();
  417.             }
  418.  
  419.             if (super._minSize.height < this.titleBarMargin() + this.menuViewHeight() + this.bottomBorderMargin()) {
  420.                super._minSize.height = this.titleBarMargin() + this.menuViewHeight() + this.bottomBorderMargin();
  421.             }
  422.  
  423.             return new Size(super._minSize);
  424.          }
  425.       }
  426.    }
  427.  
  428.    public void setOwner(WindowOwner var1) {
  429.       this._owner = var1;
  430.    }
  431.  
  432.    public WindowOwner owner() {
  433.       return this._owner;
  434.    }
  435.  
  436.    public void setMenuView(MenuView var1) {
  437.       if (var1 == null || var1 != this.menuView) {
  438.          if (this.menuView != null) {
  439.             this.menuView.removeFromSuperview();
  440.          }
  441.  
  442.          this.menuView = var1;
  443.          int var2 = this.leftBorderMargin();
  444.          int var3 = this.titleBarMargin();
  445.          int var4 = super.bounds.width - (this.leftBorderMargin() + this.rightBorderMargin());
  446.          int var5 = this.menuView.height();
  447.          if (var5 == 0) {
  448.             var5 = this.menuView.minSize().height;
  449.          }
  450.  
  451.          this.menuView.setBounds(var2, var3, var4, var5);
  452.          this.addSubviewToWindow(this.menuView);
  453.          this.layoutParts();
  454.       }
  455.    }
  456.  
  457.    public MenuView menuView() {
  458.       return this.menuView;
  459.    }
  460.  
  461.    public boolean isPointInBorder(int var1, int var2) {
  462.       if (this._type == 0) {
  463.          return Rect.contains(0, 0, super.bounds.width, super.bounds.height, var1, var2);
  464.       } else if (this._resizable && var2 > super.bounds.height - this.bottomBorderMargin()) {
  465.          if (var1 < this.resizePartWidth()) {
  466.             this._resizePart = 1;
  467.          } else if (var1 > super.bounds.width - this.resizePartWidth()) {
  468.             this._resizePart = 3;
  469.          } else {
  470.             this._resizePart = 2;
  471.          }
  472.  
  473.          return true;
  474.       } else {
  475.          return var2 <= this.titleBarMargin();
  476.       }
  477.    }
  478.  
  479.    public View viewForMouse(int var1, int var2) {
  480.       Object var3 = super.viewForMouse(var1, var2);
  481.       if (this._type == 0 && var3 == this._contentView) {
  482.          var3 = this;
  483.       }
  484.  
  485.       return (View)var3;
  486.    }
  487.  
  488.    public void setTransparent(boolean var1) {
  489.       this.transparent = var1;
  490.       if (this.transparent) {
  491.          this._contentView.setTransparent(true);
  492.          ((View)this).setBuffered(true);
  493.       } else {
  494.          ((View)this).setBuffered(false);
  495.          this._contentView.setTransparent(false);
  496.       }
  497.    }
  498.  
  499.    public boolean isTransparent() {
  500.       return this.transparent;
  501.    }
  502.  
  503.    public void setType(int var1) {
  504.       this._type = var1;
  505.       if (this._type == 0) {
  506.          this.setCanBecomeMain(false);
  507.          this.setCloseable(false);
  508.       }
  509.  
  510.       this.layoutParts();
  511.    }
  512.  
  513.    public int type() {
  514.       return this._type;
  515.    }
  516.  
  517.    void updateDrawingBuffer() {
  518.       if (super.drawingBuffer != null) {
  519.          if (this.rootView == null) {
  520.             throw new InconsistencyException("Can't draw window - no RootView");
  521.          } else {
  522.             Rect var7 = Rect.newRect();
  523.             this.rootView.disableWindowsAbove(this, true);
  524.             ((View)this).reenableDrawing();
  525.             Graphics var6 = super.drawingBuffer.createGraphics();
  526.             var6.setDebugOptions(((View)this).shouldDebugGraphics());
  527.             ((View)this).superview().convertRectToView((View)null, super.bounds, var7);
  528.             var6.pushState();
  529.             var6.translate(-var7.x, -var7.y);
  530.             this.rootView.draw(var6, var7);
  531.             var6.popState();
  532.             int var4 = this.isTransparent() ? this.rootView.windows.count() : this.rootView.windows.indexOf(this);
  533.             int var5 = 0;
  534.             int var3 = var4;
  535.  
  536.             while(var3-- > 0 && var5 == 0) {
  537.                InternalWindow var1 = (InternalWindow)this.rootView.windows.elementAt(var3);
  538.                if (!var1.isTransparent() && var1.bounds.contains(super.bounds)) {
  539.                   var5 = var3;
  540.                }
  541.             }
  542.  
  543.             if (var5 == 0) {
  544.                View var2 = this.rootView.viewWithBuffer(this.rootView, var7);
  545.                if (var2 != null) {
  546.                   Rect var8 = Rect.newRect(0, 0, ((View)this).width(), ((View)this).height());
  547.                   ((View)this).convertRectToView(var2, var8, var8);
  548.                   var6.pushState();
  549.                   var6.translate(-var8.x, -var8.y);
  550.                   var2.draw(var6, var8);
  551.                   var6.popState();
  552.                   Rect.returnRect(var8);
  553.                }
  554.             }
  555.  
  556.             for(int var10 = var5; var10 < var4; ++var10) {
  557.                InternalWindow var9 = (InternalWindow)this.rootView.windows.elementAt(var10);
  558.                if (var9.bounds.intersects(super.bounds)) {
  559.                   var7.setBounds(0, 0, ((View)this).width(), ((View)this).height());
  560.                   ((View)this).convertRectToView(var9, var7, var7);
  561.                   var6.pushState();
  562.                   var6.translate(-var7.x, -var7.y);
  563.                   var9.draw(var6, var7);
  564.                   var6.popState();
  565.                }
  566.             }
  567.  
  568.             Rect.returnRect(var7);
  569.             this.rootView.disableWindowsAbove(this, false);
  570.             ((View)this).reenableDrawing();
  571.             var6.dispose();
  572.          }
  573.       }
  574.    }
  575.  
  576.    public boolean mouseDown(MouseEvent var1) {
  577.       this.rootView.makeWindowVisible(this, 0, (InternalWindow)null);
  578.       if (!this.isPointInBorder(var1.x, var1.y)) {
  579.          return false;
  580.       } else {
  581.          this._lastX = var1.x + super.bounds.x;
  582.          this._lastY = var1.y + super.bounds.y;
  583.          if (this._resizePart != 0) {
  584.             InternalWindow var2 = new InternalWindow(super.bounds.x, super.bounds.y, 1, super.bounds.height);
  585.             var2.setType(0);
  586.             var2._contentView.setTransparent(false);
  587.             var2._contentView.setBackgroundColor(Color.darkGray);
  588.             var2.setLayer(400);
  589.             ((View)var2).setVertResizeInstruction(16);
  590.             var2.setRootView(((View)this).rootView());
  591.             var2.show();
  592.             _resizeWindowVector.addElement(var2);
  593.             var2 = new InternalWindow(super.bounds.maxX() - 1, super.bounds.y, 1, super.bounds.height);
  594.             var2.setType(0);
  595.             var2._contentView.setTransparent(false);
  596.             var2._contentView.setBackgroundColor(Color.darkGray);
  597.             var2.setLayer(400);
  598.             ((View)var2).setVertResizeInstruction(16);
  599.             var2.setRootView(((View)this).rootView());
  600.             var2.show();
  601.             _resizeWindowVector.addElement(var2);
  602.             var2 = new InternalWindow(super.bounds.x + 1, super.bounds.y, super.bounds.width - 2, 1);
  603.             var2.setType(0);
  604.             var2._contentView.setTransparent(false);
  605.             var2._contentView.setBackgroundColor(Color.darkGray);
  606.             var2.setLayer(400);
  607.             ((View)var2).setHorizResizeInstruction(2);
  608.             var2.setRootView(((View)this).rootView());
  609.             var2.show();
  610.             _resizeWindowVector.addElement(var2);
  611.             var2 = new InternalWindow(super.bounds.x + 1, super.bounds.maxY() - 1, super.bounds.width - 2, 1);
  612.             var2.setType(0);
  613.             var2._contentView.setTransparent(false);
  614.             var2._contentView.setBackgroundColor(Color.darkGray);
  615.             var2.setLayer(400);
  616.             ((View)var2).setHorizResizeInstruction(2);
  617.             var2.setRootView(((View)this).rootView());
  618.             var2.show();
  619.             _resizeWindowVector.addElement(var2);
  620.             return true;
  621.          } else {
  622.             this._dragStart = true;
  623.             return true;
  624.          }
  625.       }
  626.    }
  627.  
  628.    public void setBounds(int var1, int var2, int var3, int var4) {
  629.       int var5 = var1 - super.bounds.x;
  630.       int var6 = var2 - super.bounds.y;
  631.       int var7 = var3 - super.bounds.width;
  632.       int var8 = var4 - super.bounds.height;
  633.       if (this.isVisible()) {
  634.          this.moveByAndSizeBy(var5, var6, var7, var8);
  635.       } else {
  636.          this._moveBy(var5, var6);
  637.          this._sizeBy(var7, var8);
  638.          ((View)this)._setBounds(var1, var2, var3, var4);
  639.       }
  640.    }
  641.  
  642.    private void _super_moveBy(int var1, int var2) {
  643.       if (var1 != 0 || var2 != 0) {
  644.          ((View)this)._setBounds(super.bounds.x + var1, super.bounds.y + var2, super.bounds.width, super.bounds.height);
  645.          if (super._superview != null) {
  646.             super._superview.subviewDidMove(this);
  647.          }
  648.  
  649.          ((View)this).didMoveBy(var1, var2);
  650.       }
  651.    }
  652.  
  653.    private void _super_sizeBy(int var1, int var2) {
  654.       if (var1 != 0 || var2 != 0) {
  655.          ((View)this)._setBounds(super.bounds.x, super.bounds.y, super.bounds.width + var1, super.bounds.height + var2);
  656.          if (super.buffered) {
  657.             if (super.bounds.width != 0 && super.bounds.height != 0) {
  658.                super.drawingBuffer = new Bitmap(super.bounds.width, super.bounds.height);
  659.                super.drawingBufferValid = false;
  660.             } else if (super.drawingBuffer != null) {
  661.                super.drawingBuffer.flush();
  662.                super.drawingBuffer = null;
  663.             }
  664.          }
  665.  
  666.          ((View)this).disableDrawing();
  667.          if (super._superview != null) {
  668.             super._superview.subviewDidResize(this);
  669.          }
  670.  
  671.          super.didSizeBy(var1, var2);
  672.          ((View)this).reenableDrawing();
  673.       }
  674.    }
  675.  
  676.    protected void willMoveTo(Point var1) {
  677.    }
  678.  
  679.    private void _moveBy(int var1, int var2) {
  680.       if (var1 != 0 || var2 != 0) {
  681.          Point var4 = Point.newPoint(super.bounds.x + var1, super.bounds.y + var2);
  682.          this.willMoveTo(var4);
  683.          var1 = var4.x - super.bounds.x;
  684.          var2 = var4.y - super.bounds.y;
  685.          Point.returnPoint(var4);
  686.          if (!this.isVisible()) {
  687.             this._super_moveBy(var1, var2);
  688.          } else {
  689.             this._lastX = super.bounds.x;
  690.             this._lastY = super.bounds.y;
  691.             this._dragStart = true;
  692.             MouseEvent var3 = new MouseEvent(0L, -2, this._lastX + var1, this._lastY + var2, 0);
  693.             this.mouseDragged(var3);
  694.             this._dragStart = false;
  695.          }
  696.       }
  697.    }
  698.  
  699.    void _checkSize(Size var1) {
  700.       Size var2 = this.minSize();
  701.       if (super.bounds.width + var1.width < var2.width) {
  702.          var1.width = var2.width - super.bounds.width;
  703.       }
  704.  
  705.       if (super.bounds.height + var1.height < var2.height) {
  706.          var1.height = var2.height - super.bounds.height;
  707.       }
  708.  
  709.       if (this._owner != null) {
  710.          this._owner.windowWillSizeBy(this, var1);
  711.       }
  712.  
  713.    }
  714.  
  715.    private void _sizeBy(int var1, int var2) {
  716.       if (var1 != 0 || var2 != 0) {
  717.          Size var4 = Size.newSize(var1, var2);
  718.          this._checkSize(var4);
  719.          var1 = var4.width;
  720.          var2 = var4.height;
  721.          Size.returnSize(var4);
  722.          if (!this.isVisible()) {
  723.             this._super_sizeBy(var1, var2);
  724.             this.layoutParts();
  725.          } else {
  726.             Rect var3 = Rect.newRect(super.bounds);
  727.             this._super_sizeBy(var1, var2);
  728.             this.layoutParts();
  729.             if (((View)this).canDraw()) {
  730.                var3.unionWith(super.bounds);
  731.                ((View)this).superview().convertRectToView((View)null, var3, var3);
  732.                this.rootView.redraw(var3);
  733.             }
  734.  
  735.             Rect.returnRect(var3);
  736.          }
  737.       }
  738.    }
  739.  
  740.    private void moveByAndSizeBy(int var1, int var2, int var3, int var4) {
  741.       if (var1 != 0 || var2 != 0 || var3 != 0 || var4 != 0) {
  742.          Size var6 = Size.newSize(var3, var4);
  743.          this._checkSize(var6);
  744.          var3 = var6.width;
  745.          var4 = var6.height;
  746.          Size.returnSize(var6);
  747.          Point var7 = Point.newPoint(super.bounds.x + var1, super.bounds.y + var2);
  748.          this.willMoveTo(var7);
  749.          var1 = var7.x - super.bounds.x;
  750.          var2 = var7.y - super.bounds.y;
  751.          Point.returnPoint(var7);
  752.          if (!this.isVisible()) {
  753.             this._super_moveBy(var1, var2);
  754.             this._super_sizeBy(var3, var4);
  755.             this.layoutParts();
  756.          } else {
  757.             Rect var5 = Rect.newRect(super.bounds);
  758.             this._super_moveBy(var1, var2);
  759.             this._super_sizeBy(var3, var4);
  760.             if (var3 != 0 || var4 != 0) {
  761.                this.layoutParts();
  762.             }
  763.  
  764.             var5.unionWith(super.bounds);
  765.             if (((View)this).superview() != this.rootView) {
  766.                ((View)this).superview().convertRectToView(this.rootView, var5, var5);
  767.             }
  768.  
  769.             if (this.isTransparent()) {
  770.                ((View)this).disableDrawing();
  771.                this.rootView.redraw(var5);
  772.                ((View)this).reenableDrawing();
  773.                ((View)this).draw();
  774.             } else {
  775.                this.rootView.redraw(var5);
  776.             }
  777.  
  778.             Rect.returnRect(var5);
  779.          }
  780.       }
  781.    }
  782.  
  783.    private void moveToAndSizeTo(int var1, int var2, int var3, int var4) {
  784.       this.moveByAndSizeBy(var1 - super.bounds.x, var2 - super.bounds.y, var3 - super.bounds.width, var4 - super.bounds.height);
  785.    }
  786.  
  787.    public void setScrollsToVisible(boolean var1) {
  788.       this.scrollToVisible = var1;
  789.    }
  790.  
  791.    public boolean scrollsToVisible() {
  792.       return this.scrollToVisible;
  793.    }
  794.  
  795.    public void scrollRectToVisible(Rect var1) {
  796.       int var6 = 0;
  797.       int var7 = 0;
  798.       if (this.scrollToVisible) {
  799.          Rect var2 = Rect.newRect();
  800.          ((View)this).computeVisibleRect(var2);
  801.          if (var2.width == super.bounds.width && var2.height == super.bounds.height) {
  802.             Rect.returnRect(var2);
  803.          } else {
  804.             if (!var2.contains(var1)) {
  805.                ((View)this).convertRectToView((View)null, var2, var2);
  806.                Rect var3 = Rect.newRect();
  807.                ((View)this).convertRectToView((View)null, var1, var3);
  808.                Rect var4 = Rect.newRect(0, 0, ((View)this).width(), ((View)this).height());
  809.                ((View)this).convertRectToView((View)null, var4, var4);
  810.                if (var3.x < var2.x && var2.x > var4.x) {
  811.                   var6 = var2.x - var3.x;
  812.                } else if (var3.maxX() > var2.maxX() && var2.maxX() < var4.maxX()) {
  813.                   var6 = var2.maxX() - var3.maxX();
  814.                }
  815.  
  816.                if (var3.y < var2.y && var2.y > var4.y) {
  817.                   var7 = var2.y - var3.y;
  818.                } else if (var3.maxY() > var2.maxY() && var2.maxY() < var4.maxY()) {
  819.                   var7 = var2.maxY() - var3.maxY();
  820.                }
  821.  
  822.                Rect var5 = ((View)this).rootView().bounds;
  823.                if (var6 > 0 && var4.x + var6 > 3) {
  824.                   var6 = 3 - var4.x;
  825.                } else if (var6 < 0 && var4.maxX() + var6 < var5.maxX() - 3) {
  826.                   var6 = var5.maxX() - 3 - var4.maxX();
  827.                }
  828.  
  829.                if (var7 > 0 && var4.y + var7 > 3) {
  830.                   var7 = 3 - var4.y;
  831.                } else if (var7 < 0 && var4.maxY() + var7 < var5.maxY() - 3) {
  832.                   var7 = var5.maxY() - 3 - var4.maxY();
  833.                }
  834.  
  835.                ((View)this).moveBy(var6, var7);
  836.                Rect.returnRect(var3);
  837.                Rect.returnRect(var4);
  838.             }
  839.  
  840.             Rect.returnRect(var2);
  841.          }
  842.       }
  843.    }
  844.  
  845.    public void subviewDidResize() {
  846.    }
  847.  
  848.    public void center() {
  849.       Rect var1 = this.rootView.bounds;
  850.       Rect var2 = new Rect((var1.width - super.bounds.width) / 2, (var1.height - super.bounds.height) / 2, super.bounds.width, super.bounds.height);
  851.       if (var2.y < 0) {
  852.          var2.y = 0;
  853.       }
  854.  
  855.       ((View)this).setBounds(var2);
  856.    }
  857.  
  858.    void mouseResizeDrag(MouseEvent var1) {
  859.       int var5 = 0;
  860.       var1.x += super.bounds.x;
  861.       var1.y += super.bounds.y;
  862.       if (this._resizePart == 2) {
  863.          var1.x = this._lastX;
  864.       }
  865.  
  866.       Rect var3 = Rect.newRect(super.bounds);
  867.       if (this._resizePart == 1) {
  868.          var3.moveBy(var1.x - this._lastX, 0);
  869.          var3.sizeBy(this._lastX - var1.x, var1.y - this._lastY);
  870.       } else {
  871.          var3.sizeBy(var1.x - this._lastX, var1.y - this._lastY);
  872.       }
  873.  
  874.       if (var3.height > ((View)this).superview().height() - var3.y) {
  875.          var3.sizeBy(0, ((View)this).superview().height() - var3.height - var3.y);
  876.       }
  877.  
  878.       Size var4 = Size.newSize(var3.width - super.bounds.width, var3.height - super.bounds.height);
  879.       this._checkSize(var4);
  880.       if (this._resizePart == 1) {
  881.          if (var3.x > super.bounds.x + super.bounds.width) {
  882.             var3.moveBy(super.bounds.x - var3.x - var4.width, 0);
  883.          } else {
  884.             var3.moveBy(var3.width - super.bounds.width - var4.width, 0);
  885.          }
  886.       }
  887.  
  888.       var3.sizeBy(var4.width - (var3.width - super.bounds.width), var4.height - (var3.height - super.bounds.height));
  889.       Size.returnSize(var4);
  890.       InternalWindow var2 = (InternalWindow)_resizeWindowVector.elementAt(0);
  891.       var5 = var3.height - var2.bounds.height;
  892.       if (this._resizePart == 1) {
  893.          if (var5 < 0) {
  894.             var2 = (InternalWindow)_resizeWindowVector.elementAt(1);
  895.             ((View)var2).sizeTo(1, var3.height);
  896.             var2 = (InternalWindow)_resizeWindowVector.elementAt(2);
  897.             var2.moveToAndSizeTo(var3.x + 1, var3.y, var3.width - 2, 1);
  898.             var2 = (InternalWindow)_resizeWindowVector.elementAt(3);
  899.             var2.moveToAndSizeTo(var3.x + 1, var3.maxY() - 1, var3.width - 2, 1);
  900.             var2 = (InternalWindow)_resizeWindowVector.elementAt(0);
  901.             var2.moveToAndSizeTo(var3.x, var3.y, 1, var3.height);
  902.          } else {
  903.             var2 = (InternalWindow)_resizeWindowVector.elementAt(0);
  904.             var2.moveToAndSizeTo(var3.x, var3.y, 1, var3.height);
  905.             var2 = (InternalWindow)_resizeWindowVector.elementAt(3);
  906.             var2.moveToAndSizeTo(var3.x + 1, var3.maxY() - 1, var3.width - 2, 1);
  907.             var2 = (InternalWindow)_resizeWindowVector.elementAt(2);
  908.             var2.moveToAndSizeTo(var3.x + 1, var3.y, var3.width - 2, 1);
  909.             var2 = (InternalWindow)_resizeWindowVector.elementAt(1);
  910.             ((View)var2).sizeTo(1, var3.height);
  911.          }
  912.       } else if (this._resizePart == 2) {
  913.          if (var5 < 0) {
  914.             var2 = (InternalWindow)_resizeWindowVector.elementAt(1);
  915.             ((View)var2).sizeTo(1, var3.height);
  916.             var2 = (InternalWindow)_resizeWindowVector.elementAt(0);
  917.             ((View)var2).sizeTo(1, var3.height);
  918.             var2 = (InternalWindow)_resizeWindowVector.elementAt(3);
  919.             var2.moveToAndSizeTo(var3.x + 1, var3.maxY() - 1, var2.bounds.width, var2.bounds.height);
  920.          } else {
  921.             var2 = (InternalWindow)_resizeWindowVector.elementAt(3);
  922.             var2.moveToAndSizeTo(var3.x + 1, var3.maxY() - 1, var2.bounds.width, var2.bounds.height);
  923.             var2 = (InternalWindow)_resizeWindowVector.elementAt(1);
  924.             ((View)var2).sizeTo(1, var3.height);
  925.             var2 = (InternalWindow)_resizeWindowVector.elementAt(0);
  926.             ((View)var2).sizeTo(1, var3.height);
  927.          }
  928.       } else if (var5 < 0) {
  929.          var2 = (InternalWindow)_resizeWindowVector.elementAt(0);
  930.          ((View)var2).sizeTo(1, var3.height);
  931.          var2 = (InternalWindow)_resizeWindowVector.elementAt(2);
  932.          ((View)var2).sizeTo(var3.width - 2, 1);
  933.          var2 = (InternalWindow)_resizeWindowVector.elementAt(3);
  934.          var2.moveToAndSizeTo(var3.x + 1, var3.maxY() - 1, var3.width - 2, 1);
  935.          var2 = (InternalWindow)_resizeWindowVector.elementAt(1);
  936.          var2.moveToAndSizeTo(var3.maxX() - 1, var3.y, 1, var3.height);
  937.       } else {
  938.          var2 = (InternalWindow)_resizeWindowVector.elementAt(1);
  939.          var2.moveToAndSizeTo(var3.maxX() - 1, var3.y, 1, var3.height);
  940.          var2 = (InternalWindow)_resizeWindowVector.elementAt(3);
  941.          var2.moveToAndSizeTo(var3.x + 1, var3.maxY() - 1, var3.width - 2, 1);
  942.          var2 = (InternalWindow)_resizeWindowVector.elementAt(2);
  943.          ((View)var2).sizeTo(var3.width - 2, 1);
  944.          var2 = (InternalWindow)_resizeWindowVector.elementAt(0);
  945.          ((View)var2).sizeTo(1, var3.height);
  946.       }
  947.  
  948.       Rect.returnRect(var3);
  949.    }
  950.  
  951.    public void mouseDragged(MouseEvent var1) {
  952.       if (this._resizePart != 0) {
  953.          this.mouseResizeDrag(var1);
  954.       } else {
  955.          int var14 = var1.x + super.bounds.x;
  956.          int var15 = var1.y + super.bounds.y;
  957.          int var11;
  958.          if (this._type == 0) {
  959.             var11 = -5;
  960.          } else {
  961.             var11 = -this.titleBarMargin() + 5;
  962.          }
  963.  
  964.          int var13 = ((View)this).superview().height() - 5;
  965.          int var9 = super.bounds.y + var15 - this._lastY;
  966.          if (var9 < var11) {
  967.             var15 = var11 + this._lastY - super.bounds.y;
  968.          } else if (var9 > var13) {
  969.             var15 = var13 + this._lastY - super.bounds.y;
  970.          }
  971.  
  972.          int var10 = -super.bounds.width + 5;
  973.          int var12 = ((View)this).superview().width() - 5;
  974.          int var8 = super.bounds.x + var14 - this._lastX;
  975.          if (var8 < var10) {
  976.             var14 = var10 + this._lastX - super.bounds.x;
  977.          } else if (var8 > var12) {
  978.             var14 = var12 + this._lastX - super.bounds.x;
  979.          }
  980.  
  981.          Point var7 = Point.newPoint(super.bounds.x + var14 - this._lastX, super.bounds.y + var15 - this._lastY);
  982.          this.willMoveTo(var7);
  983.          var14 = var7.x + this._lastX - super.bounds.x;
  984.          var15 = var7.y + this._lastY - super.bounds.y;
  985.          Point.returnPoint(var7);
  986.          Rect var6 = Rect.newRect();
  987.          ((View)this).computeVisibleRect(var6);
  988.          Rect var4 = Rect.newRect();
  989.          ((View)this).convertRectToView((View)null, var6, var4);
  990.          Rect var5 = Rect.newRect(var6);
  991.          var5.moveBy(var14 - this._lastX, var15 - this._lastY);
  992.          boolean var18 = var6.contains(var5);
  993.          ((View)this).convertRectToView((View)null, var5, var5);
  994.          Vector var3 = this.rootView.windowRects(var5, this);
  995.          if (this._dragStart) {
  996.             if (var3 == null || var3.isEmpty()) {
  997.                var3 = this.rootView.windowRects(var4, this);
  998.             }
  999.  
  1000.             this._dragStart = false;
  1001.          }
  1002.  
  1003.          boolean var16;
  1004.          boolean var17;
  1005.          if ((var3 == null || var3.isEmpty()) && var18 && !this.isTransparent()) {
  1006.             var16 = true;
  1007.             var17 = false;
  1008.          } else {
  1009.             var16 = false;
  1010.             var17 = true;
  1011.             if (!this.isTransparent() && super.drawingBuffer == null) {
  1012.                this._createdDrawingBuffer = true;
  1013.                ((View)this).setBuffered(true);
  1014.                this._drawToBackingStore = true;
  1015.                Graphics var19 = super.drawingBuffer.createGraphics();
  1016.                var19.setDebugOptions(((View)this).shouldDebugGraphics());
  1017.                this.draw(var19, (Rect)null);
  1018.                var19.dispose();
  1019.                Object var23 = null;
  1020.                this._drawToBackingStore = false;
  1021.             }
  1022.          }
  1023.  
  1024.          VectorCache.returnVector(var3);
  1025.          if (var16 && !this._drewOnLastDrag) {
  1026.             Graphics var2 = ((View)this).rootView().createGraphics();
  1027.             this._super_moveBy(var14 - this._lastX, var15 - this._lastY);
  1028.             var2.setClipRect(var6);
  1029.             var2.copyArea(var4.x, var4.y, var4.width, var4.height, super.bounds.x, super.bounds.y);
  1030.             var2.dispose();
  1031.             Object var20 = null;
  1032.          } else if (var16) {
  1033.             this._super_moveBy(var14 - this._lastX, var15 - this._lastY);
  1034.             this._drewOnLastDrag = false;
  1035.             var17 = true;
  1036.          } else {
  1037.             this._super_moveBy(var14 - this._lastX, var15 - this._lastY);
  1038.          }
  1039.  
  1040.          if (var17 && !this.isTransparent()) {
  1041.             if (super.drawingBuffer != null) {
  1042.                super.drawingBufferIsBitCache = true;
  1043.             }
  1044.  
  1045.             ((View)this).draw();
  1046.             if (super.drawingBuffer != null) {
  1047.                super.drawingBufferIsBitCache = false;
  1048.             }
  1049.  
  1050.             if (!var16) {
  1051.                this._drewOnLastDrag = true;
  1052.             }
  1053.          }
  1054.  
  1055.          if (this.isTransparent()) {
  1056.             ((View)this).draw();
  1057.          }
  1058.  
  1059.          this.rootView.disableWindowsAbove(this, true);
  1060.          this.rootView.redraw(var4);
  1061.          this.rootView.disableWindowsAbove(this, false);
  1062.          this._lastX = var14;
  1063.          this._lastY = var15;
  1064.          var4.unionWith(super.bounds);
  1065.          this.rootView.redrawTransparentWindows(var4, this);
  1066.          Rect.returnRect(var6);
  1067.       }
  1068.    }
  1069.  
  1070.    public void mouseUp(MouseEvent var1) {
  1071.       if (this._resizePart != 0) {
  1072.          InternalWindow var2 = (InternalWindow)_resizeWindowVector.elementAt(0);
  1073.          InternalWindow var3 = (InternalWindow)_resizeWindowVector.elementAt(1);
  1074.          if (this._resizePart == 1) {
  1075.             this.moveByAndSizeBy(var2.bounds.x - super.bounds.x, 0, var3.bounds.x - var2.bounds.x - super.bounds.width + 1, var2.bounds.height - super.bounds.height);
  1076.          } else {
  1077.             ((View)this).sizeTo(var3.bounds.x - var2.bounds.x + 1, var2.bounds.height);
  1078.          }
  1079.  
  1080.          int var4 = _resizeWindowVector.count();
  1081.  
  1082.          while(var4-- > 0) {
  1083.             var2 = (InternalWindow)_resizeWindowVector.elementAt(var4);
  1084.             var2.hide();
  1085.          }
  1086.  
  1087.          _resizeWindowVector.removeAllElements();
  1088.          this._resizePart = 0;
  1089.       }
  1090.  
  1091.       if (this._createdDrawingBuffer) {
  1092.          ((View)this).setBuffered(false);
  1093.          this._createdDrawingBuffer = false;
  1094.       }
  1095.  
  1096.    }
  1097.  
  1098.    void _drawLine(Graphics var1, int var2, int var3, int var4, Color var5, Color var6) {
  1099.       var1.setColor(var5);
  1100.  
  1101.       for(int var7 = var2; var7 <= var3; var7 += 2) {
  1102.          var1.drawLine(var7, var4, var7, var4);
  1103.       }
  1104.  
  1105.       var1.setColor(var6);
  1106.  
  1107.       for(int var8 = var2 + 1; var8 <= var3; var8 += 2) {
  1108.          var1.drawLine(var8, var4, var8, var4);
  1109.       }
  1110.  
  1111.    }
  1112.  
  1113.    public void drawView(Graphics var1) {
  1114.       if ((super.drawingBuffer == null || var1.isDrawingBuffer()) && this._type != 0) {
  1115.          this._border.drawInRect(var1, 0, 0, super.bounds.width, super.bounds.height);
  1116.       }
  1117.    }
  1118.  
  1119.    public void drawTitleBar() {
  1120.       if (this._type != 0) {
  1121.          Rect var1 = Rect.newRect(0, 0, super.bounds.width, this.titleBarMargin());
  1122.          ((View)this).draw(var1);
  1123.          Rect.returnRect(var1);
  1124.       }
  1125.    }
  1126.  
  1127.    public void drawBottomBorder() {
  1128.       if (this._type != 0) {
  1129.          Rect var1 = Rect.newRect(0, super.bounds.height - this.bottomBorderMargin(), super.bounds.width, this.bottomBorderMargin());
  1130.          ((View)this).draw(var1);
  1131.          Rect.returnRect(var1);
  1132.       }
  1133.    }
  1134.  
  1135.    public void draw(Graphics var1, Rect var2) {
  1136.       if (this.isTransparent() && (var1 == null || !var1.isDrawingBuffer()) && this.rootView._redrawTransWindows) {
  1137.          Object var3 = null;
  1138.          if (var3 == null || ((View)var3).isTransparent()) {
  1139.             this.updateDrawingBuffer();
  1140.          }
  1141.       }
  1142.  
  1143.       super.draw(var1, var2);
  1144.    }
  1145.  
  1146.    public void didBecomeMain() {
  1147.       this.drawTitleBar();
  1148.       if (this._owner != null) {
  1149.          this._owner.windowDidBecomeMain(this);
  1150.       }
  1151.  
  1152.       this.rootView.setFocusedView(this.focusedView(), false);
  1153.       if (this.containsDocument()) {
  1154.          Application.application().makeCurrentDocumentWindow(this);
  1155.       }
  1156.  
  1157.    }
  1158.  
  1159.    public void didResignMain() {
  1160.       this.drawTitleBar();
  1161.       if (this._owner != null) {
  1162.          this._owner.windowDidResignMain(this);
  1163.       }
  1164.  
  1165.       if (this.rootView != null) {
  1166.          this.rootView.setFocusedView((View)null, false);
  1167.       }
  1168.  
  1169.    }
  1170.  
  1171.    public void setContainsDocument(boolean var1) {
  1172.       this._containsDocument = var1;
  1173.    }
  1174.  
  1175.    public boolean containsDocument() {
  1176.       return this._containsDocument;
  1177.    }
  1178.  
  1179.    public void setCanBecomeDocument(boolean var1) {
  1180.       this.setContainsDocument(var1);
  1181.    }
  1182.  
  1183.    public boolean canBecomeDocument() {
  1184.       return this.containsDocument();
  1185.    }
  1186.  
  1187.    public void didBecomeCurrentDocument() {
  1188.    }
  1189.  
  1190.    public void didResignCurrentDocument() {
  1191.    }
  1192.  
  1193.    public boolean isCurrentDocument() {
  1194.       return Application.application().currentDocumentWindow() == this;
  1195.    }
  1196.  
  1197.    public void setFocusedView(View var1) {
  1198.       this._focusedView = var1;
  1199.       if (this.rootView != null) {
  1200.          if (this.rootView.mainWindow() == this && var1 != null) {
  1201.             this.rootView.makeWindowVisible(this, 0, (InternalWindow)null);
  1202.          }
  1203.  
  1204.          this.rootView.setFocusedView(this.focusedView());
  1205.       }
  1206.  
  1207.    }
  1208.  
  1209.    public View focusedView() {
  1210.       if (this._focusedView != null && this._focusedView.descendsFrom(this)) {
  1211.          return this._focusedView;
  1212.       } else {
  1213.          this._focusedView = null;
  1214.          return this._focusedView;
  1215.       }
  1216.    }
  1217.  
  1218.    public void describeClassInfo(ClassInfo var1) {
  1219.       super.describeClassInfo(var1);
  1220.       var1.addClass("netscape.application.InternalWindow", 3);
  1221.       var1.addField("owner", (byte)18);
  1222.       var1.addField("contentView", (byte)18);
  1223.       var1.addField("focusedView", (byte)18);
  1224.       var1.addField("closeButton", (byte)18);
  1225.       var1.addField("titleFont", (byte)18);
  1226.       var1.addField("title", (byte)16);
  1227.       var1.addField("border", (byte)18);
  1228.       var1.addField("layer", (byte)8);
  1229.       var1.addField("type", (byte)8);
  1230.       var1.addField("closeable", (byte)0);
  1231.       var1.addField("resizeable", (byte)0);
  1232.       var1.addField("canBecomeMain", (byte)0);
  1233.       var1.addField("canBecomeDocument", (byte)0);
  1234.       var1.addField("onscreen", (byte)0);
  1235.       var1.addField("transparent", (byte)0);
  1236.       var1.addField("scrollToVisible", (byte)0);
  1237.       var1.addField("defaultSelectedView", (byte)18);
  1238.       var1.addField("menuView", (byte)18);
  1239.    }
  1240.  
  1241.    public void encode(Encoder var1) throws CodingException {
  1242.       super.encode(var1);
  1243.       var1.encodeObject("owner", (Codable)this._owner);
  1244.       var1.encodeObject("contentView", this._contentView);
  1245.       var1.encodeObject("focusedView", this.focusedView());
  1246.       var1.encodeObject("closeButton", this._closeButton);
  1247.       var1.encodeObject("titleFont", this._titleFont);
  1248.       var1.encodeString("title", this._title);
  1249.       var1.encodeObject("border", this._border);
  1250.       var1.encodeInt("layer", this._layer);
  1251.       var1.encodeInt("type", this._type);
  1252.       var1.encodeBoolean("closeable", this._closeable);
  1253.       var1.encodeBoolean("resizeable", this._resizable);
  1254.       var1.encodeBoolean("canBecomeMain", this._canBecomeMain);
  1255.       var1.encodeBoolean("canBecomeDocument", this._containsDocument);
  1256.       var1.encodeBoolean("onscreen", this._onscreen);
  1257.       var1.encodeBoolean("transparent", this.transparent);
  1258.       var1.encodeBoolean("scrollToVisible", this.scrollToVisible);
  1259.       var1.encodeObject("defaultSelectedView", this._defaultSelectedView);
  1260.       var1.encodeObject("menuView", this.menuView);
  1261.    }
  1262.  
  1263.    public void decode(Decoder var1) throws CodingException {
  1264.       int var2 = var1.versionForClassName("netscape.application.TextField");
  1265.       super.decode(var1);
  1266.       this._owner = (WindowOwner)var1.decodeObject("owner");
  1267.       this._contentView = (WindowContentView)var1.decodeObject("contentView");
  1268.       this._focusedView = (View)var1.decodeObject("focusedView");
  1269.       this._closeButton = (Button)var1.decodeObject("closeButton");
  1270.       this._titleFont = (Font)var1.decodeObject("titleFont");
  1271.       this._title = var1.decodeString("title");
  1272.       this._border = (Border)var1.decodeObject("border");
  1273.       this._layer = var1.decodeInt("layer");
  1274.       this._type = var1.decodeInt("type");
  1275.       this._closeable = var1.decodeBoolean("closeable");
  1276.       this._resizable = var1.decodeBoolean("resizeable");
  1277.       this._canBecomeMain = var1.decodeBoolean("canBecomeMain");
  1278.       this._containsDocument = var1.decodeBoolean("canBecomeDocument");
  1279.       this._onscreen = var1.decodeBoolean("onscreen");
  1280.       this.transparent = var1.decodeBoolean("transparent");
  1281.       this.scrollToVisible = var1.decodeBoolean("scrollToVisible");
  1282.       if (var2 > 1) {
  1283.          this._defaultSelectedView = (View)var1.decodeObject("defaultSelectedView");
  1284.       }
  1285.  
  1286.       if (var2 > 2) {
  1287.          this.menuView = (MenuView)var1.decodeObject("menuView");
  1288.       }
  1289.  
  1290.    }
  1291.  
  1292.    public void finishDecoding() throws CodingException {
  1293.       super.finishDecoding();
  1294.       if (this._closeButton != null) {
  1295.          this._closeButton.removeAllCommandsForKeys();
  1296.       }
  1297.  
  1298.    }
  1299.  
  1300.    public String toString() {
  1301.       return this._title != null ? "InternalWindow (" + this._title + ")" : super.toString();
  1302.    }
  1303.  
  1304.    View ancestorWithDrawingBuffer() {
  1305.       return super.drawingBuffer != null ? this : null;
  1306.    }
  1307.  
  1308.    public InternalWindow window() {
  1309.       return this;
  1310.    }
  1311.  
  1312.    public Font font() {
  1313.       return this._titleFont;
  1314.    }
  1315.  
  1316.    public void performCommand(String var1, Object var2) {
  1317.       if ("show".equals(var1)) {
  1318.          this.show();
  1319.       } else if ("hide".equals(var1)) {
  1320.          this.hide();
  1321.       } else {
  1322.          throw new NoSuchMethodError("unknown command: " + var1);
  1323.       }
  1324.    }
  1325.  
  1326.    public boolean hidesSubviewsFromKeyboard() {
  1327.       return true;
  1328.    }
  1329.  
  1330.    public void setDefaultSelectedView(View var1) {
  1331.       this._defaultSelectedView = var1;
  1332.    }
  1333.  
  1334.    public View defaultSelectedView() {
  1335.       return this._defaultSelectedView;
  1336.    }
  1337.  
  1338.    public boolean canBecomeSelectedView() {
  1339.       return this.isMain();
  1340.    }
  1341.  
  1342.    boolean wantsKeyboardArrow() {
  1343.       return false;
  1344.    }
  1345. }
  1346.