M
- the model type contained within the storepublic abstract class AbstractStoreSelectionModel<M> extends Object implements StoreSelectionModel<M>, SelectionChangedEvent.HasSelectionChangedHandlers<M>
Modifier and Type | Field and Description |
---|---|
protected boolean |
fireSelectionChangeOnClick
If true the selection change event should be fired on click.
|
protected M |
lastSelected |
protected boolean |
locked |
protected boolean |
mouseDown
Tracks if a mouse down event is currently being processed.
|
protected List<M> |
selected |
protected Style.SelectionMode |
selectionMode |
protected Store<M> |
store |
Constructor and Description |
---|
AbstractStoreSelectionModel() |
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addBeforeSelectionHandler(<any> handler) |
HandlerRegistration |
addSelectionChangedHandler(SelectionChangedEvent.SelectionChangedHandler<M> handler)
Adds a
SelectionChangedEvent.SelectionChangedHandler handler for
SelectionChangedEvent events. |
HandlerRegistration |
addSelectionHandler(<any> handler)
Adds a
SelectionChangedEvent.SelectionChangedHandler handler for SelectionChangedEvent events. |
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(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.
|
protected void |
doDeselect(List<M> models,
boolean suppressEvent) |
protected void |
doMultiSelect(List<M> models,
boolean keepExisting,
boolean suppressEvent) |
protected void |
doSelect(List<M> models,
boolean keepExisting,
boolean suppressEvent) |
protected void |
doSingleSelect(M model,
boolean suppressEvent) |
protected HandlerManager |
ensureHandlers() |
void |
fireEvent(<any> event) |
protected void |
fireSelectionChange() |
protected M |
getLastFocused() |
M |
getSelectedItem()
Returns the selected item.
|
List<M> |
getSelectedItems()
Returns the selected items.
|
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.
|
protected void |
onAdd(List<? extends M> models) |
protected void |
onClear(StoreClearEvent<M> event) |
protected void |
onLastFocusChanged(M oldFocused,
M newFocused) |
protected void |
onRecordChange(StoreRecordChangeEvent<M> event) |
protected void |
onRemove(M model) |
protected abstract void |
onSelectChange(M model,
boolean select) |
protected void |
onUpdate(M model) |
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(List<M> items,
boolean keepExisting)
Selects the items.
|
void |
select(M item,
boolean keepExisting)
Selects the item.
|
void |
selectAll()
Selects all items.
|
protected void |
setLastFocused(M lastFocused) |
void |
setLocked(boolean locked)
True to lock the selection model.
|
void |
setSelection(List<M> selection) |
void |
setSelectionMode(Style.SelectionMode selectionMode)
Sets the selection mode.
|
protected M lastSelected
protected boolean locked
protected Style.SelectionMode selectionMode
protected boolean fireSelectionChangeOnClick
protected boolean mouseDown
public HandlerRegistration addBeforeSelectionHandler(<any> handler)
public HandlerRegistration addSelectionChangedHandler(SelectionChangedEvent.SelectionChangedHandler<M> handler)
SelectionChangedEvent.HasSelectionChangedHandlers
SelectionChangedEvent.SelectionChangedHandler
handler for
SelectionChangedEvent
events.addSelectionChangedHandler
in interface SelectionChangedEvent.HasSelectionChangedHandlers<M>
handler
- the handlerpublic HandlerRegistration addSelectionHandler(<any> handler)
SelectionChangedEvent.SelectionChangedHandler
handler for SelectionChangedEvent
events.handler
- the handlerpublic void bind(Store<M> store)
StoreSelectionModel
bind
in interface StoreSelectionModel<M>
store
- the bound storepublic void deselect(int index)
StoreSelectionModel
deselect
in interface StoreSelectionModel<M>
index
- the index of the item to be deselectedpublic void deselect(int start, int end)
StoreSelectionModel
deselect
in interface StoreSelectionModel<M>
start
- the start indexend
- the end indexpublic void deselect(List<M> items)
StoreSelectionModel
deselect
in interface StoreSelectionModel<M>
items
- the itempublic void deselect(M... items)
StoreSelectionModel
deselect
in interface StoreSelectionModel<M>
items
- the items to deselectpublic void deselect(M item)
StoreSelectionModel
deselect
in interface StoreSelectionModel<M>
item
- the item to be deselectedpublic void deselectAll()
StoreSelectionModel
deselectAll
in interface StoreSelectionModel<M>
public void fireEvent(<any> event)
public M getSelectedItem()
StoreSelectionModel
getSelectedItem
in interface StoreSelectionModel<M>
public List<M> getSelectedItems()
StoreSelectionModel
getSelectedItems
in interface StoreSelectionModel<M>
public Style.SelectionMode getSelectionMode()
StoreSelectionModel
getSelectionMode
in interface StoreSelectionModel<M>
public boolean isLocked()
public boolean isSelected(M item)
StoreSelectionModel
isSelected
in interface StoreSelectionModel<M>
item
- the itempublic void refresh()
StoreSelectionModel
refresh
in interface StoreSelectionModel<M>
public void select(boolean keepExisting, M... items)
StoreSelectionModel
select
in interface StoreSelectionModel<M>
keepExisting
- true to keep existing selecteditems
- the itemspublic void select(int index, boolean keepExisting)
StoreSelectionModel
select
in interface StoreSelectionModel<M>
index
- the index of the item to be selectedkeepExisting
- true to keep existing selectedpublic void select(int start, int end, boolean keepExisting)
StoreSelectionModel
select
in interface StoreSelectionModel<M>
start
- the start indexend
- the end indexkeepExisting
- true to keep existing selectedpublic void select(List<M> items, boolean keepExisting)
StoreSelectionModel
select
in interface StoreSelectionModel<M>
items
- the items to selectkeepExisting
- true to keep existing selectedpublic void select(M item, boolean keepExisting)
StoreSelectionModel
select
in interface StoreSelectionModel<M>
item
- the itemkeepExisting
- true to keep existing selectedpublic void selectAll()
StoreSelectionModel
selectAll
in interface StoreSelectionModel<M>
public void setLocked(boolean locked)
locked
- true to lockpublic void setSelectionMode(Style.SelectionMode selectionMode)
StoreSelectionModel
The selection model supports 3 different selection modes:
setSelectionMode
in interface StoreSelectionModel<M>
selectionMode
- the selection modeprotected void doMultiSelect(List<M> models, boolean keepExisting, boolean suppressEvent)
protected void doSingleSelect(M model, boolean suppressEvent)
protected HandlerManager ensureHandlers()
protected void fireSelectionChange()
protected M getLastFocused()
protected void onClear(StoreClearEvent<M> event)
protected void onRecordChange(StoreRecordChangeEvent<M> event)
protected void onRemove(M model)
protected abstract void onSelectChange(M model, boolean select)
protected void onUpdate(M model)
protected void setLastFocused(M lastFocused)
Copyright © 2018. All rights reserved.