arlut.csd.JDataComponent
Class TimedKeySelectionManager

java.lang.Object
  |
  +--arlut.csd.JDataComponent.TimedKeySelectionManager
All Implemented Interfaces:
javax.swing.JComboBox.KeySelectionManager

public class TimedKeySelectionManager
extends java.lang.Object
implements javax.swing.JComboBox.KeySelectionManager

A JComboBox KeySelectionManager subclass that can be attached to a JComboBox to allow typing multiple characters of an item name to find it within the JComboBox's model. That is, rather than only keying on the first character in the item's name, TimedKeySelectionManager allows a user to type the full name of an object to select it, as long as the user doesn't hesitate for more than half a second between keystrokes.


Field Summary
private static boolean debug
           
private  long lastTime
           
private  java.lang.String searchString
           
private  int start
           
 
Constructor Summary
TimedKeySelectionManager()
           
 
Method Summary
private  java.lang.String getSelectedString(javax.swing.ComboBoxModel model)
           
private  java.lang.String getString(javax.swing.ComboBoxModel model, int index)
           
private  int search(javax.swing.ComboBoxModel model, int start)
          Performs a case-insensitive search, seeking a matching string in the ComboBoxModel.
 int selectionForKey(char key, javax.swing.ComboBoxModel model)
           
private  void updateSearchString(javax.swing.ComboBoxModel model, char key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

private static final boolean debug
See Also:
Constant Field Values

searchString

private java.lang.String searchString

lastTime

private long lastTime

start

private int start
Constructor Detail

TimedKeySelectionManager

public TimedKeySelectionManager()
Method Detail

selectionForKey

public int selectionForKey(char key,
                           javax.swing.ComboBoxModel model)
Specified by:
selectionForKey in interface javax.swing.JComboBox.KeySelectionManager

search

private int search(javax.swing.ComboBoxModel model,
                   int start)

Performs a case-insensitive search, seeking a matching string in the ComboBoxModel.


getString

private java.lang.String getString(javax.swing.ComboBoxModel model,
                                   int index)

getSelectedString

private java.lang.String getSelectedString(javax.swing.ComboBoxModel model)

updateSearchString

private void updateSearchString(javax.swing.ComboBoxModel model,
                                char key)