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.
Modifier and Type | Field and Description |
---|---|
private Object |
oldItem
last selected item
|
(package private) ObjectToStringConverter |
stringConverter
the converter used to convert items into their string representation
|
(package private) ComboBoxEditor |
wrapped
the original combo box editor
|
Constructor and Description |
---|
AutoCompleteComboBoxEditor(ComboBoxEditor wrapped,
ObjectToStringConverter stringConverter)
Creates a new AutoCompleteComboBoxEditor.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener l) |
Component |
getEditorComponent() |
Object |
getItem() |
void |
removeActionListener(ActionListener l) |
void |
selectAll() |
void |
setItem(Object anObject) |
final ComboBoxEditor wrapped
final ObjectToStringConverter stringConverter
public AutoCompleteComboBoxEditor(ComboBoxEditor wrapped, ObjectToStringConverter stringConverter)
wrapped
- the original ComboBoxEditor to be wrappedstringConverter
- the converter to use to convert items into their
string representation.public Component getEditorComponent()
getEditorComponent
in interface ComboBoxEditor
public void setItem(Object anObject)
setItem
in interface ComboBoxEditor
public Object getItem()
getItem
in interface ComboBoxEditor
public void selectAll()
selectAll
in interface ComboBoxEditor
public void addActionListener(ActionListener l)
addActionListener
in interface ComboBoxEditor
public void removeActionListener(ActionListener l)
removeActionListener
in interface ComboBoxEditor
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses