root / org.gvsig.educa.thematicmap.app / trunk / org.gvsig.educa.thematicmap.app / org.gvsig.educa.thematicmap.app.viewer / src / main / java / org / gvsig / educa / thematicmap / app / viewer / ThematicMapExtension.java @ 172
History | View | Annotate | Download (4.46 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.educa.thematicmap.app.viewer; |
23 |
|
24 |
import java.io.File; |
25 |
import java.util.ArrayList; |
26 |
import java.util.List; |
27 |
|
28 |
import org.gvsig.about.AboutManager; |
29 |
import org.gvsig.about.AboutParticipant; |
30 |
import org.gvsig.andami.PluginServices; |
31 |
import org.gvsig.andami.plugins.Extension; |
32 |
import org.gvsig.app.ApplicationLocator; |
33 |
import org.gvsig.app.ApplicationManager; |
34 |
import org.gvsig.educa.thematicmap.ThematicMapLocator; |
35 |
import org.gvsig.educa.thematicmap.ThematicMapManager; |
36 |
import org.gvsig.educa.thematicmap.app.viewer.ui.TocImageProvider; |
37 |
import org.gvsig.educa.thematicmap.swing.ThematicMapSwingLocator; |
38 |
import org.gvsig.educa.thematicmap.swing.ThematicMapSwingManager; |
39 |
|
40 |
/**
|
41 |
* Andami extension to show ThematicMap in the application.
|
42 |
*
|
43 |
* @author gvSIG Team
|
44 |
* @version $Id$
|
45 |
*/
|
46 |
public class ThematicMapExtension extends Extension { |
47 |
|
48 |
private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory |
49 |
.getLogger(ThematicMapExtension.class); |
50 |
|
51 |
private ThematicMapManager manager;
|
52 |
private ThematicMapSwingManager swingManager;
|
53 |
|
54 |
public void initialize() { |
55 |
// Do nothing
|
56 |
} |
57 |
|
58 |
@Override
|
59 |
public void postInitialize() { |
60 |
super.postInitialize();
|
61 |
manager = ThematicMapLocator.getManager(); |
62 |
swingManager = ThematicMapSwingLocator.getSwingManager(); |
63 |
|
64 |
// Register the document's manager
|
65 |
ThematicMapDocumentManager.register(); |
66 |
|
67 |
File appUserFolder =
|
68 |
PluginServices.getPluginServices(this).getPluginHomeFolder();
|
69 |
File thematicMapIntallFolder = new File(appUserFolder, "thematicMaps"); |
70 |
LOG.debug("Try Thematic Map instalation folder: '{}'",
|
71 |
thematicMapIntallFolder.getAbsolutePath()); |
72 |
if (!thematicMapIntallFolder.exists()) {
|
73 |
LOG.debug("Creating Thematic Map instalation folder: '{}'",
|
74 |
thematicMapIntallFolder.getAbsolutePath()); |
75 |
|
76 |
if (!thematicMapIntallFolder.mkdirs()) {
|
77 |
LOG.warn("Cant create Thematic Map folder: '{}'");
|
78 |
} |
79 |
|
80 |
} |
81 |
LOG.info("Using Thematic Map instalation folder: '{}'",
|
82 |
thematicMapIntallFolder.getAbsolutePath()); |
83 |
manager.setInstallationMapFolder(thematicMapIntallFolder |
84 |
.getAbsolutePath()); |
85 |
|
86 |
swingManager.setDefaultTocImageProvider(new TocImageProvider());
|
87 |
|
88 |
registerAbout(); |
89 |
|
90 |
} |
91 |
|
92 |
/**
|
93 |
*
|
94 |
*/
|
95 |
private void registerAbout() { |
96 |
// Register the about panel
|
97 |
ApplicationManager application = ApplicationLocator.getManager(); |
98 |
|
99 |
AboutManager about = application.getAbout(); |
100 |
|
101 |
List<AboutParticipant> participants = new ArrayList<AboutParticipant>(); |
102 |
|
103 |
participants.add(about.addDeveloper("DISID", this.getClass() |
104 |
.getClassLoader().getResource("about/disid.html"), 1)); |
105 |
|
106 |
participants.add(about.addDeveloper("UdelaR.uy", this.getClass() |
107 |
.getClassLoader().getResource("about/universidad.edu.uy.html"), 1)); |
108 |
|
109 |
participants.add(about.addSponsor("MTOP.gub.uy", this.getClass() |
110 |
.getClassLoader().getResource("about/MTOP.html"), 1)); |
111 |
|
112 |
for (AboutParticipant participant : participants) {
|
113 |
participant |
114 |
.addContribution( |
115 |
"ThematicMapExtension",
|
116 |
"Thematic Map document: read-only views which could share in packages (installed from standard gvSIG add-on installer)",
|
117 |
2011, 11, 1, 2012, 2, 29); |
118 |
} |
119 |
|
120 |
} |
121 |
|
122 |
public void execute(String actionCommand) { |
123 |
// TODO
|
124 |
} |
125 |
|
126 |
public boolean isEnabled() { |
127 |
return true; |
128 |
} |
129 |
|
130 |
public boolean isVisible() { |
131 |
return true; |
132 |
} |
133 |
|
134 |
} |