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 @ 270
History | View | Annotate | Download (3.71 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.swing.api.dynobject.DynObjectSwingManager; |
26 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
27 |
|
28 |
/**
|
29 |
* Locator for the tools swing Library. Returns references to the library's main
|
30 |
* utilities.
|
31 |
*
|
32 |
* @author 2010- C?sar Ordi?ana - gvSIG team
|
33 |
*/
|
34 |
public class ToolsSwingLocator extends BaseLocator { |
35 |
|
36 |
private static final String LOCATOR_NAME = "Tools.swing.locator"; |
37 |
|
38 |
public static final String DYNOBJECT_SWING_MANAGER_NAME = |
39 |
"Tools.dynobject.swing.manager";
|
40 |
|
41 |
public static final String DYNOBJECT_SWING_MANAGER_DESCRIPTION = |
42 |
"Tools DynObject Swing Manager";
|
43 |
|
44 |
public static final String USABILITY_SWING_MANAGER_NAME = |
45 |
"Tools.usability.swing.manager";
|
46 |
|
47 |
public static final String USABILITY_SWING_MANAGER_DESCRIPTION = |
48 |
"Tools Usability Swing Manager";
|
49 |
|
50 |
/**
|
51 |
* Unique instance.
|
52 |
*/
|
53 |
private static final ToolsSwingLocator instance = new ToolsSwingLocator(); |
54 |
|
55 |
/**
|
56 |
* Gets the instance of the {@link DynObjectSwingManager} registered.
|
57 |
*
|
58 |
* @return {@link DynObjectSwingManager}
|
59 |
*/
|
60 |
public static DynObjectSwingManager getDynObjectSwingManager() { |
61 |
return (DynObjectSwingManager) getInstance().get(
|
62 |
DYNOBJECT_SWING_MANAGER_NAME); |
63 |
} |
64 |
|
65 |
/**
|
66 |
* Return the singleton instance.
|
67 |
*
|
68 |
* @return the singleton instance
|
69 |
*/
|
70 |
public static ToolsSwingLocator getInstance() { |
71 |
return instance;
|
72 |
} |
73 |
|
74 |
/**
|
75 |
* Gets the instance of the {@link UsabilitySwingManager} registered.
|
76 |
*
|
77 |
* @return {@link UsabilitySwingManager}
|
78 |
*/
|
79 |
public static UsabilitySwingManager getUsabilitySwingManager() { |
80 |
return (UsabilitySwingManager) getInstance().get(
|
81 |
USABILITY_SWING_MANAGER_NAME); |
82 |
} |
83 |
|
84 |
/**
|
85 |
* Registers the Class implementing the DynObjectSwingManager interface.
|
86 |
*
|
87 |
* @param clazz
|
88 |
* implementing the DynObjectSwingManager interface
|
89 |
*/
|
90 |
public static void registerDynObjectSwingManager( |
91 |
Class<? extends DynObjectSwingManager> clazz) { |
92 |
getInstance().register(DYNOBJECT_SWING_MANAGER_NAME, |
93 |
DYNOBJECT_SWING_MANAGER_DESCRIPTION, clazz); |
94 |
} |
95 |
|
96 |
/**
|
97 |
* Registers the Class implementing the UsabilitySwingManager interface.
|
98 |
*
|
99 |
* @param clazz
|
100 |
* implementing the UsabilitySwingManager interface
|
101 |
*/
|
102 |
public static void registerUsabilitySwingManager( |
103 |
Class<? extends UsabilitySwingManager> clazz) { |
104 |
getInstance().register(USABILITY_SWING_MANAGER_NAME, |
105 |
USABILITY_SWING_MANAGER_DESCRIPTION, clazz); |
106 |
} |
107 |
|
108 |
/**
|
109 |
* Return the Locator's name
|
110 |
*
|
111 |
* @return a String with the Locator's name
|
112 |
*/
|
113 |
public String getLocatorName() { |
114 |
return LOCATOR_NAME;
|
115 |
} |
116 |
|
117 |
} |