home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 144 / DPCS0200.iso / Internet / Supanet / system / swing.jar / javax / swing / plaf / basic / BasicTreeUI$TreeHomeAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  2.3 KB  |  77 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.event.ActionEvent;
  4. import javax.swing.AbstractAction;
  5. import javax.swing.tree.TreePath;
  6.  
  7. public class BasicTreeUI$TreeHomeAction extends AbstractAction {
  8.    // $FF: synthetic field
  9.    private final BasicTreeUI this$0;
  10.    protected int direction;
  11.    private boolean addToSelection;
  12.    private boolean changeSelection;
  13.  
  14.    public BasicTreeUI$TreeHomeAction(BasicTreeUI var1, int var2, String var3) {
  15.       this(var1, var2, var3, false, true);
  16.    }
  17.  
  18.    private BasicTreeUI$TreeHomeAction(BasicTreeUI var1, int var2, String var3, boolean var4, boolean var5) {
  19.       super(var3);
  20.       this.this$0 = var1;
  21.       this.direction = var2;
  22.       this.changeSelection = var5;
  23.       this.addToSelection = var4;
  24.    }
  25.  
  26.    // $FF: synthetic method
  27.    BasicTreeUI$TreeHomeAction(BasicTreeUI var1, BasicTreeUI.1 var2, int var3, String var4, boolean var5, boolean var6) {
  28.       this(var1, var3, var4, var5, var6);
  29.    }
  30.  
  31.    public void actionPerformed(ActionEvent var1) {
  32.       int var2 = this.this$0.getRowCount(this.this$0.tree);
  33.       if (this.this$0.tree != null && var2 > 0) {
  34.          if (this.direction == -1) {
  35.             this.this$0.ensureRowsAreVisible(0, 0);
  36.             if (this.addToSelection) {
  37.                TreePath var3 = BasicTreeUI.access$9(this.this$0);
  38.                int var4 = var3 == null ? -1 : this.this$0.getRowForPath(this.this$0.tree, var3);
  39.                if (var4 == -1) {
  40.                   this.this$0.tree.setSelectionInterval(0, 0);
  41.                } else {
  42.                   this.this$0.tree.setSelectionInterval(0, var4);
  43.                   BasicTreeUI.access$2(this.this$0, var3);
  44.                   BasicTreeUI.access$3(this.this$0, this.this$0.getPathForRow(this.this$0.tree, 0));
  45.                }
  46.             } else if (this.changeSelection) {
  47.                this.this$0.tree.setSelectionInterval(0, 0);
  48.             } else {
  49.                BasicTreeUI.access$6(this.this$0, this.this$0.getPathForRow(this.this$0.tree, 0), true);
  50.             }
  51.          } else {
  52.             this.this$0.ensureRowsAreVisible(var2 - 1, var2 - 1);
  53.             if (this.addToSelection) {
  54.                TreePath var5 = BasicTreeUI.access$9(this.this$0);
  55.                int var6 = var5 == null ? -1 : this.this$0.getRowForPath(this.this$0.tree, var5);
  56.                if (var6 == -1) {
  57.                   this.this$0.tree.setSelectionInterval(var2 - 1, var2 - 1);
  58.                } else {
  59.                   this.this$0.tree.setSelectionInterval(var6, var2 - 1);
  60.                   BasicTreeUI.access$2(this.this$0, var5);
  61.                   BasicTreeUI.access$3(this.this$0, this.this$0.getPathForRow(this.this$0.tree, var2 - 1));
  62.                }
  63.             } else if (this.changeSelection) {
  64.                this.this$0.tree.setSelectionInterval(var2 - 1, var2 - 1);
  65.             } else {
  66.                BasicTreeUI.access$6(this.this$0, this.this$0.getPathForRow(this.this$0.tree, var2 - 1), true);
  67.             }
  68.          }
  69.       }
  70.  
  71.    }
  72.  
  73.    public boolean isEnabled() {
  74.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  75.    }
  76. }
  77.