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 ListSelectionModel
public void removeListSelectionListener(ListSelectionListener l_)
removeListSelectionListener
in interface ListSelectionModel
public void setSelectionMode(int mode_)
setSelectionMode
in interface ListSelectionModel
public int getSelectionMode()
getSelectionMode
in interface ListSelectionModel
public boolean isSelectedIndex(int index)
isSelectedIndex
in interface ListSelectionModel
public int getMinSelectionIndex()
getMinSelectionIndex
in interface ListSelectionModel
public int getMaxSelectionIndex()
getMaxSelectionIndex
in interface ListSelectionModel
public boolean isSelectionEmpty()
isSelectionEmpty
in interface ListSelectionModel
public void clearSelection()
clearSelection
in interface ListSelectionModel
public void addSelectionInterval(int index0, int index1)
addSelectionInterval
in interface ListSelectionModel
public void removeSelectionInterval(int index0, int index1)
removeSelectionInterval
in interface ListSelectionModel
public void setSelectionInterval(int index0, int index1)
setSelectionInterval
in interface ListSelectionModel
public void insertIndexInterval(int index, int length, boolean before)
insertIndexInterval
in interface ListSelectionModel
public void removeIndexInterval(int index0, int index1)
removeIndexInterval
in interface ListSelectionModel
protected void fireValueChanged(int firstindex_, int lastindex_)
firstindex_
- The first index in the intervallastindex_
- The last index in the interval.