pagelayout
Class BoundSpring

java.lang.Object
  extended by pagelayout.BoundSpring

public class BoundSpring
extends java.lang.Object

The BoundSpring class encapsulates the geometrical properties of an object of the class Cell in terms of minimum, maximum, and preferred width and height of the rectangle that encloses the cell.

Also defined here are methods addx, addy, and outerProduct that are used to determine the BoundSpring of cells that may contain other cells, such as rows ( Row), columns ( Column), and rectangular grids ( CellGrid).


Constructor Summary
BoundSpring(BoundSpring boundSpring)
          Creates a BoundSpring which is an exact copy of the given BoundSpring.
BoundSpring(java.awt.Component component)
          Creates the BoundSpring for a component.
BoundSpring(int minGap, int preferredGap, int maxGap, boolean isHorizontalGap)
          Creates the BoundSpring for a horizontal or a vertical gap.
 
Method Summary
 BoundSpring addx(BoundSpring boundSpring)
          Computes the BoundSpring resulting from horizontal stacking of this object and another BoundSpring object.
static BoundSpring addx(BoundSpring aBoundSpring, BoundSpring bBoundSpring)
          Computes the BoundSpring resulting from horizontal stacking of two BoundSpring objects.
 BoundSpring addy(BoundSpring bBoundSpring)
          Computes the BoundSpring resulting from vertical stacking of this object and another BoundSpring object.
static BoundSpring addy(BoundSpring aBoundSpring, BoundSpring bBoundSpring)
          Computes the BoundSpring resulting from vertical stacking of two BoundSpring objects.
protected  void encloseBoundSpring(BoundSpring bs)
           
protected  void fixMax()
           
 int getMaximumHeight()
          Returns the maximum height of this BoundSpring object.
 int getMaximumWidth()
          Returns the maximum width of this BoundSpring object.
 int getMinimumHeight()
          Returns the minimum height of this BoundSpring object.
 int getMinimumWidth()
          Returns the minimum width of this BoundSpring object.
 int getPreferredHeight()
          Returns the preferred height of this BoundSpring object.
 int getPreferredWidth()
          Returns the preferred width of this BoundSpring object.
protected  int getSize(int type, int coord)
          Compact utility method for getting various dimensions of this BoundSpring.
protected  boolean isFixed(int c)
           
 boolean isGap()
          Returns true if this object represents the enclosing rectangle of a gap.
 boolean isXFixed()
          Returns true if this object is rigid in the x-direction.
 boolean isYFixed()
          Returns true if this object is rigid in the y-direction.
 void linkHeight(java.awt.Component[] componentArray, int fromOffset)
          Sets the height of the components in the input component array to the height of this BoundSpring.
 void linkWidth(java.awt.Component[] componentArray, int fromOffset)
          Sets the width of the components in the input component array to the width of this BoundSpring.
 BoundSpring outerProduct(BoundSpring verticalSpring)
          Returns the outer product of this object with another BoundSpring object.
static BoundSpring outerProduct(BoundSpring horizontalSpring, BoundSpring verticalSpring)
          Returns the outer product of the two input BoundSpring objects.
protected  void setFixedHeight()
           
protected  void setFixedWidth()
           
 void setInset(int horizontalGap, int verticalGap)
          Increases the width and height of this object by the specified inputs.
protected  void setSize(int value, int type, int coord)
          Compact utility method for setting various dimensions of this BoundSpring.
 java.lang.String toString()
          Returns the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BoundSpring

public BoundSpring(java.awt.Component component)
Creates the BoundSpring for a component.

Parameters:
component - the component for which the BoundSpring is to be created.

BoundSpring

public BoundSpring(int minGap,
                   int preferredGap,
                   int maxGap,
                   boolean isHorizontalGap)
Creates the BoundSpring for a horizontal or a vertical gap.

Parameters:
minGap - the minimum length of the gap.
preferredGap - the preferred length of the gap.
maxGap - the maximum length of the gap.
isHorizontalGap - true for a horizontal gap, false otherwise.

BoundSpring

public BoundSpring(BoundSpring boundSpring)
Creates a BoundSpring which is an exact copy of the given BoundSpring.

Parameters:
boundSpring - the BoundSpring object to be duplicated.
Method Detail

addx

public BoundSpring addx(BoundSpring boundSpring)
Computes the BoundSpring resulting from horizontal stacking of this object and another BoundSpring object.

Parameters:
boundSpring - the second BoundSpring object.
Returns:
The BoundSpring object resulting from the horizontal stacking.

addx

public static BoundSpring addx(BoundSpring aBoundSpring,
                               BoundSpring bBoundSpring)
Computes the BoundSpring resulting from horizontal stacking of two BoundSpring objects.

Parameters:
aBoundSpring - the first BoundSpring object. Note that the result is copied to this object which is returned as the output of this method.
bBoundSpring - the second BoundSpring object.
Returns:
The BoundSpring object resulting from the horizontal stacking.

addy

public BoundSpring addy(BoundSpring bBoundSpring)
Computes the BoundSpring resulting from vertical stacking of this object and another BoundSpring object.

Parameters:
bBoundSpring - the second BoundSpring object.
Returns:
The BoundSpring object resulting from the vertical stacking.

addy

public static BoundSpring addy(BoundSpring aBoundSpring,
                               BoundSpring bBoundSpring)
Computes the BoundSpring resulting from vertical stacking of two BoundSpring objects.

Parameters:
aBoundSpring - the first BoundSpring object. Note that the result is copied to this object which is returned as the output of this method.
bBoundSpring - the second BoundSpring object.
Returns:
The BoundSpring object resulting from the vertical stacking.

getMinimumWidth

public int getMinimumWidth()
Returns the minimum width of this BoundSpring object.

Returns:
The minimum width of this BoundSpring object.

getMinimumHeight

public int getMinimumHeight()
Returns the minimum height of this BoundSpring object.

Returns:
The minimum height of this BoundSpring object.

getPreferredWidth

public int getPreferredWidth()
Returns the preferred width of this BoundSpring object.

Returns:
The preferred width of this BoundSpring object.

getPreferredHeight

public int getPreferredHeight()
Returns the preferred height of this BoundSpring object.

Returns:
The preferred height of this BoundSpring object.

getMaximumWidth

public int getMaximumWidth()
Returns the maximum width of this BoundSpring object.

Returns:
The maximum width of this BoundSpring object.

getMaximumHeight

public int getMaximumHeight()
Returns the maximum height of this BoundSpring object.

Returns:
The maximum height of this BoundSpring object.

isXFixed

public boolean isXFixed()
Returns true if this object is rigid in the x-direction.

Returns:
true if this object is rigid in the x-direction,false otherwise.

isYFixed

public boolean isYFixed()
Returns true if this object is rigid in the y-direction.

Returns:
true if this object is rigid in the y-direction,false otherwise.

isGap

public boolean isGap()
Returns true if this object represents the enclosing rectangle of a gap.

Returns:
true of this object is a in the y-direction,false otherwise.

toString

public java.lang.String toString()
Returns the string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this object.

linkHeight

public void linkHeight(java.awt.Component[] componentArray,
                       int fromOffset)
Sets the height of the components in the input component array to the height of this BoundSpring. Only the elements in the array starting from the index fromOffset are affected in this manner.

Parameters:
componentArray - the array of components to resize.
fromOffset - the index of the first element in the array to modify.

linkWidth

public void linkWidth(java.awt.Component[] componentArray,
                      int fromOffset)
Sets the width of the components in the input component array to the width of this BoundSpring. Only the elements in the array starting from the index fromOffset are affected in this manner.

Parameters:
componentArray - the array of components to resize.
fromOffset - the index of the first element in the array to modify.

outerProduct

public BoundSpring outerProduct(BoundSpring verticalSpring)
Returns the outer product of this object with another BoundSpring object. The outer product of two the BoundSpring objects is BoundSpring of the rectangle formed by the horizontal spring (i.e. minimum, maximum and preferred width) of the first object and the vertical spring (i.e. minimum, maximum and preferred height) of the second.

Parameters:
verticalSpring - the object whose vertical spring is copied to the vertical spring of the result.
Returns:
The BoundSpring object resulting from the operation defined above.

outerProduct

public static BoundSpring outerProduct(BoundSpring horizontalSpring,
                                       BoundSpring verticalSpring)
Returns the outer product of the two input BoundSpring objects.

Parameters:
horizontalSpring - the object whose horizontal spring is copied to the horizontal spring of the result. The result is copied to this object which is returned as the output of this method.
verticalSpring - the object whose vertical spring is copied to the vertical spring of the result.
Returns:
The outer product of the inputs.

setInset

public void setInset(int horizontalGap,
                     int verticalGap)
Increases the width and height of this object by the specified inputs.

Parameters:
horizontalGap - the specified increase in the width.
verticalGap - the specified increase in the height.

getSize

protected int getSize(int type,
                      int coord)
Compact utility method for getting various dimensions of this BoundSpring.

Parameters:
type - 0, 1, or any other number for getting the minimum, maximum or preferred size along the coordinate specified the selcond paramter.
coord - 0 for x axis (width), 1 for y axis (height)
Returns:
The size dependent upon the inputs as specified above.

setSize

protected void setSize(int value,
                       int type,
                       int coord)
Compact utility method for setting various dimensions of this BoundSpring.

Parameters:
value - the actual value.
type - 0, 1, or any other number for setting the minimum, maximum or preferred size along the coordinate specified the selcond paramter.
coord - 0 for x axis (width), 1 for y axis (height)

isFixed

protected boolean isFixed(int c)

setFixedWidth

protected void setFixedWidth()

setFixedHeight

protected void setFixedHeight()

encloseBoundSpring

protected void encloseBoundSpring(BoundSpring bs)

fixMax

protected void fixMax()