01: package jimm.datavision.gui.cmd;
02:
03: import jimm.datavision.Report;
04: import jimm.datavision.PaperFormat;
05: import jimm.datavision.gui.Designer;
06: import jimm.util.I18N;
07:
08: /**
09: * Change a report's paper size.
10: *
11: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
12: */
13: public class PaperSizeCommand extends CommandAdapter {
14:
15: Report report;
16: Designer designer;
17: PaperFormat origFormat;
18: PaperFormat newFormat;
19:
20: public PaperSizeCommand(Report r, Designer win, PaperFormat p) {
21: super (I18N.get("PaperSizeCommand.name"));
22: report = r;
23: designer = win;
24: origFormat = report.getPaperFormat();
25: newFormat = p;
26: }
27:
28: public void perform() {
29: report.setPaperFormat(newFormat);
30: designer.paperSizeChanged(newFormat);
31: designer.invalidate();
32: }
33:
34: public void undo() {
35: report.setPaperFormat(origFormat);
36: designer.paperSizeChanged(origFormat);
37: designer.invalidate();
38: }
39:
40: }
|