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

## charvax.swing
Class DefaultListSelectionModel

    java.lang.Object
      charvax.swing.DefaultListSelectionModel

All Implemented Interfaces:
  ListSelectionModel

public class DefaultListSelectionModel
extends java.lang.Object
implements ListSelectionModel

Default data model for list selections.

Field Summary
`protected java.util.ArrayList` | `_listeners` The list of listeners.
`protected java.util.TreeSet` | `_selection` The set of selected indices.

Fields inherited from interface charvax.swing.ListSelectionModel
`MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION`

Constructor Summary
`DefaultListSelectionModel()`

Method Summary
`void` | `addListSelectionListener(ListSelectionListener l_)` Add a listener to the list that is notified each time a change to the selection occurs.
`void` | `addSelectionInterval(int index0, int index1)` Change the selection to be the set union between the current selection and the indices between index0 and index1 inclusive.
`void` | `clearSelection()` Change the selection to be the empty set.
`protected void` | `fireValueChanged(int firstindex_, int lastindex_)` Notify the listeners that the selection has changed.
`int` | `getMaxSelectionIndex()` Returns the last selected index, or -1 if the selection is empty.
`int` | `getMinSelectionIndex()` Returns the first selected index, or -1 if the selection is empty.
`int` | `getSelectionMode()` Returns the current selection mode.
`void` | `insertIndexInterval(int index, int length, boolean before)` Insert length indices beginning before/after index, without notifying the ListSelectionListeners.
`boolean` | `isSelectedIndex(int index)` Returns true if the specified index is selected.
`boolean` | `isSelectionEmpty()` Returns true if no indices are selected.
`void` | `removeIndexInterval(int index0, int index1)` Remove the indices in the interval index0,index1 (inclusive) from the selection model, without notifying the ListSelectionListeners.
`void` | `removeListSelectionListener(ListSelectionListener l_)` Remove a listener from the list.
`void` | `removeSelectionInterval(int index0, int index1)` Change the selection to be the set difference between the current selection and the indices between index0 and index1 inclusive.
`void` | `setSelectionInterval(int index0, int index1)` Change the selection to be between index0 and index1 inclusive.
`void` | `setSelectionMode(int mode_)` Set the selection mode.

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

Field Detail

### _listeners

    protected java.util.ArrayList _listeners

  The list of listeners.

### _selection

    protected java.util.TreeSet _selection

  The set of selected indices.

Constructor Detail

### DefaultListSelectionModel

    public DefaultListSelectionModel()

Method Detail

### addListSelectionListener

    public void addListSelectionListener(ListSelectionListener l_)

  Add a listener to the list that is notified each time a change to the selection occurs.

  Specified by:
    `addListSelectionListener` in interface `ListSelectionModel`

### removeListSelectionListener

    public void removeListSelectionListener(ListSelectionListener l_)

  Remove a listener from the list.

  Specified by:
    `removeListSelectionListener` in interface `ListSelectionModel`

### setSelectionMode

    public void setSelectionMode(int mode_)

  Set the selection mode. The following modes are allowed:
  - SINGLE_SELECTION. Only one list index can be selected at a time.
  - SINGLE_INTERVAL_SELECTION. One contiguous index interval can be set at at time.

  Specified by:
    `setSelectionMode` in interface `ListSelectionModel`

### getSelectionMode

    public int getSelectionMode()

  Returns the current selection mode.

  Specified by:
    `getSelectionMode` in interface `ListSelectionModel`

### isSelectedIndex

    public boolean isSelectedIndex(int index)

  Returns true if the specified index is selected.

  Specified by:
    `isSelectedIndex` in interface `ListSelectionModel`

### getMinSelectionIndex

    public int getMinSelectionIndex()

  Returns the first selected index, or -1 if the selection is empty.

  Specified by:
    `getMinSelectionIndex` in interface `ListSelectionModel`

### getMaxSelectionIndex

    public int getMaxSelectionIndex()

  Returns the last selected index, or -1 if the selection is empty.

  Specified by:
    `getMaxSelectionIndex` in interface `ListSelectionModel`

### isSelectionEmpty

    public boolean isSelectionEmpty()

  Returns true if no indices are selected.

  Specified by:
    `isSelectionEmpty` in interface `ListSelectionModel`

### clearSelection

    public void clearSelection()

  Change the selection to be the empty set. If this represents a change to the selection then notify each ListSelectionListener.

  Specified by:
    `clearSelection` in interface `ListSelectionModel`

### addSelectionInterval

    public void addSelectionInterval(int index0,
                                     int index1)

  Change the selection to be the set union between the current selection and the indices between index0 and index1 inclusive. If this represents a change to the current selection, then notify each ListSelectionListener. Note that index0 does not have to be less than or equal to index1.

  Specified by:
    `addSelectionInterval` in interface `ListSelectionModel`

### removeSelectionInterval

    public void removeSelectionInterval(int index0,
                                        int index1)

  Change the selection to be the set difference between the current selection and the indices between index0 and index1 inclusive. If this represents a change to the current selection, then notify each ListSelectionListener. Note that index0 does not have to be less than or equal to index1.

  Specified by:
    `removeSelectionInterval` in interface `ListSelectionModel`

### setSelectionInterval

    public void setSelectionInterval(int index0,
                                     int index1)

  Change the selection to be between index0 and index1 inclusive. If this represents a change to the selection, then notify each ListSelectionListener. Note that index0 doesn't have to be less than or equal to index1.

  Specified by:
    `setSelectionInterval` in interface `ListSelectionModel`

### insertIndexInterval

    public void insertIndexInterval(int index,
                                    int length,
                                    boolean before)

  Insert length indices beginning before/after index, without notifying the ListSelectionListeners. This is typically called to sync the selection model with a corresponding change in the data model.

  Specified by:
    `insertIndexInterval` in interface `ListSelectionModel`

### removeIndexInterval

    public void removeIndexInterval(int index0,
                                    int index1)

  Remove the indices in the interval index0,index1 (inclusive) from the selection model, without notifying the ListSelectionListeners. This is typically called to sync the selection model with a corresponding change in the data model.

  Specified by:
    `removeIndexInterval` in interface `ListSelectionModel`

### fireValueChanged

    protected void fireValueChanged(int firstindex_,
                                    int lastindex_)

  Notify the listeners that the selection has changed.

  Parameters:
    `firstindex_` - The first index in the interval
    `lastindex_` - The last index in the interval.

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