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 @ 447
History | View | Annotate | Download (4.86 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 |
|
30 |
/**
|
31 |
* {@link Locator} for the tools swing Library. It returns a reference to the
|
32 |
* library's main
|
33 |
* utilities.
|
34 |
*
|
35 |
* @author 2010- C?sar Ordi?ana - gvSIG team
|
36 |
*/
|
37 |
public class ToolsSwingLocator extends BaseLocator { |
38 |
|
39 |
private static final String LOCATOR_NAME = "Tools.swing.locator"; |
40 |
|
41 |
public static final String DYNOBJECT_SWING_MANAGER_NAME = |
42 |
"Tools.dynobject.swing.manager";
|
43 |
|
44 |
public static final String DYNOBJECT_SWING_MANAGER_DESCRIPTION = |
45 |
"Tools DynObject Swing Manager";
|
46 |
|
47 |
public static final String USABILITY_SWING_MANAGER_NAME = |
48 |
"Tools.usability.swing.manager";
|
49 |
|
50 |
public static final String USABILITY_SWING_MANAGER_DESCRIPTION = |
51 |
"Tools Usability Swing Manager";
|
52 |
|
53 |
private static final String TASKSTATUS_SWING_MANAGER_NAME = "Tools.task.swing.manager"; |
54 |
|
55 |
private static final String TASKSTATUS_SWING_MANAGER_DESCRIPTION = "Tools Task Swing Manager"; |
56 |
|
57 |
/**
|
58 |
* Unique instance.
|
59 |
*/
|
60 |
private static final ToolsSwingLocator instance = new ToolsSwingLocator(); |
61 |
|
62 |
/**
|
63 |
* Gets the instance of the {@link DynObjectSwingManager} registered.
|
64 |
*
|
65 |
* @return {@link DynObjectSwingManager}
|
66 |
*/
|
67 |
public static DynObjectSwingManager getDynObjectSwingManager() { |
68 |
return (DynObjectSwingManager) getInstance().get(
|
69 |
DYNOBJECT_SWING_MANAGER_NAME); |
70 |
} |
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 |
* Registers the Class implementing the {@link DynObjectSwingManager}
|
93 |
* interface.
|
94 |
*
|
95 |
* @param clazz
|
96 |
* implementing the {@link DynObjectSwingManager} interface
|
97 |
*/
|
98 |
public static void registerDynObjectSwingManager( |
99 |
Class<? extends DynObjectSwingManager> clazz) { |
100 |
getInstance().register(DYNOBJECT_SWING_MANAGER_NAME, |
101 |
DYNOBJECT_SWING_MANAGER_DESCRIPTION, clazz); |
102 |
} |
103 |
|
104 |
/**
|
105 |
* Gets the instance of the {@link UsabilitySwingManager} registered.
|
106 |
*
|
107 |
* @return {@link UsabilitySwingManager}
|
108 |
*/
|
109 |
public static UsabilitySwingManager getUsabilitySwingManager() { |
110 |
return (UsabilitySwingManager) getInstance().get(
|
111 |
USABILITY_SWING_MANAGER_NAME); |
112 |
} |
113 |
|
114 |
/**
|
115 |
* Registers the Class implementing the {@link UsabilitySwingManager}
|
116 |
* interface.
|
117 |
*
|
118 |
* @param clazz
|
119 |
* implementing the {@link UsabilitySwingManager} interface
|
120 |
*/
|
121 |
public static void registerUsabilitySwingManager( |
122 |
Class<? extends UsabilitySwingManager> clazz) { |
123 |
getInstance().register(USABILITY_SWING_MANAGER_NAME, |
124 |
USABILITY_SWING_MANAGER_DESCRIPTION, clazz); |
125 |
} |
126 |
|
127 |
/**
|
128 |
* Gets the instance of the {@link TaskStatusSwingManager} registered.
|
129 |
*
|
130 |
* @return {@link TaskStatusSwingManager}
|
131 |
*/
|
132 |
public static TaskStatusSwingManager getTaskStatusSwingManager() { |
133 |
return (TaskStatusSwingManager) getInstance().get(
|
134 |
TASKSTATUS_SWING_MANAGER_NAME); |
135 |
} |
136 |
|
137 |
/**
|
138 |
* Registers the Class implementing the {@link TaskStatusSwingManager}
|
139 |
* interface.
|
140 |
*
|
141 |
* @param clazz
|
142 |
* implementing the {@link TaskStatusSwingManager} interface
|
143 |
*/
|
144 |
public static void registerTaskStatusSwingManager( |
145 |
Class<? extends TaskStatusSwingManager> clazz) { |
146 |
getInstance().register(TASKSTATUS_SWING_MANAGER_NAME, |
147 |
TASKSTATUS_SWING_MANAGER_DESCRIPTION, clazz); |
148 |
} |
149 |
|
150 |
|
151 |
} |