01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.printing.ui.internal.editor.commands;
18:
19: import net.refractions.udig.printing.model.impl.LabelBoxPrinter;
20: import net.refractions.udig.printing.ui.internal.Messages;
21:
22: import org.eclipse.gef.commands.Command;
23:
24: /**
25: * Provides ...TODO summary sentence
26: * <p>
27: * TODO Description
28: * </p><p>
29: * Responsibilities:
30: * <ul>
31: * <li>
32: * <li>
33: * </ul>
34: * </p><p>
35: * Example Use:<pre><code>
36: * RenameNodeCommand x = new RenameNodeCommand( ... );
37: * TODO code example
38: * </code></pre>
39: * </p>
40: * @author Richard Gould
41: * @since 0.3
42: */
43: public class RenameLabelCommand extends Command {
44: private LabelBoxPrinter labelBox;
45: private String newName;
46: private String oldName;
47:
48: public void setName(String name) {
49: this .newName = name;
50: }
51:
52: public void setNode(LabelBoxPrinter node) {
53: this .labelBox = node;
54: }
55:
56: public void execute() {
57: oldName = this .labelBox.getText();
58: this .labelBox.setText(newName);
59: }
60:
61: public String getLabel() {
62: return Messages.RenameLabelCommand_label;
63: }
64:
65: public void redo() {
66: this .labelBox.setText(newName);
67: }
68:
69: public void undo() {
70: this.labelBox.setText(oldName);
71: }
72:
73: }
|