Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.user.cellview.client
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 java.lang.Object
implements HeaderBuilder<T>, FooterBuilder<T>

Default implementation of `HeaderBuilder` that renders columns.

Constructor Summary
`AbstractHeaderOrFooterBuilder(AbstractCellTable<T> table, boolean isFooter)` Create a new DefaultHeaderBuilder for the header of footer section.

Method Summary
`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)` If you want to handle browser events using a subclass of `Header`, implement this method to return the appropriate instance and cell table will forward events originating in the element to the `Header`.
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractHeaderOrFooterBuilder

    public AbstractHeaderOrFooterBuilder(AbstractCellTable<T> table,
                                         boolean isFooter)

  Create a new DefaultHeaderBuilder for the header of footer section.

  Parameters:
    `table` - the table being built
    `isFooter` - true if building the footer, false if the header

Method Detail

### buildFooter

    public final TableSectionBuilder buildFooter()

  Description copied from interface: `FooterBuilder`
  Builds the DOM subtree for this footer. The root of the subtree must be a TFOOT element, as appropriate. This method may be called multiple times and should return a new DOM subtree each time.

  If the footer is empty, return null.

  Specified by:
    `buildFooter` in interface `FooterBuilder<T>`
  Returns:
    a `TableSectionBuilder` representing the new footer, or null if the footer is empty

### buildHeader

    public final TableSectionBuilder 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 interface `HeaderBuilder<T>`
  Returns:
    a `TableSectionBuilder` representing the new header, or null if the header is empty

### getColumn

    public Column<T,?> getColumn(Element elem)

  Description copied from interface: `HeaderBuilder`
  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. The column is used to support features such as column sorting.

  Specified by:
    `getColumn` in interface `FooterBuilder<T>`
  Specified by:
    `getColumn` in interface `HeaderBuilder<T>`
  Parameters:
    `elem` - the element that the contains column
  Returns:
    the immediate column contained by the element

### getHeader

    public Header<?> getHeader(Element elem)

  Description copied from interface: `HeaderBuilder`
  If you want to handle browser events using a subclass of `Header`, 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.

  Specified by:
    `getHeader` in interface `FooterBuilder<T>`
  Specified by:
    `getHeader` in interface `HeaderBuilder<T>`
  Parameters:
    `elem` - the element that the contains header
  Returns:
    the immediate `Header` contained by the element

### getRowIndex

    public int getRowIndex(TableRowElement row)

  Description copied from interface: `HeaderBuilder`
  Get the row index from the associated `TableRowElement` (an TR element).

  Specified by:
    `getRowIndex` in interface `FooterBuilder<T>`
  Specified by:
    `getRowIndex` in interface `HeaderBuilder<T>`
  Parameters:
    `row` - the row element
  Returns:
    the row value index

### isBuildingFooter

    public boolean isBuildingFooter()

  Check if this builder is building a header or footer table.

  Returns:
    true if a footer, false if a header

### isColumn

    public boolean isColumn(Element elem)

  Description copied from interface: `HeaderBuilder`
  Check if an element contains a `Column`. This method should return false if and only if `HeaderBuilder.getColumn(Element)` would return null.

  Specified by:
    `isColumn` in interface `FooterBuilder<T>`
  Specified by:
    `isColumn` in interface `HeaderBuilder<T>`
  Parameters:
    `elem` - the element of interest

### isHeader

    public boolean isHeader(Element elem)

  Description copied from interface: `HeaderBuilder`
  Check if an element contains a `Header`. This method should return false if and only if `HeaderBuilder.getHeader(Element)` would return null.

  Specified by:
    `isHeader` in interface `FooterBuilder<T>`
  Specified by:
    `isHeader` in interface `HeaderBuilder<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.

### buildHeaderOrFooterImpl

    protected abstract boolean buildHeaderOrFooterImpl()

  Implementation that builds the header or footer using the convenience methods in this class.

  Returns:
    true if the header contains content, false if empty

### enableColumnHandlers

    protected final void enableColumnHandlers(ElementBuilderBase<?> builder,
                                              Column<T,?> column)

  Enables column-specific event handling for the specified element. If a column is sortable, then clicking on the element or a child of the element will trigger a sort event.

  Parameters:
    `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 associate

### getHeader

    protected final Header<?> getHeader(int index)

  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

    protected AbstractCellTable<T> getTable()

### renderHeader

    protected final <H> void renderHeader(ElementBuilderBase<?> out,
                                          Cell.Context context,
                                          Header<H> header)

  Renders a given Header into a given ElementBuilderBase. This method ensures that the CellTable widget will handle events events originating in the Header.

  Type Parameters:
    `H` - the data type of the header
  Parameters:
    `out` - 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 added
    `context` - the `Cell.Context` of the header being rendered
    `header` - the `Header` to render

### renderSortableHeader

    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.

  Parameters:
    `out` - the builder to render into
    `header` - the header to render
    `context` - the context of the header
    `isSorted` - true if the column is sorted
    `isSortAscending` - indicated the sort order, if sorted

### startRow

    protected final TableRowBuilder startRow()

  Add a header (or footer) row to the table, below any rows previously added.

  Returns:
    the row to add

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD