java.lang.Object
javax.swing.AbstractListModel<E>
javax.swing.DefaultListModel<E>
com.aoapps.hodgepodge.swing.SynchronizingListModel<E>
- All Implemented Interfaces:
Serializable
,ListModel<E>
When requested, it will synchronize its list of elements to an externally-
provided list. The is useful when the data source is obtained elsewhere and
the list-based component needs to be synchronized.
Since these updates may occur while a user is manipulating the components, only the minimum number of changes to the elements is made. Thus selections and other aspects of the component remain intact. Most importantly, if nothing in the list has changed, the component is not changed.
- Author:
- AO Industries, Inc.
- See Also:
-
Field Summary
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
synchronize
(List<? extends E> list) Synchronizes the list, adding and removing only a minimum number of elements.Methods inherited from class javax.swing.DefaultListModel
add, addAll, addAll, addElement, capacity, clear, contains, copyInto, elementAt, elements, ensureCapacity, firstElement, get, getElementAt, getSize, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeAllElements, removeElement, removeElementAt, removeRange, set, setElementAt, setSize, size, toArray, toString, trimToSize
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
Constructor Details
-
SynchronizingListModel
public SynchronizingListModel() -
SynchronizingListModel
-
-
Method Details
-
synchronize
Synchronizes the list, adding and removing only a minimum number of elements. Comparisons are performed using .equals. This must be called from the Swing event dispatch thread.
-