cookxml.cookswing.helper
Class SpringConstraintHelper

java.lang.Object
  extended bycookxml.cookswing.helper.SpringConstraintHelper
All Implemented Interfaces:
NoAdd

public class SpringConstraintHelper
extends Object
implements NoAdd

Helper class for constructing a spring constraint. A spring constraint can be very tricky to set up.

Given a dimension (x or y), there three types of constraint. the top/left constraint, the width/height constraints, and the bottom/right constraints. Only two constraints can be active for a given component in one dimension, since the third can be inferred from the other two. Thus, if you want to set the constraint for both sides of a component, width and height constraints, which are present by default, must be cleared.

Since:
CookSwing 1.0
See Also:
SpringLayout, SpringLayout.Constraints, SpringLayoutAdder

Field Summary
 boolean clearHeight
          this flag is used to clear the height spring of the component.
 boolean clearWidth
          this flag is used to clear the width spring of the component.
 Component comp1
          the component to be aligned.
 Component comp2
          the component to comparing to.
 String edge1
          the edge of this component.
 String edge2
          the edge of the component to be aligned.
 Spring height
           
 boolean maxHeight
          get and set the height spring of the component to be its maximum height.
 boolean maxWidth
          get and set the width spring of the component to be its maximum width.
 boolean minHeight
          get and set the height spring of the component to be its minimum height.
 boolean minWidth
          get and set the width spring of the component to be its minimum width.
 int pad
          the padding distance between the two edges
 boolean preferredHeight
          get and set the height spring of the component to be its preferred height.
 boolean preferredWidth
          get and set the width spring of the component to be its preferred width.
 Spring width
           
 Integer xpad
           
 Integer ypad
           
 
Constructor Summary
SpringConstraintHelper()
           
 
Method Summary
 void add(Component c)
           
static String getConstraint(String constraint)
           
 void putConstraint(SpringLayout layout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xpad

public Integer xpad

ypad

public Integer ypad

width

public Spring width

height

public Spring height

clearWidth

public boolean clearWidth
this flag is used to clear the width spring of the component.


clearHeight

public boolean clearHeight
this flag is used to clear the height spring of the component.


preferredWidth

public boolean preferredWidth
get and set the width spring of the component to be its preferred width.


preferredHeight

public boolean preferredHeight
get and set the height spring of the component to be its preferred height.


maxWidth

public boolean maxWidth
get and set the width spring of the component to be its maximum width.


maxHeight

public boolean maxHeight
get and set the height spring of the component to be its maximum height.


minWidth

public boolean minWidth
get and set the width spring of the component to be its minimum width.


minHeight

public boolean minHeight
get and set the height spring of the component to be its minimum height.


pad

public int pad
the padding distance between the two edges


edge1

public String edge1
the edge of this component.


edge2

public String edge2
the edge of the component to be aligned.


comp1

public Component comp1
the component to be aligned.


comp2

public Component comp2
the component to comparing to.

Constructor Detail

SpringConstraintHelper

public SpringConstraintHelper()
Method Detail

add

public void add(Component c)

putConstraint

public void putConstraint(SpringLayout layout)

getConstraint

public static String getConstraint(String constraint)