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

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