com.vaadin.client.widget.escalator.
Class FlyweightRow
- java.lang.Object
-
- com.vaadin.client.widget.escalator.FlyweightRow
-
All Implemented Interfaces:
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 Summary
Constructors Constructor Description FlyweightRow()
-
Method Summary
All Methods Modifier and Type Method Description void
addCells(int index, int numberOfColumns)
Iterable<FlyweightCell>
getCells()
Returns flyweight cells for the client code to render.
Iterable<FlyweightCell>
getCells(int offset, int numberOfCells)
Returns a subrange of flyweight cells for the client code to render.
com.google.gwt.dom.client.TableRowElement
getElement()
Gets the root element for this row.
int
getRow()
Gets the row index.
Iterable<FlyweightCell>
getUnattachedCells(int offset, int numberOfCells)
Returns a subrange of unattached flyweight cells.
void
removeCells(int index, int numberOfColumns)
void
setup(com.google.gwt.dom.client.TableRowElement e, int row, double[] columnWidths)
boolean
teardown()
Tear down the state of the Row.
-
-
-
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()
orgetCells()
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.
-
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<
objects passed in toCell
>EscalatorUpdater.updateCells(Row, List)
Specified by:
getElement
in interfaceRow
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 returnnumberOfCells
- the number of cells to returnReturns:
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 returnnumberOfCells
- the number of cells to returnReturns:
an iterable of flyweight cells
-
-