swingx
Version 2009-07-31

org.jdesktop.swingx.autocomplete
Class AutoCompleteComboBoxEditor

java.lang.Object
  extended by org.jdesktop.swingx.autocomplete.AutoCompleteComboBoxEditor
All Implemented Interfaces:
ComboBoxEditor

public class AutoCompleteComboBoxEditor
extends Object
implements ComboBoxEditor

Wrapper around the combobox editor that translates combobox items into strings. The methods setItem and getItem are modified to account for the string conversion.

This is necessary for those cases where the combobox items have no useful toString() method and a custom ObjectToStringConverter is used.

If we do not do this, the interaction between ComboBoxEditor and JComboBox will result in firing ActionListener events with the string value of ComboBoxEditor as the currently selected value.


Constructor Summary
AutoCompleteComboBoxEditor(ComboBoxEditor wrapped, ObjectToStringConverter stringConverter)
          Creates a new AutoCompleteComboBoxEditor.
 
Method Summary
 void addActionListener(ActionListener l)
           
 Component getEditorComponent()
           
 Object getItem()
           
 void removeActionListener(ActionListener l)
           
 void selectAll()
           
 void setItem(Object anObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoCompleteComboBoxEditor

public AutoCompleteComboBoxEditor(ComboBoxEditor wrapped,
                                  ObjectToStringConverter stringConverter)
Creates a new AutoCompleteComboBoxEditor.

Parameters:
wrapped - the original ComboBoxEditor to be wrapped
stringConverter - the converter to use to convert items into their string representation.
Method Detail

getEditorComponent

public Component getEditorComponent()
Specified by:
getEditorComponent in interface ComboBoxEditor

setItem

public void setItem(Object anObject)
Specified by:
setItem in interface ComboBoxEditor

getItem

public Object getItem()
Specified by:
getItem in interface ComboBoxEditor

selectAll

public void selectAll()
Specified by:
selectAll in interface ComboBoxEditor

addActionListener

public void addActionListener(ActionListener l)
Specified by:
addActionListener in interface ComboBoxEditor

removeActionListener

public void removeActionListener(ActionListener l)
Specified by:
removeActionListener in interface ComboBoxEditor

swingx
Version 2009-07-31