01: package jimm.datavision.gui.cmd;
02:
03: import jimm.datavision.Report;
04: import jimm.datavision.Section;
05: import jimm.datavision.ReportSectionLoc;
06: import jimm.datavision.gui.Designer;
07: import jimm.datavision.gui.SectionWidget;
08: import jimm.util.I18N;
09:
10: public class DeleteSectionCommand extends CommandAdapter {
11:
12: protected Designer designer;
13: protected Report report;
14: protected Section section;
15: protected ReportSectionLoc sectionLoc;
16: protected SectionWidget sectionWidget;
17: protected SectionWidget sectionWidgetAbove;
18:
19: /**
20: * Constructor.
21: */
22: public DeleteSectionCommand(Designer designer, Report report,
23: Section section) {
24: super (I18N.get("DeleteSectionCommand.name"));
25: this .designer = designer;
26: this .report = report;
27: this .section = section;
28: this .sectionWidget = designer.findSectionWidgetFor(section);
29: sectionLoc = report.getSectionLocation(section);
30: }
31:
32: public void perform() {
33: // Removes section from report and window.
34: sectionWidgetAbove = designer.doDeleteSection(section);
35: }
36:
37: public void undo() {
38: report.reinsertSection(sectionLoc);
39: designer.insertSectionWidgetAfter(sectionWidget,
40: sectionWidgetAbove);
41: }
42:
43: }
|