com.vaadin.client.ui.grid
Class GridHeader

java.lang.Object
  extended by com.vaadin.client.ui.grid.GridHeader

public class GridHeader
extends java.lang.Object

Represents the header section of a Grid. A header consists of a single header row containing a header cell for each column. Each cell has a simple textual caption.

Since:
Author:
Vaadin Ltd

Nested Class Summary
 class GridHeader.HeaderCell
          A single cell in a grid header row.
 class GridHeader.HeaderRow
          A single row in a grid header section.
 
Constructor Summary
GridHeader()
           
 
Method Summary
protected  void addColumn(GridColumn<?,?> column)
           
 ROWTYPE addRow(int index)
          Inserts a new row at the given position.
 ROWTYPE appendRow()
          Adds a new row at the bottom of this section.
protected  GridHeader.HeaderRow createRow()
          Creates and returns a new instance of the row type.
 java.util.Collection<java.lang.String> getConsumedEvents()
          Returns the events consumed by the header
 GridHeader.HeaderRow getDefaultRow()
          Returns the current default row of this header.
protected  Grid<?> getGrid()
           
 ROWTYPE getRow(int index)
          Returns the row at the given position.
 int getRowCount()
          Returns the number of rows in this section.
protected  java.util.List<ROWTYPE> getRows()
           
protected  int getVisibleRowCount()
           
 boolean isVisible()
          Returns the visibility of this section.
 ROWTYPE prependRow()
          Adds a new row at the top of this section.
protected  void removeColumn(GridColumn<?,?> column)
           
 void removeRow(int index)
          Removes the row at the given position.
 void removeRow(ROWTYPE row)
          Removes the given row from the section.
protected  void requestSectionRefresh()
          Informs the grid that this section should be re-rendered.
 void setDefaultRow(GridHeader.HeaderRow row)
          Sets the default row of this header.
protected  void setGrid(Grid<?> grid)
           
 void setVisible(boolean visible)
          Sets the visibility of the whole section.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridHeader

public GridHeader()
Method Detail

removeRow

public void removeRow(int index)
Removes the row at the given position.

Parameters:
index - the position of the row

setDefaultRow

public void setDefaultRow(GridHeader.HeaderRow row)
Sets the default row of this header. The default row is a special header row providing a user interface for sorting columns.

Parameters:
row - the new default row, or null for no default row
Throws:
java.lang.IllegalArgumentException - this header does not contain the row

getDefaultRow

public GridHeader.HeaderRow getDefaultRow()
Returns the current default row of this header. The default row is a special header row providing a user interface for sorting columns.

Returns:
the default row or null if no default row set

createRow

protected GridHeader.HeaderRow createRow()
Creates and returns a new instance of the row type.

Returns:
the created row

requestSectionRefresh

protected void requestSectionRefresh()
Informs the grid that this section should be re-rendered.

Note that re-render means calling update() on each cell, preAttach()/postAttach()/preDetach()/postDetach() is not called as the cells are not removed from the DOM.


getConsumedEvents

public java.util.Collection<java.lang.String> getConsumedEvents()
Returns the events consumed by the header

Returns:
a collection of BrowserEvents

setVisible

public void setVisible(boolean visible)
Sets the visibility of the whole section.

Parameters:
visible - true to show this section, false to hide

isVisible

public boolean isVisible()
Returns the visibility of this section.

Returns:
true if visible, false otherwise.

addRow

public ROWTYPE addRow(int index)
Inserts a new row at the given position.

Parameters:
index - the position at which to insert the row
Returns:
the new row
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of bounds

prependRow

public ROWTYPE prependRow()
Adds a new row at the top of this section.

Returns:
the new row

appendRow

public ROWTYPE appendRow()
Adds a new row at the bottom of this section.

Returns:
the new row

removeRow

public void removeRow(ROWTYPE row)
Removes the given row from the section.

Parameters:
row - the row to be removed
Throws:
java.lang.IllegalArgumentException - if the row does not exist in this section

getRow

public ROWTYPE getRow(int index)
Returns the row at the given position.

Parameters:
index - the position of the row
Returns:
the row with the given index
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of bounds

getRowCount

public int getRowCount()
Returns the number of rows in this section.

Returns:
the number of rows

getRows

protected java.util.List<ROWTYPE> getRows()

getVisibleRowCount

protected int getVisibleRowCount()

addColumn

protected void addColumn(GridColumn<?,?> column)

removeColumn

protected void removeColumn(GridColumn<?,?> column)

setGrid

protected void setGrid(Grid<?> grid)

getGrid

protected Grid<?> getGrid()


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