|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.gwt.view.client.DefaultSelectionEventManager<T>
T
- the data type of records in the listpublic class DefaultSelectionEventManager<T>
An implementation of CellPreviewEvent.Handler
that adds selection
support via the spacebar and mouse clicks and handles the control key.
If the HasData
source of the selection event uses a
MultiSelectionModel
, this manager additionally provides support for
shift key to select a range of values. For all other SelectionModel
s,
only the control key is supported.
Nested Class Summary | |
---|---|
static class |
DefaultSelectionEventManager.BlacklistEventTranslator<T>
An event translator that disables selection for the specified blacklisted columns. |
static class |
DefaultSelectionEventManager.CheckboxEventTranslator<T>
Implementation of DefaultSelectionEventManager.BlacklistEventTranslator that only triggers selection when
any checkbox is selected. |
static interface |
DefaultSelectionEventManager.EventTranslator<T>
Translates CellPreviewEvent s into DefaultSelectionEventManager.SelectAction s. |
static class |
DefaultSelectionEventManager.SelectAction
The action that controls how selection is handled. |
static class |
DefaultSelectionEventManager.WhitelistEventTranslator<T>
An event translator that allows selection only for the specified whitelisted columns. |
Constructor Summary | |
---|---|
protected |
DefaultSelectionEventManager(DefaultSelectionEventManager.EventTranslator<T> translator)
Construct a new DefaultSelectionEventManager using the specified
DefaultSelectionEventManager.BlacklistEventTranslator to control which DefaultSelectionEventManager.SelectAction to take for
each event. |
Method Summary | ||
---|---|---|
protected void |
clearSelection(MultiSelectionModel<? super T> selectionModel)
Removes all items from the selection. |
|
static
|
createBlacklistManager(int... blacklistedColumns)
Construct a new DefaultSelectionEventManager that ignores selection
for the columns in the specified blacklist. |
|
static
|
createCheckboxManager()
Construct a new DefaultSelectionEventManager that triggers
selection when any checkbox in any column is clicked. |
|
static
|
createCheckboxManager(int column)
Construct a new DefaultSelectionEventManager that triggers
selection when a checkbox in the specified column is clicked. |
|
static
|
createCustomManager(DefaultSelectionEventManager.EventTranslator<T> translator)
Create a new DefaultSelectionEventManager using the specified
DefaultSelectionEventManager.BlacklistEventTranslator to control which DefaultSelectionEventManager.SelectAction to take for
each event. |
|
static
|
createDefaultManager()
Create a new DefaultSelectionEventManager that handles selection
via user interactions. |
|
static
|
createWhitelistManager(int... whitelistedColumns)
Construct a new DefaultSelectionEventManager that allows selection
only for the columns in the specified whitelist. |
|
void |
doMultiSelection(MultiSelectionModel<? super T> selectionModel,
HasData<T> display,
int row,
T rowValue,
DefaultSelectionEventManager.SelectAction action,
boolean selectRange,
boolean clearOthers)
Update the selection model based on a user selection event. |
|
protected void |
handleMultiSelectionEvent(CellPreviewEvent<T> event,
DefaultSelectionEventManager.SelectAction action,
MultiSelectionModel<? super T> selectionModel)
Handle an event that could cause a value to be selected for a MultiSelectionModel . |
|
protected void |
handleSelectionEvent(CellPreviewEvent<T> event,
DefaultSelectionEventManager.SelectAction action,
SelectionModel<? super T> selectionModel)
Handle an event that could cause a value to be selected. |
|
void |
onCellPreview(CellPreviewEvent<T> event)
Called when CellPreviewEvent is fired. |
|
protected void |
selectOne(MultiSelectionModel<? super T> selectionModel,
T target,
boolean selected,
boolean clearOthers)
Selects the given item, optionally clearing any prior selection. |
|
protected void |
setRangeSelection(MultiSelectionModel<? super T> selectionModel,
HasData<T> display,
Range range,
boolean addToSelection,
boolean clearOthers)
Select or deselect a range of row indexes, optionally deselecting all other values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DefaultSelectionEventManager(DefaultSelectionEventManager.EventTranslator<T> translator)
DefaultSelectionEventManager
using the specified
DefaultSelectionEventManager.BlacklistEventTranslator
to control which DefaultSelectionEventManager.SelectAction
to take for
each event.
translator
- the DefaultSelectionEventManager.BlacklistEventTranslator
to useMethod Detail |
---|
public static <T> DefaultSelectionEventManager<T> createBlacklistManager(int... blacklistedColumns)
DefaultSelectionEventManager
that ignores selection
for the columns in the specified blacklist.
T
- the data type of the displayblacklistedColumns
- the columns to include in the blacklist
DefaultSelectionEventManager
instancepublic static <T> DefaultSelectionEventManager<T> createCheckboxManager()
DefaultSelectionEventManager
that triggers
selection when any checkbox in any column is clicked.
T
- the data type of the display
DefaultSelectionEventManager
instancepublic static <T> DefaultSelectionEventManager<T> createCheckboxManager(int column)
DefaultSelectionEventManager
that triggers
selection when a checkbox in the specified column is clicked.
T
- the data type of the displaycolumn
- the column to handle
DefaultSelectionEventManager
instancepublic static <T> DefaultSelectionEventManager<T> createCustomManager(DefaultSelectionEventManager.EventTranslator<T> translator)
DefaultSelectionEventManager
using the specified
DefaultSelectionEventManager.BlacklistEventTranslator
to control which DefaultSelectionEventManager.SelectAction
to take for
each event.
T
- the data type of the displaytranslator
- the DefaultSelectionEventManager.BlacklistEventTranslator
to use
DefaultSelectionEventManager
instancepublic static <T> DefaultSelectionEventManager<T> createDefaultManager()
DefaultSelectionEventManager
that handles selection
via user interactions.
T
- the data type of the display
DefaultSelectionEventManager
instancepublic static <T> DefaultSelectionEventManager<T> createWhitelistManager(int... whitelistedColumns)
DefaultSelectionEventManager
that allows selection
only for the columns in the specified whitelist.
T
- the data type of the displaywhitelistedColumns
- the columns to include in the whitelist
DefaultSelectionEventManager
instancepublic void doMultiSelection(MultiSelectionModel<? super T> selectionModel, HasData<T> display, int row, T rowValue, DefaultSelectionEventManager.SelectAction action, boolean selectRange, boolean clearOthers)
selectionModel
- the selection model to updaterow
- the absolute index of the selected rowrowValue
- the selected row valueaction
- the DefaultSelectionEventManager.SelectAction
to applyselectRange
- true to select the range from the last selected rowclearOthers
- true to clear the current selectionpublic void onCellPreview(CellPreviewEvent<T> event)
CellPreviewEvent.Handler
CellPreviewEvent
is fired.
onCellPreview
in interface CellPreviewEvent.Handler<T>
event
- the CellPreviewEvent
that was firedprotected void clearSelection(MultiSelectionModel<? super T> selectionModel)
selectionModel
- the MultiSelectionModel
to clearprotected void handleMultiSelectionEvent(CellPreviewEvent<T> event, DefaultSelectionEventManager.SelectAction action, MultiSelectionModel<? super T> selectionModel)
MultiSelectionModel
. This overloaded method adds support for both
the control and shift keys. If the shift key is held down, all rows between
the previous selected row and the current row are selected.
event
- the CellPreviewEvent
that triggered selectionaction
- the action to handleselectionModel
- the SelectionModel
to updateprotected void handleSelectionEvent(CellPreviewEvent<T> event, DefaultSelectionEventManager.SelectAction action, SelectionModel<? super T> selectionModel)
SelectionModel
. Pressing the space bar or ctrl+click will
toggle the selection state. Clicking selects the row if it is not selected.
event
- the CellPreviewEvent
that triggered selectionaction
- the action to handleselectionModel
- the SelectionModel
to updateprotected void selectOne(MultiSelectionModel<? super T> selectionModel, T target, boolean selected, boolean clearOthers)
selectionModel
- the MultiSelectionModel
to updatetarget
- the item to selectselected
- true to select, false to deselectclearOthers
- true to clear all other selected itemsprotected void setRangeSelection(MultiSelectionModel<? super T> selectionModel, HasData<T> display, Range range, boolean addToSelection, boolean clearOthers)
selectionModel
- the MultiSelectionModel
to updatedisplay
- the HasData
source of the selection eventrange
- the Range
of rows to select or deselectaddToSelection
- true to select, false to deselect the rangeclearOthers
- true to deselect rows not in the range
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |