svn-gvsig-desktop / tags / v1_0_2_Build_911 / extensions / extScripting / src / org / gvsig / scripting / ScriptingAppAccesor.java @ 11388
History | View | Annotate | Download (4.07 KB)
1 | 5741 | jmvivo | package org.gvsig.scripting; |
---|---|---|---|
2 | |||
3 | 5782 | jmvivo | import java.io.File; |
4 | 5741 | jmvivo | import java.util.Hashtable; |
5 | import java.util.Map; |
||
6 | |||
7 | import com.iver.andami.PluginServices; |
||
8 | 6574 | jmvivo | import com.iver.utiles.extensionPoints.ExtensionPoints; |
9 | import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
||
10 | 5741 | jmvivo | |
11 | public class ScriptingAppAccesor { |
||
12 | 5782 | jmvivo | private static String scriptsDirectory = null; |
13 | 6574 | jmvivo | private static ExtensionPoints extensionPoints = |
14 | ExtensionPointsSingleton.getInstance(); |
||
15 | 5741 | jmvivo | |
16 | 6574 | jmvivo | public ExtensionPoints getExtensionPoints() {
|
17 | return extensionPoints;
|
||
18 | } |
||
19 | |||
20 | 5741 | jmvivo | public Object getActiveDocument() { |
21 | 6880 | cesar | return PluginServices.getMDIManager().getActiveWindow();
|
22 | 5741 | jmvivo | } |
23 | |||
24 | 5782 | jmvivo | public String getScriptsDirectory() { |
25 | if (scriptsDirectory == null) { |
||
26 | File file = new File(PluginServices.getPluginServices("org.gvsig.scripting").getClassLoader().getBaseDir(),"scripts"); |
||
27 | scriptsDirectory = file.getAbsolutePath(); |
||
28 | } |
||
29 | return scriptsDirectory;
|
||
30 | } |
||
31 | |||
32 | |||
33 | 5741 | jmvivo | public String translate(String str) { |
34 | return PluginServices.getText(this,str); |
||
35 | } |
||
36 | |||
37 | public Object show(Map params) { |
||
38 | return ScriptingExtension.show(params);
|
||
39 | |||
40 | } |
||
41 | |||
42 | public Object show(String fileName,String language) { |
||
43 | Hashtable params = new Hashtable(); |
||
44 | params.put("fileName",fileName);
|
||
45 | params.put("language",language);
|
||
46 | return ScriptingExtension.show(params);
|
||
47 | } |
||
48 | 6774 | jmvivo | |
49 | public Object show(String fileName,String language, String title) { |
||
50 | Hashtable params = new Hashtable(); |
||
51 | params.put("fileName",fileName);
|
||
52 | params.put("language",language);
|
||
53 | params.put("title",title);
|
||
54 | return ScriptingExtension.show(params);
|
||
55 | } |
||
56 | 5741 | jmvivo | |
57 | 6774 | jmvivo | |
58 | 5741 | jmvivo | public Object show(String fileName,String language,Map aParams) { |
59 | Hashtable params = new Hashtable(); |
||
60 | params.putAll(aParams); |
||
61 | params.put("fileName",fileName);
|
||
62 | params.put("language",language);
|
||
63 | return ScriptingExtension.show(params);
|
||
64 | } |
||
65 | |||
66 | 6774 | jmvivo | public Object show(String fileName,String language, String title, Map aParams) { |
67 | Hashtable params = new Hashtable(); |
||
68 | params.putAll(aParams); |
||
69 | params.put("fileName",fileName);
|
||
70 | params.put("language",language);
|
||
71 | params.put("title",title);
|
||
72 | return ScriptingExtension.show(params);
|
||
73 | } |
||
74 | |||
75 | 5741 | jmvivo | public Object show(String fileName,String language,int width, int height) { |
76 | Hashtable params = new Hashtable(); |
||
77 | params.put("fileName",fileName);
|
||
78 | params.put("language",language);
|
||
79 | params.put("width",new Integer(width)); |
||
80 | params.put("height",new Integer(height)); |
||
81 | return ScriptingExtension.show(params);
|
||
82 | } |
||
83 | |||
84 | 6774 | jmvivo | public Object show(String fileName,String language, String title, int width, int height) { |
85 | Hashtable params = new Hashtable(); |
||
86 | params.put("fileName",fileName);
|
||
87 | params.put("language",language);
|
||
88 | params.put("width",new Integer(width)); |
||
89 | params.put("height",new Integer(height)); |
||
90 | params.put("title",title);
|
||
91 | return ScriptingExtension.show(params);
|
||
92 | } |
||
93 | |||
94 | |||
95 | 5741 | jmvivo | public Object show(String fileName,String language,int width, int height, Map aParams) { |
96 | Hashtable params = new Hashtable(); |
||
97 | params.putAll(aParams); |
||
98 | params.put("fileName",fileName);
|
||
99 | params.put("language",language);
|
||
100 | params.put("width",new Integer(width)); |
||
101 | params.put("height",new Integer(height)); |
||
102 | return ScriptingExtension.show(params);
|
||
103 | } |
||
104 | |||
105 | 6774 | jmvivo | public Object show(String fileName,String language, String title, int width, int height, Map aParams) { |
106 | Hashtable params = new Hashtable(); |
||
107 | params.putAll(aParams); |
||
108 | params.put("fileName",fileName);
|
||
109 | params.put("language",language);
|
||
110 | params.put("width",new Integer(width)); |
||
111 | params.put("height",new Integer(height)); |
||
112 | params.put("title",title);
|
||
113 | return ScriptingExtension.show(params);
|
||
114 | } |
||
115 | |||
116 | |||
117 | 5741 | jmvivo | public void run(Map params) { |
118 | ScriptingExtension.run(params); |
||
119 | } |
||
120 | |||
121 | public void run(String fileName, String language) { |
||
122 | Hashtable params = new Hashtable(); |
||
123 | params.put("fileName",fileName);
|
||
124 | params.put("language",language);
|
||
125 | ScriptingExtension.run(params); |
||
126 | } |
||
127 | |||
128 | public void run(String fileName, String language,Map aParams) { |
||
129 | Hashtable params = new Hashtable(); |
||
130 | params.putAll(aParams); |
||
131 | params.put("fileName",fileName);
|
||
132 | params.put("language",language);
|
||
133 | ScriptingExtension.run(params); |
||
134 | } |
||
135 | 5892 | jmvivo | |
136 | public Class classForName(String className) throws ClassNotFoundException { |
||
137 | return Class.forName(className); |
||
138 | } |
||
139 | 5741 | jmvivo | } |