java.lang.Object
javax.swing.AbstractListModel<E>
javax.swing.DefaultListModel<T>
com.iamsoft.util.ui.EnhancedListModel<T>
- Type Parameters:
T
- The type of the elements of this model.
- All Implemented Interfaces:
Reorderable
,ReorderableListModel<T>
,Serializable
,ListModel<T>
- Direct Known Subclasses:
UndoableListModel
Allow user to move items up/down within list.
List
models really should be generified.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum for indicating direction of movement of items in list. -
Field Summary
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAll
(Collection<? extends T> pObjects) Add all elements in a collection.void
fireContentsChanged
(Object pSrc, int pIdx0, int pIdx1) TODO: Protect method.protected void
fireIntervalAdded
(Object pSrc, int pIdx0, int pIdx1) protected void
fireIntervalRemoved
(Object pSrc, int pIdx0, int pIdx1) int[]
getIndices
(Collection<?> pColl) Any elements not present in list marked with -1.void
insertAll
(Collection<? extends T> pObjects, int pIdx) Inserts all elements in a collection.protected boolean
ListModelEvents are fired if this is true.void
move
(Object pObject, EnhancedListModel.Direction pDir) Move specified object up or down.void
moveAll
(int[] pIndices, EnhancedListModel.Direction pDir) Shifts elements at specified locations in specified direction.void
moveAll
(Collection<?> pObjects, EnhancedListModel.Direction pDir) Move specified objects up or down.void
removeAll
(int[] pIndices) Remove specified indices.boolean
removeAll
(Collection<?> pColl) Remove all elements in a collection.protected void
setEventFiringEnabled
(boolean pEventFiringEnabled) Object[]
Methods inherited from class javax.swing.DefaultListModel
add, 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, getListDataListeners, getListeners, removeListDataListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
-
Constructor Details
-
EnhancedListModel
public EnhancedListModel() -
EnhancedListModel
-
-
Method Details
-
isEventFiringEnabled
protected boolean isEventFiringEnabled()ListModelEvents are fired if this is true. -
setEventFiringEnabled
protected void setEventFiringEnabled(boolean pEventFiringEnabled) - See Also:
-
moveAll
Shifts elements at specified locations in specified direction. One event is fired with indices determined by range of updates. Behavior undefined if indices are duplicated or out of range.- Specified by:
moveAll
in interfaceReorderable
-
moveAll
Move specified objects up or down. Behavior undefined if objects in collection are duplicated. -
move
Move specified object up or down. -
getIndices
Any elements not present in list marked with -1.- Returns:
- int array with same size of Collection.
-
addAll
Add all elements in a collection. Fires a single event.- Overrides:
addAll
in classDefaultListModel<T>
-
insertAll
Inserts all elements in a collection. Fires a single event. -
removeAll
public void removeAll(int[] pIndices) Remove specified indices. Contiguous ranges are removed as a batch. This method minimizes event notifications rather that execution time. Behavior undefined if indices are repeated or out of range. -
removeAll
Remove all elements in a collection. Minimizes number of events rather than execution time. Behavior undefined if duplicate elements contained within argument collection.- Returns:
- true if list is updated.
-
toArray
-
fireContentsChanged
TODO: Protect method.- Overrides:
fireContentsChanged
in classAbstractListModel<T>
-
fireIntervalAdded
- Overrides:
fireIntervalAdded
in classAbstractListModel<T>
-
fireIntervalRemoved
- Overrides:
fireIntervalRemoved
in classAbstractListModel<T>
-