com.jgoodies.forms.factories
Class FormFactory

java.lang.Object
  extended by com.jgoodies.forms.factories.FormFactory

public final class FormFactory
extends java.lang.Object

A factory that creates instances of FormLayout for frequently used form layouts. It makes form creation easier and more consistent.

The FormLayout factory methods are work in progress and may change without notice. If you want to use these methods, you may consider copying them into your codebase.

The forms are described by major and minor columns. Major columns consist of a leading label and a set of related components, for example: a label plus textfield, or label plus textfield plus button. The component part of a major column is divided into minor columns as shown in this layout:

 <-    major column 1        ->  <-     major column 2       -> 
 label1 textfield1a textfield1b  label2 textfield2a textfield2b
 label3 textfield3a textfield3b  label4 textfield4
 label5 textfield5               label6 textfield6
 

Most forms use 1, 2, 3 or 4 major columns, which in turn are often split into 1, 2, 3 or 4 minor columns.

Version:
$Revision: 1.1 $
Author:
Karsten Lentzsch
See Also:
FormLayout, ColumnSpec

Field Summary
static ColumnSpec BUTTON_COLSPEC
           
static ColumnSpec DEFAULT_COLSPEC
           
static RowSpec DEFAULT_ROWSPEC
           
static ColumnSpec GLUE_COLSPEC
           
static RowSpec GLUE_ROWSPEC
           
static ColumnSpec GROWING_BUTTON_COLSPEC
           
static RowSpec LINE_GAP_ROWSPEC
           
static ColumnSpec MIN_COLSPEC
           
static RowSpec MIN_ROWSPEC
           
static RowSpec NARROW_LINE_GAP_ROWSPEC
           
static RowSpec PARAGRAPH_GAP_ROWSPEC
           
static ColumnSpec PREF_COLSPEC
           
static RowSpec PREF_ROWSPEC
           
static ColumnSpec RELATED_GAP_COLSPEC
           
static RowSpec RELATED_GAP_ROWSPEC
           
static ColumnSpec UNRELATED_GAP_COLSPEC
           
static RowSpec UNRELATED_GAP_ROWSPEC
           
 
Constructor Summary
FormFactory()
           
 
Method Summary
static FormLayout createColumnLayout(int majorColumns, int minorColumns, ColumnSpec labelColumnSpec)
          Creates and answers an instance of FormLayout to build forms with the specified number of major and minor columns.
static FormLayout createColumnLayout(int majorColumns, int minorColumns, ColumnSpec labelColumnSpec, ColumnSpec componentColumnSpec, ConstantSize indent, ConstantSize majorColumnGap, ConstantSize minorColumnGap)
          Creates and answers an instance of FormLayout to build forms with the given number of major columns.
static FormLayout createColumnLayout(int majorColumns, int minorColumns, ColumnSpec labelColumnSpec, ConstantSize indent, ConstantSize minorColumnGap)
          Creates and answers an instance of FormLayout to build forms with the given number of major columns.
static ColumnSpec createGapColumnSpec(ConstantSize gapSize)
          Creates and answers a ColumnSpec that represents a gap with the specified ConstantSize.
static RowSpec createGapRowSpec(ConstantSize gapSize)
          Creates and answers a RowSpec that represents a gap with the specified ConstantSize.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_COLSPEC

public static final ColumnSpec MIN_COLSPEC

PREF_COLSPEC

public static final ColumnSpec PREF_COLSPEC

DEFAULT_COLSPEC

public static final ColumnSpec DEFAULT_COLSPEC

GLUE_COLSPEC

public static final ColumnSpec GLUE_COLSPEC

RELATED_GAP_COLSPEC

public static final ColumnSpec RELATED_GAP_COLSPEC

UNRELATED_GAP_COLSPEC

public static final ColumnSpec UNRELATED_GAP_COLSPEC

BUTTON_COLSPEC

public static final ColumnSpec BUTTON_COLSPEC

GROWING_BUTTON_COLSPEC

public static final ColumnSpec GROWING_BUTTON_COLSPEC

MIN_ROWSPEC

public static final RowSpec MIN_ROWSPEC

PREF_ROWSPEC

public static final RowSpec PREF_ROWSPEC

DEFAULT_ROWSPEC

public static final RowSpec DEFAULT_ROWSPEC

GLUE_ROWSPEC

public static final RowSpec GLUE_ROWSPEC

RELATED_GAP_ROWSPEC

public static final RowSpec RELATED_GAP_ROWSPEC

UNRELATED_GAP_ROWSPEC

public static final RowSpec UNRELATED_GAP_ROWSPEC

LINE_GAP_ROWSPEC

public static final RowSpec LINE_GAP_ROWSPEC

NARROW_LINE_GAP_ROWSPEC

public static final RowSpec NARROW_LINE_GAP_ROWSPEC

PARAGRAPH_GAP_ROWSPEC

public static final RowSpec PARAGRAPH_GAP_ROWSPEC
Constructor Detail

FormFactory

public FormFactory()
Method Detail

createColumnLayout

public static FormLayout createColumnLayout(int majorColumns,
                                            int minorColumns,
                                            ColumnSpec labelColumnSpec)
Creates and answers an instance of FormLayout to build forms with the specified number of major and minor columns.

The layout will use default values for all gaps.

This method is work in progress and may be moved, removed, or change without notice.

Parameters:
majorColumns - the number of used major columns
minorColumns - the number of used minor columns
labelColumnSpec - specifies the label columns
Returns:
a prepared FormLayout

createColumnLayout

public static FormLayout createColumnLayout(int majorColumns,
                                            int minorColumns,
                                            ColumnSpec labelColumnSpec,
                                            ConstantSize indent,
                                            ConstantSize minorColumnGap)
Creates and answers an instance of FormLayout to build forms with the given number of major columns. Major columns consists of a label and a component section, where each component section is divided into the given number of minor columns.

The layout will use the specified gaps to separate major columns, and the label and component section.

This method is work in progress and may be moved, removed, or change without notice.

Parameters:
majorColumns - the number of major columns
minorColumns - the number of minor columns
labelColumnSpec - specifies the label columns
indent - an optional ConstantSize that describes the width of the leading indent column
minorColumnGap - a ConstantSize that describes the gap between minor columns
Returns:
a prepared FormLayout

createColumnLayout

public static FormLayout createColumnLayout(int majorColumns,
                                            int minorColumns,
                                            ColumnSpec labelColumnSpec,
                                            ColumnSpec componentColumnSpec,
                                            ConstantSize indent,
                                            ConstantSize majorColumnGap,
                                            ConstantSize minorColumnGap)
Creates and answers an instance of FormLayout to build forms with the given number of major columns. Major columns consists of a label and a component section, where each component section is divided into the given number of minor columns.

The layout will use the specified gaps to separate major columns, minor columns, and the label and component section.

This method is work in progress and may be moved, removed, or change without notice.

Parameters:
majorColumns - the number of major columns
minorColumns - the number of minor columns
labelColumnSpec - specifies the label columns
componentColumnSpec - specifies the label columns
indent - an optional ConstantSize that describes the width of the leading indent column
majorColumnGap - a ConstantSize that describes the gap between major columns
minorColumnGap - a ConstantSize that describes the gap between minor columns
Returns:
a prepared FormLayout

createGapColumnSpec

public static ColumnSpec createGapColumnSpec(ConstantSize gapSize)
Creates and answers a ColumnSpec that represents a gap with the specified ConstantSize.

Parameters:
gapSize - a ConstantSize that specifies the gap
Returns:
an unmodifyable ColumnSpec that describes a horizontal gap

createGapRowSpec

public static RowSpec createGapRowSpec(ConstantSize gapSize)
Creates and answers a RowSpec that represents a gap with the specified ConstantSize.

Parameters:
gapSize - a ConstantSize that specifies the gap
Returns:
an unmodifyable RowSpec that describes a vertical gap