public abstract class Escalator.AbstractRowContainer extends Object implements RowContainer
RowContainer.BodyRowContainer| Modifier and Type | Field and Description |
|---|---|
protected com.google.gwt.dom.client.TableSectionElement |
root
The table section element (
<thead>, <tbody> or
<tfoot>) the rows (i.e. |
INITIAL_DEFAULT_ROW_HEIGHT| Constructor and Description |
|---|
AbstractRowContainer(com.google.gwt.dom.client.TableSectionElement rowContainerElement) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertArgumentsAreValidAndWithinRange(int index,
int numberOfRows) |
void |
autodetectRowHeightLater() |
void |
autodetectRowHeightNow() |
double |
calculateMaxColWidth(int index)
Iterates through all the cells in a column and returns the width of
the widest element in this RowContainer.
|
protected double |
calculateTotalRowHeight()
Returns the height of all rows in the row container.
|
com.google.gwt.dom.client.TableCellElement |
createCellElement(double width)
Create and setup an empty cell element.
|
Cell |
getCell(com.google.gwt.dom.client.Element element)
Returns the cell object which contains information about the cell the
element is in.
|
protected Escalator.AriaGridRole |
getCellElementRole()
Gets the role attribute of an element to represent a cell in a row.
|
protected abstract String |
getCellElementTagName()
Gets the tag name of an element to represent a cell in a row.
|
double |
getDefaultRowHeight()
Returns the default height of the rows in this RowContainer.
|
abstract int |
getDomRowCount()
This method calculates the current row count directly from the DOM.
|
com.google.gwt.dom.client.TableSectionElement |
getElement()
Returns the root element of RowContainer.
|
EscalatorUpdater |
getEscalatorUpdater()
Returns the current
EscalatorUpdater used to render cells. |
protected abstract double |
getHeightOfSection()
The height of this table section.
|
int |
getLogicalRowIndex(com.google.gwt.dom.client.TableRowElement tr)
Gets the logical row index for the given table row element.
|
int |
getRowCount()
Gets the number of rows in the current row container.
|
com.google.gwt.dom.client.TableRowElement |
getRowElement(int index)
Gets the row element with given logical index.
|
protected Escalator.AriaGridRole |
getRowElementRole()
Gets the role attribute of an element to represent a row in a grid.
|
protected double |
getRowTop(com.google.gwt.dom.client.TableRowElement tr)
Returns the assigned top position for the given element.
|
protected String |
getStylePrimaryName()
Returns the primary style name of the container.
|
protected abstract com.google.gwt.dom.client.TableRowElement |
getTrByVisualIndex(int index)
Gets the child element that is visually at a certain index.
|
void |
insertRows(int index,
int numberOfRows)
Adds rows at a certain index in this row container.
|
protected void |
paintInsertColumns(int offset,
int numberOfColumns,
boolean frozen) |
protected com.google.gwt.dom.client.Node |
paintInsertRow(com.google.gwt.dom.client.Node referenceRow,
com.google.gwt.dom.client.TableRowElement tr,
int logicalRowIndex)
Inserts a single row into the DOM, invoking
getEscalatorUpdater()
preAttach and
postAttach before
and after inserting the row, respectively. |
protected abstract void |
paintInsertRows(int visualIndex,
int numberOfRows)
Actually add rows into the DOM, now that everything can be
calculated.
|
protected List<com.google.gwt.dom.client.TableRowElement> |
paintInsertStaticRows(int visualIndex,
int numberOfRows) |
protected void |
paintRemoveColumns(int offset,
int numberOfColumns) |
protected void |
paintRemoveRow(com.google.gwt.dom.client.TableRowElement tr,
int logicalRowIndex)
Removes a row element from the DOM, invoking
getEscalatorUpdater()
preDetach and
postDetach before
and after removing the row, respectively. |
protected abstract void |
paintRemoveRows(int index,
int numberOfRows)
Removes those row elements from the DOM that correspond to the given
range of logical indices.
|
void |
reapplyColumnWidths()
Reapplies all the cells' widths according to the calculated widths in
the column configuration.
|
protected abstract void |
reapplyDefaultRowHeights()
The default height of rows has (most probably) changed.
|
protected void |
reapplyRowHeight(com.google.gwt.dom.client.TableRowElement tr,
double heightPx) |
protected void |
reapplyRowWidths()
Applies the total length of the columns to each row element.
|
protected abstract void |
recalculateSectionHeight() |
protected abstract void |
refreshCells(Range logicalRowRange,
Range colRange) |
void |
refreshRows(int index,
int numberOfRows)
Refreshes a range of rows in the current row container.
|
protected void |
removeRowPosition(com.google.gwt.dom.client.TableRowElement tr) |
void |
removeRows(int index,
int numberOfRows)
Removes rows at a certain index in the current row container.
|
protected abstract boolean |
rowCanBeFrozen(com.google.gwt.dom.client.TableRowElement tr)
Checks whether a row is an element, or contains such elements, that
can be frozen.
|
void |
setColumnFrozen(int column,
boolean frozen) |
void |
setColumnLastFrozen(int column,
boolean lastFrozen) |
void |
setDefaultRowHeight(double px)
The default height of the rows in this RowContainer.
|
void |
setEscalatorUpdater(EscalatorUpdater escalatorUpdater)
Sets the
EscalatorUpdater to use when displaying data in the
escalator. |
protected void |
setRowPosition(com.google.gwt.dom.client.TableRowElement tr,
int x,
double y) |
protected void |
setStylePrimaryName(String primaryStyleName)
The primary style name for the container.
|
void |
updateFreezePosition(int column,
double scrollLeft) |
protected final com.google.gwt.dom.client.TableSectionElement root
<thead>, <tbody> or
<tfoot>) the rows (i.e. <tr> tags) are
contained in.public AbstractRowContainer(com.google.gwt.dom.client.TableSectionElement rowContainerElement)
public com.google.gwt.dom.client.TableSectionElement getElement()
RowContainergetElement in interface RowContainerprotected abstract String getCellElementTagName()
Usually "th" or "td".
Note: To actually create such an element, use
createCellElement(double) instead.
createCellElement(double)protected Escalator.AriaGridRole getCellElementRole()
Usually Escalator.AriaGridRole.GRIDCELL except for a cell in the
header.
protected Escalator.AriaGridRole getRowElementRole()
Usually Escalator.AriaGridRole.ROW except for a row in the header.
public EscalatorUpdater getEscalatorUpdater()
RowContainerEscalatorUpdater used to render cells.getEscalatorUpdater in interface RowContainerpublic void setEscalatorUpdater(EscalatorUpdater escalatorUpdater)
EscalatorUpdater to use when displaying data in the
escalator.
Implementation detail: This method does no DOM modifications (i.e. is very cheap to call) if there is no data for rows or columns when this method is called.
setEscalatorUpdater in interface RowContainerescalatorUpdater - the escalator updater to use to render cells. May not be
nullEscalator.hasColumnAndRowData()public void removeRows(int index,
int numberOfRows)
Implementation detail: This method does no DOM modifications (i.e. is very cheap to call) if there are no rows in the DOM when this method is called.
removeRows in interface RowContainerindex - the index of the first row to be removednumberOfRows - the number of rows to remove, starting from the indexEscalator.hasSomethingInDom()protected abstract void paintRemoveRows(int index,
int numberOfRows)
numberOfRows
, even zero, if not all the removed rows are actually visible.
The implementation must call
paintRemoveRow(TableRowElement, int) for each row that is
removed from the DOM.
index - the logical index of the first removed rownumberOfRows - number of logical rows to removeprotected void paintRemoveRow(com.google.gwt.dom.client.TableRowElement tr,
int logicalRowIndex)
getEscalatorUpdater()
preDetach and
postDetach before
and after removing the row, respectively.
This method must be called for each removed DOM row by any
paintRemoveRows(int, int) implementation.
tr - the row element to remove.protected void assertArgumentsAreValidAndWithinRange(int index,
int numberOfRows)
throws IllegalArgumentException,
IndexOutOfBoundsException
public int getRowCount()
RowContainergetRowCount in interface RowContainerpublic abstract int getDomRowCount()
While Escalator is stable, this value should equal to
getRowCount(), but while row counts are being updated, these
two values might differ for a short while.
Any extra content, such as spacers for the body, should not be included in this count.
public void insertRows(int index,
int numberOfRows)
The new rows will be inserted between the row at the index, and the row before (an index of 0 means that the rows are inserted at the beginning). Therefore, the rows currently at the index and afterwards will be moved downwards.
The contents of the inserted rows will subsequently be queried from the escalator updater.
Note: Only the contents of the inserted rows will be rendered.
If inserting new rows affects the contents of existing rows,
RowContainer.refreshRows(int, int) needs to be called for those rows
separately.
Implementation detail: This method does no DOM modifications (i.e. is very cheap to call) if there is no data for columns when this method is called.
insertRows in interface RowContainerindex - the index of the row before which new rows are inserted, or
RowContainer.getRowCount() to add rows at the endnumberOfRows - the number of rows to insert after the indexEscalator.hasColumnAndRowData()protected abstract void paintInsertRows(int visualIndex,
int numberOfRows)
visualIndex - the DOM index to add rows intonumberOfRows - the number of rows to insertprotected List<com.google.gwt.dom.client.TableRowElement> paintInsertStaticRows(int visualIndex, int numberOfRows)
protected com.google.gwt.dom.client.Node paintInsertRow(com.google.gwt.dom.client.Node referenceRow,
com.google.gwt.dom.client.TableRowElement tr,
int logicalRowIndex)
getEscalatorUpdater()
preAttach and
postAttach before
and after inserting the row, respectively. The row should have its
cells already inserted.referenceRow - the row after which to insert or null if insert as firsttr - the row to be insertedlogicalRowIndex - the logical index of the inserted rowprotected abstract void recalculateSectionHeight()
protected double calculateTotalRowHeight()
public void refreshRows(int index,
int numberOfRows)
The data for the refreshed rows is queried from the current cell renderer.
Implementation detail: This method does no DOM modifications (i.e. is very cheap to call) if there is no data for columns when this method is called.
refreshRows in interface RowContainerindex - the index of the first row that will be updatednumberOfRows - the number of rows to update, starting from the indexEscalator.hasColumnAndRowData()public com.google.gwt.dom.client.TableCellElement createCellElement(double width)
width - the width of the cell, in pixelspublic com.google.gwt.dom.client.TableRowElement getRowElement(int index)
RowContainerEscalator.getVisibleRowRange().getRowElement in interface RowContainerindex - the logical index of the element to retrieveindexprotected abstract com.google.gwt.dom.client.TableRowElement getTrByVisualIndex(int index)
throws IndexOutOfBoundsException
index - the index of the element to retrieveindexIndexOutOfBoundsException - if index is not valid within rootprotected void paintRemoveColumns(int offset,
int numberOfColumns)
protected void paintInsertColumns(int offset,
int numberOfColumns,
boolean frozen)
public void setColumnFrozen(int column,
boolean frozen)
public void setColumnLastFrozen(int column,
boolean lastFrozen)
public void updateFreezePosition(int column,
double scrollLeft)
protected abstract boolean rowCanBeFrozen(com.google.gwt.dom.client.TableRowElement tr)
In practice, this applies for all header and footer rows. For body rows, it applies for all rows except spacer rows.
tr - the row element to check whether it, or any of its its
descendants can be frozentrue if the given element, or any of its
descendants, can be frozenpublic double calculateMaxColWidth(int index)
index - the index of the column to inspectpublic void reapplyColumnWidths()
protected void reapplyRowWidths()
Note: In contrast to reapplyColumnWidths(), this
method only modifies the width of the <tr>
element, not the cells within.
protected void setStylePrimaryName(String primaryStyleName)
primaryStyleName - the style name to use as prefix for all row and cell style
names.protected String getStylePrimaryName()
null if not set.public void setDefaultRowHeight(double px)
throws IllegalArgumentException
RowContainersetDefaultRowHeight in interface RowContainerpx - the default height in pixels of the rows in this RowContainerIllegalArgumentException - if px < 1RowContainer.getDefaultRowHeight()public double getDefaultRowHeight()
RowContainer
This value will be equal to RowContainer.INITIAL_DEFAULT_ROW_HEIGHT if the
Escalator has not yet had a chance to autodetect the row height,
or no explicit value has yet given via #setDefaultRowHeight(int)
getDefaultRowHeight in interface RowContainer#setDefaultRowHeight(int)protected abstract void reapplyDefaultRowHeights()
Make sure that the displayed rows with a default height are updated in height and top position.
Note:This implementation should not call
Escalator.recalculateElementSizes() - it is done by the
discretion of the caller of this method.
protected void reapplyRowHeight(com.google.gwt.dom.client.TableRowElement tr,
double heightPx)
protected void setRowPosition(com.google.gwt.dom.client.TableRowElement tr,
int x,
double y)
protected double getRowTop(com.google.gwt.dom.client.TableRowElement tr)
Note: This method does not calculate what a row's top position should be. It just returns an assigned value, correct or not.
tr - the table row element to measuretrBodyRowContainerImpl#getRowTop(int)protected void removeRowPosition(com.google.gwt.dom.client.TableRowElement tr)
public void autodetectRowHeightLater()
public void autodetectRowHeightNow()
public Cell getCell(com.google.gwt.dom.client.Element element)
RowContainergetCell in interface RowContainerelement - The element to get the cell for. If element is not present in
row container then null is returned.null if element is not
present in the RowContainer.protected abstract double getHeightOfSection()
Note that the body will calculate its
height, while the others will return a precomputed value.
public int getLogicalRowIndex(com.google.gwt.dom.client.TableRowElement tr)
tr - the table row element inside this container.Copyright © 2018 Vaadin Ltd. All rights reserved.