java.lang.Object
org.opensourcephysics.cabrillo.tracker.Undo

public class Undo extends Object
A class to handle undo/redo operations for Tracker.
Author:
Douglas Brown
  • Field Details

    • undomap

      protected static Map<Integer,Undo> undomap
    • undoSupport

      protected UndoableEditSupport undoSupport
    • undoManager

      protected org.opensourcephysics.cabrillo.tracker.Undo.MyUndoManager undoManager
  • Method Details

    • canUndo

      public static boolean canUndo(TrackerPanel panel)
      Reports whether an undoable edit is available for the specified panel.
      Parameters:
      panel - the TrackerPanel
      Returns:
      true if an undoable edit is available
    • getUndoDescription

      public static String getUndoDescription(TrackerPanel panel)
      Gets the undoable edit description for the specified panel.
      Parameters:
      panel - the TrackerPanel
      Returns:
      the undoable edit description
    • undo

      public static void undo(TrackerPanel panel)
      Undoes the most recently posted edit for the specified panel.
      Parameters:
      panel - the TrackerPanel
    • canRedo

      public static boolean canRedo(TrackerPanel panel)
      Reports whether an undoable edit is available for the specified panel.
      Parameters:
      panel - the TrackerPanel
      Returns:
      true if an undoable edit is available
    • getRedoDescription

      public static String getRedoDescription(TrackerPanel panel)
      Gets the redoable edit description for the specified panel.
      Parameters:
      panel - the TrackerPanel
      Returns:
      the redoable edit description
    • redo

      public static void redo(TrackerPanel panel)
      Redoes the most recently undone edit for the specified panel.
      Parameters:
      panel - the TrackerPanel
    • postTrackDelete

      protected static void postTrackDelete(TTrack track)
      Posts an undoable edit for a deleted track.
      Parameters:
      track - the track
    • postTrackClear

      protected static void postTrackClear(TrackerPanel panel, List<String> xml)
      Posts an undoable edit for a TrackerPanel cleared of tracks.
      Parameters:
      panel - the TrackerPanel that has been cleared
      xml - a list of XML strings describing the cleared tracks
    • postTrackEdit

      protected static void postTrackEdit(TTrack track, XMLControl control)
      Posts an undoable edit for a changed track.
      Parameters:
      track - the changed track
      control - an XMLControl with the previous state of the track
    • postMultiTrackEdit

      protected static void postMultiTrackEdit(ArrayList<Object[]> tracksAndXMLControls)
      Posts an undoable edit for multiple changed tracks.
      Parameters:
      tracksAndXMLControls - list of array elements, each element = {track, track's previous state}
    • postStepEdit

      protected static void postStepEdit(Step step, XMLControl control)
      Posts an undoable edit for a changed step.
      Parameters:
      step - the changed step
      control - an XMLControl with the previous state of the track
    • postStepSetEdit

      protected static void postStepSetEdit(StepSet steps, XMLControl control)
      Posts an undoable edit for a changed StepSet.
      Parameters:
      steps - the changed StepSet
      control - an XMLControl with the previous state of the StepSet
    • postCoordsEdit

      protected static void postCoordsEdit(TrackerPanel panel, XMLControl control)
      Posts an undoable edit for a changed coordinate system.
      Parameters:
      panel - the TrackerPanel with the changed coords
      control - an XMLControl with the previous state of the coords
    • postTrackAndCoordsEdit

      protected static void postTrackAndCoordsEdit(TTrack track, XMLControl trackControl, XMLControl coordsControl)
      Posts a compound undoable edit for tracks that control the coords.
      Parameters:
      track - the changed track
      trackControl - an XMLControl with the previous state of the track
      coordsControl - an XMLControl with the previous state of the coords
    • postImageVideoEdit

      protected static void postImageVideoEdit(TrackerPanel panel, String[] paths, int index, int step, boolean added)
      Posts an undoable edit for an edited image video.
      Parameters:
      panel - the TrackerPanel with the new video clip
      paths - paths to the video files
      index - step number at which edit occured
      step - step number after edit occured
      added - true if a frame was added
    • postVideoReplace

      protected static void postVideoReplace(TrackerPanel panel, XMLControl control)
      Posts an undoable edit for a replaced video clip.
      Parameters:
      panel - the TrackerPanel with the new video clip
      control - an XMLControl describing the previous video clip
    • postFilterDelete

      protected static void postFilterDelete(TrackerPanel panel, Filter filter)
      Posts an undoable edit for a video filter deletion.
      Parameters:
      panel - the TrackerPanel with the new video clip
      filter - the deleted filter
    • postFilterEdit

      protected static void postFilterEdit(TrackerPanel panel, Filter filter, XMLControl control)
      Posts an undoable edit for a change to a video filter.
      Parameters:
      panel - the TrackerPanel with the new video clip
      filter - the filter
      control - an XMLControl with the previous state of the filter
    • postFilterClear

      protected static void postFilterClear(TrackerPanel panel, List<String> xml)
      Posts an undoable edit for a TrackerPanel cleared of video filters.
      Parameters:
      panel - the TrackerPanel that has been cleared
      xml - a list of XML strings describing the cleared tracks
    • postTrackDisplayEdit

      protected static void postTrackDisplayEdit(TTrack track, XMLControl control)
      Posts an undoable edit for a footprint, name or color change.
      Parameters:
      track - the track with the changed property
      control - an XMLControl with the previous state of the footprint
    • getXMLControl

      public static XMLControl getXMLControl(VideoClip clip)
      Returns XMLControl for a VideoClip after adding absolutePath of video
    • panel

      protected TrackerPanel panel()