1 package tim.prune.undo;
\r
3 import tim.prune.I18nManager;
\r
4 import tim.prune.UpdateMessageBroker;
\r
5 import tim.prune.data.DataPoint;
\r
6 import tim.prune.data.Photo;
\r
7 import tim.prune.data.TrackInfo;
\r
10 * Operation to undo the connection of a photo to a point
\r
12 public class UndoConnectPhoto implements UndoOperation
\r
14 private DataPoint _point = null;
\r
15 private String _filename = null;
\r
20 * @param inPoint data point
\r
21 * @param inFilename filename of photo
\r
23 public UndoConnectPhoto(DataPoint inPoint, String inFilename)
\r
26 _filename = inFilename;
\r
31 * @return description of operation including photo filename
\r
33 public String getDescription()
\r
35 String desc = I18nManager.getText("undo.connectphoto") + " " + _filename;
\r
41 * Perform the undo operation on the given Track
\r
42 * @param inTrackInfo TrackInfo object on which to perform the operation
\r
44 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
47 Photo photo = _point.getPhoto();
\r
50 _point.setPhoto(null);
\r
51 photo.setDataPoint(null);
\r
52 // inform subscribers
\r
53 UpdateMessageBroker.informSubscribers();
\r
57 // throw exception if failed
\r
58 throw new UndoException(getDescription());
\r