01: package jimm.datavision.gui.cmd;
02:
03: import jimm.datavision.gui.SectionWidget;
04: import jimm.util.I18N;
05:
06: /**
07: * Mainly used by other commands to remember a section's old size
08: * and restore it on an undo.
09: *
10: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
11: */
12: public class SectionResizeCommand extends CommandAdapter {
13:
14: protected SectionWidget sw;
15: protected int oldSectionHeight;
16: protected int sectionHeightDelta;
17:
18: public SectionResizeCommand(SectionWidget sw) {
19: super (I18N.get("SectionResizeCommand.name"));
20: this .sw = sw;
21: oldSectionHeight = sw.getHeight();
22: }
23:
24: public void perform() {
25: sectionHeightDelta = sw.getHeight() - oldSectionHeight;
26: }
27:
28: public void undo() {
29: sw.growBy(-sectionHeightDelta);
30: }
31:
32: public void redo() {
33: sw.growBy(sectionHeightDelta);
34: }
35:
36: }
|