com.sencha.gxt.widget.core.client.selection
Class AbstractStoreSelectionModel<M>

java.lang.Object
  extended by com.sencha.gxt.widget.core.client.selection.AbstractStoreSelectionModel<M>
Type Parameters:
M - the model type contained within the store
All Implemented Interfaces:
HasBeforeSelectionHandlers<M>, HasSelectionHandlers<M>, HasHandlers, SelectionChangedEvent.HasSelectionChangedHandlers<M>, StoreSelectionModel<M>
Direct Known Subclasses:
GridSelectionModel, ListViewSelectionModel, TreeSelectionModel

public abstract class AbstractStoreSelectionModel<M>
extends java.lang.Object
implements StoreSelectionModel<M>, HasBeforeSelectionHandlers<M>, HasSelectionHandlers<M>, SelectionChangedEvent.HasSelectionChangedHandlers<M>

Abstract base class for store based selection models.


Constructor Summary
AbstractStoreSelectionModel()
           
 
Method Summary
 HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<M> handler)
           
 HandlerRegistration addSelectionChangedHandler(SelectionChangedEvent.SelectionChangedHandler<M> handler)
          Adds a SelectionChangedEvent.SelectionChangedHandler handler for SelectionChangedEvent events.
 HandlerRegistration addSelectionHandler(SelectionHandler<M> handler)
           
 void bind(Store<M> store)
          Binds the store to the 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.
 void fireEvent(GwtEvent<?> event)
           
 M getSelectedItem()
          Returns the selected item.
 java.util.List<M> getSelectedItems()
          Returns the selected items.
 java.util.List<M> getSelection()
           
 Style.SelectionMode getSelectionMode()
          Returns the selection mode.
 boolean isLocked()
          Returns true if the selection model is locked.
 boolean isSelected(M item)
          Returns true if the item is selected.
 void refresh()
          Refreshes the current selections.
 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 setLocked(boolean locked)
          True to lock the selection model.
 void setSelection(java.util.List<M> selection)
           
 void setSelectionMode(Style.SelectionMode selectionMode)
          Sets the selection mode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractStoreSelectionModel

public AbstractStoreSelectionModel()
Method Detail

addBeforeSelectionHandler

public HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<M> handler)
Specified by:
addBeforeSelectionHandler in interface HasBeforeSelectionHandlers<M>

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>
Parameters:
handler - the handler
Returns:
the registration for the event

addSelectionHandler

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

bind

public void bind(Store<M> store)
Description copied from interface: StoreSelectionModel
Binds the store to the selection model.

Specified by:
bind in interface StoreSelectionModel<M>
Parameters:
store - the bound store

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>
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>
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>
Parameters:
items - the item

deselect

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

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

deselect

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

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

deselectAll

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

Specified by:
deselectAll in interface StoreSelectionModel<M>

fireEvent

public void fireEvent(GwtEvent<?> event)
Specified by:
fireEvent in interface HasHandlers

getSelectedItem

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

Specified by:
getSelectedItem in interface StoreSelectionModel<M>

getSelectedItems

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

Specified by:
getSelectedItems in interface StoreSelectionModel<M>

getSelection

public java.util.List<M> getSelection()

getSelectionMode

public Style.SelectionMode getSelectionMode()
Description copied from interface: StoreSelectionModel
Returns the selection mode.

Specified by:
getSelectionMode in interface StoreSelectionModel<M>
Returns:
the selection mode

isLocked

public boolean isLocked()
Returns true if the selection model is locked.

Returns:
the locked state

isSelected

public boolean isSelected(M item)
Description copied from interface: StoreSelectionModel
Returns true if the item is selected.

Specified by:
isSelected in interface StoreSelectionModel<M>
Parameters:
item - the item
Returns:
true if selected

refresh

public void refresh()
Description copied from interface: StoreSelectionModel
Refreshes the current selections.

Specified by:
refresh in interface StoreSelectionModel<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>
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>
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>
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>
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>
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>

setLocked

public void setLocked(boolean locked)
True to lock the selection model. When locked, all selection changes are disabled.

Parameters:
locked - true to lock

setSelection

public void setSelection(java.util.List<M> selection)

setSelectionMode

public void setSelectionMode(Style.SelectionMode selectionMode)
Description copied from interface: StoreSelectionModel
Sets the selection mode.

The selection model supports 3 different selection modes:

Specified by:
setSelectionMode in interface StoreSelectionModel<M>
Parameters:
selectionMode - the selection mode


Copyright © 2012. All Rights Reserved.