com.vaadin.ui.components.grid
Class GridColumn

java.lang.Object
  extended by com.vaadin.ui.components.grid.GridColumn
All Implemented Interfaces:
java.io.Serializable

public class GridColumn
extends java.lang.Object
implements java.io.Serializable

A column in the grid. Can be obtained by calling Grid.getColumn(Object propertyId).

Since:
Author:
Vaadin Ltd
See Also:
Serialized Form

Method Summary
protected  void checkColumnIsAttached()
          Checks if column is attached and throws an IllegalStateException if it is not
 Converter<?,?> getConverter()
          Returns the converter instance used by this column.
 java.lang.String getFooterCaption()
          Returns the caption of the footer.
 java.lang.String getHeaderCaption()
          Returns the caption of the header.
 Renderer<?> getRenderer()
          Returns the renderer instance used by this column.
 int getWidth()
          Returns the width (in pixels).
 boolean isSortable()
          Are the sorting controls visible in the column header
 boolean isVisible()
          Is this column visible in the grid.
 void setConverter(Converter<?,?> converter)
          Sets the converter used to convert from the property value type to the renderer presentation type.
 void setFooterCaption(java.lang.String caption)
          Sets the caption of the footer.
 void setHeaderCaption(java.lang.String caption)
          Sets the caption of the header.
 void setLastFrozenColumn()
          Sets this column as the last frozen column in its grid.
 void setRenderer(Renderer<?> renderer)
          Sets the renderer for this column.
<T> void
setRenderer(Renderer<T> renderer, Converter<? extends T,?> converter)
          Sets the renderer for this column and the converter used to convert from the property value type to the renderer presentation type.
 void setSortable(boolean sortable)
          Should sorting controls be available for the column
 void setVisible(boolean visible)
          Set the visibility of this column
 void setWidth(int pixelWidth)
          Sets the width (in pixels).
 void setWidthUndefined()
          Marks the column width as undefined meaning that the grid is free to resize the column based on the cell contents and available space in the grid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getHeaderCaption

public java.lang.String getHeaderCaption()
                                  throws java.lang.IllegalStateException
Returns the caption of the header. By default the header caption is the property id of the column.

Returns:
the text in the header
Throws:
java.lang.IllegalStateException - if the column no longer is attached to the grid

setHeaderCaption

public void setHeaderCaption(java.lang.String caption)
                      throws java.lang.IllegalStateException
Sets the caption of the header.

Parameters:
caption - the text to show in the caption
Throws:
java.lang.IllegalStateException - if the column is no longer attached to any grid

getFooterCaption

public java.lang.String getFooterCaption()
                                  throws java.lang.IllegalStateException
Returns the caption of the footer. By default the captions are null.

Returns:
the text in the footer
Throws:
java.lang.IllegalStateException - if the column is no longer attached to any grid

setFooterCaption

public void setFooterCaption(java.lang.String caption)
                      throws java.lang.IllegalStateException
Sets the caption of the footer.

Parameters:
caption - the text to show in the caption
Throws:
java.lang.IllegalStateException - if the column is no longer attached to any grid

getWidth

public int getWidth()
             throws java.lang.IllegalStateException
Returns the width (in pixels). By default a column is 100px wide.

Returns:
the width in pixels of the column
Throws:
java.lang.IllegalStateException - if the column is no longer attached to any grid

setWidth

public void setWidth(int pixelWidth)
              throws java.lang.IllegalStateException,
                     java.lang.IllegalArgumentException
Sets the width (in pixels).

Parameters:
pixelWidth - the new pixel width of the column
Throws:
java.lang.IllegalStateException - if the column is no longer attached to any grid
java.lang.IllegalArgumentException - thrown if pixel width is less than zero

setWidthUndefined

public void setWidthUndefined()
Marks the column width as undefined meaning that the grid is free to resize the column based on the cell contents and available space in the grid.


isVisible

public boolean isVisible()
                  throws java.lang.IllegalStateException
Is this column visible in the grid. By default all columns are visible.

Returns:
true if the column is visible
Throws:
java.lang.IllegalStateException - if the column is no longer attached to any grid

setVisible

public void setVisible(boolean visible)
                throws java.lang.IllegalStateException
Set the visibility of this column

Parameters:
visible - is the column visible
Throws:
java.lang.IllegalStateException - if the column is no longer attached to any grid

checkColumnIsAttached

protected void checkColumnIsAttached()
                              throws java.lang.IllegalStateException
Checks if column is attached and throws an IllegalStateException if it is not

Throws:
java.lang.IllegalStateException - if the column is no longer attached to any grid

setLastFrozenColumn

public void setLastFrozenColumn()
Sets this column as the last frozen column in its grid.

Throws:
java.lang.IllegalArgumentException - if the column is no longer attached to any grid
See Also:
Grid.setLastFrozenColumn(GridColumn)

setRenderer

public void setRenderer(Renderer<?> renderer)
Sets the renderer for this column.

If a suitable converter isn't defined explicitly, the session converter factory is used to find a compatible converter.

Parameters:
renderer - the renderer to use
Throws:
java.lang.IllegalArgumentException - if no compatible converter could be found
See Also:
VaadinSession.getConverterFactory(), ConverterUtil.getConverter(Class, Class, VaadinSession), setConverter(Converter)

setRenderer

public <T> void setRenderer(Renderer<T> renderer,
                            Converter<? extends T,?> converter)
Sets the renderer for this column and the converter used to convert from the property value type to the renderer presentation type.

Parameters:
renderer - the renderer to use, cannot be null
converter - the converter to use
Throws:
java.lang.IllegalArgumentException - if the renderer is already associated with a grid column

setConverter

public void setConverter(Converter<?,?> converter)
                  throws java.lang.IllegalArgumentException
Sets the converter used to convert from the property value type to the renderer presentation type.

Parameters:
converter - the converter to use, or null to not use any converters
Throws:
java.lang.IllegalArgumentException - if the types are not compatible

getRenderer

public Renderer<?> getRenderer()
Returns the renderer instance used by this column.

Returns:
the renderer

getConverter

public Converter<?,?> getConverter()
Returns the converter instance used by this column.

Returns:
the converter

setSortable

public void setSortable(boolean sortable)
Should sorting controls be available for the column

Parameters:
sortable - true if the sorting controls should be visible.

isSortable

public boolean isSortable()
Are the sorting controls visible in the column header



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