com.vaadin.client.widget.escalator
Class FlyweightRow

java.lang.Object
  extended by com.vaadin.client.widget.escalator.FlyweightRow
All Implemented Interfaces:
Row

public class FlyweightRow
extends java.lang.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 Summary
FlyweightRow()
           
 
Method Summary
 void addCells(int index, int numberOfColumns)
           
 java.lang.Iterable<FlyweightCell> getCells()
          Returns flyweight cells for the client code to render.
 java.lang.Iterable<FlyweightCell> getCells(int offset, int numberOfCells)
          Returns a subrange of flyweight cells for the client code to render.
 TableRowElement getElement()
          Gets the root element for this row.
 int getRow()
          Gets the row index.
 java.lang.Iterable<FlyweightCell> getUnattachedCells(int offset, int numberOfCells)
          Returns a subrange of unattached flyweight cells.
 void removeCells(int index, int numberOfColumns)
           
 void setup(TableRowElement e, int row, double[] columnWidths)
           
 boolean teardown()
          Tear down the state of the Row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlyweightRow

public FlyweightRow()
Method Detail

setup

public void setup(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 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 java.lang.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 java.lang.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 java.lang.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


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.