File: UndoReorder.java

package info (click to toggle)
gpsprune 10-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,220 kB
  • ctags: 3,013
  • sloc: java: 22,662; sh: 23; makefile: 16; python: 15
file content (46 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package tim.prune.undo;

import tim.prune.I18nManager;
import tim.prune.data.DataPoint;
import tim.prune.data.Track;
import tim.prune.data.TrackInfo;

/**
 * Abstract operation to undo a reordering by replacing track contents with a shallow copy
 */
public abstract class UndoReorder implements UndoOperation
{
	/** Shallow copy of whole track contents */
	private DataPoint[] _contents = null;
	/** Description */
	private String _description = null;

	/**
	 * Constructor
	 * @param inTrack track contents to copy
	 * @param inDescKey description key
	 */
	public UndoReorder(Track inTrack, String inDescKey)
	{
		_contents = inTrack.cloneContents();
		_description = I18nManager.getText(inDescKey);
	}

	/**
	 * @return description
	 */
	public String getDescription() {
		return _description;
	}


	/**
	 * Perform the undo operation on the given Track
	 * @param inTrackInfo TrackInfo object on which to perform the operation
	 */
	public void performUndo(TrackInfo inTrackInfo) throws UndoException
	{
		// restore track to previous values
		inTrackInfo.getTrack().replaceContents(_contents);
	}
}