Statistics
| Revision:

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 @ 93

History | View | Annotate | Download (2.55 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

    
27
/**
28
 * Locator for the tools swing Library. Returns references to the library's main
29
 * utilities.
30
 * 
31
 * @author 2010- C?sar Ordi?ana - gvSIG team
32
 */
33
public class ToolsSwingLocator extends BaseLocator {
34

    
35
        private static final String LOCATOR_NAME = "Tools.swing.locator";
36

    
37
        public static final String DYNOBJECT_SWING_MANAGER_NAME = "Tools.dynobject.swing.manager";
38

    
39
        public static final String DYNOBJECT_SWING_MANAGER_DESCRIPTION = "Tools DynObject Swing Manager";
40

    
41
        /**
42
         * Unique instance.
43
         */
44
        private static final ToolsSwingLocator instance = new ToolsSwingLocator();
45

    
46
        /**
47
         * Return the singleton instance.
48
         * 
49
         * @return the singleton instance
50
         */
51
        public static ToolsSwingLocator getInstance() {
52
                return instance;
53
        }
54

    
55
        /**
56
         * Return the Locator's name
57
         * 
58
         * @return a String with the Locator's name
59
         */
60
        public String getLocatorName() {
61
                return LOCATOR_NAME;
62
        }
63

    
64
        /**
65
         * Registers the Class implementing the DynObjectSwingManager interface.
66
         * 
67
         * @param clazz
68
         *            implementing the DynObjectSwingManager interface
69
         */
70
        public static void registerDynObjectSwingManager(
71
                        Class<? extends DynObjectSwingManager> clazz) {
72
                getInstance().register(DYNOBJECT_SWING_MANAGER_NAME,
73
                                DYNOBJECT_SWING_MANAGER_DESCRIPTION, clazz);
74
        }
75

    
76
        /**
77
         * Gets the instance of the {@link DynObjectSwingManager} registered.
78
         * 
79
         * @return {@link DynObjectSwingManager}
80
         */
81
        public static DynObjectSwingManager getDynObjectSwingManager() {
82
                return (DynObjectSwingManager) getInstance().get(
83
                                DYNOBJECT_SWING_MANAGER_NAME);
84
        }
85

    
86
}