01: package jimm.datavision.gui.cmd;
02:
03: import jimm.datavision.gui.FieldWidget;
04: import jimm.util.I18N;
05:
06: /**
07: * Shows or hides a field.
08: *
09: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
10: */
11: public class FieldShowHideCommand extends CommandAdapter {
12:
13: protected FieldWidget fw;
14: protected boolean newVisibility;
15:
16: public FieldShowHideCommand(FieldWidget fw, String nameKey,
17: boolean newVisibility) {
18: super (I18N.get(nameKey));
19:
20: this .fw = fw;
21: this .newVisibility = newVisibility;
22: }
23:
24: public void perform() {
25: fw.doSetVisibility(newVisibility);
26: }
27:
28: public void undo() {
29: fw.doSetVisibility(!newVisibility);
30: }
31:
32: }
|