Interface HeaderBuilder<T>
-
- Type Parameters:
T
- the row data type
- All Known Implementing Classes:
AbstractHeaderOrFooterBuilder
,DefaultHeaderOrFooterBuilder
public interface HeaderBuilder<T>
Builds the DOM elements for the header section of a CellTable. It also provides queries on elements in the last DOM subtree that it created.HeaderBuilder
provides two optional ways to handle events, via aColumn
, aHeader
, or both. IfgetColumn(Element)
returns aColumn
given the targetElement
of an event, cell table will use it to enable features such as sorting. IfgetHeader(Element)
returns aHeader
, cell table will forward the event to theHeader
. You can specify both aColumn
andHeader
.The default implementation used by cell widgets is
DefaultHeaderOrFooterBuilder
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TableSectionBuilder
buildHeader()
Builds the DOM subtree for this header.Column<T,?>
getColumn(Element elem)
Given an element in the DOM subtree returned by the most recent call tobuildHeader()
, returns the Column that should be the target of any button clicks or other events on that element, or null if the events should be discarded.Header<?>
getHeader(Element elem)
int
getRowIndex(TableRowElement row)
Get the row index from the associatedTableRowElement
(an TR element).boolean
isColumn(Element elem)
Check if an element contains aColumn
.boolean
isHeader(Element elem)
Check if an element contains aHeader
.
-
-
-
Method Detail
-
buildHeader
TableSectionBuilder buildHeader()
Builds the DOM subtree for this header. The root of the subtree must be a THEAD element, as appropriate. This method may be called multiple times and should return a new DOM subtree each time.If the header is empty, return null.
- Returns:
- a
TableSectionBuilder
representing the new header, or null if the header is empty
-
getColumn
Column<T,?> getColumn(Element elem)
Given an element in the DOM subtree returned by the most recent call tobuildHeader()
, returns the Column that should be the target of any button clicks or other events on that element, or null if the events should be discarded. The column is used to support features such as column sorting.- Parameters:
elem
- the element that the contains column- Returns:
- the immediate column contained by the element
-
getHeader
Header<?> getHeader(Element elem)
If you want to handle browser events using a subclass ofHeader
, implement this method to return the appropriate instance and cell table will forward events originating in the element to theHeader
. Return null if events from the element should be discarded.- Parameters:
elem
- the element that the contains header- Returns:
- the immediate
Header
contained by the element
-
getRowIndex
int getRowIndex(TableRowElement row)
Get the row index from the associatedTableRowElement
(an TR element).- Parameters:
row
- the row element- Returns:
- the row value index
-
isColumn
boolean isColumn(Element elem)
Check if an element contains aColumn
. This method should return false if and only ifgetColumn(Element)
would return null.- Parameters:
elem
- the element of interest
-
isHeader
boolean isHeader(Element elem)
Check if an element contains aHeader
. This method should return false if and only ifgetHeader(Element)
would return null.- Parameters:
elem
- the element of interest
-
-