Class 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:
  • Constructor Details

    • UndoableListModel

      public UndoableListModel()
    • UndoableListModel

      public UndoableListModel(Collection<?> pColl)
  • Method Details

    • 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 class EnhancedListModel
    • fireIntervalAdded

      protected void fireIntervalAdded(Object pSrc, int pIdx0, int pIdx1)
      Overrides:
      fireIntervalAdded in class EnhancedListModel
    • fireIntervalRemoved

      protected void fireIntervalRemoved(Object pSrc, int pIdx0, int pIdx1)
      Overrides:
      fireIntervalRemoved in class EnhancedListModel
    • main

      public static void main(String[] pArgs)
      Create an UndoableListModel, add some items and perform a few undos and redos.