01: package jimm.datavision.gui.cmd;
02:
03: import jimm.datavision.Nameable;
04: import jimm.util.I18N;
05:
06: /**
07: * A command for changing a {@link Nameable} object's name.
08: *
09: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
10: */
11: public class NameableRenameCommand extends CommandAdapter {
12:
13: protected Nameable nameable;
14: protected String oldName;
15: protected String newName;
16:
17: public NameableRenameCommand(Nameable nameable, String oldName,
18: String newName) {
19: super (I18N.get("NameableRenameCommand.name"));
20: this .nameable = nameable;
21: this .oldName = oldName;
22: this .newName = newName;
23: }
24:
25: public void perform() {
26: nameable.setName(newName);
27: }
28:
29: public void undo() {
30: nameable.setName(oldName);
31: }
32:
33: }
|