com.isti.util.gui
Class SortedValuesJList

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JList
                  extended by com.isti.util.gui.SortedValuesJList
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable

public class SortedValuesJList
extends javax.swing.JList

Class SortedValuesJList extends JList to implement a sorted-table model and to enforce the paradigm that list changes should only happen via the event-dispatch thread. Elements in the list are sorted according to the natural ordering of the value objects (not the keys) in the table model.

See Also:
Serialized Form

Nested Class Summary
static interface SortedValuesJList.ListSelKeyChangeCallBack
          Interface ListSelKeyChangeCallBack defines a call-back method that is invoked when the selected list item has changed (and its key has changed).
 
Nested classes/interfaces inherited from class javax.swing.JList
javax.swing.JList.AccessibleJList, javax.swing.JList.DropLocation
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  SortedValuesJList.ListSelKeyChangeCallBack listSelKeyChangeCallBackObj
          Call-back object used when list selection changes.
protected  java.lang.Object selectedKeyObject
          Key object for currently selected item.
protected  java.lang.Object selectedKeySyncObj
          Thread-synchronization object for 'selectedKeyObject'.
protected static boolean SORT_DIR_FLAG
          Direction-of-sort flag for 'FifoHashListModel' used by list (true).
protected  FifoHashListModel sortedListModelObj
          FifoHashtable-based model for list.
 
Fields inherited from class javax.swing.JList
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SortedValuesJList()
          Creates a sorted JList with a sorted-table model.
SortedValuesJList(javax.swing.ListCellRenderer cellRendererObj)
          Creates a sorted JList with a sorted-table model.
SortedValuesJList(javax.swing.ListCellRenderer cellRendererObj, java.util.Map tableMapObj)
          Creates a sorted JList with a sorted-values-table model.
SortedValuesJList(javax.swing.ListCellRenderer cellRendererObj, java.util.Map tableMapObj, boolean sortDirFlag)
          Creates a sorted JList with a sorted-values-table model.
SortedValuesJList(javax.swing.ListCellRenderer cellRendererObj, java.util.Map tableMapObj, boolean sortDirFlag, int sortType)
          Creates a sorted JList with a sorted-values-table model.
SortedValuesJList(java.util.Map tableMapObj)
          Creates a sorted JList with a sorted-values-table model.
 
Method Summary
 void clearSelection()
          Clears the selection.
protected  void doSelectLastItemInList(boolean ensureVisibleFlag)
          Sets the selected index for the list.
protected  void doSetColors(java.awt.Color foregroundColor, java.awt.Color backgroundColor, java.awt.Color selForegroundColor, java.awt.Color selBackgroundColor)
          Sets the list colors.
protected  void doSetSelectedIndex(int val, boolean ensureVisibleFlag)
          Sets the selected index for the list.
 void ensureSelectionVisible()
          Ensures that the current list selection is visible.
 void fireContentsChanged()
          Fires a contents-changed event to the list model.
 java.lang.Object getCellAt(int indexVal)
          Returns the object associated with the given index on the list.
 java.lang.Object getSelectedKeyObj()
          Returns the key for the currently selected item.
 java.lang.String getSelectedKeyString()
          Returns the key string for the currently selected item.
 boolean getSortFlag()
          Gets the direction-of-sort flag for 'FifoHashListModel' used by list.
 int getSortType()
          Gets the sort type for 'FifoHashListModel' used by list.
 boolean isSelectionVisible()
          Determines whether or not the current list selection is visible.
 java.lang.Object locationToValue(java.awt.Point pointObj)
          Returns the object associated with the cell closest to the given location.
protected  void processListSelectionChange()
          Processes a change in the selected list item.
 void put(java.lang.Object key, java.lang.Object value)
          Adds a key/value pair to the list, placing it in sorted order according to the value.
 void put(java.lang.Object key, java.lang.Object value, boolean sortFlag)
          Adds a key/value pair to the list, optionally placing it in sorted order according to the value.
 void putAll(java.util.Map mapObj)
          Copies all of the mappings from the specified map into the list, placing them in sorted order according to the values.
 void putAll(java.util.Map mapObj, boolean sortFlag)
          Copies all of the mappings from the specified map into the list, placing them in sorted order according to the values.
 void removeKey(java.lang.Object key)
          Removes the mapping for the given key from the list (if present).
 void repaint()
          Called after updates to the list have occurred to repaint the list.
 void requestFocus()
          Requests that this list have the keyboard focus.
 void reSortList(boolean sortDirFlag, int sortType)
          Resorts the list with the specified direction and type.
protected  void resyncSelectedItem()
          Resynchronizes the selected list item by reselecting the selected-key tracker object.
 void selectLastItemInList(boolean ensureVisibleFlag)
          Sets the selected index for the list.
 void selectLastItemInList(boolean ensureVisibleFlag, boolean alwaysQueueFlag)
          Sets the selected index for the list.
 void setColors(java.awt.Color foregroundColor, java.awt.Color backgroundColor, java.awt.Color selForegroundColor, java.awt.Color selBackgroundColor)
          Sets the list colors.
 void setColors(java.awt.Color foregroundColor, java.awt.Color backgroundColor, java.awt.Color selForegroundColor, java.awt.Color selBackgroundColor, boolean directFlag)
          Sets the list colors.
 void setListData(java.util.Map tableMapObj)
          Clears any current list data and enters the items from the given Map object.
 void setListenersEnabled(boolean flgVal)
          Sets whether or not 'ListDataListener' objects attached to the list model are called when changes occur.
 void setListSelKeyChangeCallBack(SortedValuesJList.ListSelKeyChangeCallBack cbObj)
          Sets the ListSelKeyChangeCallBack object whose call-back method is invoked when the selected list item has changed (and its key has changed).
 void setSelectedIndex(int val)
          Sets the selected index for the list.
 void setSelectedIndex(int val, boolean ensureVisibleFlag)
          Sets the selected index for the list.
 void setSelectedKey(java.lang.Object keyObj)
          Selects the item corresponding to the given key.
 void setSelectedKey(java.lang.Object keyObj, boolean ensureVisibleFlag)
          Selects the item corresponding to the given key.
 
Methods inherited from class javax.swing.JList
addListSelectionListener, addSelectionInterval, createSelectionModel, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getDropLocation, getDropMode, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setDropMode, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sortedListModelObj

protected final FifoHashListModel sortedListModelObj
FifoHashtable-based model for list.


SORT_DIR_FLAG

protected static final boolean SORT_DIR_FLAG
Direction-of-sort flag for 'FifoHashListModel' used by list (true).

See Also:
Constant Field Values

selectedKeyObject

protected java.lang.Object selectedKeyObject
Key object for currently selected item.


selectedKeySyncObj

protected final java.lang.Object selectedKeySyncObj
Thread-synchronization object for 'selectedKeyObject'.


listSelKeyChangeCallBackObj

protected SortedValuesJList.ListSelKeyChangeCallBack listSelKeyChangeCallBackObj
Call-back object used when list selection changes.

Constructor Detail

SortedValuesJList

public SortedValuesJList(javax.swing.ListCellRenderer cellRendererObj,
                         java.util.Map tableMapObj,
                         boolean sortDirFlag,
                         int sortType)
Creates a sorted JList with a sorted-values-table model. If the given map object is non-null then its elements are added to the table model, sorted according to the natural ordering of the value objects.

Parameters:
cellRendererObj - list-cell renderer to use, or null to use the default list-cell renderer.
tableMapObj - the map object to use, or null for none.
sortDirFlag - true for ascending sort order, false for descending.
sortType - the sort type.
Throws:
java.lang.ClassCastException - if the values in the map are not Comparable, or are not mutually comparable.

SortedValuesJList

public SortedValuesJList(javax.swing.ListCellRenderer cellRendererObj,
                         java.util.Map tableMapObj,
                         boolean sortDirFlag)
Creates a sorted JList with a sorted-values-table model. If the given map object is non-null then its elements are added to the table model, sorted according to the natural ordering of the value objects.

Parameters:
cellRendererObj - list-cell renderer to use, or null to use the default list-cell renderer.
tableMapObj - the map object to use, or null for none.
sortDirFlag - true for ascending sort order, false for descending.
Throws:
java.lang.ClassCastException - if the values in the map are not Comparable, or are not mutually comparable.

SortedValuesJList

public SortedValuesJList(javax.swing.ListCellRenderer cellRendererObj,
                         java.util.Map tableMapObj)
Creates a sorted JList with a sorted-values-table model. If the given map object is non-null then its elements are added to the table model, sorted according to the natural ordering of the value objects.

Parameters:
cellRendererObj - list-cell renderer to use, or null to use the default list-cell renderer.
tableMapObj - the map object to use, or null for none.
Throws:
java.lang.ClassCastException - if the values in the map are not Comparable, or are not mutually comparable.

SortedValuesJList

public SortedValuesJList(javax.swing.ListCellRenderer cellRendererObj)
Creates a sorted JList with a sorted-table model.

Parameters:
cellRendererObj - list-cell renderer to use, or null to use the default list-cell renderer.

SortedValuesJList

public SortedValuesJList(java.util.Map tableMapObj)
Creates a sorted JList with a sorted-values-table model. If the given map object is non-null then its elements are added to the table model, sorted according to the natural ordering of the value objects.

Parameters:
tableMapObj - the map object to use, or null for none.
Throws:
java.lang.ClassCastException - if the values in the map are not Comparable, or are not mutually comparable.

SortedValuesJList

public SortedValuesJList()
Creates a sorted JList with a sorted-table model.

Method Detail

getSortFlag

public boolean getSortFlag()
Gets the direction-of-sort flag for 'FifoHashListModel' used by list.

Returns:
true for ascending sort order, false for descending.

getSortType

public int getSortType()
Gets the sort type for 'FifoHashListModel' used by list.

Returns:
the sort type.

reSortList

public void reSortList(boolean sortDirFlag,
                       int sortType)
Resorts the list with the specified direction and type.

Parameters:
sortDirFlag - true for ascending sort order, false for descending.
sortType - the sort type.

put

public void put(java.lang.Object key,
                java.lang.Object value)
Adds a key/value pair to the list, placing it in sorted order according to the value. The value should implement the Comparable interface. If the list previously contained a mapping for this key, the old value is deleted and the new value is placed in proper sort order. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.

put

public void put(java.lang.Object key,
                java.lang.Object value,
                boolean sortFlag)
Adds a key/value pair to the list, optionally placing it in sorted order according to the value. If sorted the value should implement the Comparable interface. If the list previously contained a mapping for this key, the old value is deleted and the new value is placed in proper sort order. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
sortFlag - true to sort the values, false otherwise.

putAll

public void putAll(java.util.Map mapObj)
Copies all of the mappings from the specified map into the list, placing them in sorted order according to the values. The values should implement the Comparable interface. These mappings replace any mappings that this list had for any of the keys currently in the specified Map. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
mapObj - mappings to be stored in this map.

putAll

public void putAll(java.util.Map mapObj,
                   boolean sortFlag)
Copies all of the mappings from the specified map into the list, placing them in sorted order according to the values. The values should implement the Comparable interface. These mappings replace any mappings that this list had for any of the keys currently in the specified Map. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
mapObj - mappings to be stored in this map.
sortFlag - true to sort the values, false otherwise.

removeKey

public void removeKey(java.lang.Object key)
Removes the mapping for the given key from the list (if present). If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
key - key whose mapping is to be removed from the hashtable.

setListData

public void setListData(java.util.Map tableMapObj)
Clears any current list data and enters the items from the given Map object. If the thread calling this method is not the event- dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
tableMapObj - a Map object containing the items to display in the list, or null for no items.

repaint

public void repaint()
Called after updates to the list have occurred to repaint the list. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Overrides:
repaint in class java.awt.Component

requestFocus

public void requestFocus()
Requests that this list have the keyboard focus. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Overrides:
requestFocus in class javax.swing.JComponent

setSelectedKey

public void setSelectedKey(java.lang.Object keyObj,
                           boolean ensureVisibleFlag)
Selects the item corresponding to the given key. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
keyObj - the key object to use.
ensureVisibleFlag - if true then the selected item will be made visible.

setSelectedKey

public void setSelectedKey(java.lang.Object keyObj)
Selects the item corresponding to the given key. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
keyObj - the key object to use.

setSelectedIndex

public void setSelectedIndex(int val,
                             boolean ensureVisibleFlag)
Sets the selected index for the list. This method does not throw an exception if the index value is out of range. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
val - the index value.
ensureVisibleFlag - if true then the selected item will be made visible.

setSelectedIndex

public void setSelectedIndex(int val)
Sets the selected index for the list. This method does not throw an exception if the index value is out of range. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Overrides:
setSelectedIndex in class javax.swing.JList
Parameters:
val - the index value.

doSetSelectedIndex

protected void doSetSelectedIndex(int val,
                                  boolean ensureVisibleFlag)
Sets the selected index for the list. This method does not throw an exception if the index value is out of range.

Parameters:
val - the index value.
ensureVisibleFlag - if true then the selected item will be made visible.

selectLastItemInList

public void selectLastItemInList(boolean ensureVisibleFlag,
                                 boolean alwaysQueueFlag)
Sets the selected index for the list. This method does not throw an exception if an error occurs. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread. Setting the 'alwaysQueueFlag' parameter to 'true' can help ensure that this action happens after other changes to the list have completed.

Parameters:
ensureVisibleFlag - if true then the selected item will be made visible.
alwaysQueueFlag - if true then the action will be put on the queue of events to be performed later by the event-dispatch thread; if false then this will only happen if the calling thread is not the event-dispatch thread.

selectLastItemInList

public void selectLastItemInList(boolean ensureVisibleFlag)
Sets the selected index for the list. This method does not throw an exception if an error occurs. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
ensureVisibleFlag - if true then the selected item will be made visible.

doSelectLastItemInList

protected void doSelectLastItemInList(boolean ensureVisibleFlag)
Sets the selected index for the list. This method does not throw an exception if an error occurs.

Parameters:
ensureVisibleFlag - if true then the selected item will be made visible.

ensureSelectionVisible

public void ensureSelectionVisible()
Ensures that the current list selection is visible. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.


clearSelection

public void clearSelection()
Clears the selection. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Overrides:
clearSelection in class javax.swing.JList

getCellAt

public java.lang.Object getCellAt(int indexVal)
Returns the object associated with the given index on the list.

Parameters:
indexVal - the index value to use.
Returns:
The associated object, or null if none matched.

locationToValue

public java.lang.Object locationToValue(java.awt.Point pointObj)
Returns the object associated with the cell closest to the given location.

Parameters:
pointObj - the coordinates to use, relative to the list object.
Returns:
The object associated with the cell closest to the given location, or null if none found.

getSelectedKeyObj

public java.lang.Object getSelectedKeyObj()
Returns the key for the currently selected item.

Returns:
The key object for the currently selected item, or null if not available.

getSelectedKeyString

public java.lang.String getSelectedKeyString()
Returns the key string for the currently selected item.

Returns:
The key string for the currently selected item, or null if not available.

isSelectionVisible

public boolean isSelectionVisible()
Determines whether or not the current list selection is visible.

Returns:
true if the current list selection is visible; false if not (or if no list item selected).

setListenersEnabled

public void setListenersEnabled(boolean flgVal)
Sets whether or not 'ListDataListener' objects attached to the list model are called when changes occur.

Parameters:
flgVal - true to enable calling of 'ListDataListener' objects, false to disable.

fireContentsChanged

public void fireContentsChanged()
Fires a contents-changed event to the list model.


setColors

public void setColors(java.awt.Color foregroundColor,
                      java.awt.Color backgroundColor,
                      java.awt.Color selForegroundColor,
                      java.awt.Color selBackgroundColor,
                      boolean directFlag)
Sets the list colors. If the thread calling this method is not the event-dispatch thread (and 'directFlag'==false) then the action is queued and invoked later by the event-dispatch thread.

Parameters:
foregroundColor - the foreground color to set, or null to leave the color unchanged.
backgroundColor - the background color to set, or null to leave the color unchanged.
selForegroundColor - the selection foreground color to set, or null to leave the color unchanged.
selBackgroundColor - the selection background color to set, or null to leave the color unchanged.
directFlag - if true then the color setting is always done immediately; if false and the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

setColors

public void setColors(java.awt.Color foregroundColor,
                      java.awt.Color backgroundColor,
                      java.awt.Color selForegroundColor,
                      java.awt.Color selBackgroundColor)
Sets the list colors. If the thread calling this method is not the event-dispatch thread then the action is queued and invoked later by the event-dispatch thread.

Parameters:
foregroundColor - the foreground color to set, or null to leave the color unchanged.
backgroundColor - the background color to set, or null to leave the color unchanged.
selForegroundColor - the selection foreground color to set, or null to leave the color unchanged.
selBackgroundColor - the selection background color to set, or null to leave the color unchanged.

doSetColors

protected void doSetColors(java.awt.Color foregroundColor,
                           java.awt.Color backgroundColor,
                           java.awt.Color selForegroundColor,
                           java.awt.Color selBackgroundColor)
Sets the list colors.

Parameters:
foregroundColor - the foreground color to set, or null to leave the color unchanged.
backgroundColor - the background color to set, or null to leave the color unchanged.
selForegroundColor - the selection foreground color to set, or null to leave the color unchanged.
selBackgroundColor - the selection background color to set, or null to leave the color unchanged.

resyncSelectedItem

protected void resyncSelectedItem()
Resynchronizes the selected list item by reselecting the selected-key tracker object. This needs to be done after the list model has been modified.


processListSelectionChange

protected void processListSelectionChange()
Processes a change in the selected list item.


setListSelKeyChangeCallBack

public void setListSelKeyChangeCallBack(SortedValuesJList.ListSelKeyChangeCallBack cbObj)
Sets the ListSelKeyChangeCallBack object whose call-back method is invoked when the selected list item has changed (and its key has changed).

Parameters:
cbObj - the 'ListSelKeyChangeCallBack' object to be used, or null to clear the call-back object.