gov.nasa.gsfc.drl.rtstps.viewer.tables
Class PickerModel

java.lang.Object
  extended by javax.swing.DefaultListSelectionModel
      extended by gov.nasa.gsfc.drl.rtstps.viewer.tables.PickerModel
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.ListSelectionModel

 class PickerModel
extends javax.swing.DefaultListSelectionModel

This class is a list selection model. I use it in a JList to decide which status elements I will show in a status table. The differences between this model and the default one are (1) the user can select and deselect single items by just clicking on them without needing the control key. It adds or removes the element to the current selection. The default model always clears all other selections and requires that you use the control key to add selections. (2) This model has a "select all" method, which you can wire to a button.


Field Summary
private  int listSize
           
private static long serialVersionUID
           
 
Fields inherited from class javax.swing.DefaultListSelectionModel
leadAnchorNotificationEnabled, listenerList
 
Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
Constructor Summary
PickerModel(int listSize)
           
 
Method Summary
(package private)  void selectAll()
          Select all elements.
(package private)  void setListSize(int size)
           
 void setSelectionInterval(int i0, int i1)
          When a single item is selected, this method changes it to a add/remove toggle.
 
Methods inherited from class javax.swing.DefaultListSelectionModel
addListSelectionListener, addSelectionInterval, clearSelection, clone, fireValueChanged, fireValueChanged, fireValueChanged, getAnchorSelectionIndex, getLeadSelectionIndex, getListeners, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getSelectionMode, getValueIsAdjusting, insertIndexInterval, isLeadAnchorNotificationEnabled, isSelectedIndex, isSelectionEmpty, moveLeadSelectionIndex, removeIndexInterval, removeListSelectionListener, removeSelectionInterval, setAnchorSelectionIndex, setLeadAnchorNotificationEnabled, setLeadSelectionIndex, setSelectionMode, setValueIsAdjusting, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

listSize

private int listSize

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

PickerModel

PickerModel(int listSize)
Method Detail

setListSize

final void setListSize(int size)

selectAll

final void selectAll()
Select all elements.


setSelectionInterval

public void setSelectionInterval(int i0,
                                 int i1)
When a single item is selected, this method changes it to a add/remove toggle.

Specified by:
setSelectionInterval in interface javax.swing.ListSelectionModel
Overrides:
setSelectionInterval in class javax.swing.DefaultListSelectionModel