T
- the row typeC
- the column typepublic abstract class Column<T,C> extends java.lang.Object implements HasCell<T,C>, HasAlignment
HasHorizontalAlignment.AutoHorizontalAlignmentConstant, HasHorizontalAlignment.HorizontalAlignmentConstant
HasVerticalAlignment.VerticalAlignmentConstant
ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT
ALIGN_BOTTOM, ALIGN_MIDDLE, ALIGN_TOP
Constructor and Description |
---|
Column(Cell<C> cell)
Construct a new Column with a given
Cell . |
Modifier and Type | Method and Description |
---|---|
Cell<C> |
getCell()
Returns the
Cell responsible for rendering items in the column. |
java.lang.String |
getCellStyleNames(Cell.Context context,
T object)
Get extra style names that should be applied to a cell in this column.
|
java.lang.String |
getDataStoreName() |
FieldUpdater<T,C> |
getFieldUpdater()
Returns the
FieldUpdater used for updating values in the column. |
HasHorizontalAlignment.HorizontalAlignmentConstant |
getHorizontalAlignment()
Gets the horizontal alignment.
|
abstract C |
getValue(T object)
Returns the column value from within the underlying data object.
|
HasVerticalAlignment.VerticalAlignmentConstant |
getVerticalAlignment()
Gets the vertical alignment.
|
boolean |
isDefaultSortAscending()
Check if the default sort order of the column is ascending or descending.
|
boolean |
isSortable()
Check if the column is sortable.
|
void |
onBrowserEvent(Cell.Context context,
Element elem,
T object,
NativeEvent event)
Handle a browser event that took place within the column.
|
void |
render(Cell.Context context,
T object,
SafeHtmlBuilder sb)
Render the object into the cell.
|
void |
setCellStyleNames(java.lang.String styleNames)
Set extra style names that should be applied to every cell.
|
void |
setDataStoreName(java.lang.String name)
Sets a string that identifies this column in a data query.
|
void |
setDefaultSortAscending(boolean isAscending)
Set whether or not the default sort order is ascending.
|
void |
setFieldUpdater(FieldUpdater<T,C> fieldUpdater)
Set the
FieldUpdater used for updating values in the column. |
void |
setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the horizontal alignment.
|
void |
setSortable(boolean sortable)
Set whether or not the column can be sorted.
|
void |
setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the vertical alignment.
|
public java.lang.String getCellStyleNames(Cell.Context context, T object)
context
- the cell contextobject
- the base object to be updated, or null if the row is emptynull
if there are no extra styles for the cells in this
columnpublic java.lang.String getDataStoreName()
public FieldUpdater<T,C> getFieldUpdater()
FieldUpdater
used for updating values in the column.getFieldUpdater
in interface HasCell<T,C>
setFieldUpdater(FieldUpdater)
public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
HasHorizontalAlignment
getHorizontalAlignment
in interface HasHorizontalAlignment
HasHorizontalAlignment.ALIGN_LEFT
,
HasHorizontalAlignment.ALIGN_CENTER
,
HasHorizontalAlignment.ALIGN_RIGHT
,
HasHorizontalAlignment.ALIGN_JUSTIFY
, or
null).public abstract C getValue(T object)
public HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment()
HasVerticalAlignment
getVerticalAlignment
in interface HasVerticalAlignment
public boolean isDefaultSortAscending()
public boolean isSortable()
public void onBrowserEvent(Cell.Context context, Element elem, T object, NativeEvent event)
context
- the cell contextelem
- the parent Elementobject
- the base object to be updatedevent
- the native browser eventpublic void render(Cell.Context context, T object, SafeHtmlBuilder sb)
context
- the cell contextobject
- the object to rendersb
- the buffer to render intopublic void setCellStyleNames(java.lang.String styleNames)
If you want to apply style names based on the row or cell value, override
#getCellStyleNames(Context, Object)
directly.
styleNames
- the extra style names to apply in a space-separated list,
or null
if there are no extra styles for this cellpublic void setDataStoreName(java.lang.String name)
name
- name of the column from the data store's perspectivepublic void setDefaultSortAscending(boolean isAscending)
isAscending
- true to set the default order to ascending, false for
descendingpublic void setFieldUpdater(FieldUpdater<T,C> fieldUpdater)
FieldUpdater
used for updating values in the column.fieldUpdater
- the field updatergetFieldUpdater()
public void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Use null
to clear horizontal alignment, allowing it to be
determined by the standard HTML mechanisms such as inheritance and CSS
rules.
The new horizontal alignment will apply the next time the table is rendered.
setHorizontalAlignment
in interface HasHorizontalAlignment
align
- the horizontal alignment (
HasHorizontalAlignment.ALIGN_LEFT
,
HasHorizontalAlignment.ALIGN_CENTER
,
HasHorizontalAlignment.ALIGN_RIGHT
,
HasHorizontalAlignment.ALIGN_JUSTIFY
,
HasHorizontalAlignment.ALIGN_LOCALE_START
, or
HasHorizontalAlignment.ALIGN_LOCALE_END
).public void setSortable(boolean sortable)
sortable
- true to make sortable, false to make unsortablepublic void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
The new vertical alignment will apply the next time the table is rendered.
setVerticalAlignment
in interface HasVerticalAlignment
align
- the vertical alignment (
HasVerticalAlignment.ALIGN_TOP
,
HasVerticalAlignment.ALIGN_MIDDLE
, or
HasVerticalAlignment.ALIGN_BOTTOM
).