gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.util / org.gvsig.tools.util.api / src / main / java / org / gvsig / tools / util / ToolsUtilLocator.java @ 2286
History | View | Annotate | Download (8.63 KB)
1 |
package org.gvsig.tools.util; |
---|---|
2 |
|
3 |
/**
|
4 |
* gvSIG. Desktop Geographic Information System.
|
5 |
*
|
6 |
* Copyright (C) 2007-2013 gvSIG Association.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or modify it under
|
9 |
* the terms of the GNU General Public License as published by the Free Software
|
10 |
* Foundation; either version 3 of the License, or (at your option) any later
|
11 |
* version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
14 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
15 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
16 |
* details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License along with
|
19 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
20 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
21 |
*
|
22 |
* For any additional information, do not hesitate to contact us at info AT
|
23 |
* gvsig.com, or visit our website www.gvsig.com.
|
24 |
*/
|
25 |
|
26 |
import org.gvsig.configurableactions.ConfigurableActionsMamager; |
27 |
import org.gvsig.filedialogchooser.FileDialogChooserManager; |
28 |
import org.gvsig.imageviewer.ImageViewerManager; |
29 |
import org.gvsig.propertypage.PropertiesPageManager; |
30 |
import org.gvsig.svgsupport.SVGSupportManager; |
31 |
import org.gvsig.texteditor.TextEditorManager; |
32 |
import org.gvsig.tools.locator.AbstractLocator; |
33 |
import org.gvsig.tools.locator.Locator; |
34 |
import org.gvsig.tools.locator.LocatorException; |
35 |
import org.gvsig.webbrowser2.WebBrowserManager; |
36 |
|
37 |
/**
|
38 |
* @author gvSIG Team
|
39 |
*
|
40 |
*/
|
41 |
@SuppressWarnings("rawtypes") |
42 |
public class ToolsUtilLocator extends AbstractLocator { |
43 |
|
44 |
private static final String LOCATOR_NAME = "ToolsUtilLocator"; |
45 |
|
46 |
public static final String TOOLS_UTIL_MANAGER_NAME = "org.gvsig.tools.util.manager"; |
47 |
private static final String TOOLS_UTIL_MANAGER_DESCRIPTION = "Tools utilities."; |
48 |
|
49 |
public static final String PROPERTIES_PAGE_MANAGER_NAME = "org.gvsig.tools.properties.page.manager"; |
50 |
private static final String PROPERTIES_PAGE_MANAGER_DESCRIPTION = "Properties page manager"; |
51 |
|
52 |
public static final String FILE_DIALOG_CHOOSER_MANAGER_NAME = "org.gvsig.filedialogchooser.manager"; |
53 |
private static final String FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION = "File dialog chooser."; |
54 |
|
55 |
public static final String PLUGINS_SVGSUPPORT_MANAGER_NAME = "SVGSupportManager"; |
56 |
private static final String PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION = "SVGSupportManager"; |
57 |
|
58 |
public static final String PLUGINS_IMAGEVIEWER_MANAGER_NAME = "ImageViewerManager"; |
59 |
private static final String PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION = "ImageViewerManager"; |
60 |
|
61 |
public static final String CONFIGURABLE_ACTIONS_MANAGER_NAME = "ConfigurableActionsMamager"; |
62 |
private static final String CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION = "ConfigurableActionsMamager"; |
63 |
|
64 |
public static final String TEXTEDITOR_MANAGER_NAME = "TextEditorMamager"; |
65 |
private static final String TEXTEDITOR_MANAGER_DESCRIPTION = "TextEditorMamager"; |
66 |
|
67 |
public static final String WEBBROWSER_MANAGER_NAME = "WebBrowserMamager"; |
68 |
private static final String WEBBROWSER_MANAGER_DESCRIPTION = "WebBrowserMamager"; |
69 |
|
70 |
private static final ToolsUtilLocator INSTANCE = new ToolsUtilLocator(); |
71 |
|
72 |
private ToolsUtilLocator() {
|
73 |
|
74 |
} |
75 |
|
76 |
/**
|
77 |
* Return the singleton instance.
|
78 |
*
|
79 |
* @return the singleton instance
|
80 |
*/
|
81 |
public static ToolsUtilLocator getInstance() { |
82 |
return INSTANCE;
|
83 |
} |
84 |
|
85 |
@Override
|
86 |
public String getLocatorName() { |
87 |
return LOCATOR_NAME;
|
88 |
} |
89 |
|
90 |
/**
|
91 |
* Return a reference to ToolsUtilManager.
|
92 |
*
|
93 |
* @return a reference to ToolsUtilManager
|
94 |
* @throws LocatorException if there is no access to the class or the class
|
95 |
* cannot be instantiated
|
96 |
* @see Locator#get(String)
|
97 |
*/
|
98 |
public static ToolsUtilManager getToolsUtilManager() |
99 |
throws LocatorException {
|
100 |
return (ToolsUtilManager) getInstance().get(TOOLS_UTIL_MANAGER_NAME);
|
101 |
} |
102 |
|
103 |
/**
|
104 |
* Registers the Class implementing the ToolsUtilManager interface.
|
105 |
*
|
106 |
* @param clazz implementing the ToolsUtilManager interface
|
107 |
*/
|
108 |
public static void registerToolsUtilManager(Class clazz) { |
109 |
getInstance().register(TOOLS_UTIL_MANAGER_NAME, |
110 |
TOOLS_UTIL_MANAGER_DESCRIPTION, clazz); |
111 |
} |
112 |
|
113 |
public static void registerDefaultToolsUtilManager(Class clazz) { |
114 |
getInstance().registerDefault(TOOLS_UTIL_MANAGER_NAME, |
115 |
TOOLS_UTIL_MANAGER_DESCRIPTION, clazz); |
116 |
} |
117 |
|
118 |
public static FileDialogChooserManager getFileDialogChooserManager() |
119 |
throws LocatorException {
|
120 |
return (FileDialogChooserManager) getInstance().get(FILE_DIALOG_CHOOSER_MANAGER_NAME);
|
121 |
} |
122 |
|
123 |
public static void registerFileDialogChooserManager(Class clazz) { |
124 |
getInstance().register(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
125 |
FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
126 |
} |
127 |
|
128 |
public static void registerDefaultFileDialogChooserManager(Class clazz) { |
129 |
getInstance().registerDefault(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
130 |
FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
131 |
} |
132 |
|
133 |
//SVG support
|
134 |
public static SVGSupportManager getSVGSupportManager() throws LocatorException { |
135 |
return (SVGSupportManager) getInstance().get(PLUGINS_SVGSUPPORT_MANAGER_NAME);
|
136 |
} |
137 |
|
138 |
public static void registerSVGSupportManager(Class clazz) { |
139 |
getInstance().register(PLUGINS_SVGSUPPORT_MANAGER_NAME, PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, |
140 |
clazz); |
141 |
} |
142 |
|
143 |
public static void registerDefaultSVGSupportManager(Class clazz) { |
144 |
getInstance().registerDefault(PLUGINS_SVGSUPPORT_MANAGER_NAME, |
145 |
PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, clazz); |
146 |
} |
147 |
|
148 |
public static ImageViewerManager getImageViewerManager() throws LocatorException { |
149 |
return (ImageViewerManager) getInstance().get(PLUGINS_IMAGEVIEWER_MANAGER_NAME);
|
150 |
} |
151 |
|
152 |
public static void registerImageViewertManager(Class clazz) { |
153 |
getInstance().register(PLUGINS_IMAGEVIEWER_MANAGER_NAME, PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION, |
154 |
clazz); |
155 |
} |
156 |
|
157 |
public static void registerDefaultImageViewerManager(Class clazz) { |
158 |
getInstance().registerDefault(PLUGINS_IMAGEVIEWER_MANAGER_NAME, |
159 |
PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION, clazz); |
160 |
} |
161 |
|
162 |
|
163 |
public static ConfigurableActionsMamager getConfigurableActionsMamager() throws LocatorException { |
164 |
return (ConfigurableActionsMamager) getInstance().get(CONFIGURABLE_ACTIONS_MANAGER_NAME);
|
165 |
} |
166 |
|
167 |
public static void registerConfigurableActionsMamager(Class clazz) { |
168 |
getInstance().register(CONFIGURABLE_ACTIONS_MANAGER_NAME, CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION, |
169 |
clazz); |
170 |
} |
171 |
|
172 |
public static void registerDefaultConfigurableActionsMamager(Class clazz) { |
173 |
getInstance().registerDefault(CONFIGURABLE_ACTIONS_MANAGER_NAME, |
174 |
CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION, clazz); |
175 |
} |
176 |
|
177 |
|
178 |
public static PropertiesPageManager getPropertiesPageManager() throws LocatorException { |
179 |
return (PropertiesPageManager) getInstance().get(PROPERTIES_PAGE_MANAGER_NAME);
|
180 |
} |
181 |
|
182 |
public static void registerPropertiesPageManager(Class clazz) { |
183 |
getInstance().register(PROPERTIES_PAGE_MANAGER_NAME, |
184 |
PROPERTIES_PAGE_MANAGER_DESCRIPTION, |
185 |
clazz); |
186 |
} |
187 |
|
188 |
public static void registerDefaultPropertiesPageManager(Class clazz) { |
189 |
getInstance().registerDefault( |
190 |
PROPERTIES_PAGE_MANAGER_NAME, |
191 |
PROPERTIES_PAGE_MANAGER_DESCRIPTION, clazz); |
192 |
} |
193 |
|
194 |
public static TextEditorManager getTextEditorManager() throws LocatorException { |
195 |
return (TextEditorManager) getInstance().get(TEXTEDITOR_MANAGER_NAME);
|
196 |
} |
197 |
|
198 |
public static void registerTextEditorManager(Class clazz) { |
199 |
getInstance().register(TEXTEDITOR_MANAGER_NAME, |
200 |
TEXTEDITOR_MANAGER_DESCRIPTION, |
201 |
clazz); |
202 |
} |
203 |
|
204 |
public static void registerDefaultTextEditorManager(Class clazz) { |
205 |
getInstance().registerDefault( |
206 |
TEXTEDITOR_MANAGER_NAME, |
207 |
TEXTEDITOR_MANAGER_DESCRIPTION, clazz); |
208 |
} |
209 |
|
210 |
|
211 |
public static WebBrowserManager getWebBrowserManager() throws LocatorException { |
212 |
return (WebBrowserManager) getInstance().get(WEBBROWSER_MANAGER_NAME);
|
213 |
} |
214 |
|
215 |
public static void registerWebBrowserManager(Class clazz) { |
216 |
getInstance().register(WEBBROWSER_MANAGER_NAME, |
217 |
WEBBROWSER_MANAGER_DESCRIPTION, |
218 |
clazz); |
219 |
} |
220 |
|
221 |
public static void registerDefaultWebBrowserManager(Class clazz) { |
222 |
getInstance().registerDefault( |
223 |
WEBBROWSER_MANAGER_NAME, |
224 |
WEBBROWSER_MANAGER_DESCRIPTION, clazz); |
225 |
} |
226 |
|
227 |
} |