Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class com.sun.java.swing.DefaultListSelectionModel

java.lang.Object
  |
  +--com.sun.java.swing.DefaultListSelectionModel

public class DefaultListSelectionModel
extends java.lang.Object
implements ListSelectionModel, java.lang.Cloneable, java.io.Serializable
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 Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
ListSelectionModel, Serialized Form

Field Summary
boolean leadAnchorNotificationEnabled
           
EventListenerList listenerList
           
java.util.BitSet value
           
 
Constructor Summary
DefaultListSelectionModel()
           
 
Method Summary
void addListSelectionListener(ListSelectionListener l)
           
void addSelectionInterval(int index0, int index1)
           
void clearSelection()
           
java.lang.Object clone()
          Returns a clone of the reciever with the same selection. listenerLists are not duplicated.
void fireValueChanged(boolean isAdjusting)
          Notify listeners that we are beginning or ending a series of value changes
void fireValueChanged(int firstIndex, int lastIndex)
          Notify ListSelectionListeners that the value of the selection, in the closed interval firstIndex,lastIndex, has changed.
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(ListSelectionListener l)
           
void removeSelectionInterval(int index0, int index1)
           
void setAnchorSelectionIndex(int index)
           
void setLeadAnchorNotificationEnabled(boolean flag)
          Sets the value of the leadAnchorNotificationEnabled flag.
void setLeadSelectionIndex(int index)
           
void setSelectionInterval(int index0, int index1)
           
void setSelectionMode(int selectionMode)
           
void setValueIsAdjusting(boolean b)
           
java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

value

protected java.util.BitSet value

listenerList

protected EventListenerList listenerList

leadAnchorNotificationEnabled

protected boolean leadAnchorNotificationEnabled
Constructor Detail

DefaultListSelectionModel

public DefaultListSelectionModel()
Method Detail

getMinSelectionIndex

public int getMinSelectionIndex()
Description copied from interface:
Returns the first selected index or -1 if the selection is empty.
Specified by:
getMinSelectionIndex in interface ListSelectionModel

getMaxSelectionIndex

public int getMaxSelectionIndex()
Description copied from interface:
Returns the last selected index or -1 if the selection is empty.
Specified by:
getMaxSelectionIndex in interface ListSelectionModel

getValueIsAdjusting

public boolean getValueIsAdjusting()
Description copied from interface:
 
Specified by:
getValueIsAdjusting in interface ListSelectionModel

getSelectionMode

public int getSelectionMode()
Description copied from interface:
 
Specified by:
getSelectionMode in interface ListSelectionModel

setSelectionMode

public void setSelectionMode(int selectionMode)
Description copied from interface:
The following selectionMode values are allowed:
Specified by:
setSelectionMode in interface ListSelectionModel

isSelectedIndex

public boolean isSelectedIndex(int index)
Description copied from interface:
Returns true if the specified index is selected.
Specified by:
isSelectedIndex in interface ListSelectionModel

isSelectionEmpty

public boolean isSelectionEmpty()
Description copied from interface:
Returns true if no indices are selected.
Specified by:
isSelectionEmpty in interface ListSelectionModel

addListSelectionListener

public void addListSelectionListener(ListSelectionListener l)
Description copied from interface:
Add a listener to the list that's notified each time a change to the selection occurs.
Specified by:
addListSelectionListener in interface ListSelectionModel

removeListSelectionListener

public void removeListSelectionListener(ListSelectionListener l)
Description copied from interface:
Remove a listener from the list that's notified each time a change to the selection occurs.
Specified by:
removeListSelectionListener in interface ListSelectionModel

fireValueChanged

protected void fireValueChanged(boolean isAdjusting)
Notify listeners that we are beginning or ending a series of value changes

fireValueChanged

protected void fireValueChanged(int firstIndex,
                                int lastIndex)
Notify ListSelectionListeners that the value of the selection, in the closed interval firstIndex,lastIndex, has changed.

fireValueChanged

protected void fireValueChanged(int firstIndex,
                                int lastIndex,
                                boolean isAdjusting)
Parameters:
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.
See Also:
EventListenerList

clearSelection

public void clearSelection()
Description copied from interface:
Change the selection to the empty set. If this represents a change to the current selection then notify each ListSelectionListener.
Specified by:
clearSelection in interface ListSelectionModel

setLeadAnchorNotificationEnabled

public void setLeadAnchorNotificationEnabled(boolean flag)
Sets the value of the leadAnchorNotificationEnabled flag.
See Also:
isLeadAnchorNotificationEnabled()

isLeadAnchorNotificationEnabled

public boolean isLeadAnchorNotificationEnabled()
Returns the value of the 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 norrowing 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.
Returns:
the value of the leadAnchorNotificationEnabled flag
See Also:
setLeadAnchorNotificationEnabled(boolean)

setSelectionInterval

public void setSelectionInterval(int index0,
                                 int index1)
Description copied from interface:
Change the selection to be between index0 and index1 inclusive. If this represents a change to the current 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

addSelectionInterval

public void addSelectionInterval(int index0,
                                 int index1)
Description copied from interface:
Change the selection to be the set union of 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 doesn't have to be less than or equal to index1.
Specified by:
addSelectionInterval in interface ListSelectionModel

removeSelectionInterval

public void removeSelectionInterval(int index0,
                                    int index1)
Description copied from interface:
Change the selection to be the set difference of 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 doesn't have to be less than or equal to index1.
Specified by:
removeSelectionInterval in interface ListSelectionModel

insertIndexInterval

public void insertIndexInterval(int index,
                                int length,
                                boolean before)
Insert length indices beginning before/after index. 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. This is typically called to sync the selection model width a corresponding change in the data model. Note that (as always) index0 need not be <= index1.
Specified by:
removeIndexInterval in interface ListSelectionModel

setValueIsAdjusting

public void setValueIsAdjusting(boolean b)
Description copied from interface:
This property is true if upcoming changes to the value of the model should be considered a single event. For example if the model is being updated in response to a user drag, the value of the valueIsAdjusting property will be set to true when the drag is initiated and be set to false when the drag is finished. This property allows listeners to to update only when a change has been finalized, rather than always handling all of the intermediate values.
Specified by:
setValueIsAdjusting in interface ListSelectionModel

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
                      throws java.lang.CloneNotSupportedException
Returns a clone of the reciever with the same selection. listenerLists are not duplicated.
Throws:
java.lang.CloneNotSupportedException - if the receiver does not both (a) implement the Cloneable interface and (b) define a clone method.
Overrides:
clone in class java.lang.Object

getAnchorSelectionIndex

public int getAnchorSelectionIndex()
Description copied from interface:
Return the first index argument from the most recent call to setSelectionInterval() or addSelectionInterval(). The most recent index0 is considered the "anchor" and the most recent index1 is considered the "lead". Some interfaces display these indices specially, e.g. Windows95 displays the lead index with a dotted yellow outline.
Specified by:
getAnchorSelectionIndex in interface ListSelectionModel

getLeadSelectionIndex

public int getLeadSelectionIndex()
Description copied from interface:
Return the second index argument from the most recent call to setSelectionInterval() or addSelectionInterval().
Specified by:
getLeadSelectionIndex in interface ListSelectionModel

setAnchorSelectionIndex

public void setAnchorSelectionIndex(int index)
Description copied from interface:
Set the anchor selection index.
Specified by:
setAnchorSelectionIndex in interface ListSelectionModel

setLeadSelectionIndex

public void setLeadSelectionIndex(int index)
Description copied from interface:
Set the lead selection index.
Specified by:
setLeadSelectionIndex in interface ListSelectionModel

Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug or feature
Submit comments/suggestions about javadoc
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.