Class AbstractHeaderOrFooterBuilder<T>
java.lang.Object
com.google.gwt.user.cellview.client.AbstractHeaderOrFooterBuilder<T>
- Type Parameters:
T
- the data type of the table
- All Implemented Interfaces:
FooterBuilder<T>
,HeaderBuilder<T>
- Direct Known Subclasses:
DefaultHeaderOrFooterBuilder
public abstract class AbstractHeaderOrFooterBuilder<T>
extends Object
implements HeaderBuilder<T>, FooterBuilder<T>
Default implementation of
HeaderBuilder
that renders columns.-
Constructor Summary
ConstructorDescriptionAbstractHeaderOrFooterBuilder
(AbstractCellTable<T> table, boolean isFooter) Create a new DefaultHeaderBuilder for the header of footer section. -
Method Summary
Modifier and TypeMethodDescriptionfinal TableSectionBuilder
Builds the DOM subtree for this footer.final TableSectionBuilder
Builds the DOM subtree for this header.protected abstract boolean
Implementation that builds the header or footer using the convenience methods in this class.protected final void
enableColumnHandlers
(ElementBuilderBase<?> builder, Column<T, ?> column) Enables column-specific event handling for the specified element.Given an element in the DOM subtree returned by the most recent call toHeaderBuilder.buildHeader()
, 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.protected final Header
<?> getHeader
(int index) Get the header or footer at the specified index.Header
<?> int
Get the row index from the associatedTableRowElement
(an TR element).protected AbstractCellTable
<T> getTable()
boolean
Check if this builder is building a header or footer table.boolean
Check if an element contains aColumn
.boolean
Check if an element contains aHeader
.boolean
Check if the icon is located at the start or end of the line.protected final <H> void
renderHeader
(ElementBuilderBase<?> out, Cell.Context context, Header<H> header) Renders a given Header into a given ElementBuilderBase.protected final void
renderSortableHeader
(ElementBuilderBase<?> out, Cell.Context context, Header<?> header, boolean isSorted, boolean isSortAscending) Render a header, including a sort icon if the column is sortable and sorted.void
setSortIconStartOfLine
(boolean isStartOfLine) Set the position of the sort icon to the start or end of the line.protected final TableRowBuilder
startRow()
Add a header (or footer) row to the table, below any rows previously added.
-
Constructor Details
-
AbstractHeaderOrFooterBuilder
Create a new DefaultHeaderBuilder for the header of footer section.- Parameters:
table
- the table being builtisFooter
- true if building the footer, false if the header
-
-
Method Details
-
buildHeader
Description copied from interface:HeaderBuilder
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.
- Specified by:
buildHeader
in interfaceHeaderBuilder<T>
- Returns:
- a
TableSectionBuilder
representing the new header, or null if the header is empty
-
getColumn
Description copied from interface:HeaderBuilder
Given an element in the DOM subtree returned by the most recent call toHeaderBuilder.buildHeader()
, 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.- Specified by:
getColumn
in interfaceFooterBuilder<T>
- Specified by:
getColumn
in interfaceHeaderBuilder<T>
- Parameters:
elem
- the element that the contains column- Returns:
- the immediate column contained by the element
-
getHeader
Description copied from interface:HeaderBuilder
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.- Specified by:
getHeader
in interfaceFooterBuilder<T>
- Specified by:
getHeader
in interfaceHeaderBuilder<T>
- Parameters:
elem
- the element that the contains header- Returns:
- the immediate
Header
contained by the element
-
getRowIndex
Description copied from interface:HeaderBuilder
Get the row index from the associatedTableRowElement
(an TR element).- Specified by:
getRowIndex
in interfaceFooterBuilder<T>
- Specified by:
getRowIndex
in interfaceHeaderBuilder<T>
- Parameters:
row
- the row element- Returns:
- the row value index
-
isColumn
Description copied from interface:HeaderBuilder
Check if an element contains aColumn
. This method should return false if and only ifHeaderBuilder.getColumn(Element)
would return null.- Specified by:
isColumn
in interfaceFooterBuilder<T>
- Specified by:
isColumn
in interfaceHeaderBuilder<T>
- Parameters:
elem
- the element of interest
-
isHeader
Description copied from interface:HeaderBuilder
Check if an element contains aHeader
. This method should return false if and only ifHeaderBuilder.getHeader(Element)
would return null.- Specified by:
isHeader
in interfaceFooterBuilder<T>
- Specified by:
isHeader
in interfaceHeaderBuilder<T>
- Parameters:
elem
- the element of interest
-
isSortIconStartOfLine
public boolean isSortIconStartOfLine()Check if the icon is located at the start or end of the line. The start of the line refers to the left side in LTR mode and the right side in RTL mode. The default location is the start of the line. -
setSortIconStartOfLine
public void setSortIconStartOfLine(boolean isStartOfLine) Set the position of the sort icon to the start or end of the line. The start of the line refers to the left side in LTR mode and the right side in RTL mode. The default location is the start of the line. -
getHeader
Get the header or footer at the specified index.- Parameters:
index
- the column index of the header- Returns:
- the header or footer, depending on the value of isFooter
-
getTable
-
startRow
Add a header (or footer) row to the table, below any rows previously added.- Returns:
- the row to add