com.vaadin.client.ui.grid
Class GridColumn<C,T>

java.lang.Object
  extended by com.vaadin.client.ui.grid.GridColumn<C,T>
Type Parameters:
C - The column type
T - The row type
Direct Known Subclasses:
Grid.SelectionColumn

public abstract class GridColumn<C,T>
extends java.lang.Object

Represents a column in the Grid.

Since:
Author:
Vaadin Ltd

Constructor Summary
GridColumn(Renderer<? super C> renderer)
          Constructs a new column with a custom renderer.
 
Method Summary
 Renderer<? super C> getRenderer()
          The renderer to render the cell width.
abstract  C getValue(T row)
          Returns the data that should be rendered into the cell.
 int getWidth()
          Returns the pixel width of the column
 boolean isSortable()
          Are sort indicators shown for the column.
 boolean isVisible()
          Is the column visible.
 void setHeader(java.lang.String caption)
          Sets a header caption for this column.
 void setSortable(boolean sortable)
          Enables sort indicators for the grid.
 void setVisible(boolean visible)
          Sets a column as visible in the grid.
 void setWidth(int pixels)
          Sets the pixel width of the column.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridColumn

public GridColumn(Renderer<? super C> renderer)
Constructs a new column with a custom renderer.

Parameters:
renderer - The renderer to use for rendering the cells
Method Detail

setHeader

public void setHeader(java.lang.String caption)
Sets a header caption for this column.

Parameters:
caption - caption text for header

isVisible

public boolean isVisible()
Is the column visible. By default all columns are visible.

Returns:
true if the column is visible

setVisible

public void setVisible(boolean visible)
Sets a column as visible in the grid.

Parameters:
visible - true if the column should be displayed in the grid

getValue

public abstract C getValue(T row)
Returns the data that should be rendered into the cell. By default returning Strings and Widgets are supported. If the return type is a String then it will be treated as preformatted text.

To support other types you will need to pass a custom renderer to the column via the column constructor.

Parameters:
row - The row object that provides the cell content.
Returns:
The cell content

getRenderer

public Renderer<? super C> getRenderer()
The renderer to render the cell width. By default renders the data as a String or adds the widget into the cell if the column type is of widget type.

Returns:
The renderer to render the cell content with

setWidth

public void setWidth(int pixels)
Sets the pixel width of the column. Use a negative value for the grid to autosize column based on content and available space

Parameters:
pixels - the width in pixels or negative for auto sizing

getWidth

public int getWidth()
Returns the pixel width of the column

Returns:
pixel width of the column

setSortable

public void setSortable(boolean sortable)
Enables sort indicators for the grid.

Note:The API can still sort the column even if this is set to false.

Parameters:
sortable - true when column sort indicators are visible.

isSortable

public boolean isSortable()
Are sort indicators shown for the column.

Returns:
true if the column is sortable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.