com.guiseframework.component
Class Table.DefaultCellRepresentationStrategy<V>

java.lang.Object
  extended by com.guiseframework.component.Table.DefaultCellRepresentationStrategy<V>
Type Parameters:
V - The type of value the strategy is to represent.
All Implemented Interfaces:
Table.CellRepresentationStrategy<V>
Enclosing class:
Table

public static class Table.DefaultCellRepresentationStrategy<V>
extends java.lang.Object
implements Table.CellRepresentationStrategy<V>

A default table cell representation strategy. Component values will be represented as themselves. For non-editable cells, a message component will be generated using the cell's value as its message. Editable cells will be represented using a checkbox for boolean values and a text control for all other values.

Author:
Garret Wilson
See Also:
Message, Converter

Constructor Summary
Table.DefaultCellRepresentationStrategy(Converter<V,java.lang.String> converter)
          Converter constructor.
 
Method Summary
<C extends V>
Component
createComponent(Table table, TableModel model, int rowIndex, TableColumnModel<C> column, boolean editable, boolean selected, boolean focused)
          Creates a component for the given cell.
 Converter<V,java.lang.String> getConverter()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table.DefaultCellRepresentationStrategy

public Table.DefaultCellRepresentationStrategy(Converter<V,java.lang.String> converter)
Converter constructor.

Parameters:
converter - The converter to use for displaying the value as a string.
Throws:
java.lang.NullPointerException - if the given converter is null.
Method Detail

getConverter

public Converter<V,java.lang.String> getConverter()
Returns:
The converter to use for displaying the value as a string.

createComponent

public <C extends V> Component createComponent(Table table,
                                               TableModel model,
                                               int rowIndex,
                                               TableColumnModel<C> column,
                                               boolean editable,
                                               boolean selected,
                                               boolean focused)
Creates a component for the given cell. This implementation returns a message with string value of the given value using the object's toString() method.

Specified by:
createComponent in interface Table.CellRepresentationStrategy<V>
Type Parameters:
C - The type of value contained in the column.
Parameters:
table - The component containing the model.
model - The model containing the value.
rowIndex - The zero-based row index of the value.
column - The column of the value.
editable - Whether values in this column are editable.
selected - true if the value is selected.
focused - true if the value has the focus.
Returns:
A new component to represent the given value.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.