Class CellReference<T>

  • Type Parameters:
    T - the type of the row object containing this cell
    Direct Known Subclasses:
    EventCellReference, RendererCellReference

    public class CellReference<T>
    extends Object
    A data class which contains information which identifies a cell in a Grid.

    Since this class follows the Flyweight-pattern any instance of this object is subject to change without the user knowing it and so should not be stored anywhere outside of the method providing these instances.

    Since:
    7.4
    Author:
    Vaadin Ltd
    • Constructor Detail

      • CellReference

        public CellReference​(RowReference<T> rowReference)
        Constructs a new cell reference for the given row.
        Parameters:
        rowReference - the row that requires a new cell
    • Method Detail

      • set

        public void set​(int columnIndexDOM,
                        int columnIndex,
                        Grid.Column<?,​T> column)
        Sets the identifying information for this cell.

        The difference between columnIndexDOM and columnIndex comes from hidden columns.

        Parameters:
        columnIndexDOM - the index of the column in the DOM
        columnIndex - the index of the column
        column - the column object
      • getGrid

        public Grid<T> getGrid()
        Gets the grid that contains the referenced cell.
        Returns:
        the grid that contains referenced cell
      • getRowIndex

        public int getRowIndex()
        Gets the row index of the row.
        Returns:
        the index of the row
      • getRow

        public T getRow()
        Gets the row data object.
        Returns:
        the row object
      • getColumnIndex

        public int getColumnIndex()
        Gets the index of the column.

        NOTE: The index includes hidden columns in the count, unlike getColumnIndexDOM().

        Returns:
        the index of the column
      • getColumnIndexDOM

        public int getColumnIndexDOM()
        Gets the index of the cell in the DOM. The difference to getColumnIndex() is caused by hidden columns.
        Returns:
        the index of the column in the DOM
        Since:
        7.5.0
      • getColumn

        public Grid.Column<?,​T> getColumn()
        Gets the column objects.
        Returns:
        the column object
      • getValue

        public Object getValue()
        Gets the value of the cell.
        Returns:
        the value of the cell
      • getElement

        public com.google.gwt.dom.client.TableCellElement getElement()
        Get the element of the cell.
        Returns:
        the element of the cell
      • getRowReference

        protected RowReference<T> getRowReference()
        Gets the RowReference for this CellReference.
        Returns:
        the row reference