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

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.SelectionGrid
                          extended by com.google.gwt.widgetideas.table.client.FixedWidthGrid
                              extended by com.google.gwt.widgetideas.table.client.SortableFixedWidthGrid
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.SourcesTableEvents, HasAutoFitColumn, HasFixedColumnWidth, HasSortableColumns, HasTableCells, SourceSortableColumnsEvents, SourceTableSelectionEvents
Direct Known Subclasses:
PagingGrid

public class SortableFixedWidthGrid
extends FixedWidthGrid
implements HasSortableColumns

A variation of the Grid that supports many more options such as lazy row and column creation, row movement, hovering, row selection, and better column resizing.


Nested Class Summary
static class SortableFixedWidthGrid.ColumnSorter
          The column sorter defines an algorithm to sort columns.
 class SortableFixedWidthGrid.ColumnSorterCallback
          Callback that is called when the row sorting is complete.
 
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.SelectionGrid
SelectionGrid.SelectedGridRowFormatter
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.overrides.HTMLTable
HTMLTable.CellFormatter, HTMLTable.ColumnFormatter, HTMLTable.RowFormatter
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
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.SelectionGrid
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.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
SortableFixedWidthGrid()
           
 
Method Summary
 void addSortableColumnsListener(SortableColumnsListener listener)
          Add a SortableColumnsListener listener.
 SortableFixedWidthGrid.ColumnSorter getColumnSorter()
           
 TableModel.ColumnSortList getColumnSortList()
           
 void moveRowDown(int row)
          Move a row up (relative to the screen) one index to a lesser index.
 void moveRowUp(int row)
          Move a row down (relative to the screen) one index to a greater index.
 void removeSortableColumnsListener(SortableColumnsListener listener)
          Remove a SortableColumnsListenerbleColumnsListener listener.
 void reverseRows()
          Completely reverse the order of all rows in the table.
 void setColumnSorter(SortableFixedWidthGrid.ColumnSorter sorter)
          Set the SortableFixedWidthGrid.ColumnSorter.
 void sortColumn(int column)
          Sort the grid according to the specified column.
 void sortColumn(int column, boolean ascending)
          Sort the grid according to the specified column.
 void swapRows(int row1, int row2)
          Swap the positions of two rows.
 
Methods inherited from class com.google.gwt.widgetideas.table.client.FixedWidthGrid
autoFitColumnWidth, getAutoFitColumnWidth, getColumnWidth, getDefaultColumnWidth, insertRow, removeRow, resizeColumns, resizeRows, setColumnWidth
 
Methods inherited from class com.google.gwt.widgetideas.table.client.SelectionGrid
addTableSelectionListener, deselectRow, deselectRows, getHoveringPolicy, getMinHoverRow, getSelectedRows, getSelectionPolicy, isRowSelected, onBrowserEvent, onCellClicked, removeTableSelectionListener, selectRow, selectRow, setHoveringPolicy, setMinHoverRow, setSelectionPolicy
 
Methods inherited from class com.google.gwt.widgetideas.table.client.overrides.Grid
getCellCount, getColumnCount, getRowCount, resize
 
Methods inherited from class com.google.gwt.widgetideas.table.client.overrides.HTMLTable
addTableListener, clear, clearAll, clearCell, getCellFormatter, getCellPadding, getCellSpacing, getColumnFormatter, getEventTargetCell, getHTML, getRowFormatter, getText, getWidget, isCellPresent, iterator, remove, removeTableListener, setBorderWidth, setCellPadding, setCellSpacing, setElement, setHTML, setText, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortableFixedWidthGrid

public SortableFixedWidthGrid()
Method Detail

addSortableColumnsListener

public void addSortableColumnsListener(SortableColumnsListener listener)
Add a SortableColumnsListener listener.

Specified by:
addSortableColumnsListener in interface SourceSortableColumnsEvents
Parameters:
listener - the listener

getColumnSorter

public SortableFixedWidthGrid.ColumnSorter getColumnSorter()
Returns:
the column sorter used to sort columns

getColumnSortList

public TableModel.ColumnSortList getColumnSortList()
Returns:
the TableModel.ColumnSortList of previously sorted columns

moveRowDown

public void moveRowDown(int row)
Move a row up (relative to the screen) one index to a lesser index.

Parameters:
row - the row index to move
Throws:
java.lang.IndexOutOfBoundsException

moveRowUp

public void moveRowUp(int row)
Move a row down (relative to the screen) one index to a greater index.

Parameters:
row - the row index to move
Throws:
java.lang.IndexOutOfBoundsException

removeSortableColumnsListener

public void removeSortableColumnsListener(SortableColumnsListener listener)
Remove a SortableColumnsListenerbleColumnsListener listener.

Specified by:
removeSortableColumnsListener in interface SourceSortableColumnsEvents
Parameters:
listener - the listener to remove

reverseRows

public void reverseRows()
Completely reverse the order of all rows in the table.


setColumnSorter

public void setColumnSorter(SortableFixedWidthGrid.ColumnSorter sorter)
Set the SortableFixedWidthGrid.ColumnSorter.

Parameters:
sorter - the new SortableFixedWidthGrid.ColumnSorter

sortColumn

public void sortColumn(int column)
Sort the grid according to the specified column. If the column is already sorted, reverse sort it.

Specified by:
sortColumn in interface HasSortableColumns
Parameters:
column - the column to sort
Throws:
java.lang.IndexOutOfBoundsException

sortColumn

public void sortColumn(int column,
                       boolean ascending)
Sort the grid according to the specified column.

Parameters:
column - the column to sort
ascending - sort the column in ascending order
Throws:
java.lang.IndexOutOfBoundsException

swapRows

public void swapRows(int row1,
                     int row2)
Swap the positions of two rows.

Parameters:
row1 - the first row to swap
row2 - the second row to swap
Throws:
java.lang.IndexOutOfBoundsException