1 package tim.prune.undo;
\r
3 import tim.prune.I18nManager;
\r
4 import tim.prune.UpdateMessageBroker;
\r
5 import tim.prune.data.AudioClip;
\r
6 import tim.prune.data.DataPoint;
\r
7 import tim.prune.data.Photo;
\r
8 import tim.prune.data.TrackInfo;
\r
11 * Operation to undo the connection of a photo and/or audio to a point
\r
13 public class UndoConnectMedia implements UndoOperation
\r
15 private DataPoint _point = null;
\r
16 private String _photoFilename = null;
\r
17 private String _audioFilename = null;
\r
22 * @param inPoint data point
\r
23 * @param inPhotoFilename filename of photo, or null if photo not connected
\r
24 * @param inAudioFilename filename of audio, or null of audio not connected
\r
26 public UndoConnectMedia(DataPoint inPoint, String inPhotoFilename, String inAudioFilename)
\r
29 _photoFilename = inPhotoFilename;
\r
30 _audioFilename = inAudioFilename;
\r
35 * @return description of operation including photo and/or audio filename(s)
\r
37 public String getDescription()
\r
39 String desc = I18nManager.getText("undo.connect") + " " + (_photoFilename==null?"":_photoFilename)
\r
40 + (_photoFilename!=null && _audioFilename!=null?", ":"")
\r
41 + (_audioFilename==null?"":_audioFilename);
\r
47 * Perform the undo operation on the given Track
\r
48 * @param inTrackInfo TrackInfo object on which to perform the operation
\r
50 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
52 if (_photoFilename != null)
\r
55 Photo photo = _point.getPhoto();
\r
58 _point.setPhoto(null);
\r
59 photo.setDataPoint(null);
\r
62 if (_audioFilename != null)
\r
65 AudioClip audio = _point.getAudio();
\r
68 _point.setAudio(null);
\r
69 audio.setDataPoint(null);
\r
72 // inform subscribers
\r
73 UpdateMessageBroker.informSubscribers();
\r