Spec-Zone .ru
спецификации, руководства, описания, API
|
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.DefaultListSelectionModel
Default data model for list selections.
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 FormField Summary | |
protected boolean |
leadAnchorNotificationEnabled
|
protected EventListenerList |
listenerList
|
Fields inherited from interface javax.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's notified each time a change to the selection occurs. |
void |
addSelectionInterval(int index0,
int index1)
Change the selection to be the set union of the current selection and the indices between index0 and index1 inclusive. |
void |
clearSelection()
Change the selection to the empty set. |
Object |
clone()
Returns a clone of this selection model with the same selection. |
protected void |
fireValueChanged(boolean isAdjusting)
Notifies listeners that we have ended a series of adjustments. |
protected void |
fireValueChanged(int firstIndex,
int lastIndex)
Notifies 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()
Return the first index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval(). |
int |
getLeadSelectionIndex()
Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval(). |
EventListener[] |
getListeners(Class listenerType)
Returns an array of all the listeners of the given type that were added to this model. |
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 selection mode. |
boolean |
getValueIsAdjusting()
Returns true if the value is undergoing a series of changes. |
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)
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. |
void |
removeListSelectionListener(ListSelectionListener l)
Remove a listener from the list that's notified each time a change to the selection occurs. |
void |
removeSelectionInterval(int index0,
int index1)
Change the selection to be the set difference of the current selection and the indices between index0 and index1 inclusive. |
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)
Sets 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)
Change the selection to be between index0 and index1 inclusive. |
void |
setSelectionMode(int selectionMode)
Sets the selection mode. |
void |
setValueIsAdjusting(boolean isAdjusting)
This property is true if upcoming changes to the value of the model should be considered a single event. |
String |
toString()
Returns a string that displays and identifies this object's properties. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected EventListenerList listenerList
protected boolean leadAnchorNotificationEnabled
Constructor Detail |
public DefaultListSelectionModel()
Method Detail |
public int getMinSelectionIndex()
ListSelectionModel
getMinSelectionIndex
in interface ListSelectionModel
public int getMaxSelectionIndex()
ListSelectionModel
getMaxSelectionIndex
in interface ListSelectionModel
public boolean getValueIsAdjusting()
ListSelectionModel
getValueIsAdjusting
in interface ListSelectionModel
javax.swing.ListSelectionModel
ListSelectionModel.setValueIsAdjusting(boolean)
public int getSelectionMode()
getSelectionMode
in interface ListSelectionModel
getSelectionMode()
public void setSelectionMode(int selectionMode)
setSelectionMode
in interface ListSelectionModel
selectionMode
- one of three values:
IllegalArgumentException
- if selectionMode
is not one of the legal values shown abovesetSelectionMode(int)
public boolean isSelectedIndex(int index)
ListSelectionModel
isSelectedIndex
in interface ListSelectionModel
public boolean isSelectionEmpty()
ListSelectionModel
isSelectionEmpty
in interface ListSelectionModel
public void addListSelectionListener(ListSelectionListener l)
ListSelectionModel
addListSelectionListener
in interface ListSelectionModel
javax.swing.ListSelectionModel
l
- the ListSelectionListenerListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener)
,
ListSelectionModel.setSelectionInterval(int, int)
,
ListSelectionModel.addSelectionInterval(int, int)
,
ListSelectionModel.removeSelectionInterval(int, int)
,
ListSelectionModel.clearSelection()
,
ListSelectionModel.insertIndexInterval(int, int, boolean)
,
ListSelectionModel.removeIndexInterval(int, int)
public void removeListSelectionListener(ListSelectionListener l)
ListSelectionModel
removeListSelectionListener
in interface ListSelectionModel
javax.swing.ListSelectionModel
l
- the ListSelectionListenerListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)
protected void fireValueChanged(boolean isAdjusting)
protected void fireValueChanged(int firstIndex, int lastIndex)
ListSelectionListeners
that the value
of the selection, in the closed interval firstIndex
,
lastIndex
, has changed.protected void fireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
firstIndex
- the first index in the intervallastIndex
- the last index in the intervalisAdjusting
- true if this is the final change in a series of
adjustmentsEventListenerList
public EventListener[] getListeners(Class listenerType)
public void setLeadAnchorNotificationEnabled(boolean flag)
isLeadAnchorNotificationEnabled()
public boolean isLeadAnchorNotificationEnabled()
leadAnchorNotificationEnabled
flag.
When leadAnchorNotificationEnabled
is true the model
generates notification events with bounds that cover all the changes to
the selection plus the changes to the lead and anchor indices.
Setting the flag to false causes a narrowing of the event's bounds to
include only the elements that have been selected or deselected since
the last change. Either way, the model continues to maintain the lead
and anchor variables internally. The default is true.leadAnchorNotificationEnabled
flagsetLeadAnchorNotificationEnabled(boolean)
public void clearSelection()
ListSelectionModel
clearSelection
in interface ListSelectionModel
javax.swing.ListSelectionModel
ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectionInterval(int index0, int index1)
ListSelectionModel
setSelectionInterval
in interface ListSelectionModel
javax.swing.ListSelectionModel
index0
- one end of the interval.index1
- other end of the intervalListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)
public void addSelectionInterval(int index0, int index1)
ListSelectionModel
addSelectionInterval
in interface ListSelectionModel
javax.swing.ListSelectionModel
index0
- one end of the interval.index1
- other end of the intervalListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)
public void removeSelectionInterval(int index0, int index1)
ListSelectionModel
removeSelectionInterval
in interface ListSelectionModel
javax.swing.ListSelectionModel
index0
- one end of the interval.index1
- other end of the intervalListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)
public void insertIndexInterval(int index, int length, boolean before)
insertIndexInterval
in interface ListSelectionModel
public void removeIndexInterval(int index0, int index1)
removeIndexInterval
in interface ListSelectionModel
public void setValueIsAdjusting(boolean isAdjusting)
ListSelectionModel
setValueIsAdjusting
in interface ListSelectionModel
javax.swing.ListSelectionModel
valueIsAdjusting
- The new value of the property.ListSelectionModel.getValueIsAdjusting()
public String toString()
toString
in class Object
String
representation of this objectpublic Object clone() throws CloneNotSupportedException
listenerLists
are not duplicated.clone
in class Object
CloneNotSupportedException
- if the selection model does not
both (a) implement the Cloneable interface and (b) define a
clone
method.public int getAnchorSelectionIndex()
ListSelectionModel
getAnchorSelectionIndex
in interface ListSelectionModel
javax.swing.ListSelectionModel
ListSelectionModel.getLeadSelectionIndex()
,
ListSelectionModel.setSelectionInterval(int, int)
,
ListSelectionModel.addSelectionInterval(int, int)
public int getLeadSelectionIndex()
ListSelectionModel
getLeadSelectionIndex
in interface ListSelectionModel
javax.swing.ListSelectionModel
ListSelectionModel.getAnchorSelectionIndex()
,
ListSelectionModel.setSelectionInterval(int, int)
,
ListSelectionModel.addSelectionInterval(int, int)
public void setAnchorSelectionIndex(int anchorIndex)
setAnchorSelectionIndex
in interface 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 ListSelectionModel
getLeadSelectionIndex()
,
setAnchorSelectionIndex(int)
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.