01: package jimm.datavision.gui.cmd;
02:
03: import jimm.datavision.Scripting;
04: import jimm.util.I18N;
05: import java.util.HashMap;
06: import java.util.Map;
07:
08: /**
09: * Performs changes to a report's scripting language information.
10: *
11: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
12: */
13: public class ScriptingCommand extends CommandAdapter {
14:
15: protected Scripting scripting;
16: protected String newDefaultLang;
17: protected Map newLangs;
18: protected String origDefaultLang;
19: protected Map origLangs;
20:
21: public ScriptingCommand(Scripting scripting, String newDefaultLang,
22: Map newLangs) {
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(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: }
|