Statistics
| Revision:

gvsig-3d / 2.1 / trunk / org.gvsig.view3d / org.gvsig.view3d.swing / org.gvsig.view3d.swing.api / src / main / java / org / gvsig / view3d / swing / api / View3DSwingLocator.java @ 443

History | View | Annotate | Download (2.77 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 gvSIG Association
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

    
25
package org.gvsig.view3d.swing.api;
26

    
27
import org.gvsig.tools.locator.BaseLocator;
28
import org.gvsig.tools.locator.LocatorException;
29

    
30
/**
31
 * This locator is the entry point for the View 3D swing library, providing
32
 * access to View3D swing services through the {@link View3DSwingManager} .
33
 *
34
 * @author lmarques
35
 * @version $Id$
36
 */
37
public class View3DSwingLocator extends BaseLocator {
38

    
39
    private static final String LOCATOR_NAME = "View3DSwingLocator";
40

    
41
    public static final String MANAGER_NAME = "View3D.SwingManager";
42

    
43
    private static final String MANAGER_DESCRIPTION = "View 3D Swing Manager";
44

    
45
    private static final View3DSwingLocator instance = new View3DSwingLocator();
46

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

    
56
    public String getLocatorName() {
57
        return LOCATOR_NAME;
58
    }
59

    
60
    /**
61
     * Return a reference to View3DSwingManager.
62
     * 
63
     * @return a reference to View3DSwingManager
64
     * @throws LocatorException
65
     *             if there is no access to the class or the class
66
     *             cannot be instantiated
67
     * @see Locator#get(String)View3DSwingManager
68
     */
69
    public static View3DSwingManager getManager() throws LocatorException {
70
        return (View3DSwingManager) getInstance().get(MANAGER_NAME);
71
    }
72

    
73
    /**
74
     * Registers the Class implementing the View3DSwingLocator interface.
75
     * 
76
     * @param clazz
77
     *            implementing the View3DSwingManager interface
78
     */
79
    public static void registerManager(Class clazz) {
80
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
81
    }
82

    
83
    public static void registerDefaultManager(Class clazz) {
84
        getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
85
    }
86

    
87
}