com.gwtext.client.widgets.grid
Class RowSelectionModel

java.lang.Object
  extended by com.gwtext.client.core.JsObject
      extended by com.gwtext.client.widgets.grid.AbstractSelectionModel
          extended by com.gwtext.client.widgets.grid.RowSelectionModel
Direct Known Subclasses:
CheckboxSelectionModel

public class RowSelectionModel
extends AbstractSelectionModel

A Grid's row based selection model.


Field Summary
 
Fields inherited from class com.gwtext.client.core.JsObject
jsObj
 
Constructor Summary
RowSelectionModel()
          Cretes a new RowSelectionModel.
RowSelectionModel(boolean singleSelect)
          Cretes a new RowSelectionModel.
RowSelectionModel(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 void addListener(RowSelectionListener listener)
          Add a Row selection listener.
 void clearSelections()
          Clears all selections.
protected  com.google.gwt.core.client.JavaScriptObject create(boolean singleSelect)
           
 void deselectRange(int startRow, int endRow)
          Deselects a range of rows.
 void deselectRow(int row)
          Deselects a row.
 int getCount()
          Gets the number of selected rows.
 Record getSelected()
          Returns the first selected record.
 Record[] getSelections()
          Returns the selected records.
 boolean hasSelection()
          Returns true if there is a selection.
 boolean isIdSelected(java.lang.String id)
          Returns true if the specified record id is selected.
 boolean isLocked()
          Returns true if the selections are locked.
 boolean isSelected(int row)
          Returns true if row is selected.
 boolean isSelected(Record record)
          Returns true if the record is selected.
 void selectAll()
          Selects all rows.
 void selectFirstRow()
          Selects the first row.
 void selectLastRow()
          Selects the last row.
 void selectLastRow(boolean keepExisting)
          Seletcs the last row.
 void selectNext()
          Selects the row immediately following the last selected row.
 void selectPrevious()
          Selects the row that precedes the last selected row.
 void selectRange(int startRow, int endRow)
          Selects a range of rows.
 void selectRange(int startRow, int endRow, boolean keepExisting)
          Selects a range of rows.
 void selectRecords(Record record)
          Select a Record.
 void selectRecords(Record[] records)
          Select records.
 void selectRow(int row)
          Selects a row.
 void selectRow(int row, boolean keepExisting)
          Selects a row.
 void selectRows(int[] rows)
          Selects multiple rows.
 void selectRows(int[] rows, boolean keepExisting)
          Selects multiple rows.
 
Methods inherited from class com.gwtext.client.widgets.grid.AbstractSelectionModel
lock, unlock
 
Methods inherited from class com.gwtext.client.core.JsObject
getJsObj, getProperties, isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowSelectionModel

public RowSelectionModel()
Cretes a new RowSelectionModel.


RowSelectionModel

public RowSelectionModel(boolean singleSelect)
Cretes a new RowSelectionModel.

Parameters:
singleSelect - true to allow selection of only one row at a time (defaults to false)

RowSelectionModel

public RowSelectionModel(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail

create

protected com.google.gwt.core.client.JavaScriptObject create(boolean singleSelect)

clearSelections

public void clearSelections()
Clears all selections.


deselectRange

public void deselectRange(int startRow,
                          int endRow)
Deselects a range of rows. All rows in between startRow and endRow are also deselected.

Parameters:
startRow - the index of the first row in the range
endRow - the index of the last row in the range

deselectRow

public void deselectRow(int row)
Deselects a row.

Parameters:
row - the index of the row to deselect

getCount

public int getCount()
Gets the number of selected rows.

Returns:
the number of selected rows

getSelected

public Record getSelected()
Returns the first selected record.

Returns:
the first selected record

getSelections

public Record[] getSelections()
Returns the selected records.

Returns:
the selected records

hasSelection

public boolean hasSelection()
Returns true if there is a selection.

Returns:
true if there is a selection

isIdSelected

public boolean isIdSelected(java.lang.String id)
Returns true if the specified record id is selected.

Parameters:
id - the id of record to check
Returns:
true if selected

isLocked

public boolean isLocked()
Returns true if the selections are locked.

Overrides:
isLocked in class AbstractSelectionModel
Returns:
true if selections are locked

isSelected

public boolean isSelected(int row)
Returns true if row is selected.

Parameters:
row - the row index
Returns:
true if selected

isSelected

public boolean isSelected(Record record)
Returns true if the record is selected.

Parameters:
record - the record to check
Returns:
true if selected

selectAll

public void selectAll()
Selects all rows.


selectFirstRow

public void selectFirstRow()
Selects the first row.


selectLastRow

public void selectLastRow()
Selects the last row.


selectLastRow

public void selectLastRow(boolean keepExisting)
Seletcs the last row.

Parameters:
keepExisting - true to keep existing selection

selectNext

public void selectNext()
Selects the row immediately following the last selected row.


selectPrevious

public void selectPrevious()
Selects the row that precedes the last selected row.


selectRange

public void selectRange(int startRow,
                        int endRow)
Selects a range of rows. All rows in between startRow and endRow are also selected.

Parameters:
startRow - the index of the first row
endRow - the index of the last row

selectRange

public void selectRange(int startRow,
                        int endRow,
                        boolean keepExisting)
Selects a range of rows. All rows in between startRow and endRow are also selected.

Parameters:
startRow - the index of the first row
endRow - the index of the last row
keepExisting - keep the existing selection

selectRecords

public void selectRecords(Record record)
Select a Record.

Parameters:
record - the record to select

selectRecords

public void selectRecords(Record[] records)
Select records.

Parameters:
records - the records to select

selectRow

public void selectRow(int row)
Selects a row.

Parameters:
row - the row index to select

selectRow

public void selectRow(int row,
                      boolean keepExisting)
Selects a row.

Parameters:
row - the row index to select
keepExisting - keep existing selection

selectRows

public void selectRows(int[] rows)
Selects multiple rows.

Parameters:
rows - array of the indexes of the row to select

selectRows

public void selectRows(int[] rows,
                       boolean keepExisting)
Selects multiple rows.

Parameters:
rows - array of the indexes of the row to select
keepExisting - keep the existing selection

addListener

public void addListener(RowSelectionListener listener)
Add a Row selection listener.

Parameters:
listener - the listener