com.jgoodies.forms.layout
Class CellConstraints

java.lang.Object
  extended by com.jgoodies.forms.layout.CellConstraints
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class CellConstraints
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Defines constraints for components that are layed out with the FormLayout. Defines the components display area: grid x, grid y, grid width (column span), grid height (row span), horizontal alignment and vertical alignment.

Most methods return this object to enable method chaining.

You can set optional insets in a constructor. This is useful if you need to use a pixel-size insets to align perceived component bounds with pixel data, for example an icon. Anyway, this is rarely used. The insets don't affect the size computation for columns and rows. I consider renaming the insets to offsets to better indicate the motivation for this option.

Examples:
The following cell constraints locate a component in the third column of the fifth row; column and row span are 1; the component will be aligned with the column's right-hand side and the row's bottom.

 CellConstraints cc = new CellConstraints();
 cc.xy  (3, 5);
 cc.xy  (3, 5, CellConstraints.RIGHT, CellConstraints.BOTTOM);
 cc.xy  (3, 5, "right, bottom");

 cc.xyw (3, 5, 1);
 cc.xyw (3, 5, 1, CellConstraints.RIGHT, CellConstraints.BOTTOM);
 cc.xyw (3, 5, 1, "right, bottom");

 cc.xywh(3, 5, 1, 1);
 cc.xywh(3, 5, 1, 1, CellConstraints.RIGHT, CellConstraints.BOTTOM);
 cc.xywh(3, 5, 1, 1, "right, bottom");
 
See also the examples in the FormLayout class comment.

TODO: Explain in the JavaDocs that the insets are actually offsets. And describe that these offsets are not taken into account when FormLayout computes the column and row sizes.

TODO: Rename the inset to offsets.

TODO: In the Forms 1.0.x invisible components are not taken into account when the FormLayout lays out the container. Add an optional setting for this on both the container-level and component-level. So one can specify that invisible components shall be taken into account, but may exclude individual components. Or the other way round, exclude invisible components, and include individual components. The API of both the FormLayout and CellConstraints classes shall be extended to support this option. This feature is planned for the Forms version 1.1 and is described in issue #28 of the Forms' issue tracker where you can track the progress.

Version:
$Revision: 54721 $
Author:
Karsten Lentzsch
See Also:
Serialized Form

Nested Class Summary
static class CellConstraints.Alignment
          An ordinal-based serializable typesafe enumeration for component alignment types as used by the FormLayout.
 
Field Summary
static CellConstraints.Alignment BOTTOM
          Put the component in the bottom.
static CellConstraints.Alignment CENTER
          Put the component in the center.
static CellConstraints.Alignment DEFAULT
          Use the column's or row's default alignment.
private static java.awt.Insets EMPTY_INSETS
          A reusable Insets object to reduce object instantiation.
static CellConstraints.Alignment FILL
          Fill the cell either horizontally or vertically.
 int gridHeight
          Describes the component's vertical grid extent (number of cells).
 int gridWidth
          Describes the component's horizontal grid extend (number of cells).
 int gridX
          Describes the component's horizontal grid origin (starts at 1).
 int gridY
          Describes the component's vertical grid origin (starts at 1).
 CellConstraints.Alignment hAlign
          Describes the component's horizontal alignment.
 java.awt.Insets insets
          Describes the component's Insets in it's display area.
static CellConstraints.Alignment LEFT
          Put the component in the left.
static CellConstraints.Alignment RIGHT
          Put the component in the right.
static CellConstraints.Alignment TOP
          Put the component in the top.
 CellConstraints.Alignment vAlign
          Describes the component's vertical alignment.
private static CellConstraints.Alignment[] VALUES
          An array of all enumeration values used to canonicalize deserialized alignments.
 
Constructor Summary
CellConstraints()
          Constructs a default instance of CellConstraints.
CellConstraints(int gridX, int gridY)
          Constructs an instance of CellConstraints for the given cell position.
CellConstraints(int gridX, int gridY, CellConstraints.Alignment hAlign, CellConstraints.Alignment vAlign)
          Constructs an instance of CellConstraints for the given cell position, anchor, and fill.
CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight)
          Constructs an instance of CellConstraints for the given cell position and size.
CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight, CellConstraints.Alignment hAlign, CellConstraints.Alignment vAlign)
          Constructs an instance of CellConstraints for the given cell position and size, anchor, and fill.
CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight, CellConstraints.Alignment hAlign, CellConstraints.Alignment vAlign, java.awt.Insets insets)
          Constructs an instance of CellConstraints for the complete set of available properties.
CellConstraints(java.lang.String encodedConstraints)
          Constructs an instance of CellConstraints from the given encoded string properties.
 
Method Summary
 java.lang.Object clone()
          Creates a copy of this cell constraints object.
private  int componentSize(java.awt.Component component, FormSpec formSpec, int cellSize, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure)
          Computes and returns the pixel size of the given component using the given form specification, measures, and cell size.
private  CellConstraints.Alignment concreteAlignment(CellConstraints.Alignment cellAlignment, FormSpec formSpec)
          Computes and returns the concrete alignment.
private  CellConstraints.Alignment decodeAlignment(java.lang.String encodedAlignment)
          Parses an alignment string description and returns the corresponding alignment value.
private  java.lang.Integer decodeInt(java.lang.String token)
          Decodes an integer string representation and returns the associated Integer or null in case of an invalid number format.
(package private)  void ensureValidGridBounds(int colCount, int rowCount)
          Checks and verifies that this constraints object has valid grid index values, i. e. the display area cells are inside the form's grid.
private  void ensureValidOrientations(CellConstraints.Alignment horizontalAlignment, CellConstraints.Alignment verticalAlignment)
          Checks and verifies that the horizontal alignment is a horizontal and the vertical alignment is vertical.
private  int extent(CellConstraints.Alignment alignment, int cellSize, int componentSize)
          Returns the component's pixel extent.
private  java.lang.String formatInt(int number)
          Returns an integer that has a minimum of two characters.
private  void initFromConstraints(java.lang.String encodedConstraints)
          Decodes and returns the grid bounds and alignments for this constraints as an array of six integers.
private  int origin(CellConstraints.Alignment alignment, int cellOrigin, int cellSize, int componentSize)
          Computes and returns the component's pixel origin.
private  void setAlignments(java.lang.String encodedAlignments)
          Decodes a string description for the horizontal and vertical alignment and sets this CellConstraints' alignment values.
(package private)  void setBounds(java.awt.Component c, FormLayout layout, java.awt.Rectangle cellBounds, FormLayout.Measure minWidthMeasure, FormLayout.Measure minHeightMeasure, FormLayout.Measure prefWidthMeasure, FormLayout.Measure prefHeightMeasure)
          Sets the component's bounds using the given component and cell bounds.
 java.lang.String toShortString()
          Returns a short string representation of this constraints object.
 java.lang.String toShortString(FormLayout layout)
          Returns a short string representation of this constraints object.
 java.lang.String toString()
          Constructs and returns a string representation of this constraints object.
private  CellConstraints.Alignment usedAlignment(CellConstraints.Alignment cellAlignment, FormSpec formSpec)
          Returns the alignment used for a given form constraints object.
 CellConstraints xy(int col, int row)
          Sets row and column origins; sets width and height to 1; uses the default alignments.
 CellConstraints xy(int col, int row, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
          Sets the row and column origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.
 CellConstraints xy(int col, int row, java.lang.String encodedAlignments)
          Sets row and column origins; sets width and height to 1; decodes horizontal and vertical alignments from the given string.
 CellConstraints xyw(int col, int row, int colSpan)
          Sets the row, column, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.
 CellConstraints xyw(int col, int row, int colSpan, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
          Sets the row, column, width, and height; sets the horizontal and vertical aligment using the specified alignment objects.
 CellConstraints xyw(int col, int row, int colSpan, java.lang.String encodedAlignments)
          Sets the row, column, width, and height; decodes the horizontal and vertical alignments from the given string.
 CellConstraints xywh(int col, int row, int colSpan, int rowSpan)
          Sets the row, column, width, and height; uses default alignments.
 CellConstraints xywh(int col, int row, int colSpan, int rowSpan, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
          Sets the row, column, width, and height; sets the horizontal and vertical aligment using the specified alignment objects.
 CellConstraints xywh(int col, int row, int colSpan, int rowSpan, java.lang.String encodedAlignments)
          Sets the row, column, width, and height; decodes the horizontal and vertical alignments from the given string.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final CellConstraints.Alignment DEFAULT
Use the column's or row's default alignment.


FILL

public static final CellConstraints.Alignment FILL
Fill the cell either horizontally or vertically.


LEFT

public static final CellConstraints.Alignment LEFT
Put the component in the left.


RIGHT

public static final CellConstraints.Alignment RIGHT
Put the component in the right.


CENTER

public static final CellConstraints.Alignment CENTER
Put the component in the center.


TOP

public static final CellConstraints.Alignment TOP
Put the component in the top.


BOTTOM

public static final CellConstraints.Alignment BOTTOM
Put the component in the bottom.


VALUES

private static final CellConstraints.Alignment[] VALUES
An array of all enumeration values used to canonicalize deserialized alignments.


EMPTY_INSETS

private static final java.awt.Insets EMPTY_INSETS
A reusable Insets object to reduce object instantiation.


gridX

public int gridX
Describes the component's horizontal grid origin (starts at 1).


gridY

public int gridY
Describes the component's vertical grid origin (starts at 1).


gridWidth

public int gridWidth
Describes the component's horizontal grid extend (number of cells).


gridHeight

public int gridHeight
Describes the component's vertical grid extent (number of cells).


hAlign

public CellConstraints.Alignment hAlign
Describes the component's horizontal alignment.


vAlign

public CellConstraints.Alignment vAlign
Describes the component's vertical alignment.


insets

public java.awt.Insets insets
Describes the component's Insets in it's display area.

Constructor Detail

CellConstraints

public CellConstraints()
Constructs a default instance of CellConstraints.


CellConstraints

public CellConstraints(int gridX,
                       int gridY)
Constructs an instance of CellConstraints for the given cell position.

Examples:

 new CellConstraints(1, 3);
 new CellConstraints(1, 3);
 

Parameters:
gridX - the component's horizontal grid origin
gridY - the component's vertical grid origin

CellConstraints

public CellConstraints(int gridX,
                       int gridY,
                       CellConstraints.Alignment hAlign,
                       CellConstraints.Alignment vAlign)
Constructs an instance of CellConstraints for the given cell position, anchor, and fill.

Examples:

 new CellConstraints(1, 3, CellConstraints.LEFT,   CellConstraints.BOTTOM);
 new CellConstraints(1, 3, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
gridX - the component's horizontal grid origin
gridY - the component's vertical grid origin
hAlign - the component's horizontal alignment
vAlign - the component's vertical alignment

CellConstraints

public CellConstraints(int gridX,
                       int gridY,
                       int gridWidth,
                       int gridHeight)
Constructs an instance of CellConstraints for the given cell position and size.

Examples:

 new CellConstraints(1, 3, 2, 1);
 new CellConstraints(1, 3, 7, 3);
 

Parameters:
gridX - the component's horizontal grid origin
gridY - the component's vertical grid origin
gridWidth - the component's horizontal extent
gridHeight - the component's vertical extent

CellConstraints

public CellConstraints(int gridX,
                       int gridY,
                       int gridWidth,
                       int gridHeight,
                       CellConstraints.Alignment hAlign,
                       CellConstraints.Alignment vAlign)
Constructs an instance of CellConstraints for the given cell position and size, anchor, and fill.

Examples:

 new CellConstraints(1, 3, 2, 1, CellConstraints.LEFT,   CellConstraints.BOTTOM);
 new CellConstraints(1, 3, 7, 3, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
gridX - the component's horizontal grid origin
gridY - the component's vertical grid origin
gridWidth - the component's horizontal extent
gridHeight - the component's vertical extent
hAlign - the component's horizontal alignment
vAlign - the component's vertical alignment

CellConstraints

public CellConstraints(int gridX,
                       int gridY,
                       int gridWidth,
                       int gridHeight,
                       CellConstraints.Alignment hAlign,
                       CellConstraints.Alignment vAlign,
                       java.awt.Insets insets)
Constructs an instance of CellConstraints for the complete set of available properties.

Examples:

 new CellConstraints(1, 3, 2, 1, CellConstraints.LEFT,   CellConstraints.BOTTOM, new Insets(0, 1, 0, 3));
 new CellConstraints(1, 3, 7, 3, CellConstraints.CENTER, CellConstraints.FILL,   new Insets(0, 1, 0, 0));
 

Parameters:
gridX - the component's horizontal grid origin
gridY - the component's vertical grid origin
gridWidth - the component's horizontal extent
gridHeight - the component's vertical extent
hAlign - the component's horizontal alignment
vAlign - the component's vertical alignment
insets - the component's display area Insets
Throws:
java.lang.IndexOutOfBoundsException - if the grid origin or extent is negative
java.lang.NullPointerException - if the horizontal or vertical alignment is null
java.lang.IllegalArgumentException - if an alignment orientation is invalid

CellConstraints

public CellConstraints(java.lang.String encodedConstraints)
Constructs an instance of CellConstraints from the given encoded string properties.

Examples:

 new CellConstraints("1, 3");
 new CellConstraints("1, 3, left, bottom");
 new CellConstraints("1, 3, 2, 1, left, bottom");
 new CellConstraints("1, 3, 2, 1, l, b");
 

Parameters:
encodedConstraints - the constraints encoded as string
Method Detail

xy

public CellConstraints xy(int col,
                          int row)
Sets row and column origins; sets width and height to 1; uses the default alignments.

Examples:

 cc.xy(1, 1);
 cc.xy(1, 3);
 

Parameters:
col - the new column index
row - the new row index
Returns:
this

xy

public CellConstraints xy(int col,
                          int row,
                          java.lang.String encodedAlignments)
Sets row and column origins; sets width and height to 1; decodes horizontal and vertical alignments from the given string.

Examples:

 cc.xy(1, 3, "left, bottom");
 cc.xy(1, 3, "l, b");
 cc.xy(1, 3, "center, fill");
 cc.xy(1, 3, "c, f");
 

Parameters:
col - the new column index
row - the new row index
encodedAlignments - describes the horizontal and vertical alignments
Returns:
this
Throws:
java.lang.IllegalArgumentException - if an alignment orientation is invalid

xy

public CellConstraints xy(int col,
                          int row,
                          CellConstraints.Alignment colAlign,
                          CellConstraints.Alignment rowAlign)
Sets the row and column origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.

Examples:

 cc.xy(1, 3, CellConstraints.LEFT,   CellConstraints.BOTTOM);
 cc.xy(1, 3, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
col - the new column index
row - the new row index
colAlign - horizontal component alignment
rowAlign - vertical component alignment
Returns:
this

xyw

public CellConstraints xyw(int col,
                           int row,
                           int colSpan)
Sets the row, column, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.

Examples:

 cc.xyw(1, 3, 7);
 cc.xyw(1, 3, 2);
 

Parameters:
col - the new column index
row - the new row index
colSpan - the column span or grid width
Returns:
this

xyw

public CellConstraints xyw(int col,
                           int row,
                           int colSpan,
                           java.lang.String encodedAlignments)
Sets the row, column, width, and height; decodes the horizontal and vertical alignments from the given string. The row span (height) is set to 1.

Examples:

 cc.xyw(1, 3, 7, "left, bottom");
 cc.xyw(1, 3, 7, "l, b");
 cc.xyw(1, 3, 2, "center, fill");
 cc.xyw(1, 3, 2, "c, f");
 

Parameters:
col - the new column index
row - the new row index
colSpan - the column span or grid width
encodedAlignments - describes the horizontal and vertical alignments
Returns:
this
Throws:
java.lang.IllegalArgumentException - if an alignment orientation is invalid

xyw

public CellConstraints xyw(int col,
                           int row,
                           int colSpan,
                           CellConstraints.Alignment colAlign,
                           CellConstraints.Alignment rowAlign)
Sets the row, column, width, and height; sets the horizontal and vertical aligment using the specified alignment objects. The row span (height) is set to 1.

Examples:

 cc.xyw(1, 3, 2, CellConstraints.LEFT,   CellConstraints.BOTTOM);
 cc.xyw(1, 3, 7, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
col - the new column index
row - the new row index
colSpan - the column span or grid width
colAlign - horizontal component alignment
rowAlign - vertical component alignment
Returns:
this
Throws:
java.lang.IllegalArgumentException - if an alignment orientation is invalid

xywh

public CellConstraints xywh(int col,
                            int row,
                            int colSpan,
                            int rowSpan)
Sets the row, column, width, and height; uses default alignments.

Examples:

 cc.xywh(1, 3, 2, 1);
 cc.xywh(1, 3, 7, 3);
 

Parameters:
col - the new column index
row - the new row index
colSpan - the column span or grid width
rowSpan - the row span or grid height
Returns:
this

xywh

public CellConstraints xywh(int col,
                            int row,
                            int colSpan,
                            int rowSpan,
                            java.lang.String encodedAlignments)
Sets the row, column, width, and height; decodes the horizontal and vertical alignments from the given string.

Examples:

 cc.xywh(1, 3, 2, 1, "left, bottom");
 cc.xywh(1, 3, 2, 1, "l, b");
 cc.xywh(1, 3, 7, 3, "center, fill");
 cc.xywh(1, 3, 7, 3, "c, f");
 

Parameters:
col - the new column index
row - the new row index
colSpan - the column span or grid width
rowSpan - the row span or grid height
encodedAlignments - describes the horizontal and vertical alignments
Returns:
this
Throws:
java.lang.IllegalArgumentException - if an alignment orientation is invalid

xywh

public CellConstraints xywh(int col,
                            int row,
                            int colSpan,
                            int rowSpan,
                            CellConstraints.Alignment colAlign,
                            CellConstraints.Alignment rowAlign)
Sets the row, column, width, and height; sets the horizontal and vertical aligment using the specified alignment objects.

Examples:

 cc.xywh(1, 3, 2, 1, CellConstraints.LEFT,   CellConstraints.BOTTOM);
 cc.xywh(1, 3, 7, 3, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
col - the new column index
row - the new row index
colSpan - the column span or grid width
rowSpan - the row span or grid height
colAlign - horizontal component alignment
rowAlign - vertical component alignment
Returns:
this
Throws:
java.lang.IllegalArgumentException - if an alignment orientation is invalid

initFromConstraints

private void initFromConstraints(java.lang.String encodedConstraints)
Decodes and returns the grid bounds and alignments for this constraints as an array of six integers. The string representation is a comma separated sequence, one of
 "x, y"
 "x, y, w, h"
 "x, y, hAlign, vAlign"
 "x, y, w, h, hAlign, vAlign"
 

Parameters:
encodedConstraints - represents horizontal and vertical alignment
Throws:
java.lang.IllegalArgumentException - if the encoded constraints do not follow the constraint syntax

setAlignments

private void setAlignments(java.lang.String encodedAlignments)
Decodes a string description for the horizontal and vertical alignment and sets this CellConstraints' alignment values.

Valid horizontal aligmnents are: left, middle, right, default, and fill. Valid vertical alignments are: top, center, bottom, default, and fill. The anchor's string representation abbreviates the alignment: l, m, r, d, f, t, c, and b.

Anchor examples: "m, c" is centered, "l, t" is northwest, "m, t" is north, "r, c" east. "m, d" is horizontally centered and uses the row's default alignment. "d, t" is on top of the cell and uses the column's default alignment.

Parameters:
encodedAlignments - represents horizontal and vertical alignment
Throws:
java.lang.IllegalArgumentException - if an alignment orientation is invalid

decodeInt

private java.lang.Integer decodeInt(java.lang.String token)
Decodes an integer string representation and returns the associated Integer or null in case of an invalid number format.

Parameters:
token - the encoded integer
Returns:
the decoded Integer or null

decodeAlignment

private CellConstraints.Alignment decodeAlignment(java.lang.String encodedAlignment)
Parses an alignment string description and returns the corresponding alignment value.

Parameters:
encodedAlignment - the encoded alignment
Returns:
the associated Alignment instance

ensureValidGridBounds

void ensureValidGridBounds(int colCount,
                           int rowCount)
Checks and verifies that this constraints object has valid grid index values, i. e. the display area cells are inside the form's grid.

Parameters:
colCount - number of columns in the grid
rowCount - number of rows in the grid
Throws:
java.lang.IndexOutOfBoundsException - if the display area described by this constraints object is not inside the grid

ensureValidOrientations

private void ensureValidOrientations(CellConstraints.Alignment horizontalAlignment,
                                     CellConstraints.Alignment verticalAlignment)
Checks and verifies that the horizontal alignment is a horizontal and the vertical alignment is vertical.

Parameters:
horizontalAlignment - the horizontal alignment
verticalAlignment - the vertical alignment
Throws:
java.lang.IllegalArgumentException - if an alignment is invalid

setBounds

void setBounds(java.awt.Component c,
               FormLayout layout,
               java.awt.Rectangle cellBounds,
               FormLayout.Measure minWidthMeasure,
               FormLayout.Measure minHeightMeasure,
               FormLayout.Measure prefWidthMeasure,
               FormLayout.Measure prefHeightMeasure)
Sets the component's bounds using the given component and cell bounds.

Parameters:
c - the component to set bounds
layout - the FormLayout instance that computes the bounds
cellBounds - the cell's bounds
minWidthMeasure - measures the minimum width
minHeightMeasure - measures the minimum height
prefWidthMeasure - measures the preferred width
prefHeightMeasure - measures the preferred height

concreteAlignment

private CellConstraints.Alignment concreteAlignment(CellConstraints.Alignment cellAlignment,
                                                    FormSpec formSpec)
Computes and returns the concrete alignment. Takes into account the cell alignment and the FormSpec if applicable.

If this constraints object doesn't belong to a single column or row, the formSpec parameter is null. In this case the cell alignment is answered, but DEFAULT is mapped to FILL.

If the cell belongs to a single column or row, we use the cell alignment, unless it is DEFAULT, where the alignment is inherited from the column or row resp.

Parameters:
cellAlignment - this cell's aligment
formSpec - the associated column or row specification
Returns:
the concrete alignment

usedAlignment

private CellConstraints.Alignment usedAlignment(CellConstraints.Alignment cellAlignment,
                                                FormSpec formSpec)
Returns the alignment used for a given form constraints object. The cell alignment overrides the column or row default, unless it is DEFAULT. In the latter case, we use the column or row alignment.

Parameters:
cellAlignment - this cell constraint's alignment
formSpec - the associated column or row specification
Returns:
the alignment used

componentSize

private int componentSize(java.awt.Component component,
                          FormSpec formSpec,
                          int cellSize,
                          FormLayout.Measure minMeasure,
                          FormLayout.Measure prefMeasure)
Computes and returns the pixel size of the given component using the given form specification, measures, and cell size.

Parameters:
component - the component to measure
formSpec - the specification of the component's column/row
minMeasure - the measure for the minimum size
prefMeasure - the measure for the preferred size
cellSize - the cell size
Returns:
the component size as measured or a constant

origin

private int origin(CellConstraints.Alignment alignment,
                   int cellOrigin,
                   int cellSize,
                   int componentSize)
Computes and returns the component's pixel origin.

Parameters:
alignment - the component's alignment
cellOrigin - the origin of the display area
cellSize - the extent of the display area
componentSize -
Returns:
the component's pixel origin

extent

private int extent(CellConstraints.Alignment alignment,
                   int cellSize,
                   int componentSize)
Returns the component's pixel extent.

Parameters:
alignment - the component's alignment
cellSize - the size of the display area
componentSize - the component's size
Returns:
the component's pixel extent

clone

public java.lang.Object clone()
Creates a copy of this cell constraints object.

Overrides:
clone in class java.lang.Object
Returns:
a copy of this cell constraints object

toString

public java.lang.String toString()
Constructs and returns a string representation of this constraints object.

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

toShortString

public java.lang.String toShortString()
Returns a short string representation of this constraints object.

Returns:
a short string representation of this constraints object

toShortString

public java.lang.String toShortString(FormLayout layout)
Returns a short string representation of this constraints object. This method can use the given FormLayout to display extra information how default alignments are mapped to concrete alignments. Therefore it asks the related column and row as specified by this constraints object.

Parameters:
layout - the layout to be presented as a string
Returns:
a short string representation of this constraints object

formatInt

private java.lang.String formatInt(int number)
Returns an integer that has a minimum of two characters.

Parameters:
number - the number to format
Returns:
a string representation for a number with a minum of two chars