T - the data type of the tablepublic abstract class AbstractHeaderOrFooterBuilder<T> extends java.lang.Object implements HeaderBuilder<T>, FooterBuilder<T>
HeaderBuilder that renders columns.| Constructor and Description |
|---|
AbstractHeaderOrFooterBuilder(AbstractCellTable<T> table,
boolean isFooter)
Create a new DefaultHeaderBuilder for the header of footer section.
|
| Modifier and Type | Method and Description |
|---|---|
TableSectionBuilder |
buildFooter()
Builds the DOM subtree for this footer.
|
TableSectionBuilder |
buildHeader()
Builds the DOM subtree for this header.
|
protected abstract boolean |
buildHeaderOrFooterImpl()
Implementation that builds the header or footer using the convenience
methods in this class.
|
protected void |
enableColumnHandlers(ElementBuilderBase<?> builder,
Column<T,?> column)
Enables column-specific event handling for the specified element.
|
Column<T,?> |
getColumn(Element elem)
Given an element in the DOM subtree returned by the most recent call to
HeaderBuilder.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. |
Header<?> |
getHeader(Element elem)
|
protected Header<?> |
getHeader(int index)
Get the header or footer at the specified index.
|
int |
getRowIndex(TableRowElement row)
Get the row index from the associated
TableRowElement (an TR element). |
protected AbstractCellTable<T> |
getTable() |
boolean |
isBuildingFooter()
Check if this builder is building a header or footer table.
|
boolean |
isColumn(Element elem)
Check if an element contains a
Column. |
boolean |
isHeader(Element elem)
Check if an element contains a
Header. |
boolean |
isSortIconStartOfLine()
Check if the icon is located at the start or end of the line.
|
protected <H> void |
renderHeader(ElementBuilderBase<?> out,
Cell.Context context,
Header<H> header)
Renders a given Header into a given ElementBuilderBase.
|
protected 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 TableRowBuilder |
startRow()
Add a header (or footer) row to the table, below any rows previously added.
|
public AbstractHeaderOrFooterBuilder(AbstractCellTable<T> table, boolean isFooter)
table - the table being builtisFooter - true if building the footer, false if the headerpublic final TableSectionBuilder buildFooter()
FooterBuilderIf the footer is empty, return null.
buildFooter in interface FooterBuilder<T>TableSectionBuilder representing the new footer, or null
if the footer is emptypublic final TableSectionBuilder buildHeader()
HeaderBuilderIf the header is empty, return null.
buildHeader in interface HeaderBuilder<T>TableSectionBuilder representing the new header, or null
if the header is emptypublic Column<T,?> getColumn(Element elem)
HeaderBuilderHeaderBuilder.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.getColumn in interface FooterBuilder<T>getColumn in interface HeaderBuilder<T>elem - the element that the contains columnpublic Header<?> getHeader(Element elem)
HeaderBuilderHeader,
implement this method to return the appropriate instance and cell table
will forward events originating in the element to the Header.
Return null if events from the element should be discarded.getHeader in interface FooterBuilder<T>getHeader in interface HeaderBuilder<T>elem - the element that the contains headerHeader contained by the elementpublic int getRowIndex(TableRowElement row)
HeaderBuilderTableRowElement (an TR element).getRowIndex in interface FooterBuilder<T>getRowIndex in interface HeaderBuilder<T>row - the row elementpublic boolean isBuildingFooter()
public boolean isColumn(Element elem)
HeaderBuilderColumn. This method should return
false if and only if HeaderBuilder.getColumn(Element) would return null.isColumn in interface FooterBuilder<T>isColumn in interface HeaderBuilder<T>elem - the element of interestpublic boolean isHeader(Element elem)
HeaderBuilderHeader. This method should return
false if and only if HeaderBuilder.getHeader(Element) would return null.isHeader in interface FooterBuilder<T>isHeader in interface HeaderBuilder<T>elem - the element of interestpublic boolean isSortIconStartOfLine()
public void setSortIconStartOfLine(boolean isStartOfLine)
protected abstract boolean buildHeaderOrFooterImpl()
protected final void enableColumnHandlers(ElementBuilderBase<?> builder, Column<T,?> column)
builder - the builder to associate with the column. The builder should
be a child element of a row returned by startRow() and must
be in a state where an attribute can be added.column - the column to associateprotected final Header<?> getHeader(int index)
index - the column index of the headerprotected AbstractCellTable<T> getTable()
protected final <H> void renderHeader(ElementBuilderBase<?> out, Cell.Context context, Header<H> header)
H - the data type of the headerout - the ElementBuilderBase to render into. The builder
should be a child element of a row returned by startRow()
and must be in a state that allows both attributes and elements to
be addedcontext - the Cell.Context of the header being renderedheader - the Header to renderprotected final void renderSortableHeader(ElementBuilderBase<?> out, Cell.Context context, Header<?> header, boolean isSorted, boolean isSortAscending)
out - the builder to render intoheader - the header to rendercontext - the context of the headerisSorted - true if the column is sortedisSortAscending - indicated the sort order, if sortedprotected final TableRowBuilder startRow()