uic.model
Class ExtendedListSelectionModel

java.lang.Object
  extended by uic.model.ExtendedListSelectionModel
All Implemented Interfaces:
ListSelectionModel
Direct Known Subclasses:
UICListSelectionModel

public class ExtendedListSelectionModel
extends Object
implements ListSelectionModel

List selection model, that handles 2 extra selection types

Since:
2.0 (moved here from uic.widgets where it lived from releases 1.1)
Author:
Roy van der Kuil

Field Summary
static int EXTENDED_INTERVAL_SELECTION
          Selection model that looks most like java standard multi selection interval selection Use when list will mostly contain one selected item, but CAN have more selections
static int NO_SELECTION
          No selection possible
 
Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
Constructor Summary
ExtendedListSelectionModel()
           
 
Method Summary
 void addListSelectionListener(ListSelectionListener listener)
          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.
protected  void fireValueChanged(int index0, int index1)
          Fires the valueChanged event to all listeners
 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().
 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 current 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 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 listener)
          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 index)
          Set the anchor selection index.
 void setLeadSelectionIndex(int index)
          Set the lead selection index.
 void setSelectionInterval(int index0, int index1)
          Change the selection to be between index0 and index1 inclusive.
 void setSelectionMode(int selectionMode)
          Set the selection mode.
 void setValueIsAdjusting(boolean valueIsAdjusting)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENDED_INTERVAL_SELECTION

public static int EXTENDED_INTERVAL_SELECTION
Selection model that looks most like java standard multi selection interval selection Use when list will mostly contain one selected item, but CAN have more selections


NO_SELECTION

public static int NO_SELECTION
No selection possible

Constructor Detail

ExtendedListSelectionModel

public ExtendedListSelectionModel()
Method Detail

addListSelectionListener

public void addListSelectionListener(ListSelectionListener listener)
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 listener)
Remove a listener from the list that's notified each time a change to the selection occurs.

Specified by:
removeListSelectionListener in interface ListSelectionModel

addSelectionInterval

public 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.

Specified by:
addSelectionInterval in interface ListSelectionModel

clearSelection

public void clearSelection()
Change the selection to the empty set.

Specified by:
clearSelection in interface ListSelectionModel

getAnchorSelectionIndex

public int getAnchorSelectionIndex()
Return the first index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().

Specified by:
getAnchorSelectionIndex in interface ListSelectionModel

getLeadSelectionIndex

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

Specified by:
getLeadSelectionIndex in interface ListSelectionModel

setAnchorSelectionIndex

public void setAnchorSelectionIndex(int index)
Set the anchor selection index.

Specified by:
setAnchorSelectionIndex in interface ListSelectionModel

setLeadSelectionIndex

public void setLeadSelectionIndex(int index)
Set the lead selection index.

Specified by:
setLeadSelectionIndex in interface ListSelectionModel

getMinSelectionIndex

public int getMinSelectionIndex()
Returns the first selected index or -1 if the selection is empty.

Specified by:
getMinSelectionIndex in interface ListSelectionModel
Returns:
the first selected index or -1 if the selection is empty.

getMaxSelectionIndex

public int getMaxSelectionIndex()
Returns the last selected index or -1 if the selection is empty.

Specified by:
getMaxSelectionIndex in interface ListSelectionModel
Returns:
the last selected index or -1 if the selection is empty.

getSelectionMode

public int getSelectionMode()
Returns the current selection mode.

Specified by:
getSelectionMode in interface ListSelectionModel
Returns:
the current selection mode.

setSelectionMode

public void setSelectionMode(int selectionMode)
Set the selection mode.

Specified by:
setSelectionMode in interface ListSelectionModel

getValueIsAdjusting

public boolean getValueIsAdjusting()
Returns true if the value is undergoing a series of changes.

Specified by:
getValueIsAdjusting in interface ListSelectionModel

setValueIsAdjusting

public void setValueIsAdjusting(boolean valueIsAdjusting)
Specified by:
setValueIsAdjusting in interface ListSelectionModel

insertIndexInterval

public void insertIndexInterval(int index,
                                int length,
                                boolean before)
Insert length indices beginning before/after index. TODO: currently has no implementation

Specified by:
insertIndexInterval in interface ListSelectionModel

isSelectedIndex

public boolean isSelectedIndex(int index)
Returns true if the specified index is selected.

Specified by:
isSelectedIndex in interface ListSelectionModel

isSelectionEmpty

public boolean isSelectionEmpty()
Returns true if no indices are selected.

Specified by:
isSelectionEmpty in interface ListSelectionModel

removeIndexInterval

public void removeIndexInterval(int index0,
                                int index1)
Remove the indices in the interval index0,index1 (inclusive) from the selection model.

Specified by:
removeIndexInterval in interface ListSelectionModel

removeSelectionInterval

public 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. Currently just calls removeIndexInterval(), cause I do not know the difference

Specified by:
removeSelectionInterval in interface ListSelectionModel

setSelectionInterval

public void setSelectionInterval(int index0,
                                 int index1)
Change the selection to be between index0 and index1 inclusive.

Specified by:
setSelectionInterval in interface ListSelectionModel

fireValueChanged

protected void fireValueChanged(int index0,
                                int index1)
Fires the valueChanged event to all listeners



Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence