Class 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 Detail

      • DefaultCellRepresentationStrategy

        public 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 VComponent 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.