public class CheckList.CheckListSelectionModel
extends java.lang.Object
implements javax.swing.ListSelectionModel, java.lang.Cloneable, java.io.Serializable
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
ListSelectionModel
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected boolean |
leadAnchorNotificationEnabled |
protected javax.swing.event.EventListenerList |
listenerList |
Constructor and Description |
---|
CheckList.CheckListSelectionModel() |
Modifier and Type | Method and Description |
---|---|
void |
addListSelectionListener(javax.swing.event.ListSelectionListener l) |
void |
addSelectionInterval(int index0,
int index1) |
void |
clearSelection() |
java.lang.Object |
clone()
Returns a clone of the reciever with the same selection.
|
protected void |
fireValueChanged(boolean isAdjusting)
Notify listeners that we have ended a series of adjustments.
|
protected void |
fireValueChanged(int firstIndex,
int lastIndex)
Notify ListSelectionListeners that the value of the selection,
in the closed interval firstIndex,lastIndex, has changed.
|
protected void |
fireValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting) |
int |
getAnchorSelectionIndex() |
int |
getLeadSelectionIndex() |
int |
getMaxSelectionIndex() |
int |
getMinSelectionIndex() |
int |
getSelectionMode() |
boolean |
getValueIsAdjusting() |
void |
insertIndexInterval(int index,
int length,
boolean before)
Insert length indices beginning before/after index.
|
boolean |
isLeadAnchorNotificationEnabled()
Returns the value of the leadAnchorNotificationEnabled flag.
|
boolean |
isSelectedIndex(int index) |
boolean |
isSelectionEmpty() |
void |
removeIndexInterval(int index0,
int index1)
Remove the indices in the interval index0,index1 (inclusive) from
the selection model.
|
void |
removeListSelectionListener(javax.swing.event.ListSelectionListener l) |
void |
removeSelectionInterval(int index0,
int index1) |
void |
setAnchorSelectionIndex(int anchorIndex)
Set the anchor selection index, leaving all selection values unchanged.
|
void |
setLeadAnchorNotificationEnabled(boolean flag)
Sets the value of the leadAnchorNotificationEnabled flag.
|
void |
setLeadSelectionIndex(int leadIndex)
Set the lead selection index, ensuring that values between the
anchor and the new lead are either all selected or all deselected.
|
void |
setSelectionInterval(int index0,
int index1) |
void |
setSelectionMode(int selectionMode) |
void |
setValueIsAdjusting(boolean isAdjusting) |
java.lang.String |
toString()
Returns a string that displays and identifies this
object's properties.
|
protected javax.swing.event.EventListenerList listenerList
protected boolean leadAnchorNotificationEnabled
public int getMinSelectionIndex()
getMinSelectionIndex
in interface javax.swing.ListSelectionModel
public int getMaxSelectionIndex()
getMaxSelectionIndex
in interface javax.swing.ListSelectionModel
public boolean getValueIsAdjusting()
getValueIsAdjusting
in interface javax.swing.ListSelectionModel
public int getSelectionMode()
getSelectionMode
in interface javax.swing.ListSelectionModel
public void setSelectionMode(int selectionMode)
setSelectionMode
in interface javax.swing.ListSelectionModel
public boolean isSelectedIndex(int index)
isSelectedIndex
in interface javax.swing.ListSelectionModel
public boolean isSelectionEmpty()
isSelectionEmpty
in interface javax.swing.ListSelectionModel
public void addListSelectionListener(javax.swing.event.ListSelectionListener l)
addListSelectionListener
in interface javax.swing.ListSelectionModel
public void removeListSelectionListener(javax.swing.event.ListSelectionListener l)
removeListSelectionListener
in interface javax.swing.ListSelectionModel
protected void fireValueChanged(boolean isAdjusting)
protected void fireValueChanged(int firstIndex, int lastIndex)
protected void fireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
firstIndex
- The first index in the interval.index1
- The last index in the interval.isAdjusting
- True if this is the final change in a series of them.EventListenerList
public void setLeadAnchorNotificationEnabled(boolean flag)
isLeadAnchorNotificationEnabled()
public boolean isLeadAnchorNotificationEnabled()
setLeadAnchorNotificationEnabled(boolean)
public void clearSelection()
clearSelection
in interface javax.swing.ListSelectionModel
public void setSelectionInterval(int index0, int index1)
setSelectionInterval
in interface javax.swing.ListSelectionModel
public void addSelectionInterval(int index0, int index1)
addSelectionInterval
in interface javax.swing.ListSelectionModel
public void removeSelectionInterval(int index0, int index1)
removeSelectionInterval
in interface javax.swing.ListSelectionModel
public void insertIndexInterval(int index, int length, boolean before)
insertIndexInterval
in interface javax.swing.ListSelectionModel
public void removeIndexInterval(int index0, int index1)
removeIndexInterval
in interface javax.swing.ListSelectionModel
public void setValueIsAdjusting(boolean isAdjusting)
setValueIsAdjusting
in interface javax.swing.ListSelectionModel
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if the receiver does not
both (a) implement the Cloneable interface and (b) define a
clone
method.public int getAnchorSelectionIndex()
getAnchorSelectionIndex
in interface javax.swing.ListSelectionModel
public int getLeadSelectionIndex()
getLeadSelectionIndex
in interface javax.swing.ListSelectionModel
public void setAnchorSelectionIndex(int anchorIndex)
setAnchorSelectionIndex
in interface javax.swing.ListSelectionModel
getAnchorSelectionIndex()
,
setLeadSelectionIndex(int)
public void setLeadSelectionIndex(int leadIndex)
If the value at the anchor index is not selected, do the same thing in reverse, selecting values in the old range and deslecting values in the new one.
Generate a single event for this change and notify all listeners. For the purposes of generating minimal bounds in this event, do the operation in a single pass; that way the first and last index inside the ListSelectionEvent that is broadcast will refer to cells that actually changed value because of this method. If, instead, this operation were done in two steps the effect on the selection state would be the same but two events would be generated and the bounds around the changed values would be wider, including cells that had been first cleared only to later be set.
This method can be used in the mouseDragged() method of a UI class to extend a selection.
setLeadSelectionIndex
in interface javax.swing.ListSelectionModel
getLeadSelectionIndex()
,
setAnchorSelectionIndex(int)