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 @ 474
History | View | Annotate | Download (2.8 KB)
1 | 405 | llmarques | /**
|
---|---|---|---|
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 | 443 | llmarques | * This locator is the entry point for the View 3D swing library, providing
|
32 | * access to View3D swing services through the {@link View3DSwingManager} .
|
||
33 | 405 | llmarques | *
|
34 | 448 | llmarques | * @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
|
35 | 405 | llmarques | */
|
36 | 443 | llmarques | public class View3DSwingLocator extends BaseLocator { |
37 | 405 | llmarques | |
38 | 443 | llmarques | private static final String LOCATOR_NAME = "View3DSwingLocator"; |
39 | 405 | llmarques | |
40 | 443 | llmarques | public static final String MANAGER_NAME = "View3D.SwingManager"; |
41 | 405 | llmarques | |
42 | private static final String MANAGER_DESCRIPTION = "View 3D Swing Manager"; |
||
43 | |||
44 | 443 | llmarques | private static final View3DSwingLocator instance = new View3DSwingLocator(); |
45 | 405 | llmarques | |
46 | /**
|
||
47 | * Return the singleton instance.
|
||
48 | *
|
||
49 | * @return the singleton instance
|
||
50 | */
|
||
51 | 443 | llmarques | public static View3DSwingLocator getInstance() { |
52 | 405 | llmarques | return instance;
|
53 | } |
||
54 | |||
55 | public String getLocatorName() { |
||
56 | return LOCATOR_NAME;
|
||
57 | } |
||
58 | |||
59 | /**
|
||
60 | 443 | llmarques | * Return a reference to View3DSwingManager.
|
61 | 405 | llmarques | *
|
62 | 443 | llmarques | * @return a reference to View3DSwingManager
|
63 | 405 | llmarques | * @throws LocatorException
|
64 | * if there is no access to the class or the class
|
||
65 | * cannot be instantiated
|
||
66 | 443 | llmarques | * @see Locator#get(String)View3DSwingManager
|
67 | 405 | llmarques | */
|
68 | 443 | llmarques | public static View3DSwingManager getManager() throws LocatorException { |
69 | return (View3DSwingManager) getInstance().get(MANAGER_NAME);
|
||
70 | 405 | llmarques | } |
71 | |||
72 | /**
|
||
73 | 443 | llmarques | * Registers the Class implementing the View3DSwingLocator interface.
|
74 | 405 | llmarques | *
|
75 | * @param clazz
|
||
76 | 443 | llmarques | * implementing the View3DSwingManager interface
|
77 | 405 | llmarques | */
|
78 | public static void registerManager(Class clazz) { |
||
79 | getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
||
80 | } |
||
81 | |||
82 | public static void registerDefaultManager(Class clazz) { |
||
83 | getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
||
84 | } |
||
85 | |||
86 | } |