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 | 1495 | fdiaz | package org.gvsig.tools.util; |
---|---|---|---|
2 | 1702 | jjdelcerro | |
3 | 1495 | fdiaz | /**
|
4 | * gvSIG. Desktop Geographic Information System.
|
||
5 | *
|
||
6 | * Copyright (C) 2007-2013 gvSIG Association.
|
||
7 | *
|
||
8 | 1702 | jjdelcerro | * 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 | 1495 | fdiaz | *
|
13 | 1702 | jjdelcerro | * 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 | 1495 | fdiaz | *
|
18 | 1702 | jjdelcerro | * 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 | 1495 | fdiaz | *
|
22 | 1702 | jjdelcerro | * For any additional information, do not hesitate to contact us at info AT
|
23 | * gvsig.com, or visit our website www.gvsig.com.
|
||
24 | 1495 | fdiaz | */
|
25 | |||
26 | 1714 | jjdelcerro | import org.gvsig.configurableactions.ConfigurableActionsMamager; |
27 | 1553 | jjdelcerro | import org.gvsig.filedialogchooser.FileDialogChooserManager; |
28 | 1702 | jjdelcerro | import org.gvsig.imageviewer.ImageViewerManager; |
29 | 1746 | jjdelcerro | import org.gvsig.propertypage.PropertiesPageManager; |
30 | 1563 | jjdelcerro | import org.gvsig.svgsupport.SVGSupportManager; |
31 | 1495 | fdiaz | import org.gvsig.tools.locator.AbstractLocator; |
32 | import org.gvsig.tools.locator.Locator; |
||
33 | import org.gvsig.tools.locator.LocatorException; |
||
34 | |||
35 | /**
|
||
36 | 1702 | jjdelcerro | * @author gvSIG Team
|
37 | 1495 | fdiaz | *
|
38 | */
|
||
39 | @SuppressWarnings("rawtypes") |
||
40 | public class ToolsUtilLocator extends AbstractLocator { |
||
41 | |||
42 | 1702 | jjdelcerro | private static final String LOCATOR_NAME = "ToolsUtilLocator"; |
43 | 1495 | fdiaz | |
44 | 1702 | jjdelcerro | 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 | 1495 | fdiaz | |
47 | 1746 | jjdelcerro | 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 | 1553 | jjdelcerro | public static final String FILE_DIALOG_CHOOSER_MANAGER_NAME = "org.gvsig.filedialogchooser.manager"; |
51 | 1702 | jjdelcerro | private static final String FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION = "File dialog chooser."; |
52 | 1495 | fdiaz | |
53 | 1563 | jjdelcerro | public static final String PLUGINS_SVGSUPPORT_MANAGER_NAME = "SVGSupportManager"; |
54 | private static final String PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION = "SVGSupportManager"; |
||
55 | 1567 | fdiaz | |
56 | 1702 | jjdelcerro | public static final String PLUGINS_IMAGEVIEWER_MANAGER_NAME = "ImageViewerManager"; |
57 | private static final String PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION = "ImageViewerManager"; |
||
58 | 1495 | fdiaz | |
59 | 1714 | jjdelcerro | public static final String CONFIGURABLE_ACTIONS_MANAGER_NAME = "ConfigurableActionsMamager"; |
60 | private static final String CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION = "ConfigurableActionsMamager"; |
||
61 | |||
62 | 1702 | jjdelcerro | private static final ToolsUtilLocator instance = new ToolsUtilLocator(); |
63 | 1495 | fdiaz | |
64 | 1702 | jjdelcerro | private ToolsUtilLocator() {
|
65 | 1495 | fdiaz | |
66 | 1702 | jjdelcerro | } |
67 | 1495 | fdiaz | |
68 | 1702 | jjdelcerro | /**
|
69 | * Return the singleton instance.
|
||
70 | *
|
||
71 | * @return the singleton instance
|
||
72 | */
|
||
73 | public static ToolsUtilLocator getInstance() { |
||
74 | return instance;
|
||
75 | } |
||
76 | 1495 | fdiaz | |
77 | 1702 | jjdelcerro | @Override
|
78 | public String getLocatorName() { |
||
79 | return LOCATOR_NAME;
|
||
80 | } |
||
81 | 1495 | fdiaz | |
82 | 1702 | jjdelcerro | /**
|
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 | 1495 | fdiaz | |
95 | 1702 | jjdelcerro | /**
|
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 | 1495 | fdiaz | |
105 | 1702 | jjdelcerro | public static void registerDefaultToolsUtilManager(Class clazz) { |
106 | getInstance().registerDefault(TOOLS_UTIL_MANAGER_NAME, |
||
107 | TOOLS_UTIL_MANAGER_DESCRIPTION, clazz); |
||
108 | } |
||
109 | 1495 | fdiaz | |
110 | 1702 | jjdelcerro | public static FileDialogChooserManager getFileDialogChooserManager() |
111 | throws LocatorException {
|
||
112 | return (FileDialogChooserManager) getInstance().get(FILE_DIALOG_CHOOSER_MANAGER_NAME);
|
||
113 | } |
||
114 | |||
115 | 1553 | jjdelcerro | public static void registerFileDialogChooserManager(Class clazz) { |
116 | 1702 | jjdelcerro | getInstance().register(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
117 | FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
||
118 | } |
||
119 | 1553 | jjdelcerro | |
120 | 1702 | jjdelcerro | public static void registerDefaultFileDialogChooserManager(Class clazz) { |
121 | getInstance().registerDefault(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
||
122 | FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
||
123 | } |
||
124 | 1553 | jjdelcerro | |
125 | 1702 | jjdelcerro | //SVG support
|
126 | 1563 | jjdelcerro | 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 | 1702 | jjdelcerro | public static void registerDefaultSVGSupportManager(Class clazz) { |
136 | getInstance().registerDefault(PLUGINS_SVGSUPPORT_MANAGER_NAME, |
||
137 | PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, clazz); |
||
138 | } |
||
139 | 1563 | jjdelcerro | |
140 | 1702 | jjdelcerro | 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 | 1714 | jjdelcerro | |
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 | 1746 | jjdelcerro | |
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 | 1495 | fdiaz | } |