svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / main / java / org / gvsig / raster / lib / legend / api / RasterLegendLocator.java @ 44831
History | View | Annotate | Download (1.85 KB)
1 |
package org.gvsig.raster.lib.legend.api; |
---|---|
2 |
|
3 |
import org.gvsig.tools.locator.AbstractLocator; |
4 |
import org.gvsig.tools.locator.LocatorException; |
5 |
|
6 |
/**
|
7 |
* Raster legend locator to get Raster legend manager singleton instance
|
8 |
*
|
9 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
|
10 |
*
|
11 |
*/
|
12 |
public class RasterLegendLocator extends AbstractLocator { |
13 |
|
14 |
public static final String LOCATOR_NAME = "RasterLegendLocator"; |
15 |
|
16 |
public static final String RASTER_LEGEND_MANAGER_NAME = "RasterLegendManager"; |
17 |
|
18 |
public static final String RASTER_LEGEND_MANAGER_DESCRIPTION = |
19 |
"Raster legend manager of gvSIG raster";
|
20 |
|
21 |
/**
|
22 |
* Unique instance.
|
23 |
*/
|
24 |
private static final RasterLegendLocator instance = new RasterLegendLocator(); |
25 |
|
26 |
/**
|
27 |
* Return the singleton instance.
|
28 |
*
|
29 |
* @return the singleton instance
|
30 |
*/
|
31 |
public static RasterLegendLocator getInstance() { |
32 |
return instance;
|
33 |
} |
34 |
|
35 |
@Override
|
36 |
public String getLocatorName() { |
37 |
return LOCATOR_NAME;
|
38 |
} |
39 |
|
40 |
/**
|
41 |
* Return a reference to {@link RasterLegendManager}.
|
42 |
*
|
43 |
* @return a reference to RasterLegendManager
|
44 |
* @throws LocatorException
|
45 |
* if there is no access to the class or the class cannot be
|
46 |
* instantiated
|
47 |
* @see Locator#get(String)
|
48 |
*/
|
49 |
public static RasterLegendManager getRasterLegendManager() throws LocatorException { |
50 |
return (RasterLegendManager) getInstance().get(RASTER_LEGEND_MANAGER_NAME);
|
51 |
} |
52 |
|
53 |
/**
|
54 |
* Registers the Class implementing the {@link RasterLegendManager}
|
55 |
* interface.
|
56 |
*
|
57 |
* @param clazz
|
58 |
* implementing the RasterLegendManager interface
|
59 |
*/
|
60 |
public static void registerRasterLegendManager(Class clazz) { |
61 |
getInstance() |
62 |
.register(RASTER_LEGEND_MANAGER_NAME, RASTER_LEGEND_MANAGER_DESCRIPTION, clazz); |
63 |
} |
64 |
|
65 |
} |