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 @ 449
History | View | Annotate | Download (5.73 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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 |
*/
|
22 |
package org.gvsig.tools.swing.api; |
23 |
|
24 |
import org.gvsig.tools.locator.BaseLocator; |
25 |
import org.gvsig.tools.locator.Locator; |
26 |
import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager; |
27 |
import org.gvsig.tools.swing.api.task.TaskStatusSwingManager; |
28 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
29 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
30 |
|
31 |
/**
|
32 |
* {@link Locator} for the tools swing Library. It returns a reference to the
|
33 |
* library's main
|
34 |
* utilities.
|
35 |
*
|
36 |
* @author 2010- C?sar Ordi?ana - gvSIG team
|
37 |
*/
|
38 |
public class ToolsSwingLocator extends BaseLocator { |
39 |
|
40 |
private static final String LOCATOR_NAME = "Tools.swing.locator"; |
41 |
|
42 |
public static final String DYNOBJECT_SWING_MANAGER_NAME = |
43 |
"Tools.dynobject.swing.manager";
|
44 |
|
45 |
public static final String DYNOBJECT_SWING_MANAGER_DESCRIPTION = |
46 |
"Tools DynObject Swing Manager";
|
47 |
|
48 |
public static final String USABILITY_SWING_MANAGER_NAME = |
49 |
"Tools.usability.swing.manager";
|
50 |
|
51 |
public static final String USABILITY_SWING_MANAGER_DESCRIPTION = |
52 |
"Tools Usability Swing Manager";
|
53 |
|
54 |
private static final String TASKSTATUS_SWING_MANAGER_NAME = "Tools.task.swing.manager"; |
55 |
|
56 |
private static final String TASKSTATUS_SWING_MANAGER_DESCRIPTION = "Tools Task Swing Manager"; |
57 |
|
58 |
private static final String WINDOW_MANAGER_NAME = "Tools.task.swing.windowmanager"; |
59 |
|
60 |
private static final String WINDOW_MANAGER_DESCRIPTION = "Tools Window Manager"; |
61 |
|
62 |
/**
|
63 |
* Unique instance.
|
64 |
*/
|
65 |
private static final ToolsSwingLocator instance = new ToolsSwingLocator(); |
66 |
|
67 |
/**
|
68 |
* Gets the instance of the {@link DynObjectSwingManager} registered.
|
69 |
*
|
70 |
* @return {@link DynObjectSwingManager}
|
71 |
*/
|
72 |
public static DynObjectSwingManager getDynObjectSwingManager() { |
73 |
return (DynObjectSwingManager) getInstance().get(
|
74 |
DYNOBJECT_SWING_MANAGER_NAME); |
75 |
} |
76 |
|
77 |
/**
|
78 |
* Return the {@link Singleton} instance.
|
79 |
*
|
80 |
* @return the {@link Singleton} instance
|
81 |
*/
|
82 |
public static ToolsSwingLocator getInstance() { |
83 |
return instance;
|
84 |
} |
85 |
|
86 |
/**
|
87 |
* Return the {@link Locator}'s name
|
88 |
*
|
89 |
* @return a String with the {@link Locator}'s name
|
90 |
*/
|
91 |
@Override
|
92 |
public String getLocatorName() { |
93 |
return LOCATOR_NAME;
|
94 |
} |
95 |
|
96 |
/**
|
97 |
* Registers the Class implementing the {@link DynObjectSwingManager}
|
98 |
* interface.
|
99 |
*
|
100 |
* @param clazz
|
101 |
* implementing the {@link DynObjectSwingManager} interface
|
102 |
*/
|
103 |
public static void registerDynObjectSwingManager( |
104 |
Class<? extends DynObjectSwingManager> clazz) { |
105 |
getInstance().register(DYNOBJECT_SWING_MANAGER_NAME, |
106 |
DYNOBJECT_SWING_MANAGER_DESCRIPTION, clazz); |
107 |
} |
108 |
|
109 |
/**
|
110 |
* Gets the instance of the {@link UsabilitySwingManager} registered.
|
111 |
*
|
112 |
* @return {@link UsabilitySwingManager}
|
113 |
*/
|
114 |
public static UsabilitySwingManager getUsabilitySwingManager() { |
115 |
return (UsabilitySwingManager) getInstance().get(
|
116 |
USABILITY_SWING_MANAGER_NAME); |
117 |
} |
118 |
|
119 |
/**
|
120 |
* Registers the Class implementing the {@link UsabilitySwingManager}
|
121 |
* interface.
|
122 |
*
|
123 |
* @param clazz
|
124 |
* implementing the {@link UsabilitySwingManager} interface
|
125 |
*/
|
126 |
public static void registerUsabilitySwingManager( |
127 |
Class<? extends UsabilitySwingManager> clazz) { |
128 |
getInstance().register(USABILITY_SWING_MANAGER_NAME, |
129 |
USABILITY_SWING_MANAGER_DESCRIPTION, clazz); |
130 |
} |
131 |
|
132 |
/**
|
133 |
* Gets the instance of the {@link TaskStatusSwingManager} registered.
|
134 |
*
|
135 |
* @return {@link TaskStatusSwingManager}
|
136 |
*/
|
137 |
public static TaskStatusSwingManager getTaskStatusSwingManager() { |
138 |
return (TaskStatusSwingManager) getInstance().get(
|
139 |
TASKSTATUS_SWING_MANAGER_NAME); |
140 |
} |
141 |
|
142 |
/**
|
143 |
* Registers the Class implementing the {@link TaskStatusSwingManager}
|
144 |
* interface.
|
145 |
*
|
146 |
* @param clazz
|
147 |
* implementing the {@link TaskStatusSwingManager} interface
|
148 |
*/
|
149 |
public static void registerTaskStatusSwingManager( |
150 |
Class<? extends TaskStatusSwingManager> clazz) { |
151 |
getInstance().register(TASKSTATUS_SWING_MANAGER_NAME, |
152 |
TASKSTATUS_SWING_MANAGER_DESCRIPTION, clazz); |
153 |
} |
154 |
|
155 |
/**
|
156 |
* Gets the instance of the {@link WindowManager} registered.
|
157 |
*
|
158 |
* @return {@link WindowManager}
|
159 |
*/
|
160 |
public static WindowManager getWindowManager() { |
161 |
return (WindowManager) getInstance().get(
|
162 |
WINDOW_MANAGER_NAME); |
163 |
} |
164 |
|
165 |
/**
|
166 |
* Registers the Class implementing the {@link WindowManager}
|
167 |
* interface.
|
168 |
*
|
169 |
* @param clazz
|
170 |
* implementing the {@link WindowManager} interface
|
171 |
*/
|
172 |
public static void registerWindowManager( |
173 |
Class<? extends WindowManager> clazz) { |
174 |
getInstance().register(WINDOW_MANAGER_NAME, |
175 |
WINDOW_MANAGER_DESCRIPTION, clazz); |
176 |
} |
177 |
|
178 |
|
179 |
} |