org.opensourcephysics.cabrillo.tracker
Class Undo

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

public class Undo
extends java.lang.Object

A class to handle undo/redo operations for Tracker.

Author:
Douglas Brown

Nested Class Summary
protected  class Undo.CompoundEdit
          A class to undo/redo a pair of UndoableEdits.
protected  class Undo.CoordsEdit
          A class to undo/redo coords changes.
protected  class Undo.FilterClear
          A class to undo/redo filter deletion.
protected  class Undo.FilterDelete
          A class to undo/redo filter deletion.
protected  class Undo.FilterEdit
          A class to undo/redo filter deletion.
protected  class Undo.ImageVideoEdit
          A class to undo/redo image video edits.
protected  class Undo.StepEdit
          A class to undo/redo step changes.
protected  class Undo.TEdit
          A class to undo/redo changes to objects associated with a TrackerPanel.
protected  class Undo.TrackClear
          A class to undo/redo clearing tracks.
protected  class Undo.TrackDelete
          A class to undo/redo track deletion.
protected  class Undo.TrackEdit
          A class to undo/redo track changes.
protected  class Undo.VideoReplace
          A class to undo/redo video replacements.
 
Field Summary
protected  javax.swing.undo.UndoManager undoManager
           
protected  javax.swing.undo.UndoableEditSupport undoSupport
           
 
Method Summary
static boolean canRedo(TrackerPanel panel)
          Reports whether an undoable edit is available for the specified panel.
static boolean canUndo(TrackerPanel panel)
          Reports whether an undoable edit is available for the specified panel.
protected static void postCoordsEdit(TrackerPanel panel, XMLControl control)
          Posts an undoable edit for a changed coordinate system.
protected static void postFilterClear(TrackerPanel panel, java.util.List<java.lang.String> xml)
          Posts an undoable edit for a TrackerPanel cleared of video filters.
protected static void postFilterDelete(TrackerPanel panel, Filter filter)
          Posts an undoable edit for a video filter deletion.
protected static void postFilterEdit(TrackerPanel panel, Filter filter, XMLControl control)
          Posts an undoable edit for a change to a video filter.
protected static void postImageVideoEdit(TrackerPanel panel, java.lang.String[] paths, int index, int step, boolean added)
          Posts an undoable edit for an edited image video.
protected static void postStepEdit(Step step, XMLControl control)
          Posts an undoable edit for a changed step.
protected static void postTrackAndCoordsEdit(TTrack track, XMLControl trackControl, XMLControl coordsControl)
          Posts a compound undoable edit for tracks that control the coords.
protected static void postTrackClear(TrackerPanel panel, java.util.List<java.lang.String> xml)
          Posts an undoable edit for a TrackerPanel cleared of tracks.
protected static void postTrackDelete(TTrack track)
          Posts an undoable edit for a deleted track.
protected static void postTrackEdit(TTrack track, XMLControl control)
          Posts an undoable edit for a changed track.
protected static void postVideoReplace(TrackerPanel panel, XMLControl control)
          Posts an undoable edit for a replaced video clip.
static void redo(TrackerPanel panel)
          Redoes the most recently undone edit for the specified panel.
static void undo(TrackerPanel panel)
          Undoes the most recently posted edit for the specified panel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

undoSupport

protected javax.swing.undo.UndoableEditSupport undoSupport

undoManager

protected javax.swing.undo.UndoManager undoManager
Method Detail

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

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

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,
                                     java.util.List<java.lang.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

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

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,
                                         java.lang.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,
                                      java.util.List<java.lang.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