com.jgoodies.forms.factories
Class CC

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

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

A factory for CellConstraints objects. 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.

 CC.xy  (3, 5);
 CC.xy  (3, 5, CC.RIGHT, CC.BOTTOM);
 CC.xy  (3, 5, "right, bottom");

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

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

Since:
1.3
Version:
$Revision: 1.3 $
Author:
Karsten Lentzsch
See Also:
Serialized Form

Field Summary
static CellConstraints.Alignment BOTTOM
           
static CellConstraints.Alignment CENTER
           
static CellConstraints.Alignment DEFAULT
           
static CellConstraints.Alignment FILL
           
static CellConstraints.Alignment LEFT
           
static CellConstraints.Alignment RIGHT
           
static CellConstraints.Alignment TOP
           
 
Constructor Summary
CC()
           
 
Method Summary
static CellConstraints rc(int row, int col)
          Sets row and column origins; sets height and width to 1; uses the default alignments.
static CellConstraints rc(int row, int col, CellConstraints.Alignment rowAlign, CellConstraints.Alignment colAlign)
          Sets the row and column origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.
static CellConstraints rc(int row, int col, java.lang.String encodedAlignments)
          Sets row and column origins; sets height and width to 1; decodes vertical and horizontal alignments from the given string.
static CellConstraints rchw(int row, int col, int rowSpan, int colSpan)
          Sets the row, column, height, and width; uses default alignments.
static CellConstraints rchw(int row, int col, int rowSpan, int colSpan, CellConstraints.Alignment rowAlign, CellConstraints.Alignment colAlign)
          Sets the row, column, height, and width; sets the vertical and horizontal alignment using the specified alignment objects.
static CellConstraints rchw(int row, int col, int rowSpan, int colSpan, java.lang.String encodedAlignments)
          Sets the row, column, height, and width; decodes the vertical and horizontal alignments from the given string.
static CellConstraints rcw(int row, int col, int colSpan)
          Sets the row, column, height, and width; uses a height (row span) of 1 and the vertical and horizontal default alignments.
static CellConstraints rcw(int row, int col, int colSpan, CellConstraints.Alignment rowAlign, CellConstraints.Alignment colAlign)
          Sets the row, column, height, and width; sets the vertical and horizontal alignment using the specified alignment objects.
static CellConstraints rcw(int row, int col, int colSpan, java.lang.String encodedAlignments)
          Sets the row, column, height, and width; decodes the vertical and horizontal alignments from the given string.
static CellConstraints xy(int col, int row)
          Sets column and row origins; sets width and height to 1; uses the default alignments.
static CellConstraints xy(int col, int row, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
          Sets the column and row origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.
static CellConstraints xy(int col, int row, java.lang.String encodedAlignments)
          Sets column and row origins; sets width and height to 1; decodes horizontal and vertical alignments from the given string.
static CellConstraints xyw(int col, int row, int colSpan)
          Sets the column, row, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.
static CellConstraints xyw(int col, int row, int colSpan, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
          Sets the column, row, width, and height; sets the horizontal and vertical alignment using the specified alignment objects.
static CellConstraints xyw(int col, int row, int colSpan, java.lang.String encodedAlignments)
          Sets the column, row, width, and height; decodes the horizontal and vertical alignments from the given string.
static CellConstraints xywh(int col, int row, int colSpan, int rowSpan)
          Sets the column, row, width, and height; uses default alignments.
static CellConstraints xywh(int col, int row, int colSpan, int rowSpan, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
          Sets the column, row, width, and height; sets the horizontal and vertical alignment using the specified alignment objects.
static CellConstraints xywh(int col, int row, int colSpan, int rowSpan, java.lang.String encodedAlignments)
          Sets the column, row, width, and height; decodes the horizontal and vertical alignments from the given string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final CellConstraints.Alignment DEFAULT

FILL

public static final CellConstraints.Alignment FILL

LEFT

public static final CellConstraints.Alignment LEFT

RIGHT

public static final CellConstraints.Alignment RIGHT

CENTER

public static final CellConstraints.Alignment CENTER

TOP

public static final CellConstraints.Alignment TOP

BOTTOM

public static final CellConstraints.Alignment BOTTOM
Constructor Detail

CC

public CC()
Method Detail

xy

public static CellConstraints xy(int col,
                                 int row)
Sets column and row 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 static CellConstraints xy(int col,
                                 int row,
                                 java.lang.String encodedAlignments)
Sets column and row 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 static CellConstraints xy(int col,
                                 int row,
                                 CellConstraints.Alignment colAlign,
                                 CellConstraints.Alignment rowAlign)
Sets the column and row 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 static CellConstraints xyw(int col,
                                  int row,
                                  int colSpan)
Sets the column, row, 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 static CellConstraints xyw(int col,
                                  int row,
                                  int colSpan,
                                  java.lang.String encodedAlignments)
Sets the column, row, 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 static CellConstraints xyw(int col,
                                  int row,
                                  int colSpan,
                                  CellConstraints.Alignment colAlign,
                                  CellConstraints.Alignment rowAlign)
Sets the column, row, width, and height; sets the horizontal and vertical alignment 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 static CellConstraints xywh(int col,
                                   int row,
                                   int colSpan,
                                   int rowSpan)
Sets the column, row, 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 static CellConstraints xywh(int col,
                                   int row,
                                   int colSpan,
                                   int rowSpan,
                                   java.lang.String encodedAlignments)
Sets the column, row, 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 static CellConstraints xywh(int col,
                                   int row,
                                   int colSpan,
                                   int rowSpan,
                                   CellConstraints.Alignment colAlign,
                                   CellConstraints.Alignment rowAlign)
Sets the column, row, width, and height; sets the horizontal and vertical alignment 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

rc

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

Examples:

 CC.rc(1, 1);
 CC.rc(3, 1);
 

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

rc

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

Examples:

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

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

rc

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

Examples:

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

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

rcw

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

Examples:

 CC.rcw(3, 1, 7);
 CC.rcw(3, 1, 2);
 

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

rcw

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

Examples:

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

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

rcw

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

Examples:

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

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

rchw

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

Examples:

 CC.rchw(1, 3, 2, 1);
 CC.rchw(1, 3, 7, 3);
 

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

rchw

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

Examples:

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

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

rchw

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

Examples:

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

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


Copyright © 2002-2009 JGoodies Karsten Lentzsch. All Rights Reserved.