Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## echopointng.model
Class DefaultSingleSelectionModel

    java.lang.Object
      echopointng.model.DefaultSingleSelectionModel

All Implemented Interfaces:
  SingleSelectionModel, java.io.Serializable

    public class DefaultSingleSelectionModel

extends java.lang.Object
implements SingleSelectionModel, java.io.Serializable

A generic implementation of SingleSelectionModel.

This class will perform an optimisation check when the selected index is set and will only fire a ChangeEvent if the index actually changes from the previous value.

See Also:
  Serialized Form

Field Summary
`protected ChangeEvent` | `changeEvent` Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property.
`protected EventListenerList` | `listenerList`

Constructor Summary
`DefaultSingleSelectionModel()` Initializes selectedIndex to `-1`
`DefaultSingleSelectionModel(int index)` Initializes selectedIndex to index

Method Summary
`void` | `addChangeListener(ChangeListener l)` Adds listener as a listener to changes in the model.
`void` | `clearSelection()` Clears the selection (to -1).
`void` | `fireStateChanged()` Notifies all listeners that have registered for this event type.
`int` | `getSelectedIndex()` Returns the model's selection.
`boolean` | `isSelected()` Returns true if the selection model currently has a selected value.
`void` | `removeChangeListener(ChangeListener l)` Removes listener as a listener to changes in the model.
`void` | `setSelectedIndex(int index)` Sets the model's selected index to index .

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

Field Detail

### changeEvent

    protected transient ChangeEvent changeEvent

  Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".

### listenerList

    protected EventListenerList listenerList

Constructor Detail

### DefaultSingleSelectionModel

    public DefaultSingleSelectionModel()

  Initializes selectedIndex to `-1`

### DefaultSingleSelectionModel

    public DefaultSingleSelectionModel(int index)

  Initializes selectedIndex to index

Method Detail

### addChangeListener

    public void addChangeListener(ChangeListener l)

  Description copied from interface: `SingleSelectionModel`
  Adds listener as a listener to changes in the model.

  Specified by:
    `addChangeListener` in interface `SingleSelectionModel`
  Parameters:
    `l` - the ChangeListener to add
  See Also:
    `SingleSelectionModel.addChangeListener(nextapp.echo2.app.event.ChangeListener)`

### clearSelection

    public void clearSelection()

  Description copied from interface: `SingleSelectionModel`
  Clears the selection (to -1).

  Specified by:
    `clearSelection` in interface `SingleSelectionModel`
  See Also:
    `SingleSelectionModel.clearSelection()`

### fireStateChanged

    public void fireStateChanged()

  Notifies all listeners that have registered for this event type.

### getSelectedIndex

    public int getSelectedIndex()

  Description copied from interface: `SingleSelectionModel`
  Returns the model's selection.

  Specified by:
    `getSelectedIndex` in interface `SingleSelectionModel`
  Returns:
    the model's selection, or -1 if there is no selection
  See Also:
    `SingleSelectionModel.getSelectedIndex()`

### isSelected

    public boolean isSelected()

  Description copied from interface: `SingleSelectionModel`
  Returns true if the selection model currently has a selected value.

  Specified by:
    `isSelected` in interface `SingleSelectionModel`
  Returns:
    true if a value is currently selected
  See Also:
    `SingleSelectionModel.isSelected()`

### removeChangeListener

    public void removeChangeListener(ChangeListener l)

  Description copied from interface: `SingleSelectionModel`
  Removes listener as a listener to changes in the model.

  Specified by:
    `removeChangeListener` in interface `SingleSelectionModel`
  Parameters:
    `l` - the ChangeListener to remove
  See Also:
    `SingleSelectionModel.removeChangeListener(nextapp.echo2.app.event.ChangeListener)`

### setSelectedIndex

    public void setSelectedIndex(int index)

  Description copied from interface: `SingleSelectionModel`
  Sets the model's selected index to index .
  Notifies any listeners if the model changes

  Specified by:
    `setSelectedIndex` in interface `SingleSelectionModel`
  See Also:
    `SingleSelectionModel.setSelectedIndex(int)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD