Package com.google.gwt.view.client
Class SelectionModel.AbstractSelectionModel<T>
- java.lang.Object
-
- com.google.gwt.view.client.SelectionModel.AbstractSelectionModel<T>
-
- Type Parameters:
T
- the data type of records in the list
- All Implemented Interfaces:
HasHandlers
,ProvidesKey<T>
,SelectionChangeEvent.HasSelectionChangedHandlers
,SelectionModel<T>
- Direct Known Subclasses:
DefaultSelectionModel
,MultiSelectionModel
,NoSelectionModel
,SingleSelectionModel
- Enclosing interface:
- SelectionModel<T>
public abstract static class SelectionModel.AbstractSelectionModel<T> extends java.lang.Object implements SelectionModel<T>
A default implementation ofSelectionModel
that provides listener addition and removal.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.gwt.view.client.SelectionModel
SelectionModel.AbstractSelectionModel<T>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSelectionModel(ProvidesKey<T> keyProvider)
Construct an AbstractSelectionModel with a given key provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HandlerRegistration
addSelectionChangeHandler(SelectionChangeEvent.Handler handler)
Adds aSelectionChangeEvent
handler.void
fireEvent(GwtEvent<?> event)
Fires the given event to the handlers listening to the event's type.protected void
fireSelectionChangeEvent()
Fire aSelectionChangeEvent
.java.lang.Object
getKey(T item)
Get the key for a list item.ProvidesKey<T>
getKeyProvider()
Returns aProvidesKey
instance that simply returns the input data item.protected boolean
isEventCancelled()
Return true if the next scheduled event should be canceled.protected boolean
isEventScheduled()
Return true if an event is scheduled to be fired.protected void
scheduleSelectionChangeEvent()
Schedules aSelectionChangeEvent
to fire at the end of the current event loop.protected void
setEventCancelled(boolean isEventCancelled)
Set whether the next scheduled event should be canceled.protected void
setEventScheduled(boolean isEventScheduled)
Set whether an event is scheduled to be fired.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.gwt.view.client.SelectionModel
isSelected, setSelected
-
-
-
-
Constructor Detail
-
AbstractSelectionModel
protected AbstractSelectionModel(ProvidesKey<T> keyProvider)
Construct an AbstractSelectionModel with a given key provider.- Parameters:
keyProvider
- an instance of ProvidesKey, or null if the record object should act as its own key
-
-
Method Detail
-
addSelectionChangeHandler
public HandlerRegistration addSelectionChangeHandler(SelectionChangeEvent.Handler handler)
Description copied from interface:SelectionModel
Adds aSelectionChangeEvent
handler.- Specified by:
addSelectionChangeHandler
in interfaceSelectionChangeEvent.HasSelectionChangedHandlers
- Specified by:
addSelectionChangeHandler
in interfaceSelectionModel<T>
- Parameters:
handler
- the handler- Returns:
- the registration for the event
-
fireEvent
public void fireEvent(GwtEvent<?> event)
Description copied from interface:HasHandlers
Fires the given event to the handlers listening to the event's type.Any exceptions thrown by handlers will be bundled into a
UmbrellaException
and then re-thrown after all handlers have completed. An exception thrown by a handler will not prevent other handlers from executing.- Specified by:
fireEvent
in interfaceHasHandlers
- Parameters:
event
- the event
-
getKey
public java.lang.Object getKey(T item)
Description copied from interface:ProvidesKey
Get the key for a list item.- Specified by:
getKey
in interfaceProvidesKey<T>
- Parameters:
item
- the list item- Returns:
- the key that represents the item
-
getKeyProvider
public ProvidesKey<T> getKeyProvider()
Returns aProvidesKey
instance that simply returns the input data item.- Returns:
- the key provider, which may be null
-
fireSelectionChangeEvent
protected void fireSelectionChangeEvent()
Fire aSelectionChangeEvent
. Multiple firings may be coalesced.
-
isEventCancelled
protected boolean isEventCancelled()
Return true if the next scheduled event should be canceled.- Returns:
- true if the event is canceled
-
isEventScheduled
protected boolean isEventScheduled()
Return true if an event is scheduled to be fired.- Returns:
- true if the event is scheduled
-
scheduleSelectionChangeEvent
protected void scheduleSelectionChangeEvent()
Schedules aSelectionChangeEvent
to fire at the end of the current event loop.
-
setEventCancelled
protected void setEventCancelled(boolean isEventCancelled)
Set whether the next scheduled event should be canceled.- Parameters:
isEventCancelled
- if true, cancel the event
-
setEventScheduled
protected void setEventScheduled(boolean isEventScheduled)
Set whether an event is scheduled to be fired.- Parameters:
isEventScheduled
- if true, schedule the event
-
-