KickJava   Java API By Example, From Geeks To Geeks.

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


1 package jimm.datavision.gui.cmd;
2 import jimm.datavision.Section;
3 import jimm.util.I18N;
4
5 /**
6  * Toggles the state of a section's page break flag.
7  *
8  * @author Jim Menard, <a HREF="mailto:jimm@io.com">jimm@io.com</a>
9  */

10 public class SectionPageBreakCommand extends CommandAdapter {
11
12 protected Section section;
13
14 public SectionPageBreakCommand(Section section) {
15     super(I18N.get(section.hasPageBreak()
16            ? "SectionPageBreakCommand.off_name"
17            : "SectionPageBreakCommand.on_name"));
18     this.section = section;
19 }
20
21 public void perform() {
22     boolean newState = !section.hasPageBreak();
23     section.setPageBreak(newState);
24 }
25
26 public void undo() {
27     perform();
28 }
29
30 }
31
Popular Tags