interface org.aswing.ListSelectionModel

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 org.aswing.DefaultListSelectionModel @author paling

Instance Fields

function addListSelectionListener(listener:Dynamic ->Void): Void

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

listener

the listener to be add.

function addSelectionInterval(index0:Int, index1:Int, ?programmatic:Bool): 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.

@see #addListSelectionListener()

index0

one end of the interval.

index1

other end of the interval.

programmatic

indicate if this is a programmatic change.

function clearSelection(?programmatic:Bool): Void

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

@see #addListSelectionListener()

programmatic

indicate if this is a programmatic change.

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.

@see #getLeadSelectionIndex() @see #setSelectionInterval() @see #addSelectionInterval()

function getLeadSelectionIndex(): Int

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

@see #getAnchorSelectionIndex() @see #setSelectionInterval() @see #addSelectionInterval()

function getMaxSelectionIndex(): Int

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

function getMinSelectionIndex(): Int

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

function getSelectionMode(): Int

Returns the current selection mode. @see #setSelectionMode()

returns

The value of the selectionMode property.

function insertIndexInterval(index:Int, length:Int, before:Bool, ?programmatic:Bool): 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.

index

the index.

length

the length.

before

whether before or after.

programmatic

indicate if this is a programmatic change.

function isSelectedIndex(index:Int): Bool

Returns true if the specified index is selected.

function isSelectionEmpty(): Bool

Returns true if no indices are selected.

function removeIndexInterval(index0:Int, index1:Int, ?programmatic:Bool): 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.

index

the first index.

length

the second index.

programmatic

indicate if this is a programmatic change.

function removeListSelectionListener(listener:Dynamic ->Void): Void

Removes a listener from the list selection listeners.

listener

the listener to be removed.

function removeSelectionInterval(index0:Int, index1:Int, ?programmatic:Bool): 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.

@see #addListSelectionListener()

index0

one end of the interval.

index1

other end of the interval.

programmatic

indicate if this is a programmatic change.

function setAnchorSelectionIndex(index:Int): Void

Set the anchor selection index.

@see #getAnchorSelectionIndex()

function setLeadSelectionIndex(index:Int): Void

Set the lead selection index.

@see #getLeadSelectionIndex()

function setSelectionInterval(index0:Int, index1:Int, ?programmatic:Bool): 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.

@see #addListSelectionListener()

index0

one end of the interval.

index1

other end of the interval.

programmatic

indicate if this is a programmatic change.

function setSelectionMode(selectionMode:Int): Void

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

  • SINGLESELECTION Only one list index can be selected at a time. In this mode the setSelectionInterval and addSelectionInterval methods are equivalent, and only the second index argument (the "lead index") is used.
  • MULTIPLESELECTION In this mode, there's no restriction on what can be selected.

@see #getSelectionMode()