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 disconnection of a photo from a point
\r
12 public class UndoDisconnectPhoto implements UndoOperation
\r
14 private DataPoint _point = null;
\r
15 private Photo _photo = null;
\r
16 private String _filename = null;
\r
21 * @param inPoint data point
\r
22 * @param inFilename filename of photo
\r
24 public UndoDisconnectPhoto(DataPoint inPoint, String inFilename)
\r
27 _photo = inPoint.getPhoto();
\r
28 _filename = inFilename;
\r
33 * @return description of operation including photo filename
\r
35 public String getDescription()
\r
37 String desc = I18nManager.getText("undo.disconnectphoto") + " " + _filename;
\r
43 * Perform the undo operation on the given Track
\r
44 * @param inTrackInfo TrackInfo object on which to perform the operation
\r
46 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
49 if (_point != null && _photo != null)
\r
51 _point.setPhoto(_photo);
\r
52 _photo.setDataPoint(_point);
\r
53 // inform subscribers
\r
54 UpdateMessageBroker.informSubscribers();
\r
58 // throw exception if failed
\r
59 throw new UndoException(getDescription());
\r