com.vaadin.client.widgets
Class Grid<T>

java.lang.Object
  extended by ResizeComposite
      extended by com.vaadin.client.widgets.Grid<T>
Type Parameters:
T - The row type of the grid. The row type is the POJO type from where the data is retrieved into the column cells.
All Implemented Interfaces:
DeferredWorker, Focusable, SubPartAware, HasSelectionHandlers<T>

public class Grid<T>
extends ResizeComposite
implements HasSelectionHandlers<T>, SubPartAware, DeferredWorker, Focusable

A data grid view that supports columns and lazy loading of data rows from a data source.

Columns

Each column in Grid is represented by a Grid.SelectionColumn. Each GridColumn has a custom implementation for Grid.SelectionColumn.getValue(Object) that gets the row object as an argument, and returns the value for that particular column, extracted from the row object.

Each column also has a Renderer. Its function is to take the value that is given by the GridColumn and display it to the user. A simple column might have a TextRenderer that simply takes in a String and displays it as the cell's content. A more complex renderer might be ProgressBarRenderer that takes in a floating point number, and displays a progress bar instead, based on the given number.

See: addColumn(Column), addColumn(Column, int) and addColumns(Column...). Also Grid.Column.setRenderer(Renderer).

Data Sources

Grid gets its data from a DataSource, providing row objects to Grid from a user-defined endpoint. It can be either a local in-memory data source (e.g. ListDataSource) or even a remote one, retrieving data from e.g. a REST API (see AbstractRemoteDataSource).

Since:
7.4
Author:
Vaadin Ltd

Nested Class Summary
static class Grid.AbstractGridKeyEvent<HANDLER extends AbstractGridKeyEventHandler>
           
static class Grid.AbstractGridMouseEvent<HANDLER extends AbstractGridMouseEventHandler>
           
protected  class Grid.BodyUpdater
           
static class Grid.Column<C,T>
          Base class for grid columns internally used by the Grid.
static class Grid.Editor<T>
          An editor UI for Grid rows.
static class Grid.EditorDomEvent<T>
          A wrapper for native DOM events related to the Grid editor .
protected static class Grid.Footer
          Represents the footer section of a Grid.
static class Grid.FooterCell
          A single cell in a grid Footer row.
static class Grid.FooterRow
          A single row in a grid Footer section.
static class Grid.GridEvent<T>
          A wrapper for native DOM events originating from Grid.
protected static class Grid.Header
          Represents the header section of a Grid.
static class Grid.HeaderCell
          A single cell in a grid header row.
static class Grid.HeaderRow
          A single row in a grid header section.
 class Grid.SelectionColumn
           
static class Grid.SelectionMode
          Enumeration for easy setting of selection mode.
static class Grid.StaticSection<ROWTYPE extends Grid.StaticSection.StaticRow<?>>
          Abstract base class for Grid header and footer sections.
protected  class Grid.StaticSectionUpdater
           
 
Field Summary
protected  com.vaadin.client.widgets.Grid.CellFocusHandler cellFocusHandler
           
 
Constructor Summary
Grid()
          Creates a new instance.
 
Method Summary
 void add(Widget w)
          Deprecated. 
 com.google.gwt.event.shared.HandlerRegistration addBodyClickHandler(BodyClickHandler handler)
          Register a BodyClickHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addBodyDoubleClickHandler(BodyDoubleClickHandler handler)
          Register a BodyDoubleClickHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addBodyKeyDownHandler(BodyKeyDownHandler handler)
          Register a BodyKeyDownHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addBodyKeyPressHandler(BodyKeyPressHandler handler)
          Register a BodyKeyPressHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addBodyKeyUpHandler(BodyKeyUpHandler handler)
          Register a BodyKeyUpHandler to this Grid.
<C extends Grid.Column<?,T>>
C
addColumn(C column)
          Adds a column as the last column in the grid.
<C extends Grid.Column<?,T>>
C
addColumn(C column, int index)
          Inserts a column into a specific position in the grid.
 com.google.gwt.event.shared.HandlerRegistration addColumnReorderHandler(ColumnReorderHandler<T> handler)
          Register a column reorder handler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addColumnResizeHandler(ColumnResizeHandler<T> handler)
          Register a column resize handler to this Grid.
 void addColumns(Grid.Column<?,T>... columns)
          Adds columns as the last columns in the grid.
 com.google.gwt.event.shared.HandlerRegistration addColumnVisibilityChangeHandler(ColumnVisibilityChangeHandler<T> handler)
          Register a column visibility change handler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addDataAvailableHandler(DataAvailableHandler handler)
          Register a GWT event handler for a data available event.
 com.google.gwt.event.shared.HandlerRegistration addFooterClickHandler(FooterClickHandler handler)
          Register a FooterClickHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addFooterDoubleClickHandler(FooterDoubleClickHandler handler)
          Register a FooterDoubleClickHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addFooterKeyDownHandler(FooterKeyDownHandler handler)
          Register a FooterKeyDownHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addFooterKeyPressHandler(FooterKeyPressHandler handler)
          Register a FooterKeyPressHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addFooterKeyUpHandler(FooterKeyUpHandler handler)
          Register a FooterKeyUpHandler to this Grid.
 Grid.FooterRow addFooterRowAt(int index)
          Inserts a new row at the given position to the footer section.
 com.google.gwt.event.shared.HandlerRegistration addHeaderClickHandler(HeaderClickHandler handler)
          Register a HeaderClickHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addHeaderDoubleClickHandler(HeaderDoubleClickHandler handler)
          Register a HeaderDoubleClickHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addHeaderKeyDownHandler(HeaderKeyDownHandler handler)
          Register a HeaderKeyDownHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addHeaderKeyPressHandler(HeaderKeyPressHandler handler)
          Register a HeaderKeyPressHandler to this Grid.
 com.google.gwt.event.shared.HandlerRegistration addHeaderKeyUpHandler(HeaderKeyUpHandler handler)
          Register a HeaderKeyUpHandler to this Grid.
 Grid.HeaderRow addHeaderRowAt(int index)
          Inserts a new row at the given position to the header section.
 com.google.gwt.event.shared.HandlerRegistration addRowVisibilityChangeHandler(RowVisibilityChangeHandler handler)
           
 com.google.gwt.event.shared.HandlerRegistration addScrollHandler(ScrollHandler handler)
          Adds a scroll handler to this grid
 com.google.gwt.event.shared.HandlerRegistration addSelectAllHandler(SelectAllHandler<T> handler)
          Register a GWT event handler for a select all event.
 com.google.gwt.event.shared.HandlerRegistration addSelectionHandler(SelectionHandler<T> handler)
           
 com.google.gwt.event.shared.HandlerRegistration addSortHandler(SortHandler<T> handler)
          Register a GWT event handler for a sorting event.
 Grid.FooterRow appendFooterRow()
          Adds a new row at the bottom of the footer section.
 Grid.HeaderRow appendHeaderRow()
          Adds a new row at the bottom of the header section.
 void cancelEditor()
          Cancels the currently active edit and hides the editor.
 void clear()
          Deprecated. 
protected  EscalatorUpdater createBodyUpdater()
          Creates the escalator updater used to update the body rows in this grid.
protected  EscalatorUpdater createFooterUpdater()
          Creates the escalator updater used to update the footer rows in this grid.
protected  EscalatorUpdater createHeaderUpdater()
          Creates the escalator updater used to update the header rows in this grid.
 boolean deselect(T row)
          Deselect a row using the current selection model.
 boolean deselectAll()
          Deselect all rows using the current selection model.
protected  void doAttachChildren()
           
protected  void doDetachChildren()
           
 void editRow(int rowIndex)
          Opens the editor over the row with the given index.
 void focus()
          Sets focus to this widget.
 CellReference<T> getCellReference(Element element)
          Returns a CellReference for the cell to which the given element belongs to.
 CellStyleGenerator<T> getCellStyleGenerator()
          Gets the style generator that is used for generating styles for cells
 Grid.Column<?,T> getColumn(int index)
          Returns a column by its index in the grid.
 int getColumnCount()
          Returns the amount of columns in the grid.
 java.util.List<Grid.Column<?,T>> getColumns()
          Returns a list columns in the grid, including hidden columns.
 DataSource<T> getDataSource()
          Gets the for this Grid.
 Grid.HeaderRow getDefaultHeaderRow()
          Returns the current default row of the header section.
 DetailsGenerator getDetailsGenerator()
          Gets the current details generator for row details.
 Grid.Editor<T> getEditor()
           
 java.lang.String getEditorCancelCaption()
          Gets the caption on the cancel button in the Grid editor.
 EditorHandler<T> getEditorHandler()
          Returns the handler responsible for binding data and editor widgets to the editor.
 java.lang.String getEditorSaveCaption()
          Gets the current caption on the save button in the Grid editor.
 Widget getEditorWidget(Grid.Column<?,T> column)
          Returns the editor widget associated with the given column.
protected  Escalator getEscalator()
           
 EventCellReference<T> getEventCell()
          Returns the EventCellReference for the latest event fired from this Grid.
protected  Grid.Footer getFooter()
          Returns the footer section of this grid.
 Grid.FooterRow getFooterRow(int rowIndex)
          Gets the footer row at given index.
 int getFooterRowCount()
          Gets the row count for the footer.
 int getFrozenColumnCount()
          Gets the number of frozen columns in this grid.
protected  Grid.Header getHeader()
          Returns the header section of this grid.
 Grid.HeaderRow getHeaderRow(int rowIndex)
          Gets the header row at given index.
 int getHeaderRowCount()
          Gets the row count for the header section.
 double getHeightByRows()
          Gets the amount of rows in Grid's body that are shown, while getHeightMode() is HeightMode.ROW.
 com.vaadin.shared.ui.grid.HeightMode getHeightMode()
          Returns the current HeightMode the Grid is in.
 RowStyleGenerator<T> getRowStyleGenerator()
          Gets the style generator that is used for generating styles for rows
 double getScrollHeight()
          Returns the height of the scrollable area in pixels.
 double getScrollLeft()
          Gets the horizontal scroll offset
 double getScrollTop()
          Gets the vertical scroll offset
 double getScrollWidth()
          Returns the width of the scrollable area in pixels.
 T getSelectedRow()
          Gets last selected row from the current SelectionModel.
 java.util.Collection<T> getSelectedRows()
          Gets currently selected rows from the current selection model.
 SelectionModel<T> getSelectionModel()
          Gets a reference to the current selection model.
 MenuBar getSidebarMenu()
          Gets the customizable menu bar that is by default used for toggling column hidability.
 java.util.List<SortOrder> getSortOrder()
          Get a copy of the current sort order array.
 com.google.gwt.user.client.Element getSubPartElement(java.lang.String subPart)
          Locates an element inside a component using the identifier provided in subPart.
 java.lang.String getSubPartName(com.google.gwt.user.client.Element subElement)
          Provides an identifier that identifies the element within the component.
 int getTabIndex()
           
 java.util.List<Grid.Column<?,T>> getVisibleColumns()
          Returns a list of the currently visible columns in the grid.
 boolean isColumnReorderingAllowed()
          Returns whether columns can be reordered with drag and drop.
 boolean isDetailsVisible(int rowIndex)
          Check whether the details for a row is visible or not.
 boolean isEditorActive()
          Returns whether the editor is currently open on some row.
 boolean isEditorBuffered()
          Gets the buffered editor mode.
 boolean isEditorEnabled()
          Returns the enabled state of the editor.
 boolean isEnabled()
           
 boolean isFooterVisible()
          Returns the visibility of the footer section.
 boolean isHeaderVisible()
          Returns the visibility of the header section.
 boolean isSelected(T row)
          Test if a row is selected.
 boolean isSidebarOpen()
          Tests whether the sidebar menu is currently open.
 boolean isWorkPending()
          Checks whether there are operations pending for this widget or connector that must be executed before reaching a steady state.
 java.util.Iterator<Widget> iterator()
          Deprecated. 
protected  void onAttach()
           
 void onBrowserEvent(Event event)
           
protected  void onDetach()
           
 void onResize()
           
 Grid.FooterRow prependFooterRow()
          Adds a new row at the top of the footer section.
 Grid.HeaderRow prependHeaderRow()
          Adds a new row at the top of the header section.
 void recalculateColumnWidths()
          Requests that the column widths should be recalculated.
 boolean remove(Widget w)
          Deprecated. 
 void removeColumn(Grid.Column<?,T> column)
          Removes a column from the grid.
 void removeFooterRow(Grid.FooterRow row)
          Removes the given row from the footer section.
 void removeFooterRow(int rowIndex)
          Removes the row at the given position from the footer section.
 void removeHeaderRow(Grid.HeaderRow row)
          Removes the given row from the header section.
 void removeHeaderRow(int rowIndex)
          Removes the row at the given position from the header section.
 void resetSizesFromDom()
          Resets all cached pixel sizes and reads new values from the DOM.
 void saveEditor()
          Saves any unsaved changes in the editor to the data source.
 void scrollToEnd()
          Scrolls to the end of the very last row.
 void scrollToRow(int rowIndex)
          Scrolls to a certain row, using ScrollDestination.ANY.
 void scrollToRow(int rowIndex, com.vaadin.shared.ui.grid.ScrollDestination destination)
          Scrolls to a certain row, using user-specified scroll destination.
 void scrollToStart()
          Scrolls to the beginning of the very first row.
 boolean select(T row)
          Select a row using the current selection model.
 void setAccessKey(char key)
           
 void setCellStyleGenerator(CellStyleGenerator<T> cellStyleGenerator)
          Sets the style generator that is used for generating styles for cells
 void setColumnOrder(Grid.Column<?,T>... orderedColumns)
          Sets a new column order for the grid.
 void setColumnReorderingAllowed(boolean columnReorderingAllowed)
          Sets whether column reordering with drag and drop is allowed or not.
 void setDataSource(DataSource<T> dataSource)
          Sets the data source used by this grid.
 void setDefaultHeaderRow(Grid.HeaderRow row)
          Sets the default row of the header.
 void setDetailsGenerator(DetailsGenerator detailsGenerator)
          Sets a new details generator for row details.
 void setDetailsVisible(int rowIndex, boolean visible)
          Shows or hides the details for a specific row.
 void setEditorBuffered(boolean editorBuffered)
          Sets the buffered editor mode.
 void setEditorCancelCaption(java.lang.String cancelCaption)
          Sets the caption on the cancel button in the Grid editor.
 void setEditorEnabled(boolean enabled)
          Sets the enabled state of the editor.
 void setEditorHandler(EditorHandler<T> handler)
          Sets the handler responsible for binding data and editor widgets to the editor.
 void setEditorSaveCaption(java.lang.String saveCaption)
          Sets the caption on the save button in the Grid editor.
 void setEnabled(boolean enabled)
           
 void setFocus(boolean focused)
           
 void setFooterVisible(boolean visible)
          Sets the visibility of the footer section.
 void setFrozenColumnCount(int numberOfColumns)
          Sets the number of frozen columns in this grid.
 void setHeaderVisible(boolean visible)
          Sets the visibility of the header section.
 void setHeight(java.lang.String height)
          
 void setHeightByRows(double rows)
          Sets the number of rows that should be visible in Grid's body, while getHeightMode() is HeightMode.ROW.
 void setHeightMode(com.vaadin.shared.ui.grid.HeightMode heightMode)
          Defines the mode in which the Grid widget's height is calculated.
 void setRowStyleGenerator(RowStyleGenerator<T> rowStyleGenerator)
          Sets the style generator that is used for generating styles for rows
 void setScrollLeft(double px)
          Sets the horizontal scroll offset
 void setScrollTop(double px)
          Sets the vertical scroll offset.
 void setSelectionMode(Grid.SelectionMode mode)
          Sets current selection mode.
 void setSelectionModel(SelectionModel<T> selectionModel)
          Sets the current selection model.
 void setSidebarOpen(boolean sidebarOpen)
          Sets whether the sidebar menu is open.
 void setSortOrder(java.util.List<SortOrder> order)
          Sets the sort order to use.
 void setStylePrimaryName(java.lang.String style)
           
 void setTabIndex(int index)
           
 void setWidth(java.lang.String width)
           
<C> void
sort(Grid.Column<C,T> column)
          Sorts the Grid data in ascending order along one column.
<C> void
sort(Grid.Column<C,T> column, com.vaadin.shared.data.sort.SortDirection direction)
          Sorts the Grid data along one column.
 void sort(Sort s)
          Sets the current sort order using the fluid Sort API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.client.widget.grid.selection.HasSelectionHandlers
addSelectionHandler
 

Field Detail

cellFocusHandler

protected final com.vaadin.client.widgets.Grid.CellFocusHandler cellFocusHandler
Constructor Detail

Grid

public Grid()
Creates a new instance.

Method Detail

isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean enabled)

setStylePrimaryName

public void setStylePrimaryName(java.lang.String style)

createHeaderUpdater

protected EscalatorUpdater createHeaderUpdater()
Creates the escalator updater used to update the header rows in this grid. The updater is invoked when header rows or columns are added or removed, or the content of existing header cells is changed.

Returns:
the new header updater instance
See Also:
GridHeader, getHeader()

createBodyUpdater

protected EscalatorUpdater createBodyUpdater()
Creates the escalator updater used to update the body rows in this grid. The updater is invoked when body rows or columns are added or removed, the content of body cells is changed, or the body is scrolled to expose previously hidden content.

Returns:
the new body updater instance

createFooterUpdater

protected EscalatorUpdater createFooterUpdater()
Creates the escalator updater used to update the footer rows in this grid. The updater is invoked when header rows or columns are added or removed, or the content of existing header cells is changed.

Returns:
the new footer updater instance
See Also:
GridFooter, getFooter()

addColumns

public void addColumns(Grid.Column<?,T>... columns)
Adds columns as the last columns in the grid.

Parameters:
columns - the columns to add

addColumn

public <C extends Grid.Column<?,T>> C addColumn(C column)
Adds a column as the last column in the grid.

Parameters:
column - the column to add
Returns:
given column

addColumn

public <C extends Grid.Column<?,T>> C addColumn(C column,
                                                int index)
Inserts a column into a specific position in the grid.

Parameters:
index - the index where the column should be inserted into
column - the column to add
Returns:
given column
Throws:
java.lang.IllegalStateException - if Grid's current selection model renders a selection column, and index is 0.

removeColumn

public void removeColumn(Grid.Column<?,T> column)
Removes a column from the grid.

Parameters:
column - the column to remove

getColumnCount

public int getColumnCount()
Returns the amount of columns in the grid.

NOTE: this includes the hidden columns in the count.

Returns:
The number of columns in the grid

getColumns

public java.util.List<Grid.Column<?,T>> getColumns()
Returns a list columns in the grid, including hidden columns.

For currently visible columns, use getVisibleColumns().

Returns:
A unmodifiable list of the columns in the grid

getVisibleColumns

public java.util.List<Grid.Column<?,T>> getVisibleColumns()
Returns a list of the currently visible columns in the grid.

No hidden columns included.

Returns:
A unmodifiable list of the currently visible columns in the grid
Since:
7.5.0

getColumn

public Grid.Column<?,T> getColumn(int index)
                           throws java.lang.IllegalArgumentException
Returns a column by its index in the grid.

NOTE: The indexing includes hidden columns.

Parameters:
index - the index of the column
Returns:
The column in the given index
Throws:
java.lang.IllegalArgumentException - if the column index does not exist in the grid

getHeader

protected Grid.Header getHeader()
Returns the header section of this grid. The default header contains a single row displaying the column captions.

Returns:
the header

getHeaderRow

public Grid.HeaderRow getHeaderRow(int rowIndex)
Gets the header row at given index.

Parameters:
rowIndex - 0 based index for row. Counted from top to bottom
Returns:
header row at given index
Throws:
java.lang.IllegalArgumentException - if no row exists at given index

addHeaderRowAt

public Grid.HeaderRow addHeaderRowAt(int index)
Inserts a new row at the given position to the header section. Shifts the row currently at that position and any subsequent rows down (adds one to their indices).

Parameters:
index - the position at which to insert the row
Returns:
the new row
Throws:
java.lang.IllegalArgumentException - if the index is less than 0 or greater than row count
See Also:
appendHeaderRow(), prependHeaderRow(), removeHeaderRow(HeaderRow), removeHeaderRow(int)

appendHeaderRow

public Grid.HeaderRow appendHeaderRow()
Adds a new row at the bottom of the header section.

Returns:
the new row
See Also:
prependHeaderRow(), addHeaderRowAt(int), removeHeaderRow(HeaderRow), removeHeaderRow(int)

getDefaultHeaderRow

public Grid.HeaderRow getDefaultHeaderRow()
Returns the current default row of the header section. The default row is a special header row providing a user interface for sorting columns. Setting a header caption for column updates cells in the default header.

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

getHeaderRowCount

public int getHeaderRowCount()
Gets the row count for the header section.

Returns:
row count

prependHeaderRow

public Grid.HeaderRow prependHeaderRow()
Adds a new row at the top of the header section.

Returns:
the new row
See Also:
appendHeaderRow(), addHeaderRowAt(int), removeHeaderRow(HeaderRow), removeHeaderRow(int)

removeHeaderRow

public void removeHeaderRow(Grid.HeaderRow row)
Removes the given row from the header section.

Parameters:
row - the row to be removed
Throws:
java.lang.IllegalArgumentException - if the row does not exist in this section
See Also:
removeHeaderRow(int), addHeaderRowAt(int), appendHeaderRow(), prependHeaderRow()

removeHeaderRow

public void removeHeaderRow(int rowIndex)
Removes the row at the given position from the header section.

Parameters:
index - the position of the row
Throws:
java.lang.IllegalArgumentException - if no row exists at given index
See Also:
removeHeaderRow(HeaderRow), addHeaderRowAt(int), appendHeaderRow(), prependHeaderRow()

setDefaultHeaderRow

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

Note: Setting the default header row will reset all cell contents to Column defaults.

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

setHeaderVisible

public void setHeaderVisible(boolean visible)
Sets the visibility of the header section.

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

isHeaderVisible

public boolean isHeaderVisible()
Returns the visibility of the header section.

Returns:
true if visible, false otherwise.

getFooter

protected Grid.Footer getFooter()
Returns the footer section of this grid. The default footer is empty.

Returns:
the footer

getFooterRow

public Grid.FooterRow getFooterRow(int rowIndex)
Gets the footer row at given index.

Parameters:
rowIndex - 0 based index for row. Counted from top to bottom
Returns:
footer row at given index
Throws:
java.lang.IllegalArgumentException - if no row exists at given index

addFooterRowAt

public Grid.FooterRow addFooterRowAt(int index)
Inserts a new row at the given position to the footer section. Shifts the row currently at that position and any subsequent rows down (adds one to their indices).

Parameters:
index - the position at which to insert the row
Returns:
the new row
Throws:
java.lang.IllegalArgumentException - if the index is less than 0 or greater than row count
See Also:
appendFooterRow(), prependFooterRow(), removeFooterRow(FooterRow), removeFooterRow(int)

appendFooterRow

public Grid.FooterRow appendFooterRow()
Adds a new row at the bottom of the footer section.

Returns:
the new row
See Also:
prependFooterRow(), addFooterRowAt(int), removeFooterRow(FooterRow), removeFooterRow(int)

getFooterRowCount

public int getFooterRowCount()
Gets the row count for the footer.

Returns:
row count

prependFooterRow

public Grid.FooterRow prependFooterRow()
Adds a new row at the top of the footer section.

Returns:
the new row
See Also:
appendFooterRow(), addFooterRowAt(int), removeFooterRow(FooterRow), removeFooterRow(int)

removeFooterRow

public void removeFooterRow(Grid.FooterRow row)
Removes the given row from the footer section.

Parameters:
row - the row to be removed
Throws:
java.lang.IllegalArgumentException - if the row does not exist in this section
See Also:
removeFooterRow(int), addFooterRowAt(int), appendFooterRow(), prependFooterRow()

removeFooterRow

public void removeFooterRow(int rowIndex)
Removes the row at the given position from the footer section.

Parameters:
index - the position of the row
Throws:
java.lang.IllegalArgumentException - if no row exists at given index
See Also:
removeFooterRow(FooterRow), addFooterRowAt(int), appendFooterRow(), prependFooterRow()

setFooterVisible

public void setFooterVisible(boolean visible)
Sets the visibility of the footer section.

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

isFooterVisible

public boolean isFooterVisible()
Returns the visibility of the footer section.

Returns:
true if visible, false otherwise.

getEditor

public Grid.Editor<T> getEditor()

getEscalator

protected Escalator getEscalator()

setHeight

public void setHeight(java.lang.String height)

Note: This method will change the widget's size in the browser only if getHeightMode() returns HeightMode.CSS.

See Also:
setHeightMode(HeightMode)

setWidth

public void setWidth(java.lang.String width)

setDataSource

public void setDataSource(DataSource<T> dataSource)
                   throws java.lang.IllegalArgumentException
Sets the data source used by this grid.

Parameters:
dataSource - the data source to use, not null
Throws:
java.lang.IllegalArgumentException - if dataSource is null

getDataSource

public DataSource<T> getDataSource()
Gets the for this Grid.

Returns:
the data source used by this grid

setFrozenColumnCount

public void setFrozenColumnCount(int numberOfColumns)
Sets the number of frozen columns in this grid. Setting the count to 0 means that no data columns will be frozen, but the built-in selection checkbox column will still be frozen if it's in use. Setting the count to -1 will also disable the selection column.

The default value is 0.

Parameters:
numberOfColumns - the number of columns that should be frozen
Throws:
java.lang.IllegalArgumentException - if the column count is < -1 or > the number of visible columns

getFrozenColumnCount

public int getFrozenColumnCount()
Gets the number of frozen columns in this grid. 0 means that no data columns will be frozen, but the built-in selection checkbox column will still be frozen if it's in use. -1 means that not even the selection column is frozen.

NOTE: This includes hidden columns in the count.

Returns:
the number of frozen columns

addRowVisibilityChangeHandler

public com.google.gwt.event.shared.HandlerRegistration addRowVisibilityChangeHandler(RowVisibilityChangeHandler handler)

scrollToRow

public void scrollToRow(int rowIndex)
                 throws java.lang.IllegalArgumentException
Scrolls to a certain row, using ScrollDestination.ANY.

If the details for that row are visible, those will be taken into account as well.

Parameters:
rowIndex - zero-based index of the row to scroll to.
Throws:
java.lang.IllegalArgumentException - if rowIndex is below zero, or above the maximum value supported by the data source.

scrollToRow

public void scrollToRow(int rowIndex,
                        com.vaadin.shared.ui.grid.ScrollDestination destination)
                 throws java.lang.IllegalArgumentException
Scrolls to a certain row, using user-specified scroll destination.

If the details for that row are visible, those will be taken into account as well.

Parameters:
rowIndex - zero-based index of the row to scroll to.
destination - desired destination placement of scrolled-to-row. See ScrollDestination for more information.
Throws:
java.lang.IllegalArgumentException - if rowIndex is below zero, or above the maximum value supported by the data source.

scrollToStart

public void scrollToStart()
Scrolls to the beginning of the very first row.


scrollToEnd

public void scrollToEnd()
Scrolls to the end of the very last row.


setScrollTop

public void setScrollTop(double px)
Sets the vertical scroll offset.

Parameters:
px - the number of pixels this grid should be scrolled down

getScrollTop

public double getScrollTop()
Gets the vertical scroll offset

Returns:
the number of pixels this grid is scrolled down

setScrollLeft

public void setScrollLeft(double px)
Sets the horizontal scroll offset

Parameters:
px - the number of pixels this grid should be scrolled right
Since:
7.5.0

getScrollLeft

public double getScrollLeft()
Gets the horizontal scroll offset

Returns:
the number of pixels this grid is scrolled to the right

getScrollHeight

public double getScrollHeight()
Returns the height of the scrollable area in pixels.

Returns:
the height of the scrollable area in pixels
Since:
7.5.0

getScrollWidth

public double getScrollWidth()
Returns the width of the scrollable area in pixels.

Returns:
the width of the scrollable area in pixels.
Since:
7.5.0

setHeightByRows

public void setHeightByRows(double rows)
                     throws java.lang.IllegalArgumentException
Sets the number of rows that should be visible in Grid's body, while getHeightMode() is HeightMode.ROW.

If Grid is currently not in HeightMode.ROW, the given value is remembered, and applied once the mode is applied.

Parameters:
rows - The height in terms of number of rows displayed in Grid's body. If Grid doesn't contain enough rows, white space is displayed instead.
Throws:
java.lang.IllegalArgumentException - if rows is zero or less
java.lang.IllegalArgumentException - if rows is infinite
java.lang.IllegalArgumentException - if rows is NaN
See Also:
setHeightMode(HeightMode)

getHeightByRows

public double getHeightByRows()
Gets the amount of rows in Grid's body that are shown, while getHeightMode() is HeightMode.ROW.

By default, it is .

Returns:
the amount of rows that should be shown in Grid's body, while in HeightMode.ROW.
See Also:
setHeightByRows(double)

setHeightMode

public void setHeightMode(com.vaadin.shared.ui.grid.HeightMode heightMode)
Defines the mode in which the Grid widget's height is calculated.

If HeightMode.CSS is given, Grid will respect the values given via setHeight(String), and behave as a traditional Widget.

If HeightMode.ROW is given, Grid will make sure that the body will display as many rows as getHeightByRows() defines. Note: If headers/footers are inserted or removed, the widget will resize itself to still display the required amount of rows in its body. It also takes the horizontal scrollbar into account.

Parameters:
heightMode - the mode in to which Grid should be set

getHeightMode

public com.vaadin.shared.ui.grid.HeightMode getHeightMode()
Returns the current HeightMode the Grid is in.

Defaults to HeightMode.CSS.

Returns:
the current HeightMode

onBrowserEvent

public void onBrowserEvent(Event event)

getSubPartElement

public com.google.gwt.user.client.Element getSubPartElement(java.lang.String subPart)
Description copied from interface: SubPartAware
Locates an element inside a component using the identifier provided in subPart. The subPart identifier is component specific and may be any string of characters, numbers, space characters and brackets.

Specified by:
getSubPartElement in interface SubPartAware
Parameters:
subPart - The identifier for the element inside the component
Returns:
The element identified by subPart or null if the element could not be found.

getSubPartName

public java.lang.String getSubPartName(com.google.gwt.user.client.Element subElement)
Description copied from interface: SubPartAware
Provides an identifier that identifies the element within the component. The subElement is a part of the component and must never be null.

Note! getSubPartElement(getSubPartName(element)) == element is not always true. A component can choose to provide a more generic identifier for any given element if the results of all interactions with subElement are the same as interactions with the element identified by the return value. For example a button can return an identifier for the root element even though a DIV inside the button was passed as subElement because interactions with the DIV and the root button element produce the same result.

Specified by:
getSubPartName in interface SubPartAware
Parameters:
subElement - The element the identifier string should uniquely identify
Returns:
An identifier that uniquely identifies subElement or null if no identifier could be provided.

setSelectionModel

public void setSelectionModel(SelectionModel<T> selectionModel)
Sets the current selection model.

This function will call SelectionModel.setGrid(Grid).

Parameters:
selectionModel - a selection model implementation.
Throws:
java.lang.IllegalArgumentException - if selection model argument is null

getSelectionModel

public SelectionModel<T> getSelectionModel()
Gets a reference to the current selection model.

Returns:
the currently used SelectionModel instance.

setSelectionMode

public void setSelectionMode(Grid.SelectionMode mode)
Sets current selection mode.

This is a shorthand method for setSelectionModel(com.vaadin.client.widget.grid.selection.SelectionModel).

Parameters:
mode - a selection mode value
See Also:
SelectionMode}.

isSelected

public boolean isSelected(T row)
Test if a row is selected.

Parameters:
row - a row object
Returns:
true, if the current selection model considers the provided row object selected.

select

public boolean select(T row)
Select a row using the current selection model.

Only selection models implementing SelectionModel.Single and SelectionModel.Multi are supported; for anything else, an exception will be thrown.

Parameters:
row - a row object
Returns:
true iff the current selection changed
Throws:
java.lang.IllegalStateException - if the current selection model is not an instance of SelectionModel.Single or SelectionModel.Multi

deselect

public boolean deselect(T row)
Deselect a row using the current selection model.

Only selection models implementing SelectionModel.Single and SelectionModel.Multi are supported; for anything else, an exception will be thrown.

Parameters:
row - a row object
Returns:
true iff the current selection changed
Throws:
java.lang.IllegalStateException - if the current selection model is not an instance of SelectionModel.Single or SelectionModel.Multi

deselectAll

public boolean deselectAll()
Deselect all rows using the current selection model.

Parameters:
row - a row object
Returns:
true iff the current selection changed
Throws:
java.lang.IllegalStateException - if the current selection model is not an instance of SelectionModel.Single or SelectionModel.Multi

getSelectedRow

public T getSelectedRow()
Gets last selected row from the current SelectionModel.

Only selection models implementing SelectionModel.Single are valid for this method; for anything else, use the getSelectedRows() method.

Returns:
a selected row reference, or null, if no row is selected
Throws:
java.lang.IllegalStateException - if the current selection model is not an instance of SelectionModel.Single

getSelectedRows

public java.util.Collection<T> getSelectedRows()
Gets currently selected rows from the current selection model.

Returns:
a non-null collection containing all currently selected rows.

addSelectionHandler

public com.google.gwt.event.shared.HandlerRegistration addSelectionHandler(SelectionHandler<T> handler)

sort

public void sort(Sort s)
Sets the current sort order using the fluid Sort API. Read the documentation for Sort for more information.

Parameters:
s - a sort instance

sort

public <C> void sort(Grid.Column<C,T> column)
Sorts the Grid data in ascending order along one column.

Parameters:
column - a grid column reference

sort

public <C> void sort(Grid.Column<C,T> column,
                     com.vaadin.shared.data.sort.SortDirection direction)
Sorts the Grid data along one column.

Parameters:
column - a grid column reference
direction - a sort direction value

setSortOrder

public void setSortOrder(java.util.List<SortOrder> order)
Sets the sort order to use. Setting this causes the Grid to re-sort itself.

Parameters:
order - a sort order list. If set to null, the sort order is cleared.

getSortOrder

public java.util.List<SortOrder> getSortOrder()
Get a copy of the current sort order array.

Returns:
a copy of the current sort order array

addSortHandler

public com.google.gwt.event.shared.HandlerRegistration addSortHandler(SortHandler<T> handler)
Register a GWT event handler for a sorting event. This handler gets called whenever this Grid needs its data source to provide data sorted in a specific order.

Parameters:
handler - a sort event handler
Returns:
the registration for the event

addSelectAllHandler

public com.google.gwt.event.shared.HandlerRegistration addSelectAllHandler(SelectAllHandler<T> handler)
Register a GWT event handler for a select all event. This handler gets called whenever Grid needs all rows selected.

Parameters:
handler - a select all event handler

addDataAvailableHandler

public com.google.gwt.event.shared.HandlerRegistration addDataAvailableHandler(DataAvailableHandler handler)
Register a GWT event handler for a data available event. This handler gets called whenever the DataSource for this Grid has new data available.

This handle will be fired with the current available data after registration is done.

Parameters:
handler - a data available event handler
Returns:
the registartion for the event

addBodyKeyDownHandler

public com.google.gwt.event.shared.HandlerRegistration addBodyKeyDownHandler(BodyKeyDownHandler handler)
Register a BodyKeyDownHandler to this Grid. The event for this handler is fired when a KeyDown event occurs while cell focus is in the Body of this Grid.

Parameters:
handler - the key handler to register
Returns:
the registration for the event

addBodyKeyUpHandler

public com.google.gwt.event.shared.HandlerRegistration addBodyKeyUpHandler(BodyKeyUpHandler handler)
Register a BodyKeyUpHandler to this Grid. The event for this handler is fired when a KeyUp event occurs while cell focus is in the Body of this Grid.

Parameters:
handler - the key handler to register
Returns:
the registration for the event

addBodyKeyPressHandler

public com.google.gwt.event.shared.HandlerRegistration addBodyKeyPressHandler(BodyKeyPressHandler handler)
Register a BodyKeyPressHandler to this Grid. The event for this handler is fired when a KeyPress event occurs while cell focus is in the Body of this Grid.

Parameters:
handler - the key handler to register
Returns:
the registration for the event

addHeaderKeyDownHandler

public com.google.gwt.event.shared.HandlerRegistration addHeaderKeyDownHandler(HeaderKeyDownHandler handler)
Register a HeaderKeyDownHandler to this Grid. The event for this handler is fired when a KeyDown event occurs while cell focus is in the Header of this Grid.

Parameters:
handler - the key handler to register
Returns:
the registration for the event

addHeaderKeyUpHandler

public com.google.gwt.event.shared.HandlerRegistration addHeaderKeyUpHandler(HeaderKeyUpHandler handler)
Register a HeaderKeyUpHandler to this Grid. The event for this handler is fired when a KeyUp event occurs while cell focus is in the Header of this Grid.

Parameters:
handler - the key handler to register
Returns:
the registration for the event

addHeaderKeyPressHandler

public com.google.gwt.event.shared.HandlerRegistration addHeaderKeyPressHandler(HeaderKeyPressHandler handler)
Register a HeaderKeyPressHandler to this Grid. The event for this handler is fired when a KeyPress event occurs while cell focus is in the Header of this Grid.

Parameters:
handler - the key handler to register
Returns:
the registration for the event

addFooterKeyDownHandler

public com.google.gwt.event.shared.HandlerRegistration addFooterKeyDownHandler(FooterKeyDownHandler handler)
Register a FooterKeyDownHandler to this Grid. The event for this handler is fired when a KeyDown event occurs while cell focus is in the Footer of this Grid.

Parameters:
handler - the key handler to register
Returns:
the registration for the event

addFooterKeyUpHandler

public com.google.gwt.event.shared.HandlerRegistration addFooterKeyUpHandler(FooterKeyUpHandler handler)
Register a FooterKeyUpHandler to this Grid. The event for this handler is fired when a KeyUp event occurs while cell focus is in the Footer of this Grid.

Parameters:
handler - the key handler to register
Returns:
the registration for the event

addFooterKeyPressHandler

public com.google.gwt.event.shared.HandlerRegistration addFooterKeyPressHandler(FooterKeyPressHandler handler)
Register a FooterKeyPressHandler to this Grid. The event for this handler is fired when a KeyPress event occurs while cell focus is in the Footer of this Grid.

Parameters:
handler - the key handler to register
Returns:
the registration for the event

addBodyClickHandler

public com.google.gwt.event.shared.HandlerRegistration addBodyClickHandler(BodyClickHandler handler)
Register a BodyClickHandler to this Grid. The event for this handler is fired when a Click event occurs in the Body of this Grid.

Parameters:
handler - the click handler to register
Returns:
the registration for the event

addHeaderClickHandler

public com.google.gwt.event.shared.HandlerRegistration addHeaderClickHandler(HeaderClickHandler handler)
Register a HeaderClickHandler to this Grid. The event for this handler is fired when a Click event occurs in the Header of this Grid.

Parameters:
handler - the click handler to register
Returns:
the registration for the event

addFooterClickHandler

public com.google.gwt.event.shared.HandlerRegistration addFooterClickHandler(FooterClickHandler handler)
Register a FooterClickHandler to this Grid. The event for this handler is fired when a Click event occurs in the Footer of this Grid.

Parameters:
handler - the click handler to register
Returns:
the registration for the event

addBodyDoubleClickHandler

public com.google.gwt.event.shared.HandlerRegistration addBodyDoubleClickHandler(BodyDoubleClickHandler handler)
Register a BodyDoubleClickHandler to this Grid. The event for this handler is fired when a double click event occurs in the Body of this Grid.

Parameters:
handler - the double click handler to register
Returns:
the registration for the event

addHeaderDoubleClickHandler

public com.google.gwt.event.shared.HandlerRegistration addHeaderDoubleClickHandler(HeaderDoubleClickHandler handler)
Register a HeaderDoubleClickHandler to this Grid. The event for this handler is fired when a double click event occurs in the Header of this Grid.

Parameters:
handler - the double click handler to register
Returns:
the registration for the event

addFooterDoubleClickHandler

public com.google.gwt.event.shared.HandlerRegistration addFooterDoubleClickHandler(FooterDoubleClickHandler handler)
Register a FooterDoubleClickHandler to this Grid. The event for this handler is fired when a double click event occurs in the Footer of this Grid.

Parameters:
handler - the double click handler to register
Returns:
the registration for the event

addColumnReorderHandler

public com.google.gwt.event.shared.HandlerRegistration addColumnReorderHandler(ColumnReorderHandler<T> handler)
Register a column reorder handler to this Grid. The event for this handler is fired when the Grid's columns are reordered.

Parameters:
handler - the handler for the event
Returns:
the registration for the event
Since:
7.5.0

addColumnVisibilityChangeHandler

public com.google.gwt.event.shared.HandlerRegistration addColumnVisibilityChangeHandler(ColumnVisibilityChangeHandler<T> handler)
Register a column visibility change handler to this Grid. The event for this handler is fired when the Grid's columns change visibility.

Parameters:
handler - the handler for the event
Returns:
the registration for the event
Since:
7.5.0

addColumnResizeHandler

public com.google.gwt.event.shared.HandlerRegistration addColumnResizeHandler(ColumnResizeHandler<T> handler)
Register a column resize handler to this Grid. The event for this handler is fired when the Grid's columns are resized.

Parameters:
handler - the handler for the event
Returns:
the registration for the event
Since:
7.6

addScrollHandler

public com.google.gwt.event.shared.HandlerRegistration addScrollHandler(ScrollHandler handler)
Adds a scroll handler to this grid

Parameters:
handler - the scroll handler to add
Returns:
a handler registration for the registered scroll handler

isWorkPending

public boolean isWorkPending()
Description copied from interface: DeferredWorker
Checks whether there are operations pending for this widget or connector that must be executed before reaching a steady state.

Specified by:
isWorkPending in interface DeferredWorker

isColumnReorderingAllowed

public boolean isColumnReorderingAllowed()
Returns whether columns can be reordered with drag and drop.

Returns:
true if columns can be reordered, false otherwise
Since:
7.5.0

setColumnReorderingAllowed

public void setColumnReorderingAllowed(boolean columnReorderingAllowed)
Sets whether column reordering with drag and drop is allowed or not.

Parameters:
columnReorderingAllowed - specifies whether column reordering is allowed
Since:
7.5.0

setColumnOrder

public void setColumnOrder(Grid.Column<?,T>... orderedColumns)
Sets a new column order for the grid. All columns which are not ordered here will remain in the order they were before as the last columns of grid.

Parameters:
orderedColumns - array of columns in wanted order

setCellStyleGenerator

public void setCellStyleGenerator(CellStyleGenerator<T> cellStyleGenerator)
Sets the style generator that is used for generating styles for cells

Parameters:
cellStyleGenerator - the cell style generator to set, or null to remove a previously set generator

getCellStyleGenerator

public CellStyleGenerator<T> getCellStyleGenerator()
Gets the style generator that is used for generating styles for cells

Returns:
the cell style generator, or null if no generator is set

setRowStyleGenerator

public void setRowStyleGenerator(RowStyleGenerator<T> rowStyleGenerator)
Sets the style generator that is used for generating styles for rows

Parameters:
rowStyleGenerator - the row style generator to set, or null to remove a previously set generator

getRowStyleGenerator

public RowStyleGenerator<T> getRowStyleGenerator()
Gets the style generator that is used for generating styles for rows

Returns:
the row style generator, or null if no generator is set

editRow

public void editRow(int rowIndex)
Opens the editor over the row with the given index.

Parameters:
rowIndex - the index of the row to be edited
Throws:
java.lang.IllegalStateException - if the editor is not enabled
java.lang.IllegalStateException - if the editor is already in edit mode

isEditorActive

public boolean isEditorActive()
Returns whether the editor is currently open on some row.

Returns:
true if the editor is active, false otherwise.

saveEditor

public void saveEditor()
Saves any unsaved changes in the editor to the data source.

Throws:
java.lang.IllegalStateException - if the editor is not enabled
java.lang.IllegalStateException - if the editor is not in edit mode

cancelEditor

public void cancelEditor()
Cancels the currently active edit and hides the editor. Any changes that are not saved are lost.

Throws:
java.lang.IllegalStateException - if the editor is not enabled
java.lang.IllegalStateException - if the editor is not in edit mode

getEditorHandler

public EditorHandler<T> getEditorHandler()
Returns the handler responsible for binding data and editor widgets to the editor.

Returns:
the editor handler or null if not set

setEditorHandler

public void setEditorHandler(EditorHandler<T> handler)
Sets the handler responsible for binding data and editor widgets to the editor.

Parameters:
rowHandler - the new editor handler
Throws:
java.lang.IllegalStateException - if the editor is currently in edit mode

isEditorEnabled

public boolean isEditorEnabled()
Returns the enabled state of the editor.

Returns:
true if editing is enabled, false otherwise

setEditorEnabled

public void setEditorEnabled(boolean enabled)
Sets the enabled state of the editor.

Parameters:
enabled - true to enable editing, false to disable
Throws:
java.lang.IllegalStateException - if in edit mode and trying to disable
java.lang.IllegalStateException - if the editor handler is not set

getEditorWidget

public Widget getEditorWidget(Grid.Column<?,T> column)
Returns the editor widget associated with the given column. If the editor is not active, returns null.

Parameters:
column - the column
Returns:
the widget if the editor is open, null otherwise

setEditorSaveCaption

public void setEditorSaveCaption(java.lang.String saveCaption)
                          throws java.lang.IllegalArgumentException
Sets the caption on the save button in the Grid editor.

Parameters:
saveCaption - the caption to set
Throws:
java.lang.IllegalArgumentException - if saveCaption is null

getEditorSaveCaption

public java.lang.String getEditorSaveCaption()
Gets the current caption on the save button in the Grid editor.

Returns:
the current caption on the save button

setEditorCancelCaption

public void setEditorCancelCaption(java.lang.String cancelCaption)
                            throws java.lang.IllegalArgumentException
Sets the caption on the cancel button in the Grid editor.

Parameters:
cancelCaption - the caption to set
Throws:
java.lang.IllegalArgumentException - if cancelCaption is null

getEditorCancelCaption

public java.lang.String getEditorCancelCaption()
Gets the caption on the cancel button in the Grid editor.

Returns:
the current caption on the cancel button

onAttach

protected void onAttach()

onDetach

protected void onDetach()

onResize

public void onResize()

add

@Deprecated
public void add(Widget w)
Deprecated. 

Grid does not support adding Widgets this way.

This method is implemented only because removing widgets from Grid (added via e.g. Renderers) requires the HasWidgets interface.

Parameters:
w - irrelevant
Throws:
java.lang.UnsupportedOperationException - always

clear

@Deprecated
public void clear()
Deprecated. 

Grid does not support clearing Widgets this way.

This method is implemented only because removing widgets from Grid (added via e.g. Renderers) requires the HasWidgets interface.

Throws:
java.lang.UnsupportedOperationException - always

iterator

@Deprecated
public java.util.Iterator<Widget> iterator()
Deprecated. 

Grid does not support iterating through Widgets this way.

This method is implemented only because removing widgets from Grid (added via e.g. Renderers) requires the HasWidgets interface.

Returns:
never
Throws:
java.lang.UnsupportedOperationException - always

remove

@Deprecated
public boolean remove(Widget w)
Deprecated. 

Grid does not support removing Widgets this way.

This method is implemented only because removing widgets from Grid (added via e.g. Renderers) requires the HasWidgets interface.

Returns:
always false

doAttachChildren

protected void doAttachChildren()

doDetachChildren

protected void doDetachChildren()

resetSizesFromDom

public void resetSizesFromDom()
Resets all cached pixel sizes and reads new values from the DOM. This methods should be used e.g. when styles affecting the dimensions of elements in this grid have been changed.


setDetailsGenerator

public void setDetailsGenerator(DetailsGenerator detailsGenerator)
                         throws java.lang.IllegalArgumentException
Sets a new details generator for row details.

The currently opened row details will be re-rendered.

Parameters:
detailsGenerator - the details generator to set
Throws:
java.lang.IllegalArgumentException - if detailsGenerator is null;
Since:
7.5.0

getDetailsGenerator

public DetailsGenerator getDetailsGenerator()
Gets the current details generator for row details.

Returns:
the detailsGenerator the current details generator
Since:
7.5.0

setDetailsVisible

public void setDetailsVisible(int rowIndex,
                              boolean visible)
Shows or hides the details for a specific row.

This method does nothing if trying to set show already-visible details, or hide already-hidden details.

Parameters:
rowIndex - the index of the affected row
visible - true to show the details, or false to hide them
Since:
7.5.0
See Also:
isDetailsVisible(int)

isDetailsVisible

public boolean isDetailsVisible(int rowIndex)
Check whether the details for a row is visible or not.

Parameters:
rowIndex - the index of the row for which to check details
Returns:
true iff the details for the given row is visible
Since:
7.5.0
See Also:
setDetailsVisible(int, boolean)

recalculateColumnWidths

public void recalculateColumnWidths()
Requests that the column widths should be recalculated.

The actual recalculation is not necessarily done immediately so you cannot rely on the columns being the correct width after the call returns.

Since:
7.4.1

getSidebarMenu

public MenuBar getSidebarMenu()
Gets the customizable menu bar that is by default used for toggling column hidability. The application developer is allowed to add their custom items to the end of the menu, but should try to avoid modifying the items in the beginning of the menu that control the column hiding if any columns are marked as hidable. A toggle for opening the menu will be displayed whenever the menu contains at least one item.

Returns:
the menu bar
Since:
7.5.0

isSidebarOpen

public boolean isSidebarOpen()
Tests whether the sidebar menu is currently open.

Returns:
true if the sidebar is open; false if it is closed
Since:
7.5.0
See Also:
getSidebarMenu()

setSidebarOpen

public void setSidebarOpen(boolean sidebarOpen)
Sets whether the sidebar menu is open.

Parameters:
sidebarOpen - true to open the sidebar; false to close it
Since:
7.5.0
See Also:
getSidebarMenu(), isSidebarOpen()

getTabIndex

public int getTabIndex()

setAccessKey

public void setAccessKey(char key)

setFocus

public void setFocus(boolean focused)

setTabIndex

public void setTabIndex(int index)

focus

public void focus()
Description copied from interface: Focusable
Sets focus to this widget.

Specified by:
focus in interface Focusable

setEditorBuffered

public void setEditorBuffered(boolean editorBuffered)
Sets the buffered editor mode.

Parameters:
editorUnbuffered - true to enable buffered editor, false to disable it
Since:
7.6

isEditorBuffered

public boolean isEditorBuffered()
Gets the buffered editor mode.

Returns:
true if buffered editor is enabled, false otherwise
Since:
7.6

getEventCell

public EventCellReference<T> getEventCell()
Returns the EventCellReference for the latest event fired from this Grid.

Note: This cell reference will be updated when firing the next event.

Returns:
event cell reference
Since:
7.5

getCellReference

public CellReference<T> getCellReference(Element element)
Returns a CellReference for the cell to which the given element belongs to.

Parameters:
element - Element to find from the cell's content.
Returns:
CellReference or null if cell was not found.
Since:
7.6


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