public class DefaultListSelectionModel extends java.lang.Object implements ListSelectionModel
| Modifier and Type | Field and Description |
|---|---|
protected java.util.ArrayList |
_listeners
The list of listeners.
|
protected java.util.TreeSet |
_selection
The set of selected indices.
|
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION| Constructor and Description |
|---|
DefaultListSelectionModel() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected java.util.ArrayList _listeners
protected java.util.TreeSet _selection
public void addListSelectionListener(ListSelectionListener l_)
addListSelectionListener in interface ListSelectionModelpublic void removeListSelectionListener(ListSelectionListener l_)
removeListSelectionListener in interface ListSelectionModelpublic void setSelectionMode(int mode_)
setSelectionMode in interface ListSelectionModelpublic int getSelectionMode()
getSelectionMode in interface ListSelectionModelpublic boolean isSelectedIndex(int index)
isSelectedIndex in interface ListSelectionModelpublic int getMinSelectionIndex()
getMinSelectionIndex in interface ListSelectionModelpublic int getMaxSelectionIndex()
getMaxSelectionIndex in interface ListSelectionModelpublic boolean isSelectionEmpty()
isSelectionEmpty in interface ListSelectionModelpublic void clearSelection()
clearSelection in interface ListSelectionModelpublic void addSelectionInterval(int index0,
int index1)
addSelectionInterval in interface ListSelectionModelpublic void removeSelectionInterval(int index0,
int index1)
removeSelectionInterval in interface ListSelectionModelpublic void setSelectionInterval(int index0,
int index1)
setSelectionInterval in interface ListSelectionModelpublic void insertIndexInterval(int index,
int length,
boolean before)
insertIndexInterval in interface ListSelectionModelpublic void removeIndexInterval(int index0,
int index1)
removeIndexInterval in interface ListSelectionModelprotected void fireValueChanged(int firstindex_,
int lastindex_)
firstindex_ - The first index in the intervallastindex_ - The last index in the interval.