public abstract class AbstractFormBuilder
extends java.lang.Object
FormLayout
.Builders hide details of the FormLayout and provide convenience behavior that assists you in constructing a form. This class provides a cell cursor that helps you traverse a form while you add components. Also, it offers several methods to append custom and logical columns and rows.
ButtonBarBuilder
,
ButtonStackBuilder
,
PanelBuilder
,
I15dPanelBuilder
,
DefaultFormBuilder
Constructor and Description |
---|
AbstractFormBuilder(java.awt.Container container,
FormLayout layout)
Deprecated.
Replaced by
AbstractFormBuilder(FormLayout, Container) . |
AbstractFormBuilder(FormLayout layout,
java.awt.Container container)
Constructs an instance of
AbstractFormBuilder
for the given FormLayout and layout container. |
Modifier and Type | Method and Description |
---|---|
java.awt.Component |
add(java.awt.Component component)
Adds a component to the container using the default cell constraints.
|
java.awt.Component |
add(java.awt.Component component,
CellConstraints cellConstraints)
Adds a component to the panel using the given cell constraints.
|
java.awt.Component |
add(java.awt.Component component,
java.lang.String encodedCellConstraints)
Adds a component to the panel using the given encoded cell constraints.
|
void |
appendColumn(ColumnSpec columnSpec)
Appends the given column specification to the builder's layout.
|
void |
appendColumn(java.lang.String encodedColumnSpec)
Appends a column specification to the builder's layout
that represents the given string encoding.
|
void |
appendGlueColumn()
Appends a glue column.
|
void |
appendGlueRow()
Appends a glue row.
|
void |
appendLabelComponentsGapColumn()
Appends a column that is the default gap between a label and
its associated component.
|
void |
appendParagraphGapRow()
Appends a row that is the default gap for paragraphs.
|
void |
appendRelatedComponentsGapColumn()
Appends a column that is the default gap for related components.
|
void |
appendRelatedComponentsGapRow()
Appends a row that is the default gap for related components.
|
void |
appendRow(RowSpec rowSpec)
Appends the given row specification to the builder's layout.
|
void |
appendRow(java.lang.String encodedRowSpec)
Appends a row specification to the builder's layout that represents
the given string encoding.
|
void |
appendUnrelatedComponentsGapColumn()
Appends a column that is the default gap for unrelated components.
|
void |
appendUnrelatedComponentsGapRow()
Appends a row that is the default gap for unrelated components.
|
protected CellConstraints |
cellConstraints()
Returns the CellConstraints object that is used as a cursor and
holds the current column span and row span.
|
protected CellConstraints |
createLeftAdjustedConstraints(int columnSpan)
Creates and returns a
CellConstraints object at
the current cursor position that uses the given column span
and is adjusted to the left. |
int |
getColumn()
Returns the cursor's column.
|
int |
getColumnCount()
Returns the number of columns in the form.
|
protected int |
getColumnIncrementSign()
Returns the sign (-1 or 1) used to increment the cursor's column
when moving to the next column.
|
java.awt.Container |
getContainer()
Returns the container used to build the form.
|
FormLayout |
getLayout()
Returns the instance of
FormLayout used to build this form. |
protected int |
getLeadingColumn()
Returns the index of the leading column.
|
int |
getRow()
Returns the cursor's row.
|
int |
getRowCount()
Returns the number of rows in the form.
|
boolean |
isLeftToRight()
Returns whether this builder fills the form left-to-right
or right-to-left.
|
void |
nextColumn()
Moves to the next column, does the same as #nextColumn(1).
|
void |
nextColumn(int columns)
Moves to the next column.
|
void |
nextLine()
Moves to the next line: increases the row and resets the column;
does the same as #nextLine(1).
|
void |
nextLine(int lines)
Moves the cursor down several lines: increases the row by the
specified number of lines and sets the cursor to the leading column.
|
void |
nextRow()
Increases the row by one; does the same as #nextRow(1).
|
void |
nextRow(int rows)
Increases the row by the specified rows.
|
void |
setAlignment(CellConstraints.Alignment hAlign,
CellConstraints.Alignment vAlign)
Sets the horizontal and vertical alignment.
|
void |
setBounds(int column,
int row,
int columnSpan,
int rowSpan)
Sets the cell bounds (location and extent) to the given column, row,
column span and row span.
|
void |
setColumn(int column)
Sets the cursor to the given column.
|
void |
setColumnSpan(int columnSpan)
Sets the cursor's column span.
|
void |
setExtent(int columnSpan,
int rowSpan)
Sets the cursor's extent to the given column span and row span.
|
void |
setHAlignment(CellConstraints.Alignment alignment)
Sets the horizontal alignment.
|
void |
setLeftToRight(boolean b)
Sets the form fill direction to left-to-right or right-to-left.
|
void |
setOrigin(int column,
int row)
Sets the cursor's origin to the given column and row.
|
void |
setRow(int row)
Sets the cursor to the given row.
|
void |
setRowSpan(int rowSpan)
Sets the cursor's row span.
|
void |
setVAlignment(CellConstraints.Alignment alignment)
Sets the vertical alignment.
|
public AbstractFormBuilder(FormLayout layout, java.awt.Container container)
AbstractFormBuilder
for the given FormLayout and layout container.layout
- the FormLayout
to usecontainer
- the layout containerjava.lang.NullPointerException
- if the layout or container is null@Deprecated public AbstractFormBuilder(java.awt.Container container, FormLayout layout)
AbstractFormBuilder(FormLayout, Container)
.AbstractFormBuilder
for the given
container and form layout.container
- the layout containerlayout
- the FormLayout
to usepublic final java.awt.Container getContainer()
public final FormLayout getLayout()
FormLayout
used to build this form.public final int getColumnCount()
public final int getRowCount()
public final boolean isLeftToRight()
componentOrientation
property.setLeftToRight(boolean)
,
ComponentOrientation
public final void setLeftToRight(boolean b)
componentOrientation
property.b
- true indicates left-to-right, false right-to-leftisLeftToRight()
,
ComponentOrientation
public final int getColumn()
public final void setColumn(int column)
column
- the cursor's new column indexpublic final int getRow()
public final void setRow(int row)
row
- the cursor's new row indexpublic final void setColumnSpan(int columnSpan)
columnSpan
- the cursor's new column span (grid width)public final void setRowSpan(int rowSpan)
rowSpan
- the cursor's new row span (grid height)public final void setOrigin(int column, int row)
column
- the new column indexrow
- the new row indexpublic final void setExtent(int columnSpan, int rowSpan)
columnSpan
- the new column span (grid width)rowSpan
- the new row span (grid height)public final void setBounds(int column, int row, int columnSpan, int rowSpan)
column
- the new column index (grid x)row
- the new row index (grid y)columnSpan
- the new column span (grid width)rowSpan
- the new row span (grid height)public final void nextColumn()
public final void nextColumn(int columns)
columns
- number of columns to movepublic final void nextRow()
public final void nextRow(int rows)
rows
- number of rows to movepublic final void nextLine()
public final void nextLine(int lines)
lines
- number of rows to movepublic final void setHAlignment(CellConstraints.Alignment alignment)
alignment
- the new horizontal alignmentpublic final void setVAlignment(CellConstraints.Alignment alignment)
alignment
- the new vertical alignmentpublic final void setAlignment(CellConstraints.Alignment hAlign, CellConstraints.Alignment vAlign)
hAlign
- the new horizontal alignmentvAlign
- the new vertical alignmentpublic final void appendColumn(ColumnSpec columnSpec)
columnSpec
- the column specification object to appendappendColumn(String)
public final void appendColumn(java.lang.String encodedColumnSpec)
encodedColumnSpec
- the column specification to append in encoded formappendColumn(ColumnSpec)
public final void appendGlueColumn()
public final void appendLabelComponentsGapColumn()
appendGlueColumn()
,
appendRelatedComponentsGapColumn()
,
appendUnrelatedComponentsGapColumn()
public final void appendRelatedComponentsGapColumn()
public final void appendUnrelatedComponentsGapColumn()
public final void appendRow(RowSpec rowSpec)
rowSpec
- the row specification object to appendappendRow(String)
public final void appendRow(java.lang.String encodedRowSpec)
encodedRowSpec
- the row specification to append in encoded formappendRow(RowSpec)
public final void appendGlueRow()
public final void appendRelatedComponentsGapRow()
public final void appendUnrelatedComponentsGapRow()
public final void appendParagraphGapRow()
appendGlueRow()
,
appendRelatedComponentsGapRow()
,
appendUnrelatedComponentsGapRow()
public final java.awt.Component add(java.awt.Component component, CellConstraints cellConstraints)
component
- the component to addcellConstraints
- the component's cell constraintspublic final java.awt.Component add(java.awt.Component component, java.lang.String encodedCellConstraints)
component
- the component to addencodedCellConstraints
- the component's encoded cell constraintspublic final java.awt.Component add(java.awt.Component component)
add(Component, CellConstraints)
with a cell
constraints object created by createLeftAdjustedConstraints(int)
.component
- the component to addadd(Component, CellConstraints)
,
createLeftAdjustedConstraints(int)
protected final CellConstraints cellConstraints()
CellConstraints
objectprotected int getLeadingColumn()
Subclasses may override this method, for example, if the form has a leading gap column that should not be filled with components.
protected final int getColumnIncrementSign()
protected final CellConstraints createLeftAdjustedConstraints(int columnSpan)
CellConstraints
object at
the current cursor position that uses the given column span
and is adjusted to the left. Useful when building from right to left.columnSpan
- the column span to be used in the constraints