home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / plaf / basic / BasicTreeUI$TreeTraverseAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.0 KB  |  71 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$TreeTraverseAction extends AbstractAction {
  8.    protected int direction;
  9.    private boolean changeSelection;
  10.    // $FF: synthetic field
  11.    private final BasicTreeUI this$0;
  12.  
  13.    public BasicTreeUI$TreeTraverseAction(BasicTreeUI var1, int var2, String var3) {
  14.       this(var1, var2, var3, true);
  15.    }
  16.  
  17.    private BasicTreeUI$TreeTraverseAction(BasicTreeUI var1, int var2, String var3, boolean var4) {
  18.       this.this$0 = var1;
  19.       this.direction = var2;
  20.       this.changeSelection = var4;
  21.    }
  22.  
  23.    public void actionPerformed(ActionEvent var1) {
  24.       int var2;
  25.       if (this.this$0.tree != null && (var2 = this.this$0.getRowCount(this.this$0.tree)) > 0) {
  26.          int var3 = BasicTreeUI.access$1300(this.this$0);
  27.          int var4;
  28.          if (var3 == -1) {
  29.             var4 = 0;
  30.          } else if (this.direction == 1) {
  31.             if (!this.this$0.isLeaf(var3) && !this.this$0.tree.isExpanded(var3)) {
  32.                this.this$0.toggleExpandState(this.this$0.getPathForRow(this.this$0.tree, var3));
  33.                var4 = -1;
  34.             } else {
  35.                var4 = Math.min(var3 + 1, var2 - 1);
  36.             }
  37.          } else if (!this.this$0.isLeaf(var3) && this.this$0.tree.isExpanded(var3)) {
  38.             this.this$0.toggleExpandState(this.this$0.getPathForRow(this.this$0.tree, var3));
  39.             var4 = -1;
  40.          } else {
  41.             TreePath var5 = this.this$0.getPathForRow(this.this$0.tree, var3);
  42.             if (var5 != null && var5.getPathCount() > 1) {
  43.                var4 = this.this$0.getRowForPath(this.this$0.tree, var5.getParentPath());
  44.             } else {
  45.                var4 = -1;
  46.             }
  47.          }
  48.  
  49.          if (var4 != -1) {
  50.             if (this.changeSelection) {
  51.                this.this$0.tree.setSelectionInterval(var4, var4);
  52.             } else {
  53.                BasicTreeUI.access$1400(this.this$0, this.this$0.getPathForRow(this.this$0.tree, var4), true);
  54.             }
  55.  
  56.             this.this$0.ensureRowsAreVisible(var4, var4);
  57.          }
  58.       }
  59.  
  60.    }
  61.  
  62.    public boolean isEnabled() {
  63.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  64.    }
  65.  
  66.    // $FF: synthetic method
  67.    BasicTreeUI$TreeTraverseAction(BasicTreeUI var1, int var2, String var3, boolean var4, BasicTreeUI.1 var5) {
  68.       this(var1, var2, var3, var4);
  69.    }
  70. }
  71.