Logo Search packages:      
Sourcecode: libjgoodies-forms-java version File versions  Download package

com::jgoodies::forms::layout::CellConstraints Class Reference

Inherits java::io::Serializable.

List of all members.

Detailed Description

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.

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: Consider renaming the inset to offsets.

Karsten Lentzsch

Definition at line 80 of file CellConstraints.java.

Public Member Functions

 CellConstraints (String encodedConstraints)
 CellConstraints (int gridX, int gridY, int gridWidth, int gridHeight, Alignment hAlign, Alignment vAlign, Insets insets)
 CellConstraints (int gridX, int gridY, int gridWidth, int gridHeight, Alignment hAlign, Alignment vAlign)
 CellConstraints (int gridX, int gridY, int gridWidth, int gridHeight)
 CellConstraints (int gridX, int gridY, Alignment hAlign, Alignment vAlign)
 CellConstraints (int gridX, int gridY)
 CellConstraints ()
Object clone ()
String toShortString (FormLayout layout)
String toShortString ()
String toString ()
CellConstraints xy (int col, int row, Alignment colAlign, Alignment rowAlign)
CellConstraints xy (int col, int row, String encodedAlignments)
CellConstraints xy (int col, int row)
CellConstraints xyw (int col, int row, int colSpan, Alignment colAlign, Alignment rowAlign)
CellConstraints xyw (int col, int row, int colSpan, String encodedAlignments)
CellConstraints xyw (int col, int row, int colSpan)
CellConstraints xywh (int col, int row, int colSpan, int rowSpan, Alignment colAlign, Alignment rowAlign)
CellConstraints xywh (int col, int row, int colSpan, int rowSpan, String encodedAlignments)
CellConstraints xywh (int col, int row, int colSpan, int rowSpan)

Public Attributes

int gridHeight
int gridWidth
int gridX
int gridY
Alignment hAlign
Insets insets
Alignment vAlign

Static Public Attributes

static final Alignment BOTTOM
static final Alignment CENTER
static final Alignment DEFAULT
static final Alignment FILL
static final Alignment LEFT
static final Alignment RIGHT
static final Alignment TOP

Package Functions

void ensureValidGridBounds (int colCount, int rowCount)
void setBounds (Component c, FormLayout layout, Rectangle cellBounds, FormLayout.Measure minWidthMeasure, FormLayout.Measure minHeightMeasure, FormLayout.Measure prefWidthMeasure, FormLayout.Measure prefHeightMeasure)

Private Member Functions

int componentSize (Component component, FormSpec formSpec, int cellSize, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure)
Alignment concreteAlignment (Alignment cellAlignment, FormSpec formSpec)
Alignment decodeAlignment (String encodedAlignment)
Integer decodeInt (String token)
void ensureValidOrientations (Alignment horizontalAlignment, Alignment verticalAlignment)
int extent (Alignment alignment, int cellSize, int componentSize)
String formatInt (int number)
void initFromConstraints (String encodedConstraints)
int origin (Alignment alignment, int cellOrigin, int cellSize, int componentSize)
void setAlignments (String encodedAlignments)
Alignment usedAlignment (Alignment cellAlignment, FormSpec formSpec)

Static Private Attributes

static final Insets EMPTY_INSETS
static final Alignment[] VALUES


class  Alignment

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index