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

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