KickJava   Java API By Example, From Geeks To Geeks.

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


1 package jimm.datavision.gui.cmd;
2 import jimm.datavision.Nameable;
3 import jimm.util.I18N;
4
5 /**
6  * A command for changing a {@link Nameable} object's name.
7  *
8  * @author Jim Menard, <a HREF="mailto:jimm@io.com">jimm@io.com</a>
9  */

10 public class NameableRenameCommand extends CommandAdapter {
11
12 protected Nameable nameable;
13 protected String JavaDoc oldName;
14 protected String JavaDoc newName;
15
16 public NameableRenameCommand(Nameable nameable, String JavaDoc oldName, String JavaDoc newName)
17 {
18     super(I18N.get("NameableRenameCommand.name"));
19     this.nameable = nameable;
20     this.oldName = oldName;
21     this.newName = newName;
22 }
23
24 public void perform() {
25     nameable.setName(newName);
26 }
27
28 public void undo() {
29     nameable.setName(oldName);
30 }
31
32 }
33
Popular Tags