DefaultSelectionModel (GWT Javadoc)

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.view.client
Class DefaultSelectionModel<T>

    java.lang.Object
      com.google.gwt.view.client.SelectionModel.AbstractSelectionModel<T>
          com.google.gwt.view.client.DefaultSelectionModel<T>

Type Parameters:
  `T` - the data type of records in the list

All Implemented Interfaces:
  HasHandlers, ProvidesKey<T>, SelectionChangeEvent.HasSelectionChangedHandlers, SelectionModel<T>

    public abstract class DefaultSelectionModel<T>

extends SelectionModel.AbstractSelectionModel<T>

A convenience `SelectionModel` that allows items to be selected according to a subclass-defined rule, plus a list of positive or negative exceptions.

Nested Class Summary

Nested classes/interfaces inherited from interface com.google.gwt.view.client.SelectionModel
`SelectionModel.AbstractSelectionModel<T>`

Constructor Summary
`DefaultSelectionModel()` Constructs a DefaultSelectionModel without a key provider.
`DefaultSelectionModel(ProvidesKey<T> keyProvider)` Constructs a DefaultSelectionModel with the given key provider.

Method Summary
`void` | `clearExceptions()` Removes all exceptions.
`protected void` | `fireSelectionChangeEvent()` Fire a `SelectionChangeEvent`.
`protected java.util.Map<java.lang.Object,java.lang.Boolean>` | `getExceptions(java.util.Map<java.lang.Object,java.lang.Boolean> output)` Copies the exceptions map into a user-supplied map.
`abstract boolean` | `isDefaultSelected(T item)` Returns true if the given item should be selected by default.
`boolean` | `isSelected(T item)` If the given item is marked as an exception, return the exception value.
`void` | `setSelected(T item, boolean selected)` Sets an item's selection state.

Methods inherited from class com.google.gwt.view.client.SelectionModel.AbstractSelectionModel
`addSelectionChangeHandler, fireEvent, getKey, getKeyProvider, isEventCancelled, isEventScheduled, scheduleSelectionChangeEvent, setEventCancelled, setEventScheduled`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultSelectionModel

    public DefaultSelectionModel()

  Constructs a DefaultSelectionModel without a key provider.

### DefaultSelectionModel

    public DefaultSelectionModel(ProvidesKey<T> keyProvider)

  Constructs a DefaultSelectionModel with the given key provider.

  Parameters:
    `keyProvider` - an instance of ProvidesKey, or null if the item should act as its own key

Method Detail

### clearExceptions

    public void clearExceptions()

  Removes all exceptions.

### isDefaultSelected

    public abstract boolean isDefaultSelected(T item)

  Returns true if the given item should be selected by default. Subclasses implement this method in order to define the default selection behavior.

  Parameters:
    `item` - an object of this `SelectionModel`'s type
  Returns:
    true if the item should be selected by default

### isSelected

    public boolean isSelected(T item)

  If the given item is marked as an exception, return the exception value. Otherwise, return the value of isDefaultSelected for the given item.

  Parameters:
    `item` - the object
  Returns:
    true if selected, false if not

### setSelected

    public void setSelected(T item,
                            boolean selected)

  Sets an item's selection state. If the item is currently marked as an exception, and the new selected state differs from the previous selected state, the object is removed from the list of exceptions. Otherwise, the object is added to the list of exceptions with the given selected state.

  Parameters:
    `item` - the object to select or deselect
    `selected` - true to select, false to deselect

### fireSelectionChangeEvent

    protected void fireSelectionChangeEvent()

  Description copied from class: `SelectionModel.AbstractSelectionModel`
  Fire a `SelectionChangeEvent`. Multiple firings may be coalesced.

  Overrides:
    `fireSelectionChangeEvent` in class `SelectionModel.AbstractSelectionModel<T>`

### getExceptions

    protected java.util.Map<java.lang.Object,java.lang.Boolean> getExceptions(java.util.Map<java.lang.Object,java.lang.Boolean> output)

  Copies the exceptions map into a user-supplied map.

  Parameters:
    `output` - the user supplied map
  Returns:
    the user supplied map

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD