org.jdesktop.swingx.autocomplete
Class AutoCompleteComboBoxEditor

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

public class AutoCompleteComboBoxEditor
extends java.lang.Object
implements javax.swing.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.

Author:
Noel Grandin noelgrandin@gmail.com, Thomas Bierhance

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

Constructor Detail

AutoCompleteComboBoxEditor

public AutoCompleteComboBoxEditor(javax.swing.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 java.awt.Component getEditorComponent()
Specified by:
getEditorComponent in interface javax.swing.ComboBoxEditor

setItem

public void setItem(java.lang.Object anObject)
Specified by:
setItem in interface javax.swing.ComboBoxEditor

getItem

public java.lang.Object getItem()
Specified by:
getItem in interface javax.swing.ComboBoxEditor

selectAll

public void selectAll()
Specified by:
selectAll in interface javax.swing.ComboBoxEditor

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Specified by:
addActionListener in interface javax.swing.ComboBoxEditor

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Specified by:
removeActionListener in interface javax.swing.ComboBoxEditor