Packageorg.aswing
Interfacepublic interface ListSelectionModel
ImplementorsDefaultListSelectionModel

This interface represents the current state of the selection for any of the components that display a list of values with stable indices. The selection is modeled as a set of intervals, each interval represents a contiguous range of selected list elements. The methods for modifying the set of selected intervals all take a pair of indices, index0 and index1, that represent a closed interval, i.e. the interval includes both index0 and index1.

See also

org.aswing.DefaultListSelectionModel


Public Methods
 MethodDefined by
  
addListSelectionListener(listener:Function):void
Add a listener to the list that's notified each time a change to the selection occurs.
ListSelectionModel
  
addSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void
Change the selection to be the set union of the current selection and the indices between index0 and index1 inclusive.
ListSelectionModel
  
clearSelection(programmatic:Boolean = true):void
Change the selection to the empty set.
ListSelectionModel
  
Return the first index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
ListSelectionModel
  
Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
ListSelectionModel
  
Returns the last selected index or -1 if the selection is empty.
ListSelectionModel
  
Returns the first selected index or -1 if the selection is empty.
ListSelectionModel
  
Returns the current selection mode.
ListSelectionModel
  
insertIndexInterval(index:int, length:int, before:Boolean, programmatic:Boolean = true):void
Insert length indices beginning before/after index.
ListSelectionModel
  
isSelectedIndex(index:int):Boolean
Returns true if the specified index is selected.
ListSelectionModel
  
isSelectionEmpty():Boolean
Returns true if no indices are selected.
ListSelectionModel
  
removeIndexInterval(index0:int, index1:int, programmatic:Boolean = true):void
Remove the indices in the interval index0,index1 (inclusive) from the selection model.
ListSelectionModel
  
removeListSelectionListener(listener:Function):void
Removes a listener from the list selection listeners.
ListSelectionModel
  
removeSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void
Change the selection to be the set difference of the current selection and the indices between index0 and index1 inclusive.
ListSelectionModel
  
setAnchorSelectionIndex(index:int):void
Set the anchor selection index.
ListSelectionModel
  
setLeadSelectionIndex(index:int):void
Set the lead selection index.
ListSelectionModel
  
setSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void
Change the selection to be between index0 and index1 inclusive.
ListSelectionModel
  
setSelectionMode(selectionMode:int):void
Set the selection mode.
ListSelectionModel
Method detail
addListSelectionListener()method
public function addListSelectionListener(listener:Function):void

Add a listener to the list that's notified each time a change to the selection occurs.

Parameters
listener:Function — the listener to be add.
addSelectionInterval()method 
public function addSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void

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.

Parameters
index0:int — one end of the interval.
 
index1:int — other end of the interval.
 
programmatic:Boolean (default = true) — indicate if this is a programmatic change.

See also

clearSelection()method 
public function clearSelection(programmatic:Boolean = true):void

Change the selection to the empty set. If this represents a change to the current selection then notify each ListSelectionListener.

Parameters
programmatic:Boolean (default = true) — indicate if this is a programmatic change.

See also

getAnchorSelectionIndex()method 
public function getAnchorSelectionIndex():int

Return the first index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval(). 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.

Returns
int

See also

getLeadSelectionIndex()method 
public function getLeadSelectionIndex():int

Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().

Returns
int

See also

getMaxSelectionIndex()method 
public function getMaxSelectionIndex():int

Returns the last selected index or -1 if the selection is empty.

Returns
int
getMinSelectionIndex()method 
public function getMinSelectionIndex():int

Returns the first selected index or -1 if the selection is empty.

Returns
int
getSelectionMode()method 
public function getSelectionMode():int

Returns the current selection mode.

Returns
int — The value of the selectionMode property.

See also

insertIndexInterval()method 
public function insertIndexInterval(index:int, length:int, before:Boolean, programmatic:Boolean = true):void

Insert length indices beginning before/after index. This is typically called to sync the selection model with a corresponding change in the data model.

Parameters
index:int — the index.
 
length:int — the length.
 
before:Boolean — whether before or after.
 
programmatic:Boolean (default = true) — indicate if this is a programmatic change.
isSelectedIndex()method 
public function isSelectedIndex(index:int):Boolean

Returns true if the specified index is selected.

Parameters
index:int

Returns
Boolean
isSelectionEmpty()method 
public function isSelectionEmpty():Boolean

Returns true if no indices are selected.

Returns
Boolean
removeIndexInterval()method 
public function removeIndexInterval(index0:int, index1:int, programmatic:Boolean = true):void

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.

Parameters
index0:int — the first index.
 
index1:int — the second index.
 
programmatic:Boolean (default = true) — indicate if this is a programmatic change.
removeListSelectionListener()method 
public function removeListSelectionListener(listener:Function):void

Removes a listener from the list selection listeners.

Parameters
listener:Function — the listener to be removed.
removeSelectionInterval()method 
public function removeSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void

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.

Parameters
index0:int — one end of the interval.
 
index1:int — other end of the interval.
 
programmatic:Boolean (default = true) — indicate if this is a programmatic change.

See also

setAnchorSelectionIndex()method 
public function setAnchorSelectionIndex(index:int):void

Set the anchor selection index.

Parameters
index:int

See also

setLeadSelectionIndex()method 
public function setLeadSelectionIndex(index:int):void

Set the lead selection index.

Parameters
index:int

See also

setSelectionInterval()method 
public function setSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void

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.

Parameters
index0:int — one end of the interval.
 
index1:int — other end of the interval.
 
programmatic:Boolean (default = true) — indicate if this is a programmatic change.

See also

setSelectionMode()method 
public function setSelectionMode(selectionMode:int):void

Set the selection mode. The following selectionMode values are allowed:

Parameters
selectionMode:int

See also