de.twenty11.skysail.common.grids
Class ColumnsBuilder

java.lang.Object
  extended by de.twenty11.skysail.common.grids.ColumnsBuilder

public abstract class ColumnsBuilder
extends Object

Subclasses have to implement the configure method, which typically looks something like addColumn("col1").setWidth(100).addColumn("col2")... This class is meant to be used a domain-specific-language style which lets you define a chain of columns and provide specific details to each column. The typical use is to create an anonymous inner class like in this snippet gridData.setColumnsBuilder(new ColumnsBuilder(...) {...});. 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
ColumnsBuilder()
          Creates a new ColumnsBuilder object which gets a map of parameters.
 
Method Summary
 ColumnDefinition addColumn(String name)
          Add a new column to the chain.
abstract  void configure()
          The central method to configure the chain of columns.
 List<ColumnDefinition> getColumns()
          return the chain of columns (which should have been created in the configure method).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnsBuilder

public ColumnsBuilder()
Creates a new ColumnsBuilder object which gets a map of parameters. These parameters are used to pass filter values, e.g. in a http request, you might find something like column1=foo. If there is a column called "column1", its filtervalue will be set to "foo".

Method Detail

configure

public abstract void configure()
The central method to configure the chain of columns. Subclasses will call addColumn repeatedly to add new Columns.


addColumn

public final ColumnDefinition addColumn(String name)
Add a new column to the chain.

Parameters:
name - the name of the new column
Returns:
the new column.

getColumns

public final List<ColumnDefinition> getColumns()
return the chain of columns (which should have been created in the configure method).

Returns:
the current chain of columns.

toString

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


Copyright © 2011-2012. All Rights Reserved.