com.sencha.gxt.widget.core.client.grid
Class CellSelectionModel<M>

java.lang.Object
  extended by com.sencha.gxt.widget.core.client.selection.AbstractStoreSelectionModel<M>
      extended by com.sencha.gxt.widget.core.client.grid.GridSelectionModel<M>
          extended by com.sencha.gxt.widget.core.client.grid.CellSelectionModel<M>
Type Parameters:
M - the model type
All Implemented Interfaces:
HasBeforeSelectionHandlers<M>, HasSelectionHandlers<M>, HasHandlers, CellSelectionChangedEvent.HasCellSelectionChangedHandlers<M>, SelectionChangedEvent.HasSelectionChangedHandlers<M>, StoreSelectionModel<M>

public class CellSelectionModel<M>
extends GridSelectionModel<M>
implements CellSelectionChangedEvent.HasCellSelectionChangedHandlers<M>

Cell based selection model. User selectCell(int, int) to select a cell and deselectAll() to deselect.

CellSelectionModel extends GridSelectionModel. However, CellSelectionModel only supports cell selections, no row based selections or events are supported. Use #addCellSelectionChangedHandler(CellSelectionChangedHandler) to be notified of selection changes.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sencha.gxt.widget.core.client.grid.GridSelectionModel
GridSelectionModel.SelectionModelCallback
 
Constructor Summary
CellSelectionModel()
           
 
Method Summary
 HandlerRegistration addCellSelectionChangedHandler(CellSelectionChangedEvent.CellSelectionChangedHandler<M> handler)
          Adds a CellSelectionChangedEvent.CellSelectionChangedHandler handler for CellSelectionChangedEvent events.
 HandlerRegistration addSelectionChangedHandler(SelectionChangedEvent.SelectionChangedHandler<M> handler)
          Adds a SelectionChangedEvent.SelectionChangedHandler handler for SelectionChangedEvent events.
 HandlerRegistration addSelectionHandler(SelectionHandler<M> handler)
           
 void bindGrid(Grid<M> grid)
          Binds the given grid to this selection model.
 void deselect(int index)
          Deselects the item at the given index.
 void deselect(int start, int end)
          Deselects the range.
 void deselect(java.util.List<M> items)
          Deselects the items.
 void deselect(M... items)
          Deselects the items.
 void deselect(M item)
          Deselects the item.
 void deselectAll()
          Deselects all selections.
 CellSelection<M> getSelectCell()
          Returns the selected cell or null.
 M getSelectedItem()
          Returns the selected item.
 java.util.List<M> getSelectedItems()
          Returns the selected items.
 void select(boolean keepExisting, M... items)
          Selects the items.
 void select(int index, boolean keepExisting)
          Selects the item at the given index.
 void select(int start, int end, boolean keepExisting)
          Selects the range.
 void select(java.util.List<M> items, boolean keepExisting)
          Selects the items.
 void select(M item, boolean keepExisting)
          Selects the item.
 void selectAll()
          Selects all items.
 void selectCell(int row, int cell)
          Selects the cell.
 
Methods inherited from class com.sencha.gxt.widget.core.client.grid.GridSelectionModel
bind, selectNext, selectPrevious
 
Methods inherited from class com.sencha.gxt.widget.core.client.selection.AbstractStoreSelectionModel
addBeforeSelectionHandler, fireEvent, getSelection, getSelectionMode, isLocked, isSelected, refresh, setLocked, setSelection, setSelectionMode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellSelectionModel

public CellSelectionModel()
Method Detail

addCellSelectionChangedHandler

public HandlerRegistration addCellSelectionChangedHandler(CellSelectionChangedEvent.CellSelectionChangedHandler<M> handler)
Description copied from interface: CellSelectionChangedEvent.HasCellSelectionChangedHandlers
Adds a CellSelectionChangedEvent.CellSelectionChangedHandler handler for CellSelectionChangedEvent events.

Specified by:
addCellSelectionChangedHandler in interface CellSelectionChangedEvent.HasCellSelectionChangedHandlers<M>
Parameters:
handler - the handler
Returns:
the registration for the event

addSelectionChangedHandler

public HandlerRegistration addSelectionChangedHandler(SelectionChangedEvent.SelectionChangedHandler<M> handler)
Description copied from interface: SelectionChangedEvent.HasSelectionChangedHandlers
Adds a SelectionChangedEvent.SelectionChangedHandler handler for SelectionChangedEvent events.

Specified by:
addSelectionChangedHandler in interface SelectionChangedEvent.HasSelectionChangedHandlers<M>
Overrides:
addSelectionChangedHandler in class AbstractStoreSelectionModel<M>
Parameters:
handler - the handler
Returns:
the registration for the event

addSelectionHandler

public HandlerRegistration addSelectionHandler(SelectionHandler<M> handler)
Specified by:
addSelectionHandler in interface HasSelectionHandlers<M>
Overrides:
addSelectionHandler in class AbstractStoreSelectionModel<M>

bindGrid

public void bindGrid(Grid<M> grid)
Description copied from class: GridSelectionModel
Binds the given grid to this selection model.

Overrides:
bindGrid in class GridSelectionModel<M>
Parameters:
grid - the grid to bind to this selection model

deselect

public void deselect(int index)
Description copied from interface: StoreSelectionModel
Deselects the item at the given index.

Specified by:
deselect in interface StoreSelectionModel<M>
Overrides:
deselect in class AbstractStoreSelectionModel<M>
Parameters:
index - the index of the item to be deselected

deselect

public void deselect(int start,
                     int end)
Description copied from interface: StoreSelectionModel
Deselects the range.

Specified by:
deselect in interface StoreSelectionModel<M>
Overrides:
deselect in class AbstractStoreSelectionModel<M>
Parameters:
start - the start index
end - the end index

deselect

public void deselect(java.util.List<M> items)
Description copied from interface: StoreSelectionModel
Deselects the items.

Specified by:
deselect in interface StoreSelectionModel<M>
Overrides:
deselect in class AbstractStoreSelectionModel<M>
Parameters:
items - the item

deselect

public void deselect(M item)
Description copied from interface: StoreSelectionModel
Deselects the item.

Specified by:
deselect in interface StoreSelectionModel<M>
Overrides:
deselect in class AbstractStoreSelectionModel<M>
Parameters:
item - the item to be deselected

deselect

public void deselect(M... items)
Description copied from interface: StoreSelectionModel
Deselects the items.

Specified by:
deselect in interface StoreSelectionModel<M>
Overrides:
deselect in class AbstractStoreSelectionModel<M>
Parameters:
items - the items to deselect

deselectAll

public void deselectAll()
Description copied from interface: StoreSelectionModel
Deselects all selections.

Specified by:
deselectAll in interface StoreSelectionModel<M>
Overrides:
deselectAll in class AbstractStoreSelectionModel<M>

getSelectCell

public CellSelection<M> getSelectCell()
Returns the selected cell or null.

Returns:
the selected cell or null if no selections

getSelectedItem

public M getSelectedItem()
Description copied from interface: StoreSelectionModel
Returns the selected item.

Specified by:
getSelectedItem in interface StoreSelectionModel<M>
Overrides:
getSelectedItem in class AbstractStoreSelectionModel<M>

getSelectedItems

public java.util.List<M> getSelectedItems()
Description copied from interface: StoreSelectionModel
Returns the selected items.

Specified by:
getSelectedItems in interface StoreSelectionModel<M>
Overrides:
getSelectedItems in class AbstractStoreSelectionModel<M>

select

public void select(boolean keepExisting,
                   M... items)
Description copied from interface: StoreSelectionModel
Selects the items. Selects the first item for single-select.

Specified by:
select in interface StoreSelectionModel<M>
Overrides:
select in class AbstractStoreSelectionModel<M>
Parameters:
keepExisting - true to keep existing selected
items - the items

select

public void select(int index,
                   boolean keepExisting)
Description copied from interface: StoreSelectionModel
Selects the item at the given index.

Specified by:
select in interface StoreSelectionModel<M>
Overrides:
select in class AbstractStoreSelectionModel<M>
Parameters:
index - the index of the item to be selected
keepExisting - true to keep existing selected

select

public void select(int start,
                   int end,
                   boolean keepExisting)
Description copied from interface: StoreSelectionModel
Selects the range.

Specified by:
select in interface StoreSelectionModel<M>
Overrides:
select in class AbstractStoreSelectionModel<M>
Parameters:
start - the start index
end - the end index
keepExisting - true to keep existing selected

select

public void select(java.util.List<M> items,
                   boolean keepExisting)
Description copied from interface: StoreSelectionModel
Selects the items. Selects the first item for single-select.

Specified by:
select in interface StoreSelectionModel<M>
Overrides:
select in class AbstractStoreSelectionModel<M>
Parameters:
items - the items to select
keepExisting - true to keep existing selected

select

public void select(M item,
                   boolean keepExisting)
Description copied from interface: StoreSelectionModel
Selects the item.

Specified by:
select in interface StoreSelectionModel<M>
Overrides:
select in class AbstractStoreSelectionModel<M>
Parameters:
item - the item
keepExisting - true to keep existing selected

selectAll

public void selectAll()
Description copied from interface: StoreSelectionModel
Selects all items.

Specified by:
selectAll in interface StoreSelectionModel<M>
Overrides:
selectAll in class AbstractStoreSelectionModel<M>

selectCell

public void selectCell(int row,
                       int cell)
Selects the cell.

Parameters:
row - the row index
cell - the cell index


Copyright © 2012. All Rights Reserved.