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 @ 1746
History | View | Annotate | Download (7.07 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.tools.locator.AbstractLocator; |
32 |
import org.gvsig.tools.locator.Locator; |
33 |
import org.gvsig.tools.locator.LocatorException; |
34 |
|
35 |
/**
|
36 |
* @author gvSIG Team
|
37 |
*
|
38 |
*/
|
39 |
@SuppressWarnings("rawtypes") |
40 |
public class ToolsUtilLocator extends AbstractLocator { |
41 |
|
42 |
private static final String LOCATOR_NAME = "ToolsUtilLocator"; |
43 |
|
44 |
public static final String TOOLS_UTIL_MANAGER_NAME = "org.gvsig.tools.util.manager"; |
45 |
private static final String TOOLS_UTIL_MANAGER_DESCRIPTION = "Tools utilities."; |
46 |
|
47 |
public static final String PROPERTIES_PAGE_MANAGER_NAME = "org.gvsig.tools.properties.page.manager"; |
48 |
private static final String PROPERTIES_PAGE_MANAGER_DESCRIPTION = "Properties page manager"; |
49 |
|
50 |
public static final String FILE_DIALOG_CHOOSER_MANAGER_NAME = "org.gvsig.filedialogchooser.manager"; |
51 |
private static final String FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION = "File dialog chooser."; |
52 |
|
53 |
public static final String PLUGINS_SVGSUPPORT_MANAGER_NAME = "SVGSupportManager"; |
54 |
private static final String PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION = "SVGSupportManager"; |
55 |
|
56 |
public static final String PLUGINS_IMAGEVIEWER_MANAGER_NAME = "ImageViewerManager"; |
57 |
private static final String PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION = "ImageViewerManager"; |
58 |
|
59 |
public static final String CONFIGURABLE_ACTIONS_MANAGER_NAME = "ConfigurableActionsMamager"; |
60 |
private static final String CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION = "ConfigurableActionsMamager"; |
61 |
|
62 |
private static final ToolsUtilLocator instance = new ToolsUtilLocator(); |
63 |
|
64 |
private ToolsUtilLocator() {
|
65 |
|
66 |
} |
67 |
|
68 |
/**
|
69 |
* Return the singleton instance.
|
70 |
*
|
71 |
* @return the singleton instance
|
72 |
*/
|
73 |
public static ToolsUtilLocator getInstance() { |
74 |
return instance;
|
75 |
} |
76 |
|
77 |
@Override
|
78 |
public String getLocatorName() { |
79 |
return LOCATOR_NAME;
|
80 |
} |
81 |
|
82 |
/**
|
83 |
* Return a reference to ToolsUtilManager.
|
84 |
*
|
85 |
* @return a reference to ToolsUtilManager
|
86 |
* @throws LocatorException if there is no access to the class or the class
|
87 |
* cannot be instantiated
|
88 |
* @see Locator#get(String)
|
89 |
*/
|
90 |
public static ToolsUtilManager getToolsUtilManager() |
91 |
throws LocatorException {
|
92 |
return (ToolsUtilManager) getInstance().get(TOOLS_UTIL_MANAGER_NAME);
|
93 |
} |
94 |
|
95 |
/**
|
96 |
* Registers the Class implementing the ToolsUtilManager interface.
|
97 |
*
|
98 |
* @param clazz implementing the ToolsUtilManager interface
|
99 |
*/
|
100 |
public static void registerToolsUtilManager(Class clazz) { |
101 |
getInstance().register(TOOLS_UTIL_MANAGER_NAME, |
102 |
TOOLS_UTIL_MANAGER_DESCRIPTION, clazz); |
103 |
} |
104 |
|
105 |
public static void registerDefaultToolsUtilManager(Class clazz) { |
106 |
getInstance().registerDefault(TOOLS_UTIL_MANAGER_NAME, |
107 |
TOOLS_UTIL_MANAGER_DESCRIPTION, clazz); |
108 |
} |
109 |
|
110 |
public static FileDialogChooserManager getFileDialogChooserManager() |
111 |
throws LocatorException {
|
112 |
return (FileDialogChooserManager) getInstance().get(FILE_DIALOG_CHOOSER_MANAGER_NAME);
|
113 |
} |
114 |
|
115 |
public static void registerFileDialogChooserManager(Class clazz) { |
116 |
getInstance().register(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
117 |
FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
118 |
} |
119 |
|
120 |
public static void registerDefaultFileDialogChooserManager(Class clazz) { |
121 |
getInstance().registerDefault(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
122 |
FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
123 |
} |
124 |
|
125 |
//SVG support
|
126 |
public static SVGSupportManager getSVGSupportManager() throws LocatorException { |
127 |
return (SVGSupportManager) getInstance().get(PLUGINS_SVGSUPPORT_MANAGER_NAME);
|
128 |
} |
129 |
|
130 |
public static void registerSVGSupportManager(Class clazz) { |
131 |
getInstance().register(PLUGINS_SVGSUPPORT_MANAGER_NAME, PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, |
132 |
clazz); |
133 |
} |
134 |
|
135 |
public static void registerDefaultSVGSupportManager(Class clazz) { |
136 |
getInstance().registerDefault(PLUGINS_SVGSUPPORT_MANAGER_NAME, |
137 |
PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, clazz); |
138 |
} |
139 |
|
140 |
public static ImageViewerManager getImageViewerManager() throws LocatorException { |
141 |
return (ImageViewerManager) getInstance().get(PLUGINS_IMAGEVIEWER_MANAGER_NAME);
|
142 |
} |
143 |
|
144 |
public static void registerImageViewertManager(Class clazz) { |
145 |
getInstance().register(PLUGINS_IMAGEVIEWER_MANAGER_NAME, PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION, |
146 |
clazz); |
147 |
} |
148 |
|
149 |
public static void registerDefaultImageViewerManager(Class clazz) { |
150 |
getInstance().registerDefault(PLUGINS_IMAGEVIEWER_MANAGER_NAME, |
151 |
PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION, clazz); |
152 |
} |
153 |
|
154 |
|
155 |
public static ConfigurableActionsMamager getConfigurableActionsMamager() throws LocatorException { |
156 |
return (ConfigurableActionsMamager) getInstance().get(CONFIGURABLE_ACTIONS_MANAGER_NAME);
|
157 |
} |
158 |
|
159 |
public static void registerConfigurableActionsMamager(Class clazz) { |
160 |
getInstance().register(CONFIGURABLE_ACTIONS_MANAGER_NAME, CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION, |
161 |
clazz); |
162 |
} |
163 |
|
164 |
public static void registerDefaultConfigurableActionsMamager(Class clazz) { |
165 |
getInstance().registerDefault(CONFIGURABLE_ACTIONS_MANAGER_NAME, |
166 |
CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION, clazz); |
167 |
} |
168 |
|
169 |
|
170 |
public static PropertiesPageManager getPropertiesPageManager() throws LocatorException { |
171 |
return (PropertiesPageManager) getInstance().get(PROPERTIES_PAGE_MANAGER_NAME);
|
172 |
} |
173 |
|
174 |
public static void registerPropertiesPageManager(Class clazz) { |
175 |
getInstance().register(PROPERTIES_PAGE_MANAGER_NAME, |
176 |
PROPERTIES_PAGE_MANAGER_DESCRIPTION, |
177 |
clazz); |
178 |
} |
179 |
|
180 |
public static void registerDefaultPropertiesPageManager(Class clazz) { |
181 |
getInstance().registerDefault( |
182 |
PROPERTIES_PAGE_MANAGER_NAME, |
183 |
PROPERTIES_PAGE_MANAGER_DESCRIPTION, clazz); |
184 |
} |
185 |
|
186 |
} |