01: package jimm.datavision.gui.cmd;
02:
03: import jimm.datavision.Report;
04: import jimm.util.I18N;
05:
06: /**
07: * A command for changing a field's summary.
08: *
09: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
10: */
11: public class SummaryCommand extends CommandAdapter {
12:
13: protected Report report;
14: protected String origName;
15: protected String origTitle;
16: protected String origAuthor;
17: protected String origDescription;
18: protected String newName;
19: protected String newTitle;
20: protected String newAuthor;
21: protected String newDescription;
22:
23: public SummaryCommand(Report report, String newName,
24: String newTitle, String newAuthor, String newDescription) {
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: }
|