gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.swing / org.gvsig.tools.swing.api / src / main / java / org / gvsig / tools / swing / api / ToolsSwingLocator.java @ 1124
History | View | Annotate | Download (6.69 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.tools.swing.api; |
25 |
|
26 |
import org.gvsig.tools.locator.BaseLocator; |
27 |
import org.gvsig.tools.locator.Locator; |
28 |
import org.gvsig.tools.swing.api.evaluator.ComponentSwingManager; |
29 |
import org.gvsig.tools.swing.api.task.TaskStatusSwingManager; |
30 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
31 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
32 |
import org.gvsig.tools.swing.icontheme.IconThemeManager; |
33 |
|
34 |
/**
|
35 |
* {@link Locator} for the tools swing Library. It returns a reference to the
|
36 |
* library's main
|
37 |
* utilities.
|
38 |
*
|
39 |
* @author 2010- C?sar Ordi?ana - gvSIG team
|
40 |
*/
|
41 |
public class ToolsSwingLocator extends BaseLocator { |
42 |
|
43 |
private static final String LOCATOR_NAME = "Tools.swing.locator"; |
44 |
|
45 |
public static final String USABILITY_SWING_MANAGER_NAME = |
46 |
"Tools.usability.swing.manager";
|
47 |
|
48 |
public static final String USABILITY_SWING_MANAGER_DESCRIPTION = |
49 |
"Tools Usability Swing Manager";
|
50 |
|
51 |
private static final String TASKSTATUS_SWING_MANAGER_NAME = "Tools.task.swing.manager"; |
52 |
|
53 |
private static final String TASKSTATUS_SWING_MANAGER_DESCRIPTION = "Tools Task Swing Manager"; |
54 |
|
55 |
private static final String WINDOW_MANAGER_NAME = "Tools.swing.windowmanager"; |
56 |
|
57 |
private static final String WINDOW_MANAGER_DESCRIPTION = "Tools Window Manager"; |
58 |
|
59 |
private static final String ICONTHEME_MANAGER_NAME = "Tools.swing.iconthememanager"; |
60 |
|
61 |
private static final String ICONTHEME_MANAGER_DESCRIPTION = "Tools Icon Theme Manager"; |
62 |
|
63 |
private static final String COMPONENT_SWING_MANAGER_NAME = "Tools.swing.componentmanager"; |
64 |
|
65 |
private static final String COMPONENT_SWING_MANAGER_DESCRIPTION = "Tools Swing Component Manager"; |
66 |
|
67 |
/**
|
68 |
* Unique instance.
|
69 |
*/
|
70 |
private static final ToolsSwingLocator instance = new ToolsSwingLocator(); |
71 |
|
72 |
/**
|
73 |
* Return the {@link Singleton} instance.
|
74 |
*
|
75 |
* @return the {@link Singleton} instance
|
76 |
*/
|
77 |
public static ToolsSwingLocator getInstance() { |
78 |
return instance;
|
79 |
} |
80 |
|
81 |
/**
|
82 |
* Return the {@link Locator}'s name
|
83 |
*
|
84 |
* @return a String with the {@link Locator}'s name
|
85 |
*/
|
86 |
@Override
|
87 |
public String getLocatorName() { |
88 |
return LOCATOR_NAME;
|
89 |
} |
90 |
|
91 |
/**
|
92 |
* Gets the instance of the {@link UsabilitySwingManager} registered.
|
93 |
*
|
94 |
* @return {@link UsabilitySwingManager}
|
95 |
*/
|
96 |
public static UsabilitySwingManager getUsabilitySwingManager() { |
97 |
return (UsabilitySwingManager) getInstance().get(
|
98 |
USABILITY_SWING_MANAGER_NAME); |
99 |
} |
100 |
|
101 |
/**
|
102 |
* Registers the Class implementing the {@link UsabilitySwingManager}
|
103 |
* interface.
|
104 |
*
|
105 |
* @param clazz
|
106 |
* implementing the {@link UsabilitySwingManager} interface
|
107 |
*/
|
108 |
public static void registerUsabilitySwingManager( |
109 |
Class<? extends UsabilitySwingManager> clazz) { |
110 |
getInstance().register(USABILITY_SWING_MANAGER_NAME, |
111 |
USABILITY_SWING_MANAGER_DESCRIPTION, clazz); |
112 |
} |
113 |
|
114 |
/**
|
115 |
* Gets the instance of the {@link TaskStatusSwingManager} registered.
|
116 |
*
|
117 |
* @return {@link TaskStatusSwingManager}
|
118 |
*/
|
119 |
public static TaskStatusSwingManager getTaskStatusSwingManager() { |
120 |
return (TaskStatusSwingManager) getInstance().get(
|
121 |
TASKSTATUS_SWING_MANAGER_NAME); |
122 |
} |
123 |
|
124 |
/**
|
125 |
* Registers the Class implementing the {@link TaskStatusSwingManager}
|
126 |
* interface.
|
127 |
*
|
128 |
* @param clazz
|
129 |
* implementing the {@link TaskStatusSwingManager} interface
|
130 |
*/
|
131 |
public static void registerTaskStatusSwingManager( |
132 |
Class<? extends TaskStatusSwingManager> clazz) { |
133 |
getInstance().register(TASKSTATUS_SWING_MANAGER_NAME, |
134 |
TASKSTATUS_SWING_MANAGER_DESCRIPTION, clazz); |
135 |
} |
136 |
|
137 |
/**
|
138 |
* Gets the instance of the {@link WindowManager} registered.
|
139 |
*
|
140 |
* @return {@link WindowManager}
|
141 |
*/
|
142 |
public static WindowManager getWindowManager() { |
143 |
return (WindowManager) getInstance().get(
|
144 |
WINDOW_MANAGER_NAME); |
145 |
} |
146 |
|
147 |
/**
|
148 |
* Registers the Class implementing the {@link WindowManager}
|
149 |
* interface.
|
150 |
*
|
151 |
* @param clazz
|
152 |
* implementing the {@link WindowManager} interface
|
153 |
*/
|
154 |
public static void registerWindowManager( |
155 |
Class<? extends WindowManager> clazz) { |
156 |
getInstance().register(WINDOW_MANAGER_NAME, |
157 |
WINDOW_MANAGER_DESCRIPTION, clazz); |
158 |
} |
159 |
|
160 |
/**
|
161 |
* Gets the instance of the {@link IconThemeManager} registered.
|
162 |
*
|
163 |
* @return {@link IconThemeManager}
|
164 |
*/
|
165 |
public static IconThemeManager getIconThemeManager() { |
166 |
return (IconThemeManager) getInstance().get(
|
167 |
ICONTHEME_MANAGER_NAME); |
168 |
} |
169 |
|
170 |
/**
|
171 |
* Registers the Class implementing the {@link IconThemeManager}
|
172 |
* interface.
|
173 |
*
|
174 |
* @param clazz
|
175 |
* implementing the {@link IconThemeManager} interface
|
176 |
*/
|
177 |
public static void registerIconThemeManager( |
178 |
Class<? extends IconThemeManager> clazz) { |
179 |
getInstance().register(ICONTHEME_MANAGER_NAME, |
180 |
ICONTHEME_MANAGER_DESCRIPTION, clazz); |
181 |
} |
182 |
|
183 |
/**
|
184 |
* Gets the instance of the {@link ComponentSwingManager} registered.
|
185 |
*
|
186 |
* @return {@link ComponentSwingManager}
|
187 |
*/
|
188 |
public static ComponentSwingManager getComponentSwingManager() { |
189 |
return (ComponentSwingManager) getInstance().get(
|
190 |
COMPONENT_SWING_MANAGER_NAME); |
191 |
} |
192 |
|
193 |
/**
|
194 |
* Registers the Class implementing the {@link ComponentSwingManager}
|
195 |
* interface.
|
196 |
*
|
197 |
* @param clazz
|
198 |
* implementing the {@link ComponentSwingManager} interface
|
199 |
*/
|
200 |
public static void registerComponentSwingManager( |
201 |
Class<? extends ComponentSwingManager> clazz) { |
202 |
getInstance().register( |
203 |
COMPONENT_SWING_MANAGER_NAME, |
204 |
COMPONENT_SWING_MANAGER_DESCRIPTION, clazz); |
205 |
} |
206 |
|
207 |
|
208 |
} |