de.twenty11.skysail.common.forms
Class FormBuilder

java.lang.Object
  extended by de.twenty11.skysail.common.forms.FormBuilder

public abstract class FormBuilder
extends Object

Subclasses have to implement the configure method, which typically looks something like // TODO This is a domain-specific-language style which lets you define a chain of columns. The typical use is to create an anonymous inner class like in this snippet form.setFormBuilder(new FormBuilder(...) {...});. This use case doesn't have to deal with concurrency issues, so no special care is taken to make this class ThreadSafe.

Author:
carsten

Constructor Summary
FormBuilder()
           
 
Method Summary
 FieldDefinition addField(String fieldName, FieldType type)
          Add a new field to the chain.
abstract  void configure()
          The central method to configure the chain of columns.
 Map<String,FieldDefinition> getColumns()
           
 Map<String,FieldDefinition> getFields()
          return the current chain of columns.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FormBuilder

public FormBuilder()
Method Detail

configure

public abstract void configure()
The central method to configure the chain of columns.


addField

public final FieldDefinition addField(String fieldName,
                                      FieldType type)
Add a new field to the chain.

Parameters:
type - html type
fieldName - the name of the new column
Returns:
the new field definition.

getFields

public final Map<String,FieldDefinition> getFields()
return the current chain of columns. This chain is recalculated for each call as the chain might have been changed after the initial configuration (which happens when this method is called the first time).

Returns:
the current chain of columns.

toString

public final String toString()
Overrides:
toString in class Object

getColumns

public Map<String,FieldDefinition> getColumns()


Copyright © 2011-2012. All Rights Reserved.