org.formaria.builder.helper
Class TableModelHelper

java.lang.Object
  extended by org.formaria.builder.helper.TableModelHelper

public class TableModelHelper
extends java.lang.Object

A utility class to help construct a HTML like table structure

Copyright: Copyright (c) Formaria Ltd., 2008


Constructor Summary
TableModelHelper()
           
 
Method Summary
static DataModel addData(DataModel model, java.lang.String name, java.lang.String value)
          Add data to the specified model.
static DataModel addHeader(DataModel model)
          Creates a new 'th' node and returns it
static DataModel addRow(DataModel model)
          Add a new 'tr' node to the passed DataModel
static DataModel createDataItem(java.lang.String name, java.lang.String value, DataModel model)
           
static DataModel createDataSet(java.lang.String name)
          Creates a new dataset within the model with the specified name.
static DataModel createDataSet(java.lang.String name, DataModel model)
           
static DataModel createTable(DataModel model, java.lang.String name)
          Adds a new table DataModel node to the model node The DataModel which will have the newly created table DataModel appended to it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableModelHelper

public TableModelHelper()
Method Detail

createDataSet

public static DataModel createDataSet(java.lang.String name)
Creates a new dataset within the model with the specified name. The new DataModel is appended to the root and returned

Parameters:
name - The name to be given to the new DataModel
Returns:
The newly created DataModel

createDataSet

public static DataModel createDataSet(java.lang.String name,
                                      DataModel model)

createDataItem

public static DataModel createDataItem(java.lang.String name,
                                       java.lang.String value,
                                       DataModel model)

createTable

public static DataModel createTable(DataModel model,
                                    java.lang.String name)
Adds a new table DataModel node to the model node The DataModel which will have the newly created table DataModel appended to it

Parameters:
model - The DataModel which will have the newly created model appended to it
name - The name of the new DataModel
Returns:
The newly created table DataModel

addHeader

public static DataModel addHeader(DataModel model)
Creates a new 'th' node and returns it

Parameters:
model - The model which will have the newly created DataModel appended to it
Returns:
The newly created th node

addRow

public static DataModel addRow(DataModel model)
Add a new 'tr' node to the passed DataModel

Parameters:
model - The model which will have the newly created DataModel appended to it
Returns:
The newly created th node

addData

public static DataModel addData(DataModel model,
                                java.lang.String name,
                                java.lang.String value)
Add data to the specified model.

Parameters:
model - The node which we are adding the data to
name - The name of the new data item
value - The value of the new data item
Returns:
The newly created data item