swingwtx.swing
Class DefaultListSelectionModel

java.lang.Object
  extended byswingwtx.swing.DefaultListSelectionModel
All Implemented Interfaces:
ListSelectionModel

public class DefaultListSelectionModel
extends java.lang.Object
implements ListSelectionModel

Handles tying to components and how selections are performed/reported. Note: This class is very important for JTable/JList and if you want to implement your own, you are better off extending this class than starting with something that implements ListSelectionModel.


Field Summary
protected  JComponent component
          We hold a reference to the component we are being a selection model for.
protected  int index0
           
protected  int index1
           
protected  boolean isAdjusting
           
protected  boolean isTable
           
protected  JList list
           
protected  java.util.Vector listeners
           
protected  int mode
           
protected  JTable table
           
 
Fields inherited from interface swingwtx.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
Constructor Summary
  DefaultListSelectionModel()
           
protected DefaultListSelectionModel(JComponent component)
           
 
Method Summary
 void addListSelectionListener(ListSelectionListener x)
           
 void addSelectionInterval(int index0, int index1)
           
 void clearSelection()
           
 int getAnchorSelectionIndex()
           
 int getLeadSelectionIndex()
           
 int getMaxSelectionIndex()
           
 int getMinSelectionIndex()
           
 int getSelectionMode()
           
 boolean getValueIsAdjusting()
           
 void insertIndexInterval(int index, int length, boolean before)
           
 boolean isSelectedIndex(int index)
           
 boolean isSelectionEmpty()
           
 void removeIndexInterval(int index0, int index1)
           
 void removeListSelectionListener(ListSelectionListener x)
           
 void removeSelectionInterval(int index0, int index1)
           
 void setAnchorSelectionIndex(int index)
           
 void setLeadSelectionIndex(int index)
           
 void setSelectionInterval(int index0, int index1)
           
 void setSelectionMode(int selectionMode)
           
 void setValueIsAdjusting(boolean valueIsAdjusting)
           
protected  void updateComponentForSelection()
          Sets the component to have the selection specified in this model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

component

protected JComponent component
We hold a reference to the component we are being a selection model for. This allows us to manipulate it's selection much easier and retrieve info about the selection from the component (and the component can update us when the selection changes).


table

protected JTable table

list

protected JList list

isTable

protected boolean isTable

listeners

protected java.util.Vector listeners

index0

protected int index0

index1

protected int index1

mode

protected int mode

isAdjusting

protected boolean isAdjusting
Constructor Detail

DefaultListSelectionModel

public DefaultListSelectionModel()

DefaultListSelectionModel

protected DefaultListSelectionModel(JComponent component)
Method Detail

addListSelectionListener

public void addListSelectionListener(ListSelectionListener x)
Specified by:
addListSelectionListener in interface ListSelectionModel

addSelectionInterval

public void addSelectionInterval(int index0,
                                 int index1)
Specified by:
addSelectionInterval in interface ListSelectionModel

clearSelection

public void clearSelection()
Specified by:
clearSelection in interface ListSelectionModel

getAnchorSelectionIndex

public int getAnchorSelectionIndex()
Specified by:
getAnchorSelectionIndex in interface ListSelectionModel

getLeadSelectionIndex

public int getLeadSelectionIndex()
Specified by:
getLeadSelectionIndex in interface ListSelectionModel

getMaxSelectionIndex

public int getMaxSelectionIndex()
Specified by:
getMaxSelectionIndex in interface ListSelectionModel

getMinSelectionIndex

public int getMinSelectionIndex()
Specified by:
getMinSelectionIndex in interface ListSelectionModel

getSelectionMode

public int getSelectionMode()
Specified by:
getSelectionMode in interface ListSelectionModel

getValueIsAdjusting

public boolean getValueIsAdjusting()
Specified by:
getValueIsAdjusting in interface ListSelectionModel

insertIndexInterval

public void insertIndexInterval(int index,
                                int length,
                                boolean before)
Specified by:
insertIndexInterval in interface ListSelectionModel

isSelectedIndex

public boolean isSelectedIndex(int index)
Specified by:
isSelectedIndex in interface ListSelectionModel

isSelectionEmpty

public boolean isSelectionEmpty()
Specified by:
isSelectionEmpty in interface ListSelectionModel

removeIndexInterval

public void removeIndexInterval(int index0,
                                int index1)
Specified by:
removeIndexInterval in interface ListSelectionModel

removeListSelectionListener

public void removeListSelectionListener(ListSelectionListener x)
Specified by:
removeListSelectionListener in interface ListSelectionModel

removeSelectionInterval

public void removeSelectionInterval(int index0,
                                    int index1)
Specified by:
removeSelectionInterval in interface ListSelectionModel

setAnchorSelectionIndex

public void setAnchorSelectionIndex(int index)
Specified by:
setAnchorSelectionIndex in interface ListSelectionModel

setLeadSelectionIndex

public void setLeadSelectionIndex(int index)
Specified by:
setLeadSelectionIndex in interface ListSelectionModel

setSelectionInterval

public void setSelectionInterval(int index0,
                                 int index1)
Specified by:
setSelectionInterval in interface ListSelectionModel

setSelectionMode

public void setSelectionMode(int selectionMode)
Specified by:
setSelectionMode in interface ListSelectionModel

setValueIsAdjusting

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

updateComponentForSelection

protected void updateComponentForSelection()
Sets the component to have the selection specified in this model.