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
ConstructorsConstructorDescriptionAbstractHeaderOrFooterBuilder(AbstractCellTable<T> table, boolean isFooter) Create a new DefaultHeaderBuilder for the header of footer section. -
Method Summary
Modifier and TypeMethodDescriptionfinal TableSectionBuilderBuilds the DOM subtree for this footer.final TableSectionBuilderBuilds the DOM subtree for this header.protected abstract booleanImplementation that builds the header or footer using the convenience methods in this class.protected final voidenableColumnHandlers(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<?>intGet the row index from the associatedTableRowElement(an TR element).protected AbstractCellTable<T>getTable()booleanCheck if this builder is building a header or footer table.booleanCheck if an element contains aColumn.booleanCheck if an element contains aHeader.booleanCheck if the icon is located at the start or end of the line.protected final <H> voidrenderHeader(ElementBuilderBase<?> out, Cell.Context context, Header<H> header) Renders a given Header into a given ElementBuilderBase.protected final voidrenderSortableHeader(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.voidsetSortIconStartOfLine(boolean isStartOfLine) Set the position of the sort icon to the start or end of the line.protected final TableRowBuilderstartRow()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:HeaderBuilderBuilds 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:
buildHeaderin interfaceHeaderBuilder<T>- Returns:
- a
TableSectionBuilderrepresenting the new header, or null if the header is empty
-
getColumn
Description copied from interface:HeaderBuilderGiven 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:
getColumnin interfaceFooterBuilder<T>- Specified by:
getColumnin interfaceHeaderBuilder<T>- Parameters:
elem- the element that the contains column- Returns:
- the immediate column contained by the element
-
getHeader
Description copied from interface:HeaderBuilderIf 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:
getHeaderin interfaceFooterBuilder<T>- Specified by:
getHeaderin interfaceHeaderBuilder<T>- Parameters:
elem- the element that the contains header- Returns:
- the immediate
Headercontained by the element
-
getRowIndex
Description copied from interface:HeaderBuilderGet the row index from the associatedTableRowElement(an TR element).- Specified by:
getRowIndexin interfaceFooterBuilder<T>- Specified by:
getRowIndexin interfaceHeaderBuilder<T>- Parameters:
row- the row element- Returns:
- the row value index
-
isColumn
Description copied from interface:HeaderBuilderCheck if an element contains aColumn. This method should return false if and only ifHeaderBuilder.getColumn(Element)would return null.- Specified by:
isColumnin interfaceFooterBuilder<T>- Specified by:
isColumnin interfaceHeaderBuilder<T>- Parameters:
elem- the element of interest
-
isHeader
Description copied from interface:HeaderBuilderCheck if an element contains aHeader. This method should return false if and only ifHeaderBuilder.getHeader(Element)would return null.- Specified by:
isHeaderin interfaceFooterBuilder<T>- Specified by:
isHeaderin 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