com.google.gwt.widgetideas.table.client
Class GridView

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.widgetideas.table.client.overrides.HTMLTable
                  extended by com.google.gwt.widgetideas.table.client.overrides.Grid
                      extended by com.google.gwt.widgetideas.table.client.HoverGrid
                          extended by com.google.gwt.widgetideas.table.client.FixedWidthGrid
                              extended by com.google.gwt.widgetideas.table.client.SortableFixedWidthGrid
                                  extended by com.google.gwt.widgetideas.table.client.GridView
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.SourcesTableEvents, HasAutoFitColumn, HasColumns, HasFixedColumnWidth, HasRowPaging, HasSortableColumns
Direct Known Subclasses:
EditableGridView

public class GridView
extends SortableFixedWidthGrid
implements HasRowPaging

A GridView responds to events from an underlying TableController.


Nested Class Summary
static class GridView.CellRenderer
          The renderer used to set cell contents.
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.SortableFixedWidthGrid
SortableFixedWidthGrid.ColumnSorter, SortableFixedWidthGrid.ColumnSorterCallback
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.FixedWidthGrid
FixedWidthGrid.FixedWidthGridCellFormatter, FixedWidthGrid.FixedWidthGridColumnFormatter, FixedWidthGrid.FixedWidthGridRowFormatter
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.HoverGrid
HoverGrid.HoverGridRowFormatter
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.overrides.HTMLTable
HTMLTable.CellFormatter, HTMLTable.ColumnFormatter, HTMLTable.RowFormatter, HTMLTable.WidgetMapper
 
Field Summary
protected  TableControllerListener tableControllerListener
          The listener that handles events from the underlying TableController.
 
Fields inherited from class com.google.gwt.widgetideas.table.client.FixedWidthGrid
DEFAULT_COLUMN_WIDTH, MIN_COLUMN_WIDTH
 
Fields inherited from class com.google.gwt.widgetideas.table.client.HoverGrid
HOVERING_POLICY_CELL, HOVERING_POLICY_DISABLED, HOVERING_POLICY_ROW, SELECTION_POLICY_DISABLED, SELECTION_POLICY_MULTI_ROW, SELECTION_POLICY_ONE_ROW
 
Fields inherited from class com.google.gwt.widgetideas.table.client.overrides.Grid
numColumns, numRows
 
Constructor Summary
protected GridView()
          Default constructor used for subclasses.
  GridView(MutableTableModel tableModel)
          Constructor.
  GridView(TableController tableController)
          Constructor.
 
Method Summary
 void addRowPagingListener(HasRowPagingListener listener)
          Add a new HasRowPagingListener.
protected  void fireRowPagingEvent()
           
 GridView.CellRenderer getCellRenderer()
          Get the cell renderer.
 int getCurrentPage()
          Returns the currently visible page.
protected  int getFirstRow()
          Get the first visible row index.
protected  int getLastRow()
          Get the last visible row index.
 int getNumPages()
          Get the number of pages.
 int getPageSize()
          Get the number of rows per page.
 TableController getTableController()
          Get the underlying TableController from the grid.
 void gotoFirstPage()
          Go to the first page.
 void gotoLastPage()
          Go to the last page.
 void gotoNextPage()
          Go to the next page.
 void gotoPage(int page)
          Set the current page.
 void gotoPreviousPage()
          Go to the previous page.
 void reloadPage()
          Reload the current page.
 void removeRowPagingListener(HasRowPagingListener listener)
          Remove a HasRowPagingListener.
 void renderCell(int row, int column, java.lang.Object data)
          Render the contents of the cell.
protected  void renderContents()
          Render the contents of the GridView.
 void setCellRenderer(GridView.CellRenderer cellRenderer)
          Set the cell renderer.
 void setPageSize(int pageSize)
          Set the number of rows per page.
protected  void setTableController(TableController tableController)
           
 
Methods inherited from class com.google.gwt.widgetideas.table.client.SortableFixedWidthGrid
addSortableColumnsListener, getColumnSorter, getColumnSorter, moveRowDown, moveRowUp, removeSortableColumnsListener, reverseRows, setColumnSorter, setHTML, setSortedColumn, setText, setWidget, sortColumn, sortColumn, swapRows, swapRowsRaw
 
Methods inherited from class com.google.gwt.widgetideas.table.client.FixedWidthGrid
autoFitColumnWidth, getAutoFitColumnWidth, getCellContainer, getColumnWidth, getDefaultColumnWidth, getDOMCellCount, getDOMRowCount, getFixedWidthGridCellFormatter, getFixedWidthGridRowFormatter, getGhostColumnCount, getGhostRow, getRowIndex, insertCell, insertRow, prepareCell, prepareColumn, prepareRow, resizeColumns, resizeRows, setColumnWidth, setGhostRow, updateGhostRow
 
Methods inherited from class com.google.gwt.widgetideas.table.client.HoverGrid
addHoverGridListener, deselectRow, deselectRows, getHoveringPolicy, getSelectedRows, getSelectedRowsMap, getSelectionPolicy, hoverCell, hoverRow, isRowSelected, onBrowserEvent, onCellClicked, removeHoverGridListener, removeRow, selectRow, selectRow, selectRow, setHoveringPolicy, setMinHoverRow, setSelectionPolicy, unhover
 
Methods inherited from class com.google.gwt.widgetideas.table.client.overrides.Grid
createCell, getCellCount, getColumnCount, getRowCount, resize
 
Methods inherited from class com.google.gwt.widgetideas.table.client.overrides.HTMLTable
addTableListener, checkCellBounds, checkRowBounds, cleanCell, clear, clearAll, clearCell, getBodyElement, getCellContainer, getCellFormatter, getCellPadding, getCellSpacing, getColumnFormatter, getDOMCellCount, getDOMRowCount, getEventTargetCell, getHTML, getRowFormatter, getText, getWidget, getWidgetMap, insertCells, internalClearCell, isCellPresent, iterator, remove, removeCell, removeTableListener, setBodyElement, setBorderWidth, setCellFormatter, setCellPadding, setCellSpacing, setClearText, setColumnFormatter, setRowFormatter
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, disown, doAttachChildren, doDetachChildren, onLoad, onUnload, orphan
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onAttach, onDetach, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.widgetideas.table.client.HasFixedColumnWidth
getColumnCount, getColumnWidth, getDefaultColumnWidth, setColumnWidth
 
Methods inherited from interface com.google.gwt.widgetideas.table.client.HasColumns
getCellCount, getCellPadding, getCellSpacing, getElement, getEventTargetCell, getOffsetWidth, setCellPadding, setCellSpacing, setStyleName
 

Field Detail

tableControllerListener

protected TableControllerListener tableControllerListener
The listener that handles events from the underlying TableController.

Constructor Detail

GridView

public GridView(TableController tableController)
Constructor.

Parameters:
tableController - the underlying TableController

GridView

protected GridView()
Default constructor used for subclasses.


GridView

public GridView(MutableTableModel tableModel)
Constructor.

Parameters:
tableModel - the MutableTableModel used to retrieve data
Method Detail

setTableController

protected void setTableController(TableController tableController)

addRowPagingListener

public void addRowPagingListener(HasRowPagingListener listener)
Add a new HasRowPagingListener.

Specified by:
addRowPagingListener in interface HasRowPaging
Parameters:
listener - the listener

getCellRenderer

public GridView.CellRenderer getCellRenderer()
Get the cell renderer.

Returns:
the cell rendered

getCurrentPage

public int getCurrentPage()
Returns the currently visible page.

Returns:
the current page

getNumPages

public int getNumPages()
Get the number of pages. If the number of pages is unknown, -1 is returned.

Specified by:
getNumPages in interface HasRowPaging
Returns:
the page count

getPageSize

public int getPageSize()
Get the number of rows per page.

Specified by:
getPageSize in interface HasRowPaging
Returns:
the number of rows per page

getTableController

public TableController getTableController()
Get the underlying TableController from the grid.

Returns:
the table controller

gotoFirstPage

public void gotoFirstPage()
Go to the first page.

Specified by:
gotoFirstPage in interface HasRowPaging

gotoLastPage

public void gotoLastPage()
Go to the last page.

Specified by:
gotoLastPage in interface HasRowPaging

gotoNextPage

public void gotoNextPage()
Go to the next page.


gotoPage

public void gotoPage(int page)
Set the current page. If the page is out of bounds, it will be automatically set to zero or the last page without throwing any errors.

Specified by:
gotoPage in interface HasRowPaging
Parameters:
page - the page

gotoPreviousPage

public void gotoPreviousPage()
Go to the previous page.


reloadPage

public void reloadPage()
Reload the current page.


removeRowPagingListener

public void removeRowPagingListener(HasRowPagingListener listener)
Remove a HasRowPagingListener.

Specified by:
removeRowPagingListener in interface HasRowPaging
Parameters:
listener - the listener to remove

renderCell

public void renderCell(int row,
                       int column,
                       java.lang.Object data)
Render the contents of the cell.

Parameters:
row - the row index
column - the column index
data - the data to render

setCellRenderer

public void setCellRenderer(GridView.CellRenderer cellRenderer)
Set the cell renderer.

Parameters:
cellRenderer - the new renderer

setPageSize

public void setPageSize(int pageSize)
Set the number of rows per page. By default, the page size is zero, which indicates that all rows should be shown on the page.

Specified by:
setPageSize in interface HasRowPaging
Parameters:
pageSize - the number of rows per page

getFirstRow

protected int getFirstRow()
Get the first visible row index.

Returns:
the first row index

getLastRow

protected int getLastRow()
Get the last visible row index.

Returns:
the last row index

renderContents

protected void renderContents()
Render the contents of the GridView.


fireRowPagingEvent

protected void fireRowPagingEvent()