Class Table.DefaultCellRepresentationStrategy<V>

java.lang.Object
io.guise.framework.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 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:
  • Constructor Details

    • DefaultCellRepresentationStrategy

      public DefaultCellRepresentationStrategy(Converter<V,String> converter)
      Converter constructor.
      Parameters:
      converter - The converter to use for displaying the value as a string.
      Throws:
      NullPointerException - if the given converter is null.
  • Method Details

    • getConverter

      public Converter<V,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 to represent 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.