org.springframework.richclient.form.builder
Class TableFormBuilder

java.lang.Object
  extended by org.springframework.richclient.form.builder.AbstractFormBuilder
      extended by org.springframework.richclient.form.builder.TableFormBuilder

public class TableFormBuilder
extends AbstractFormBuilder

A TableFormBuilder builds a form by using a TableLayoutBuilder

Author:
oliverh, Mathias Broekelmann

Constructor Summary
TableFormBuilder(BindingFactory bindingFactory)
          Creates an instances of the TableFormBuilder by using a BindingFactory
TableFormBuilder(BindingFactory bindingFactory, TableLayoutBuilder tableLayoutBuilder)
          Creates an instances of the TableFormBuilder by using a BindingFactory and a given
 
Method Summary
 JComponent[] add(Binding binding)
          Adds the field binding to the form.
 JComponent[] add(Binding binding, String attributes)
          Adds the field binding to the form.
 JComponent[] add(String fieldName)
          Adds the field to the form.
 JComponent[] add(String fieldName, JComponent component)
          Adds the field to the form by using the provided component.
 JComponent[] add(String fieldName, JComponent component, String attributes)
          Adds the field to the form by using the provided component.
 JComponent[] add(String fieldName, String attributes)
          Adds the field to the form.
 JComponent[] addBinding(Binding binding, JComponent wrappedControl, String attributes)
          adds a field binding to the form
 JComponent[] addBinding(Binding binding, JComponent wrappedComponent, String attributes, String labelAttributes)
          adds a field binding to the form
 JComponent[] addBinding(Binding binding, String attributes, String labelAttributes)
          adds a field binding to the form.
 JComponent[] addInScrollPane(Binding binding)
          Adds the field binding to the form.
 JComponent[] addInScrollPane(Binding binding, String attributes)
          Adds the field binding to the form.
 JComponent[] addInScrollPane(String fieldName)
          Adds the field to the form by using the default binding.
 JComponent[] addInScrollPane(String fieldName, String attributes)
          Adds the field to the form by using the default binding.
 JComponent[] addPasswordField(String fieldName)
          Adds the field to the form by using a password component.
 JComponent[] addPasswordField(String fieldName, String attributes)
          Adds the field to the form by using a password component.
 JComponent[] addSelector(String fieldName, Constraint filter)
          Adds the field to the form by using a selector component.
 JComponent[] addSelector(String fieldName, Constraint filter, String attributes)
          Adds the field to the form by using a selector component.
 void addSeparator(String text)
          Adds a labeled separator to the form.
 void addSeparator(String text, String attributes)
          Adds a labeled separator to the form
 JComponent[] addTextArea(String fieldName)
          Adds the field to the form by using a text area component which is wrapped inside a scrollpane.
 JComponent[] addTextArea(String fieldName, String attributes)
          Adds the field to the form by using a text area component which is wrapped inside a scrollpane.
 JComponent getForm()
          Returns the form which has been created by this builder
 String getLabelAttributes()
          returns the default label layout attributes for the form.
 TableLayoutBuilder getLayoutBuilder()
          Returns the layout builder which is used to build the layout of the added fields and labels
 void row()
          adds a row to the form.
 void setLabelAttributes(String labelAttributes)
          defines the default label layout attributes for the form.
 
Methods inherited from class org.springframework.richclient.form.builder.AbstractFormBuilder
createBinding, createBinding, createDefaultBinding, createLabelFor, createPasswordField, createScrollPane, createSelector, createTextArea, getBindingFactory, getComponentFactory, getFormComponentInterceptor, getFormModel, setComponentFactory, setFormComponentInterceptorFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableFormBuilder

public TableFormBuilder(BindingFactory bindingFactory)
Creates an instances of the TableFormBuilder by using a BindingFactory

Parameters:
bindingFactory - the binding factory to use to create field bindings.

TableFormBuilder

public TableFormBuilder(BindingFactory bindingFactory,
                        TableLayoutBuilder tableLayoutBuilder)
Creates an instances of the TableFormBuilder by using a BindingFactory and a given

Parameters:
bindingFactory - the binding factory to use to create field bindings.
Method Detail

row

public void row()
adds a row to the form. All subsequent field additions will be placed in a new row


add

public JComponent[] add(String fieldName)
Adds the field to the form. AbstractFormBuilder.createDefaultBinding(String) is used to create the binding for the field

Parameters:
fieldName - the name of the field to add
attributes - optional layout attributes for the component. See TableLayoutBuilder for syntax details
Returns:
an array containing the label and the component which where added to the form

add

public JComponent[] add(Binding binding)
Adds the field binding to the form.

Parameters:
binding - the field binding to add
Returns:
an array containing the label and the component of the binding which where added to the form

add

public JComponent[] add(String fieldName,
                        String attributes)
Adds the field to the form. AbstractFormBuilder.createDefaultBinding(String) is used to create the binding for the field

Parameters:
fieldName - the name of the field to add
attributes - optional layout attributes for the component. See TableLayoutBuilder for syntax details
Returns:
an array containing the label and the component which where added to the form

add

public JComponent[] add(Binding binding,
                        String attributes)
Adds the field binding to the form.

Parameters:
binding - the field binding to add
attributes - optional layout attributes for the component. See TableLayoutBuilder for syntax details
Returns:
an array containing the label and the component which where added to the form

add

public JComponent[] add(String fieldName,
                        JComponent component)
Adds the field to the form by using the provided component.

Parameters:
fieldName - the name of the field to add
component - the component for the field
Returns:
an array containing the label and the component which where added to the form

add

public JComponent[] add(String fieldName,
                        JComponent component,
                        String attributes)
Adds the field to the form by using the provided component. AbstractFormBuilder.createBinding(String, JComponent) is used to create the binding of the field

Parameters:
fieldName - the name of the field to add
component - the component for the field
attributes - optional layout attributes for the component. See TableLayoutBuilder for syntax details
Returns:
an array containing the label and the component which where added to the form

addSelector

public JComponent[] addSelector(String fieldName,
                                Constraint filter)
Adds the field to the form by using a selector component. AbstractFormBuilder.createSelector(String, Constraint) is used to create the component for the selector

Parameters:
fieldName - the name of the field to add
filter - optional filter constraint for the items of the selector
Returns:
an array containing the label and the selector component which where added to the form
See Also:
AbstractFormBuilder.createSelector(String, Constraint)

addSelector

public JComponent[] addSelector(String fieldName,
                                Constraint filter,
                                String attributes)
Adds the field to the form by using a selector component.

Parameters:
fieldName - the name of the field to add
filter - optional filter constraint for the items of the selector
attributes - optional layout attributes for the selector component. See TableLayoutBuilder for syntax details
Returns:
an array containing the label and the selector component which where added to the form

addPasswordField

public JComponent[] addPasswordField(String fieldName)
Adds the field to the form by using a password component. AbstractFormBuilder.createPasswordField(String) is used to create the component for the password field

Parameters:
fieldName - the name of the field to add
Returns:
an array containing the label and the password component which where added to the form
See Also:
AbstractFormBuilder.createPasswordField(String)

addPasswordField

public JComponent[] addPasswordField(String fieldName,
                                     String attributes)
Adds the field to the form by using a password component. AbstractFormBuilder.createPasswordField(String) is used to create the component for the password field

Parameters:
fieldName - the name of the field to add
attributes - optional layout attributes for the password component. See TableLayoutBuilder for syntax details
Returns:
an array containing the label and the password component which where added to the form
See Also:
AbstractFormBuilder.createPasswordField(String)

addTextArea

public JComponent[] addTextArea(String fieldName)
Adds the field to the form by using a text area component which is wrapped inside a scrollpane.

Note: this method ensures that the the label of the textarea has a top vertical alignment if valign is not defined in the default label attributes

Parameters:
fieldName - the name of the field to add
Returns:
an array containing the label, the textarea and the scrollpane which where added to the form
See Also:
AbstractFormBuilder.createTextArea(String)

addTextArea

public JComponent[] addTextArea(String fieldName,
                                String attributes)
Adds the field to the form by using a text area component which is wrapped inside a scrollpane. AbstractFormBuilder.createTextArea(String) is used to create the component for the text area field

Note: this method ensures that the the label of the textarea has a top vertical alignment if valign is not defined in the default label attributes

Parameters:
fieldName - the name of the field to add
attributes - optional layout attributes for the scrollpane. See TableLayoutBuilder for syntax details
Returns:
an array containing the label, the textarea and the scrollpane and which where added to the form
See Also:
AbstractFormBuilder.createTextArea(String)

addInScrollPane

public JComponent[] addInScrollPane(String fieldName)
Adds the field to the form by using the default binding. The component will be placed inside a scrollpane.

Parameters:
fieldName - the name of the field to add
Returns:
an array containing the label, the component of the field binding and the scrollpane which where added to the form

addInScrollPane

public JComponent[] addInScrollPane(String fieldName,
                                    String attributes)
Adds the field to the form by using the default binding. The component will be placed inside a scrollpane.

Parameters:
fieldName - the name of the field to add
attributes - optional layout attributes for the scrollpane. See TableLayoutBuilder for syntax details
Returns:
an array containing the label, the component of the field binding and the scrollpane binding which where added to the form
See Also:
AbstractFormBuilder.createScrollPane(String, JComponent)

addInScrollPane

public JComponent[] addInScrollPane(Binding binding)
Adds the field binding to the form. The component will be placed inside a scrollpane.

Parameters:
binding - the binding to use
Returns:
an array containing the label, the component of the field binding and the scrollpane and the component of the binding which where added to the form
See Also:
AbstractFormBuilder.createScrollPane(String, JComponent)

addInScrollPane

public JComponent[] addInScrollPane(Binding binding,
                                    String attributes)
Adds the field binding to the form. The component will be placed inside a scrollpane. AbstractFormBuilder.createScrollPane(String, JComponent) is used to create the component for the scrollpane

Parameters:
binding - the binding to use
attributes - optional layout attributes for the scrollpane. See TableLayoutBuilder for syntax details
Returns:
an array containing the label, the component of the field binding and the scrollpane and the component of the binding which where added to the form
See Also:
AbstractFormBuilder.createScrollPane(String, JComponent)

addSeparator

public void addSeparator(String text)
Adds a labeled separator to the form.

Parameters:
text - the key for the label. Must not be null

addSeparator

public void addSeparator(String text,
                         String attributes)
Adds a labeled separator to the form

Parameters:
text - the key for the label. Must not be null
attributes - optional attributes. See TableLayoutBuilder for syntax details

getLayoutBuilder

public TableLayoutBuilder getLayoutBuilder()
Returns the layout builder which is used to build the layout of the added fields and labels

Returns:
The form containing the added fields, components and labels in the defined layout. Not null

getForm

public JComponent getForm()
Returns the form which has been created by this builder

Returns:
The form containing the added fields and labels in the defined layout. Not null

getLabelAttributes

public String getLabelAttributes()
returns the default label layout attributes for the form.

Returns:
layout attributes for the labels, can be null.

setLabelAttributes

public void setLabelAttributes(String labelAttributes)
defines the default label layout attributes for the form.

Parameters:
labelAttributes - layout attributes for the labels, if null no layout attributes will be applied to the labels. See TableLayoutBuilder for syntax details.

addBinding

public JComponent[] addBinding(Binding binding,
                               String attributes,
                               String labelAttributes)
adds a field binding to the form. This method does not use the default label attributes which may have been set through setLabelAttributes(String)

Parameters:
binding - the binding of the field
attributes - optional layout attributes for the label. If null no layout attributes will be applied to the label. See TableLayoutBuilder for syntax details
Returns:
an array containing the label and the component of the binding

addBinding

public JComponent[] addBinding(Binding binding,
                               JComponent wrappedControl,
                               String attributes)
adds a field binding to the form

Parameters:
binding - the binding of the field
wrappedControl - the optional wrapped component. If null the component of the binding is used. This Parameter should be used if the component of the binding is being wrapped inside this component
attributes - optional layout attributes for the label. If null no layout attributes will be applied to the label. See TableLayoutBuilder for syntax details
Returns:
an array containing the label, the component of the field binding and the wrapped component

addBinding

public JComponent[] addBinding(Binding binding,
                               JComponent wrappedComponent,
                               String attributes,
                               String labelAttributes)
adds a field binding to the form

Parameters:
binding - the binding of the field
wrappedComponent - the optional wrapped component. If null the component of the binding is used. This Parameter should be used if the component of the binding is being wrapped inside this component
attributes - optional layout attributes for the wrapped component. If null no layout attributes will be applied to the component. See TableLayoutBuilder for syntax details
attributes - optional layout attributes for the label. If null no layout attributes will be applied to the label. See TableLayoutBuilder for syntax details
Returns:
an array containing the label, the component of the field binding and the wrapped component


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.