org.apache.beehive.netui.databinding.datagrid.api.rendering
Class CellModel

Object
  extended by CellModel
Direct Known Subclasses:
AnchorCellModel, HeaderCellModel, ImageCellModel, SpanCellModel, TemplateCellModel

public class CellModel
extends Object

The CellModel is the base class for JavaBean objects that are used to configure the rendering of a CellDecorator. A CellModel exposes primitive services and state that can be used by CellDecorators during rendering.


Constructor Summary
CellModel()
           
 
Method Summary
 void addFormatter(FormatTag.Formatter formatter)
          Add a FormatTag.Formatter which can be used to format an Object for rendering.
 String formatText(Object value)
          Format an Object value.
 DataGridTagModel getDataGridTagModel()
          Get the DataGridTagModel which is associated with the data grid tag that contains this cell.
 void setDataGridTagModel(DataGridTagModel dataGridTagModel)
          Set the DataGridTagModel for this cell.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellModel

public CellModel()
Method Detail

getDataGridTagModel

public DataGridTagModel getDataGridTagModel()
Get the DataGridTagModel which is associated with the data grid tag that contains this cell.

Returns:
the DataGridTagModel for this cell. Inside a valid data grid, this method should not return null.

setDataGridTagModel

public void setDataGridTagModel(DataGridTagModel dataGridTagModel)
Set the DataGridTagModel for this cell.

Parameters:
dataGridTagModel - the new DataGridTagModel value.

addFormatter

public void addFormatter(FormatTag.Formatter formatter)
Add a FormatTag.Formatter which can be used to format an Object for rendering. Many FormatTag.Formatter instances can be registered and will be executed in the order in which they were added. This method is provided as a service to CellModel subclasses; the use of formatters can vary based on the implementation of a CellDecorator.

Parameters:
formatter - the FormatTag.Formatter to add

formatText

public String formatText(Object value)
Format an Object value. This method is used to apply a chain of formatters to some value. It will return null if the provided value is null; in this case, it is up to the caller to provide an appropriate default value.

Parameters:
value - the Object to format
Returns:
If the value is null, return null. If there are no registered FormatTag.Formatter instances, return Object.toString() for the value parameter. Otherwisee, return the formatted value.