1 package tim.prune.undo;
\r
3 import tim.prune.I18nManager;
\r
4 import tim.prune.data.DataPoint;
\r
5 import tim.prune.data.Photo;
\r
6 import tim.prune.data.TrackInfo;
\r
9 * Operation to undo the disconnection of a photo from a point
\r
11 public class UndoDisconnectPhoto implements UndoOperation
\r
13 private DataPoint _point = null;
\r
14 private Photo _photo = null;
\r
15 private String _filename = null;
\r
20 * @param inPoint data point
\r
21 * @param inFilename filename of photo
\r
23 public UndoDisconnectPhoto(DataPoint inPoint, String inFilename)
\r
26 _photo = inPoint.getPhoto();
\r
27 _filename = inFilename;
\r
32 * @return description of operation including photo filename
\r
34 public String getDescription()
\r
36 String desc = I18nManager.getText("undo.disconnectphoto") + " " + _filename;
\r
42 * Perform the undo operation on the given Track
\r
43 * @param inTrackInfo TrackInfo object on which to perform the operation
\r
45 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
48 if (_point != null && _photo != null)
\r
50 _point.setPhoto(_photo);
\r
51 _photo.setDataPoint(_point);
\r
52 // inform subscribers
\r
53 inTrackInfo.triggerUpdate();
\r
57 // throw exception if failed
\r
58 throw new UndoException(getDescription());
\r