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 | 802 | cordinyana | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 93 | cordinyana | *
|
4 | 802 | cordinyana | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | *
|
||
6 | 93 | cordinyana | * 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 | 802 | cordinyana | *
|
11 | 93 | cordinyana | * 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 | 802 | cordinyana | *
|
16 | 93 | cordinyana | * 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 | 802 | cordinyana | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | 93 | cordinyana | * MA 02110-1301, USA.
|
20 | 802 | cordinyana | *
|
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 | 93 | cordinyana | */
|
24 | package org.gvsig.tools.swing.api; |
||
25 | |||
26 | import org.gvsig.tools.locator.BaseLocator; |
||
27 | 272 | cmartin | import org.gvsig.tools.locator.Locator; |
28 | 806 | jldominguez | import org.gvsig.tools.swing.api.evaluator.ComponentSwingManager; |
29 | 447 | jjdelcerro | import org.gvsig.tools.swing.api.task.TaskStatusSwingManager; |
30 | 100 | cordinyana | import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
31 | 449 | jjdelcerro | import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
32 | 698 | jjdelcerro | import org.gvsig.tools.swing.icontheme.IconThemeManager; |
33 | 93 | cordinyana | |
34 | /**
|
||
35 | 272 | cmartin | * {@link Locator} for the tools swing Library. It returns a reference to the
|
36 | * library's main
|
||
37 | 93 | cordinyana | * utilities.
|
38 | *
|
||
39 | * @author 2010- C?sar Ordi?ana - gvSIG team
|
||
40 | */
|
||
41 | public class ToolsSwingLocator extends BaseLocator { |
||
42 | |||
43 | 270 | cmartin | private static final String LOCATOR_NAME = "Tools.swing.locator"; |
44 | 1124 | jjdelcerro | |
45 | 270 | cmartin | public static final String USABILITY_SWING_MANAGER_NAME = |
46 | "Tools.usability.swing.manager";
|
||
47 | 100 | cordinyana | |
48 | 270 | cmartin | public static final String USABILITY_SWING_MANAGER_DESCRIPTION = |
49 | "Tools Usability Swing Manager";
|
||
50 | 100 | cordinyana | |
51 | 447 | jjdelcerro | 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 | 698 | jjdelcerro | private static final String WINDOW_MANAGER_NAME = "Tools.swing.windowmanager"; |
56 | 449 | jjdelcerro | |
57 | private static final String WINDOW_MANAGER_DESCRIPTION = "Tools Window Manager"; |
||
58 | |||
59 | 698 | jjdelcerro | 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 | 806 | jldominguez | 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 | 447 | jjdelcerro | /**
|
68 | 270 | cmartin | * Unique instance.
|
69 | */
|
||
70 | private static final ToolsSwingLocator instance = new ToolsSwingLocator(); |
||
71 | 93 | cordinyana | |
72 | 270 | cmartin | /**
|
73 | 272 | cmartin | * Return the {@link Singleton} instance.
|
74 | 270 | cmartin | *
|
75 | 272 | cmartin | * @return the {@link Singleton} instance
|
76 | 270 | cmartin | */
|
77 | public static ToolsSwingLocator getInstance() { |
||
78 | return instance;
|
||
79 | } |
||
80 | 170 | cmartin | |
81 | 270 | cmartin | /**
|
82 | 447 | jjdelcerro | * Return the {@link Locator}'s name
|
83 | 270 | cmartin | *
|
84 | 447 | jjdelcerro | * @return a String with the {@link Locator}'s name
|
85 | 270 | cmartin | */
|
86 | 447 | jjdelcerro | @Override
|
87 | public String getLocatorName() { |
||
88 | return LOCATOR_NAME;
|
||
89 | 270 | cmartin | } |
90 | 93 | cordinyana | |
91 | 270 | cmartin | /**
|
92 | 447 | jjdelcerro | * 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 | 272 | cmartin | * Registers the Class implementing the {@link UsabilitySwingManager}
|
103 | * interface.
|
||
104 | 270 | cmartin | *
|
105 | * @param clazz
|
||
106 | 272 | cmartin | * implementing the {@link UsabilitySwingManager} interface
|
107 | 270 | cmartin | */
|
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 | 93 | cordinyana | |
114 | 270 | cmartin | /**
|
115 | 447 | jjdelcerro | * Gets the instance of the {@link TaskStatusSwingManager} registered.
|
116 | 270 | cmartin | *
|
117 | 447 | jjdelcerro | * @return {@link TaskStatusSwingManager}
|
118 | 270 | cmartin | */
|
119 | 447 | jjdelcerro | public static TaskStatusSwingManager getTaskStatusSwingManager() { |
120 | return (TaskStatusSwingManager) getInstance().get(
|
||
121 | TASKSTATUS_SWING_MANAGER_NAME); |
||
122 | 270 | cmartin | } |
123 | 100 | cordinyana | |
124 | 447 | jjdelcerro | /**
|
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 | 449 | jjdelcerro | /**
|
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 | 447 | jjdelcerro | |
147 | 449 | jjdelcerro | /**
|
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 | 698 | jjdelcerro | /**
|
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 | 449 | jjdelcerro | |
170 | 698 | jjdelcerro | /**
|
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 | 806 | jldominguez | |
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 | 698 | jjdelcerro | |
193 | 806 | jldominguez | /**
|
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 | 270 | cmartin | } |