- java.lang.Object
-
- javax.swing.AbstractListModel<E>
-
- javax.swing.DefaultListModel<T>
-
- com.iamsoft.util.ui.EnhancedListModel
-
- com.iamsoft.util.ui.undo.UndoableListModel
-
- All Implemented Interfaces:
Reorderable
,ReorderableListModel
,Serializable
,ListModel
public class UndoableListModel extends EnhancedListModel
A list model whose updates can be undone. Currently implemented with a List of Lists representing deltas. TODO: Maximium history length.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UndoableListModel.UndoOrRedo
Enum describing whether action is being undone or redone.-
Nested classes/interfaces inherited from class com.iamsoft.util.ui.EnhancedListModel
EnhancedListModel.Direction
-
-
Field Summary
-
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description UndoableListModel()
UndoableListModel(Collection<?> pColl)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
fireContentsChanged(Object pSrc, int pIdx0, int pIdx1)
TODO: Protect this method.protected void
fireIntervalAdded(Object pSrc, int pIdx0, int pIdx1)
protected void
fireIntervalRemoved(Object pSrc, int pIdx0, int pIdx1)
Object[]
getDelta()
Deprecated.Needed for CCU.int
getIndex()
Where in history is the list.UndoableEdit
getNextRedo()
The last edit that was undone or null if no such edit exists.UndoableEdit
getNextUndo()
The last edit that was (re)done or null if no such edit exists.static void
main(String[] pArgs)
Create an UndoableListModel, add some items and perform a few undos and redos.-
Methods inherited from class com.iamsoft.util.ui.EnhancedListModel
addAll, getIndices, insertAll, isEventFiringEnabled, move, moveAll, moveAll, removeAll, removeAll, setEventFiringEnabled, toArray
-
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 Detail
-
UndoableListModel
public UndoableListModel()
-
UndoableListModel
public UndoableListModel(Collection<?> pColl)
-
-
Method Detail
-
getIndex
public int getIndex()
Where in history is the list.
-
getDelta
@Deprecated public Object[] getDelta()
Deprecated.Needed for CCU.Get the objects affected by the last update.
-
getNextUndo
public UndoableEdit getNextUndo()
The last edit that was (re)done or null if no such edit exists.
-
getNextRedo
public UndoableEdit getNextRedo()
The last edit that was undone or null if no such edit exists.
-
fireContentsChanged
public void fireContentsChanged(Object pSrc, int pIdx0, int pIdx1)
TODO: Protect this method.- Overrides:
fireContentsChanged
in classEnhancedListModel
-
fireIntervalAdded
protected void fireIntervalAdded(Object pSrc, int pIdx0, int pIdx1)
- Overrides:
fireIntervalAdded
in classEnhancedListModel
-
fireIntervalRemoved
protected void fireIntervalRemoved(Object pSrc, int pIdx0, int pIdx1)
- Overrides:
fireIntervalRemoved
in classEnhancedListModel
-
main
public static void main(String[] pArgs)
Create an UndoableListModel, add some items and perform a few undos and redos.
-
-