root / org.gvsig.proj / branches / refactor2018 / org.gvsig.proj / org.gvsig.proj.swing / org.gvsig.proj.swing.impl / src / main / java / org / gvsig / proj / swing / impl / CoordinateReferenceSystemSwingDefaultImplLibrary.java @ 866
History | View | Annotate | Download (5.55 KB)
1 | 7 | cordinyana | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright (C) 2007-2012 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 | package org.gvsig.proj.swing.impl; |
||
25 | |||
26 | 854 | cmartinez | import java.net.URL; |
27 | |||
28 | 24 | cordinyana | import org.gvsig.proj.swing.CoordinateReferenceSystemSwingLibrary; |
29 | import org.gvsig.proj.swing.CoordinateReferenceSystemSwingLocator; |
||
30 | 106 | jjdelcerro | import org.gvsig.tools.ToolsLocator; |
31 | import org.gvsig.tools.i18n.I18nManager; |
||
32 | 7 | cordinyana | import org.gvsig.tools.library.AbstractLibrary; |
33 | import org.gvsig.tools.library.LibraryException; |
||
34 | 854 | cmartinez | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
35 | import org.gvsig.tools.swing.icontheme.IconTheme; |
||
36 | import org.slf4j.LoggerFactory; |
||
37 | 7 | cordinyana | |
38 | /**
|
||
39 | * Library for default swing implementation initialization and configuration.
|
||
40 | *
|
||
41 | * @author gvSIG team
|
||
42 | * @version $Id$
|
||
43 | */
|
||
44 | 24 | cordinyana | public class CoordinateReferenceSystemSwingDefaultImplLibrary extends |
45 | AbstractLibrary { |
||
46 | 7 | cordinyana | |
47 | @Override
|
||
48 | public void doRegistration() { |
||
49 | 24 | cordinyana | registerAsImplementationOf(CoordinateReferenceSystemSwingLibrary.class); |
50 | 7 | cordinyana | } |
51 | |||
52 | @Override
|
||
53 | protected void doInitialize() throws LibraryException { |
||
54 | 24 | cordinyana | CoordinateReferenceSystemSwingLocator |
55 | .registerSwingManager(DefaultCoordinateReferenceSystemSwingManager.class); |
||
56 | 7 | cordinyana | } |
57 | |||
58 | @Override
|
||
59 | protected void doPostInitialize() throws LibraryException { |
||
60 | 106 | jjdelcerro | I18nManager i18nMgr = ToolsLocator.getI18nManager(); |
61 | i18nMgr.addResourceFamily("org.gvsig.proj.swing.impl.i18n.text",
|
||
62 | 32 | cordinyana | CoordinateReferenceSystemSwingDefaultImplLibrary.class |
63 | .getClassLoader(), |
||
64 | CoordinateReferenceSystemSwingDefaultImplLibrary.class.getClass() |
||
65 | .getName()); |
||
66 | 854 | cmartinez | |
67 | registerIcons(); |
||
68 | 7 | cordinyana | } |
69 | |||
70 | 854 | cmartinez | |
71 | protected void registerIcons() { |
||
72 | IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
||
73 | 866 | cmartinez | String group = "swingproj"; |
74 | // crsselector panel
|
||
75 | registerIcon(group, "crs-crsselector-text-filter", "filter_alpha.png", iconTheme); |
||
76 | registerIcon(group, "crs-crsselector-spatial-filter", "filter_spatial.png", iconTheme); |
||
77 | registerIcon(group, "crs-crsselector-dropdown", "dropdown.png", iconTheme); |
||
78 | registerIcon(group, "crs-crsselector-search", "search.png", iconTheme); |
||
79 | registerIcon(group, "crs-crsselector-search-remove", "search_remove.png", iconTheme); |
||
80 | registerIcon(group, "crs-crsselector-crs", "crs.png", iconTheme); |
||
81 | registerIcon(group, "crs-crsselector-favorite", "favourite.png", iconTheme); |
||
82 | registerIcon(group, "crs-crsselector-recent", "recent.png", iconTheme); |
||
83 | registerIcon(group, "crs-crsselector-crs-new", "crs_add.png", iconTheme); |
||
84 | registerIcon(group, "crs-crsselector-recent-remove", "recent_remove.png", iconTheme); |
||
85 | registerIcon(group, "crs-crsselector-favorite-add", "favourite_add.png", iconTheme); |
||
86 | registerIcon(group, "crs-crsselector-favorite-remove", "favourite_remove.png", iconTheme); |
||
87 | |||
88 | // ctselector panel
|
||
89 | registerIcon(group, "crs-ctselector-text-filter", "filter_alpha.png", iconTheme); |
||
90 | registerIcon(group, "crs-ctselector-dropdown", "dropdown.png", iconTheme); |
||
91 | registerIcon(group, "crs-ctselector-search", "search.png", iconTheme); |
||
92 | registerIcon(group, "crs-ctselector-search-remove", "search_remove.png", iconTheme); |
||
93 | registerIcon(group, "crs-ctselector-ct", "ct.png", iconTheme); |
||
94 | registerIcon(group, "crs-ctselector-crs", "crs.png", iconTheme); |
||
95 | registerIcon(group, "crs-ctselector-favorite", "favourite.png", iconTheme); |
||
96 | registerIcon(group, "crs-ctselector-recent", "recent.png", iconTheme); |
||
97 | registerIcon(group, "crs-ctselector-ct-new", "ct_add.png", iconTheme); |
||
98 | registerIcon(group, "crs-ctselector-recent-remove", "recent_remove.png", iconTheme); |
||
99 | registerIcon(group, "crs-ctselector-favorite-add", "favourite_add.png", iconTheme); |
||
100 | registerIcon(group, "crs-ctselector-favorite-remove", "favourite_remove.png", iconTheme); |
||
101 | |||
102 | // newcrs panel
|
||
103 | registerIcon(group, "crs-newcrs-unlock", "unlock.png", iconTheme); |
||
104 | // newct panel
|
||
105 | registerIcon(group, "crs-newct-unlock", "unlock.png", iconTheme); |
||
106 | |||
107 | // branch tree node
|
||
108 | registerIcon(group, "crs-branchnode-tree-group-expanded", "folder_open.png", iconTheme); |
||
109 | registerIcon(group, "crs-branchnode-tree-group-collapsed", "folder_closed.png", iconTheme); |
||
110 | |||
111 | // loading tree node
|
||
112 | registerIcon(group, "crs-loadingnode-spinner", "spinner.gif", iconTheme); |
||
113 | 854 | cmartinez | } |
114 | |||
115 | 866 | cmartinez | protected void registerIcon(String group, String name, String resourceName, IconTheme iconTheme) { |
116 | resourceName = "images/" + group + "/" + resourceName; |
||
117 | 854 | cmartinez | String provider = this.getClass().getName(); |
118 | ClassLoader loader = this.getClass().getClassLoader(); |
||
119 | URL resource = null; |
||
120 | try {
|
||
121 | resource = loader.getResource(resourceName); |
||
122 | iconTheme.registerDefault(provider, group, name, null, resource);
|
||
123 | } catch( Throwable e) { |
||
124 | LoggerFactory.getLogger(CoordinateReferenceSystemSwingDefaultImplLibrary.class) |
||
125 | .info("Can't register icon '" + name + "'.",e); |
||
126 | } |
||
127 | } |
||
128 | 7 | cordinyana | } |