home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / swing / GroupLayout$LinkInfo.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  2.0 KB  |  77 lines

  1. package javax.swing;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. import javax.swing.GroupLayout.ComponentInfo;
  6.  
  7. class GroupLayout$LinkInfo {
  8.    private final int axis;
  9.    private final List<GroupLayout.ComponentInfo> linked = new ArrayList();
  10.    private int size = Integer.MIN_VALUE;
  11.    // $FF: synthetic field
  12.    static final boolean $assertionsDisabled = !GroupLayout.class.desiredAssertionStatus();
  13.  
  14.    GroupLayout$LinkInfo(int var1) {
  15.       this.axis = var1;
  16.    }
  17.  
  18.    public void add(GroupLayout.ComponentInfo var1) {
  19.       GroupLayout$LinkInfo var2 = ComponentInfo.access$1100(var1, this.axis, false);
  20.       if (var2 == null) {
  21.          this.linked.add(var1);
  22.          ComponentInfo.access$1200(var1, this.axis, this);
  23.       } else if (var2 != this) {
  24.          this.linked.addAll(var2.linked);
  25.  
  26.          for(GroupLayout.ComponentInfo var4 : var2.linked) {
  27.             ComponentInfo.access$1200(var4, this.axis, this);
  28.          }
  29.       }
  30.  
  31.       this.clearCachedSize();
  32.    }
  33.  
  34.    public void remove(GroupLayout.ComponentInfo var1) {
  35.       this.linked.remove(var1);
  36.       ComponentInfo.access$1200(var1, this.axis, (GroupLayout$LinkInfo)null);
  37.       if (this.linked.size() == 1) {
  38.          ComponentInfo.access$1200((GroupLayout.ComponentInfo)this.linked.get(0), this.axis, (GroupLayout$LinkInfo)null);
  39.       }
  40.  
  41.       this.clearCachedSize();
  42.    }
  43.  
  44.    public void clearCachedSize() {
  45.       this.size = Integer.MIN_VALUE;
  46.    }
  47.  
  48.    public int getSize(int var1) {
  49.       if (this.size == Integer.MIN_VALUE) {
  50.          this.size = this.calculateLinkedSize(var1);
  51.       }
  52.  
  53.       return this.size;
  54.    }
  55.  
  56.    private int calculateLinkedSize(int var1) {
  57.       int var2 = 0;
  58.  
  59.       for(GroupLayout.ComponentInfo var4 : this.linked) {
  60.          GroupLayout.ComponentSpring var5;
  61.          if (var1 == 0) {
  62.             var5 = var4.horizontalSpring;
  63.          } else {
  64.             if (!$assertionsDisabled && var1 != 1) {
  65.                throw new AssertionError();
  66.             }
  67.  
  68.             var5 = var4.verticalSpring;
  69.          }
  70.  
  71.          var2 = Math.max(var2, var5.calculateNonlinkedPreferredSize(var1));
  72.       }
  73.  
  74.       return var2;
  75.    }
  76. }
  77.