Package ca.odell.glazedlists.swing
Class DefaultEventComboBoxModel<E>
- java.lang.Object
-
- ca.odell.glazedlists.swing.DefaultEventListModel<E>
-
- ca.odell.glazedlists.swing.DefaultEventComboBoxModel<E>
-
- All Implemented Interfaces:
ListEventListener<E>
,java.util.EventListener
,javax.swing.ComboBoxModel
,javax.swing.ListModel
public class DefaultEventComboBoxModel<E> extends DefaultEventListModel<E> implements javax.swing.ComboBoxModel
A combo box model for displaying Glazed Lists in a combo box.The DefaultEventComboBoxModel class is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the event dispatch thread. To do this programmatically, use
SwingUtilities.invokeAndWait(Runnable)
and wrap the source list (or some part of the source list's pipeline) usingGlazedListsSwing.swingThreadProxyList(EventList)
.The implementation of
setSelectedItem(java.lang.Object)
andgetSelectedItem()
is not in any way tied to the contents of the list.- Author:
- Jesse Wilson
- See Also:
- Glazed Lists Tutorial
-
-
Field Summary
-
Fields inherited from class ca.odell.glazedlists.swing.DefaultEventListModel
listDataEvent, source
-
-
Constructor Summary
Constructors Modifier Constructor Description DefaultEventComboBoxModel(EventList<E> source)
Creates a new combo box model that contains the elements of the givensource
and tracks further changes made to it.protected
DefaultEventComboBoxModel(EventList<E> source, boolean disposeSource)
Creates a new combo box model that contains the elements of the givensource
and tracks further changes made to it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getSelectedItem()
Gets the currently selected item.void
setSelectedItem(java.lang.Object selected)
Sets the currently selected item.-
Methods inherited from class ca.odell.glazedlists.swing.DefaultEventListModel
addListDataListener, dispose, fireListDataEvent, getElementAt, getSize, listChanged, removeListDataListener
-
-
-
-
Constructor Detail
-
DefaultEventComboBoxModel
public DefaultEventComboBoxModel(EventList<E> source)
Creates a new combo box model that contains the elements of the givensource
and tracks further changes made to it.- Parameters:
source
- the EventList that provides the elements
-
DefaultEventComboBoxModel
protected DefaultEventComboBoxModel(EventList<E> source, boolean disposeSource)
Creates a new combo box model that contains the elements of the givensource
and tracks further changes made to it.- Parameters:
source
- the EventList that provides the elementsdiposeSource
-true
if the source list should be disposed when disposing this model,false
otherwise
-
-
Method Detail
-
getSelectedItem
public java.lang.Object getSelectedItem()
Gets the currently selected item.- Specified by:
getSelectedItem
in interfacejavax.swing.ComboBoxModel<E>
-
setSelectedItem
public void setSelectedItem(java.lang.Object selected)
Sets the currently selected item.The selection notification process is very much a hack. This fires a ListDataEvent where the range is between -1 and -1. This is identical to the notification process used by the
DefaultComboBoxModel
.- Specified by:
setSelectedItem
in interfacejavax.swing.ComboBoxModel<E>
-
-