home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / plaf / basic / BasicTreeUI$TreePageAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.6 KB  |  80 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.    protected int direction;
  11.    private boolean addToSelection;
  12.    private boolean changeSelection;
  13.    // $FF: synthetic field
  14.    private final BasicTreeUI this$0;
  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.       this.this$0 = var1;
  22.       this.direction = var2;
  23.       this.addToSelection = var4;
  24.       this.changeSelection = var5;
  25.    }
  26.  
  27.    public void actionPerformed(ActionEvent var1) {
  28.       if (this.this$0.tree != null && this.this$0.getRowCount(this.this$0.tree) > 0 && this.this$0.treeSelectionModel != null) {
  29.          Dimension var3 = this.this$0.tree.getSize();
  30.          TreePath var4 = BasicTreeUI.access$500(this.this$0);
  31.          Rectangle var6 = this.this$0.tree.getVisibleRect();
  32.          TreePath var5;
  33.          if (this.direction == -1) {
  34.             var5 = this.this$0.getClosestPathForLocation(this.this$0.tree, var6.x, var6.y);
  35.             if (var5.equals(var4)) {
  36.                var6.y = Math.max(0, var6.y - var6.height);
  37.                var5 = this.this$0.tree.getClosestPathForLocation(var6.x, var6.y);
  38.             }
  39.          } else {
  40.             var6.y = Math.min(var3.height, var6.y + var6.height - 1);
  41.             var5 = this.this$0.tree.getClosestPathForLocation(var6.x, var6.y);
  42.             if (var5.equals(var4)) {
  43.                var6.y = Math.min(var3.height, var6.y + var6.height - 1);
  44.                var5 = this.this$0.tree.getClosestPathForLocation(var6.x, var6.y);
  45.             }
  46.          }
  47.  
  48.          Rectangle var7 = this.this$0.getPathBounds(this.this$0.tree, var5);
  49.          var7.x = var6.x;
  50.          var7.width = var6.width;
  51.          if (this.direction == -1) {
  52.             var7.height = var6.height;
  53.          } else {
  54.             var7.y -= var6.height - var7.height;
  55.             var7.height = var6.height;
  56.          }
  57.  
  58.          if (this.addToSelection) {
  59.             BasicTreeUI.access$1500(this.this$0, var5);
  60.          } else if (this.changeSelection) {
  61.             this.this$0.tree.setSelectionPath(var5);
  62.          } else {
  63.             BasicTreeUI.access$1400(this.this$0, var5, true);
  64.          }
  65.  
  66.          this.this$0.tree.scrollRectToVisible(var7);
  67.       }
  68.  
  69.    }
  70.  
  71.    public boolean isEnabled() {
  72.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  73.    }
  74.  
  75.    // $FF: synthetic method
  76.    BasicTreeUI$TreePageAction(BasicTreeUI var1, int var2, String var3, boolean var4, boolean var5, BasicTreeUI.1 var6) {
  77.       this(var1, var2, var3, var4, var5);
  78.    }
  79. }
  80.