Class Header<H>
- java.lang.Object
-
- com.google.gwt.user.cellview.client.Header<H>
-
- Type Parameters:
H
- theCell
type
- Direct Known Subclasses:
SafeHtmlHeader
,TextHeader
public abstract class Header<H> extends java.lang.Object
A table column header or footer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Cell<H>
getCell()
Return theCell
responsible for rendering items in the header.java.lang.String
getHeaderStyleNames()
Get extra style names that should be applied to a cell in this header.java.lang.Object
getKey()
Get the key for the header value.abstract H
getValue()
Return the header value.void
onBrowserEvent(Cell.Context context, Element elem, NativeEvent event)
Handle a browser event that took place within the header.boolean
onPreviewColumnSortEvent(Cell.Context context, Element elem, NativeEvent event)
Preview a browser event that may trigger a column sort event.void
render(Cell.Context context, SafeHtmlBuilder sb)
Render the header.void
setHeaderStyleNames(java.lang.String styleNames)
Set extra style names that should be applied to every cell in this header.void
setUpdater(ValueUpdater<H> updater)
Set theValueUpdater
.
-
-
-
Method Detail
-
getCell
public Cell<H> getCell()
Return theCell
responsible for rendering items in the header.- Returns:
- the header Cell
-
getHeaderStyleNames
public java.lang.String getHeaderStyleNames()
Get extra style names that should be applied to a cell in this header. May be overridden to get value dependent styles by callinggetValue()
.- Returns:
- the extra styles of the given row in a space-separated list, or
null
if there are no extra styles for the cells in this header
-
getKey
public java.lang.Object getKey()
Get the key for the header value. By default, the key is the same as the value. Override this method to return a custom key.- Returns:
- the key associated with the value
-
getValue
public abstract H getValue()
Return the header value.- Returns:
- the header value
-
onBrowserEvent
public void onBrowserEvent(Cell.Context context, Element elem, NativeEvent event)
Handle a browser event that took place within the header.- Parameters:
context
- the context of the headerelem
- the parent Elementevent
- the native browser event
-
onPreviewColumnSortEvent
public boolean onPreviewColumnSortEvent(Cell.Context context, Element elem, NativeEvent event)
Preview a browser event that may trigger a column sort event. Return true if theCellTable
should proceed with sorting the column. Subclasses can override this method to disable column sort for some click events, or particular header/footer sections.This method will be invoked even if the header's cell does not consume a click event.
- Parameters:
context
- the context of the headerelem
- the parent Elementevent
- the native browser event- Returns:
- true if the
CellTable
should continue respond to the event (i.e., if this is a click event on a sortable column's header, fireColumnSortEvent
). False if theCellTable
should stop respond to the event.
-
render
public void render(Cell.Context context, SafeHtmlBuilder sb)
Render the header.- Parameters:
context
- the context of the headersb
- aSafeHtmlBuilder
to render into
-
setHeaderStyleNames
public void setHeaderStyleNames(java.lang.String styleNames)
Set extra style names that should be applied to every cell in this header.If you want to apply style names based on the header value, override
#getHeaderStyleNames(Object)
directly.- Parameters:
styleNames
- the extra style names to apply in a space-separated list, ornull
if there are no extra styles for this cell
-
setUpdater
public void setUpdater(ValueUpdater<H> updater)
Set theValueUpdater
.- Parameters:
updater
- the value updater to use
-
-