Class Column<T,C>
- java.lang.Object
-
- com.google.gwt.user.cellview.client.Column<T,C>
-
- Type Parameters:
T- the row typeC- the column type
- All Implemented Interfaces:
HasCell<T,C>,HasAlignment,HasHorizontalAlignment,HasVerticalAlignment
- Direct Known Subclasses:
IdentityColumn,TextColumn
public abstract class Column<T,C> extends java.lang.Object implements HasCell<T,C>, HasAlignment
A representation of a column in a table.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
HasHorizontalAlignment.AutoHorizontalAlignmentConstant, HasHorizontalAlignment.HorizontalAlignmentConstant
-
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment
HasVerticalAlignment.VerticalAlignmentConstant
-
-
Field Summary
-
Fields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT
-
Fields inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment
ALIGN_BOTTOM, ALIGN_MIDDLE, ALIGN_TOP
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Cell<C>getCell()Returns theCellresponsible for rendering items in the column.java.lang.StringgetCellStyleNames(Cell.Context context, T object)Get extra style names that should be applied to a cell in this column.java.lang.StringgetDataStoreName()FieldUpdater<T,C>getFieldUpdater()Returns theFieldUpdaterused for updating values in the column.HasHorizontalAlignment.HorizontalAlignmentConstantgetHorizontalAlignment()Gets the horizontal alignment.abstract CgetValue(T object)Returns the column value from within the underlying data object.HasVerticalAlignment.VerticalAlignmentConstantgetVerticalAlignment()Gets the vertical alignment.booleanisDefaultSortAscending()Check if the default sort order of the column is ascending or descending.booleanisSortable()Check if the column is sortable.voidonBrowserEvent(Cell.Context context, Element elem, T object, NativeEvent event)Handle a browser event that took place within the column.voidrender(Cell.Context context, T object, SafeHtmlBuilder sb)Render the object into the cell.voidsetCellStyleNames(java.lang.String styleNames)Set extra style names that should be applied to every cell.voidsetDataStoreName(java.lang.String name)Sets a string that identifies this column in a data query.voidsetDefaultSortAscending(boolean isAscending)Set whether or not the default sort order is ascending.voidsetFieldUpdater(FieldUpdater<T,C> fieldUpdater)Set theFieldUpdaterused for updating values in the column.voidsetHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)Sets the horizontal alignment.voidsetSortable(boolean sortable)Set whether or not the column can be sorted.voidsetVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)Sets the vertical alignment.
-
-
-
Method Detail
-
getCellStyleNames
public java.lang.String getCellStyleNames(Cell.Context context, T object)
Get extra style names that should be applied to a cell in this column.- Parameters:
context- the cell contextobject- the base object to be updated, or null if the row is empty- Returns:
- the extra styles of the given row in a space-separated list, or
nullif there are no extra styles for the cells in this column
-
getDataStoreName
public java.lang.String getDataStoreName()
- Returns:
- the database name of the column, or null if it's never been set
-
getFieldUpdater
public FieldUpdater<T,C> getFieldUpdater()
Returns theFieldUpdaterused for updating values in the column.- Specified by:
getFieldUpdaterin interfaceHasCell<T,C>- Returns:
- an instance of FieldUpdater
- See Also:
setFieldUpdater(FieldUpdater)
-
getHorizontalAlignment
public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
Description copied from interface:HasHorizontalAlignmentGets the horizontal alignment.- Specified by:
getHorizontalAlignmentin interfaceHasHorizontalAlignment- Returns:
- the current horizontal alignment (
HasHorizontalAlignment.ALIGN_LEFT,HasHorizontalAlignment.ALIGN_CENTER,HasHorizontalAlignment.ALIGN_RIGHT,HasHorizontalAlignment.ALIGN_JUSTIFY, or null).
-
getValue
public abstract C getValue(T object)
Returns the column value from within the underlying data object.
-
getVerticalAlignment
public HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment()
Description copied from interface:HasVerticalAlignmentGets the vertical alignment.- Specified by:
getVerticalAlignmentin interfaceHasVerticalAlignment- Returns:
- the current vertical alignment.
-
isDefaultSortAscending
public boolean isDefaultSortAscending()
Check if the default sort order of the column is ascending or descending.- Returns:
- true if default sort is ascending, false if not
-
isSortable
public boolean isSortable()
Check if the column is sortable.- Returns:
- true if sortable, false if not
-
onBrowserEvent
public void onBrowserEvent(Cell.Context context, Element elem, T object, NativeEvent event)
Handle a browser event that took place within the column.- Parameters:
context- the cell contextelem- the parent Elementobject- the base object to be updatedevent- the native browser event
-
render
public void render(Cell.Context context, T object, SafeHtmlBuilder sb)
Render the object into the cell.- Parameters:
context- the cell contextobject- the object to rendersb- the buffer to render into
-
setCellStyleNames
public void setCellStyleNames(java.lang.String styleNames)
Set extra style names that should be applied to every cell.If you want to apply style names based on the row or cell value, override
getCellStyleNames(Context, Object)directly.- Parameters:
styleNames- the extra style names to apply in a space-separated list, ornullif there are no extra styles for this cell
-
setDataStoreName
public void setDataStoreName(java.lang.String name)
Sets a string that identifies this column in a data query.- Parameters:
name- name of the column from the data store's perspective
-
setDefaultSortAscending
public void setDefaultSortAscending(boolean isAscending)
Set whether or not the default sort order is ascending.- Parameters:
isAscending- true to set the default order to ascending, false for descending
-
setFieldUpdater
public void setFieldUpdater(FieldUpdater<T,C> fieldUpdater)
Set theFieldUpdaterused for updating values in the column.- Parameters:
fieldUpdater- the field updater- See Also:
getFieldUpdater()
-
setHorizontalAlignment
public void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the horizontal alignment.Use
nullto 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.
- Specified by:
setHorizontalAlignmentin interfaceHasHorizontalAlignment- Parameters:
align- the horizontal alignment (HasHorizontalAlignment.ALIGN_LEFT,HasHorizontalAlignment.ALIGN_CENTER,HasHorizontalAlignment.ALIGN_RIGHT,HasHorizontalAlignment.ALIGN_JUSTIFY,HasHorizontalAlignment.ALIGN_LOCALE_START, orHasHorizontalAlignment.ALIGN_LOCALE_END).
-
setSortable
public void setSortable(boolean sortable)
Set whether or not the column can be sorted. The change will take effect the next time the table is redrawn.- Parameters:
sortable- true to make sortable, false to make unsortable
-
setVerticalAlignment
public void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the vertical alignment.The new vertical alignment will apply the next time the table is rendered.
- Specified by:
setVerticalAlignmentin interfaceHasVerticalAlignment- Parameters:
align- the vertical alignment (HasVerticalAlignment.ALIGN_TOP,HasVerticalAlignment.ALIGN_MIDDLE, orHasVerticalAlignment.ALIGN_BOTTOM).
-
-