com.jgoodies.forms.builder

## Class AbstractBuilder

- java.lang.Object
- - com.jgoodies.forms.builder.AbstractBuilder

- Direct Known Subclasses:
    AbstractButtonPanelBuilder, AbstractFormBuilder

      public abstract class AbstractBuilder
      extends Object

  An abstract class that minimizes the effort required to implement non-visual builders that use the `FormLayout`.

  Builders hide details of the FormLayout and provide convenience behavior that assists you in constructing a form, bar, stack. 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.

  Version:
    $Revision: 1.3 $
  Author:
    Karsten Lentzsch
  See Also:
    `ButtonBarBuilder`, `ButtonStackBuilder`, `PanelBuilder`, `I15dPanelBuilder`, `DefaultFormBuilder`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected CellConstraints` | `currentCellConstraints` Holds an instance of `CellConstraints` that will be used to specify the location, extent and alignments of the component to be added next.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractBuilder(FormLayout layout, Container container)` Constructs an AbstractBuilder for the given FormLayout and layout container.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ComponentFactory` | `createComponentFactory()` Invoked when the per-instance component factory is lazily initialized.
    `int` | `getColumnCount()` Returns the number of columns in the form.
    `ComponentFactory` | `getComponentFactory()` Returns this builder's component factory.
    `Container` | `getContainer()` Returns the container used to build the form.
    `FormLayout` | `getLayout()` Returns the FormLayout instance used to build this form.
    `int` | `getRowCount()` Returns the number of rows in the form.
    `void` | `setComponentFactory(ComponentFactory newFactory)` Sets a new component factory for this builder, overriding the default as provided by `FormsSetup.getComponentFactoryDefault()`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### currentCellConstraints

          protected final CellConstraints currentCellConstraints

      Holds an instance of `CellConstraints` that will be used to specify the location, extent and alignments of the component to be added next.

  - ### Constructor Detail

    - #### AbstractBuilder

          protected AbstractBuilder(FormLayout layout,
                         Container container)

      Constructs an AbstractBuilder for the given FormLayout and layout container.
      Parameters:
        `layout` - the FormLayout to use
        `container` - the layout container
      Throws:
        `NullPointerException` - if `layout` or `container` is `null`

  - ### Method Detail

    - #### getContainer

          public final Container getContainer()

      Returns the container used to build the form.
      Returns:
        the layout container

    - #### getLayout

          public final FormLayout getLayout()

      Returns the FormLayout instance used to build this form.
      Returns:
        the FormLayout

    - #### getColumnCount

          public final int getColumnCount()

      Returns the number of columns in the form.
      Returns:
        the number of columns

    - #### getRowCount

          public final int getRowCount()

      Returns the number of rows in the form.
      Returns:
        the number of rows

    - #### getComponentFactory

          public final ComponentFactory getComponentFactory()

      Returns this builder's component factory. If no factory has been set before, it is lazily initialized from the global default as returned by `FormsSetup.getComponentFactoryDefault()`.
      Returns:
        the component factory
      See Also:
        `setComponentFactory(ComponentFactory)`

    - #### setComponentFactory

          public final void setComponentFactory(ComponentFactory newFactory)

      Sets a new component factory for this builder, overriding the default as provided by `FormsSetup.getComponentFactoryDefault()`.
      Parameters:
        `newFactory` - the component factory to be used for this builder
      See Also:
        `getComponentFactory()`

    - #### createComponentFactory

          protected ComponentFactory createComponentFactory()

      Invoked when the per-instance component factory is lazily initialized. This implementation returns the global default factory.

      Subclasses may override to use a factory other than the global default. However, in most cases it is sufficient to just set a new global default using `FormsSetup.setComponentFactoryDefault(ComponentFactory)`.

      Returns:
        the factory used during the lazy initialization of the per-instance component factory

Copyright © 2002-2014 JGoodies Software GmbH. All Rights Reserved.