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 / text / AsyncBoxView$ChildState.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.9 KB  |  179 lines

  1. package javax.swing.text;
  2.  
  3. public class AsyncBoxView$ChildState implements Runnable {
  4.    private float min;
  5.    private float pref;
  6.    private float max;
  7.    private float align;
  8.    private boolean minorValid;
  9.    private float span;
  10.    private float offset;
  11.    private boolean majorValid;
  12.    private View child;
  13.    private boolean childSizeValid;
  14.    // $FF: synthetic field
  15.    private final AsyncBoxView this$0;
  16.  
  17.    public AsyncBoxView$ChildState(AsyncBoxView var1, View var2) {
  18.       this.this$0 = var1;
  19.       this.child = var2;
  20.       this.minorValid = false;
  21.       this.majorValid = false;
  22.       this.childSizeValid = false;
  23.       this.child.setParent(var1);
  24.    }
  25.  
  26.    public View getChildView() {
  27.       return this.child;
  28.    }
  29.  
  30.    public void run() {
  31.       AbstractDocument var1 = (AbstractDocument)this.this$0.getDocument();
  32.  
  33.       try {
  34.          var1.readLock();
  35.          if (!this.minorValid || !this.majorValid || !this.childSizeValid) {
  36.             if (this.child.getParent() != this.this$0) {
  37.                return;
  38.             }
  39.  
  40.             AsyncBoxView var2 = this.this$0;
  41.             synchronized(var2) {
  42.                this.this$0.changing = this;
  43.             }
  44.  
  45.             this.updateChild();
  46.             AsyncBoxView var3 = this.this$0;
  47.             synchronized(var3) {
  48.                this.this$0.changing = null;
  49.             }
  50.  
  51.             this.updateChild();
  52.             return;
  53.          }
  54.       } finally {
  55.          var1.readUnlock();
  56.       }
  57.  
  58.    }
  59.  
  60.    void updateChild() {
  61.       boolean var1 = false;
  62.       synchronized(this) {
  63.          if (!this.minorValid) {
  64.             int var3 = this.this$0.getMinorAxis();
  65.             this.min = this.child.getMinimumSpan(var3);
  66.             this.pref = this.child.getPreferredSpan(var3);
  67.             this.max = this.child.getMaximumSpan(var3);
  68.             this.minorValid = true;
  69.             var1 = true;
  70.          }
  71.       }
  72.  
  73.       if (var1) {
  74.          this.this$0.minorRequirementChange(this);
  75.       }
  76.  
  77.       boolean var13 = false;
  78.       float var4 = 0.0F;
  79.       synchronized(this) {
  80.          if (!this.majorValid) {
  81.             float var6 = this.span;
  82.             this.span = this.child.getPreferredSpan(this.this$0.axis);
  83.             var4 = this.span - var6;
  84.             this.majorValid = true;
  85.             var13 = true;
  86.          }
  87.       }
  88.  
  89.       if (var13) {
  90.          this.this$0.majorRequirementChange(this, var4);
  91.          this.this$0.locator.childChanged(this);
  92.       }
  93.  
  94.       synchronized(this) {
  95.          if (!this.childSizeValid) {
  96.             float var7;
  97.             float var8;
  98.             if (this.this$0.axis == 0) {
  99.                var7 = this.span;
  100.                var8 = this.getMinorSpan();
  101.             } else {
  102.                var7 = this.getMinorSpan();
  103.                var8 = this.span;
  104.             }
  105.  
  106.             this.childSizeValid = true;
  107.             this.child.setSize(var7, var8);
  108.          }
  109.  
  110.       }
  111.    }
  112.  
  113.    public float getMinorSpan() {
  114.       return this.max < this.this$0.minorSpan ? this.max : Math.max(this.min, this.this$0.minorSpan);
  115.    }
  116.  
  117.    public float getMinorOffset() {
  118.       if (this.max < this.this$0.minorSpan) {
  119.          float var1 = this.child.getAlignment(this.this$0.getMinorAxis());
  120.          return (this.this$0.minorSpan - this.max) * var1;
  121.       } else {
  122.          return 0.0F;
  123.       }
  124.    }
  125.  
  126.    public float getMajorSpan() {
  127.       return this.span;
  128.    }
  129.  
  130.    public float getMajorOffset() {
  131.       return this.offset;
  132.    }
  133.  
  134.    public void setMajorOffset(float var1) {
  135.       this.offset = var1;
  136.    }
  137.  
  138.    public void preferenceChanged(boolean var1, boolean var2) {
  139.       if (this.this$0.axis == 0) {
  140.          if (var1) {
  141.             this.majorValid = false;
  142.          }
  143.  
  144.          if (var2) {
  145.             this.minorValid = false;
  146.          }
  147.       } else {
  148.          if (var1) {
  149.             this.minorValid = false;
  150.          }
  151.  
  152.          if (var2) {
  153.             this.majorValid = false;
  154.          }
  155.       }
  156.  
  157.       this.childSizeValid = false;
  158.    }
  159.  
  160.    public boolean isLayoutValid() {
  161.       return this.minorValid && this.majorValid && this.childSizeValid;
  162.    }
  163.  
  164.    // $FF: synthetic method
  165.    static boolean access$002(AsyncBoxView$ChildState var0, boolean var1) {
  166.       return var0.childSizeValid = var1;
  167.    }
  168.  
  169.    // $FF: synthetic method
  170.    static float access$100(AsyncBoxView$ChildState var0) {
  171.       return var0.min;
  172.    }
  173.  
  174.    // $FF: synthetic method
  175.    static float access$200(AsyncBoxView$ChildState var0) {
  176.       return var0.pref;
  177.    }
  178. }
  179.