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 enumEnum 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 TypeMethodDescriptionvoidaddAll(Collection<? extends T> pObjects) Add all elements in a collection.voidfireContentsChanged(Object pSrc, int pIdx0, int pIdx1) TODO: Protect method.protected voidfireIntervalAdded(Object pSrc, int pIdx0, int pIdx1) protected voidfireIntervalRemoved(Object pSrc, int pIdx0, int pIdx1) int[]getIndices(Collection<?> pColl) Any elements not present in list marked with -1.voidinsertAll(Collection<? extends T> pObjects, int pIdx) Inserts all elements in a collection.protected booleanListModelEvents are fired if this is true.voidmove(Object pObject, EnhancedListModel.Direction pDir) Move specified object up or down.voidmoveAll(int[] pIndices, EnhancedListModel.Direction pDir) Shifts elements at specified locations in specified direction.voidmoveAll(Collection<?> pObjects, EnhancedListModel.Direction pDir) Move specified objects up or down.voidremoveAll(int[] pIndices) Remove specified indices.booleanremoveAll(Collection<?> pColl) Remove all elements in a collection.protected voidsetEventFiringEnabled(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, trimToSizeMethods inherited from class javax.swing.AbstractListModel
addListDataListener, getListDataListeners, getListeners, removeListDataListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
moveAllin 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:
addAllin 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:
fireContentsChangedin classAbstractListModel<T>
-
fireIntervalAdded
- Overrides:
fireIntervalAddedin classAbstractListModel<T>
-
fireIntervalRemoved
- Overrides:
fireIntervalRemovedin classAbstractListModel<T>
-