KickJava   Java API By Example, From Geeks To Geeks.

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


1 package jimm.datavision.gui.cmd;
2 import jimm.datavision.Scripting;
3 import jimm.util.I18N;
4 import java.util.HashMap JavaDoc;
5 import java.util.Map JavaDoc;
6
7 /**
8  * Performs changes to a report's scripting language information.
9  *
10  * @author Jim Menard, <a HREF="mailto:jimm@io.com">jimm@io.com</a>
11  */

12 public class ScriptingCommand extends CommandAdapter {
13
14 protected Scripting scripting;
15 protected String JavaDoc newDefaultLang;
16 protected Map JavaDoc newLangs;
17 protected String JavaDoc origDefaultLang;
18 protected Map JavaDoc origLangs;
19
20 public ScriptingCommand(Scripting scripting, String JavaDoc newDefaultLang,
21             Map JavaDoc newLangs)
22 {
23     super(I18N.get("ScriptingCommand.name"));
24
25     this.scripting = scripting;
26     this.newDefaultLang = newDefaultLang;
27     this.newLangs = newLangs;
28
29     origDefaultLang = scripting.getDefaultLanguage();
30     origLangs = new HashMap JavaDoc(scripting.getLanguages()); // Make a copy
31
}
32
33 public void perform() {
34     scripting.setDefaultLanguage(newDefaultLang);
35     scripting.replaceLanguages(newLangs);
36 }
37
38 public void undo() {
39     scripting.setDefaultLanguage(origDefaultLang);
40     scripting.replaceLanguages(origLangs);
41 }
42
43 }
44
Popular Tags