1 package tim.prune.undo;
\r
3 import tim.prune.I18nManager;
\r
4 import tim.prune.data.TrackInfo;
\r
7 * Operation to undo a load photos operation
\r
9 public class UndoLoadPhotos implements UndoOperation
\r
11 private int _numLoaded = -1;
\r
13 // TODO: Handle possibility of photos not having datapoints (yet)
\r
17 * @param inNumLoaded number of photos loaded
\r
19 public UndoLoadPhotos(int inNumLoaded)
\r
21 _numLoaded = inNumLoaded;
\r
26 * @return description of operation including number of photos loaded
\r
28 public String getDescription()
\r
30 String desc = I18nManager.getText("undo.loadphotos");
\r
32 desc = desc + " (" + _numLoaded + ")";
\r
38 * Perform the undo operation on the given Track
\r
39 * Delete both track points and Photo objects
\r
40 * @param inTrackInfo TrackInfo object on which to perform the operation
\r
42 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
44 // crop track to previous size
\r
45 int cropIndex = inTrackInfo.getTrack().getNumPoints() - _numLoaded;
\r
46 inTrackInfo.getTrack().cropTo(cropIndex);
\r
47 // crop photo list to previous size
\r
48 // (currently it is assumed that the number of points is the same as number of photos)
\r
49 cropIndex = inTrackInfo.getPhotoList().getNumPhotos() - _numLoaded;
\r
50 inTrackInfo.getPhotoList().cropTo(cropIndex);
\r
52 inTrackInfo.getSelection().clearAll();
\r