home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / plaf / basic / BasicVisibleTreeNode.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.5 KB  |  62 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import com.sun.java.swing.tree.DefaultMutableTreeNode;
  4. import com.sun.java.swing.tree.MutableTreeNode;
  5.  
  6. public class BasicVisibleTreeNode extends VisibleTreeNode {
  7.    protected BasicVisibleTreeNode(AbstractTreeUI var1, Object var2, int var3) {
  8.       super(var1, var2, var3);
  9.    }
  10.  
  11.    public void repaint() {
  12.       ((BasicTreeUI)super.treeUI).repaintNode(this);
  13.    }
  14.  
  15.    public void cancelEditing() {
  16.       ((BasicTreeUI)super.treeUI).completeEditing(false, true, false);
  17.    }
  18.  
  19.    public void modelChildCountChanged() {
  20.       if (((VisibleTreeNode)this).getRow() != -1) {
  21.          this.repaint();
  22.       }
  23.  
  24.    }
  25.  
  26.    public void insert(MutableTreeNode var1, int var2) {
  27.       this.cancelEditing();
  28.       super.insert(var1, var2);
  29.       if (((DefaultMutableTreeNode)this).getChildCount() == 1 && ((VisibleTreeNode)this).getRow() != -1) {
  30.          this.repaint();
  31.       }
  32.  
  33.    }
  34.  
  35.    public void remove(int var1) {
  36.       this.cancelEditing();
  37.       super.remove(var1);
  38.       if (((VisibleTreeNode)this).getModelChildCount() == 0 && ((VisibleTreeNode)this).getRow() != -1) {
  39.          this.repaint();
  40.       }
  41.  
  42.    }
  43.  
  44.    protected void collapse(boolean var1) {
  45.       this.cancelEditing();
  46.       super.collapse(var1);
  47.       if (var1 && (super.children == null || super.children.size() == 0)) {
  48.          this.repaint();
  49.       }
  50.  
  51.    }
  52.  
  53.    protected void expand(boolean var1) {
  54.       this.cancelEditing();
  55.       super.expand(var1);
  56.       if (var1 && (super.children == null || super.children.size() == 0)) {
  57.          this.repaint();
  58.       }
  59.  
  60.    }
  61. }
  62.