com.vaadin.client.widget.escalator.

Class FlyweightRow

  • All Implemented Interfaces:

    Row

    public class FlyweightRow
    extends Object
    implements Row

    An internal implementation of the Row interface.

    There is only one instance per Escalator. This is designed to be re-used when rendering rows.

    Since:

    7.4

    Author:

    Vaadin Ltd

    See Also:

    Escalator.AbstractRowContainer#refreshRow(Node, int)

    • Constructor Detail

      • FlyweightRow

        public FlyweightRow()
    • Method Detail

      • setup

        public void setup​(com.google.gwt.dom.client.TableRowElement e,
                          int row,
                          double[] columnWidths)
      • teardown

        public boolean teardown()

        Tear down the state of the Row.

        This is an internal check method, to prevent retrieving uninitialized data by calling getRow(), getElement() or getCells() at an improper time.

        This should only be used with asserts (" assert flyweightRow.teardown() ") so that the code is never run when asserts aren't enabled.

        Returns:

        always true

      • getRow

        public int getRow()

        Description copied from interface: Row

        Gets the row index.

        Specified by:

        getRow in interface Row

        Returns:

        the row index

      • getElement

        public com.google.gwt.dom.client.TableRowElement getElement()

        Description copied from interface: Row

        Gets the root element for this row.

        The EscalatorUpdater may update the class names of the element and add inline styles, but may not modify the contained DOM structure.

        If you wish to modify the cells within this row element, access them via the List<Cell> objects passed in to EscalatorUpdater.updateCells(Row, List)

        Specified by:

        getElement in interface Row

        Returns:

        the root element of the row

      • addCells

        public void addCells​(int index,
                             int numberOfColumns)
      • removeCells

        public void removeCells​(int index,
                                int numberOfColumns)
      • getCells

        public Iterable<FlyweightCell> getCells()

        Returns flyweight cells for the client code to render. The cells get their associated elements from the row element.

        Precondition: each cell has a corresponding element in the row

        Returns:

        an iterable of flyweight cells

        See Also:

        #setup(Element, int, int[]), teardown()

      • getCells

        public Iterable<FlyweightCell> getCells​(int offset,
                                                int numberOfCells)

        Returns a subrange of flyweight cells for the client code to render. The cells get their associated elements from the row element.

        Precondition: each cell has a corresponding element in the row

        Parameters:

        offset - the index of the first cell to return

        numberOfCells - the number of cells to return

        Returns:

        an iterable of flyweight cells

      • getUnattachedCells

        public Iterable<FlyweightCell> getUnattachedCells​(int offset,
                                                          int numberOfCells)

        Returns a subrange of unattached flyweight cells. Unattached cells do not have elements associated. Note that FlyweightRow does not keep track of whether cells in actuality have corresponding DOM elements or not; it is the caller's responsibility to invoke this method with correct parameters.

        Precondition: the range [offset, offset + numberOfCells) must be valid

        Parameters:

        offset - the index of the first cell to return

        numberOfCells - the number of cells to return

        Returns:

        an iterable of flyweight cells