home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.Component;
- import java.util.ArrayList;
- import java.util.List;
- import javax.swing.LayoutStyle.ComponentPlacement;
-
- class GroupLayout$AutoPreferredGapSpring extends GroupLayout.Spring {
- List<GroupLayout.ComponentSpring> sources;
- GroupLayout.ComponentSpring source;
- private List<GroupLayout.AutoPreferredGapMatch> matches;
- int size;
- int lastSize;
- private final int pref;
- private final int max;
- private LayoutStyle.ComponentPlacement type;
- private boolean userCreated;
- // $FF: synthetic field
- final GroupLayout this$0;
-
- private GroupLayout$AutoPreferredGapSpring(GroupLayout var1) {
- super(var1);
- this.this$0 = var1;
- this.pref = -2;
- this.max = -2;
- this.type = ComponentPlacement.RELATED;
- }
-
- GroupLayout$AutoPreferredGapSpring(GroupLayout var1, int var2, int var3) {
- super(var1);
- this.this$0 = var1;
- this.pref = var2;
- this.max = var3;
- }
-
- GroupLayout$AutoPreferredGapSpring(GroupLayout var1, LayoutStyle.ComponentPlacement var2, int var3, int var4) {
- super(var1);
- this.this$0 = var1;
- this.type = var2;
- this.pref = var3;
- this.max = var4;
- this.userCreated = true;
- }
-
- public void setSource(GroupLayout.ComponentSpring var1) {
- this.source = var1;
- }
-
- public void setSources(List<GroupLayout.ComponentSpring> var1) {
- this.sources = new ArrayList(var1);
- }
-
- public void setUserCreated(boolean var1) {
- this.userCreated = var1;
- }
-
- public boolean getUserCreated() {
- return this.userCreated;
- }
-
- void unset() {
- this.lastSize = this.getSize();
- super.unset();
- this.size = 0;
- }
-
- public void reset() {
- this.size = 0;
- this.sources = null;
- this.source = null;
- this.matches = null;
- }
-
- public void calculatePadding(int var1) {
- this.size = Integer.MIN_VALUE;
- int var2 = Integer.MIN_VALUE;
- if (this.matches != null) {
- LayoutStyle var3 = GroupLayout.access$800(this.this$0);
- byte var4;
- if (var1 == 0) {
- if (GroupLayout.access$900(this.this$0)) {
- var4 = 3;
- } else {
- var4 = 7;
- }
- } else {
- var4 = 5;
- }
-
- for(int var5 = this.matches.size() - 1; var5 >= 0; --var5) {
- GroupLayout.AutoPreferredGapMatch var6 = (GroupLayout.AutoPreferredGapMatch)this.matches.get(var5);
- var2 = Math.max(var2, this.calculatePadding(var3, var4, var6.source, var6.target));
- }
- }
-
- if (this.size == Integer.MIN_VALUE) {
- this.size = 0;
- }
-
- if (var2 == Integer.MIN_VALUE) {
- var2 = 0;
- }
-
- if (this.lastSize != Integer.MIN_VALUE) {
- this.size += Math.min(var2, this.lastSize);
- }
-
- }
-
- private int calculatePadding(LayoutStyle var1, int var2, GroupLayout.ComponentSpring var3, GroupLayout.ComponentSpring var4) {
- int var5 = var4.getOrigin() - (var3.getOrigin() + var3.getSize());
- if (var5 < 0) {
- return 0;
- } else {
- int var6;
- if (var3.getComponent() instanceof JComponent && var4.getComponent() instanceof JComponent) {
- var6 = var1.getPreferredGap((JComponent)var3.getComponent(), (JComponent)var4.getComponent(), this.type, var2, GroupLayout.access$700(this.this$0));
- } else {
- var6 = 10;
- }
-
- if (var6 > var5) {
- this.size = Math.max(this.size, var6 - var5);
- }
-
- return var6;
- }
- }
-
- public void addTarget(GroupLayout.ComponentSpring var1, int var2) {
- int var3 = var2 == 0 ? 1 : 0;
- if (this.source != null) {
- if (GroupLayout.access$1000(this.this$0, this.source.getComponent(), var1.getComponent(), var3)) {
- this.addValidTarget(this.source, var1);
- }
- } else {
- Component var4 = var1.getComponent();
-
- for(int var5 = this.sources.size() - 1; var5 >= 0; --var5) {
- GroupLayout.ComponentSpring var6 = (GroupLayout.ComponentSpring)this.sources.get(var5);
- if (GroupLayout.access$1000(this.this$0, var6.getComponent(), var4, var3)) {
- this.addValidTarget(var6, var1);
- }
- }
- }
-
- }
-
- private void addValidTarget(GroupLayout.ComponentSpring var1, GroupLayout.ComponentSpring var2) {
- if (this.matches == null) {
- this.matches = new ArrayList(1);
- }
-
- this.matches.add(new GroupLayout.AutoPreferredGapMatch(var1, var2));
- }
-
- int calculateMinimumSize(int var1) {
- return this.size;
- }
-
- int calculatePreferredSize(int var1) {
- return this.pref != -2 && this.pref != -1 ? Math.max(this.size, this.pref) : this.size;
- }
-
- int calculateMaximumSize(int var1) {
- return this.max >= 0 ? Math.max(this.getPreferredSize(var1), this.max) : this.size;
- }
-
- String getMatchDescription() {
- return this.matches == null ? "" : this.matches.toString();
- }
-
- public String toString() {
- return super.toString() + this.getMatchDescription();
- }
-
- // $FF: synthetic method
- GroupLayout$AutoPreferredGapSpring(GroupLayout var1, GroupLayout.1 var2) {
- this(var1);
- }
- }
-