Class AbstractHeaderOrFooterBuilder<T>

    • 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
      • isBuildingFooter

        public boolean isBuildingFooter()
        Check if this builder is building a header or footer table.
        Returns:
        true if a footer, false if a header
      • 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
      • 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