KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jimm > datavision > gui > cmd > SummaryCommand


1 package jimm.datavision.gui.cmd;
2 import jimm.datavision.Report;
3 import jimm.util.I18N;
4
5 /**
6  * A command for changing a field's summary.
7  *
8  * @author Jim Menard, <a HREF="mailto:jimm@io.com">jimm@io.com</a>
9  */

10 public class SummaryCommand extends CommandAdapter {
11
12 protected Report report;
13 protected String JavaDoc origName;
14 protected String JavaDoc origTitle;
15 protected String JavaDoc origAuthor;
16 protected String JavaDoc origDescription;
17 protected String JavaDoc newName;
18 protected String JavaDoc newTitle;
19 protected String JavaDoc newAuthor;
20 protected String JavaDoc newDescription;
21
22 public SummaryCommand(Report report, String JavaDoc newName, String JavaDoc newTitle,
23               String JavaDoc newAuthor, String JavaDoc newDescription)
24 {
25     super(I18N.get("SummaryCommand.name"));
26     this.report = report;
27     this.newName = newName;
28     this.newTitle = newTitle;
29     this.newAuthor = newAuthor;
30     this.newDescription = newDescription;
31
32     origName = report.getName();
33     origTitle = report.getTitle();
34     origAuthor = report.getAuthor();
35     origDescription = report.getDescription();
36 }
37
38 public void perform() {
39     report.setName(newName);
40     report.setTitle(newTitle);
41     report.setAuthor(newAuthor);
42     report.setDescription(newDescription);
43 }
44
45 public void undo() {
46     report.setName(origName);
47     report.setTitle(origTitle);
48     report.setAuthor(origAuthor);
49     report.setDescription(origDescription);
50 }
51
52 }
53
Popular Tags