svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / extension / About.java @ 45195
History | View | Annotate | Download (6.55 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
14 |
* details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License along with
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
21 |
* gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.app.extension; |
24 |
|
25 |
import java.awt.BorderLayout; |
26 |
import java.awt.FlowLayout; |
27 |
import java.awt.event.ActionEvent; |
28 |
import java.awt.event.ActionListener; |
29 |
import java.net.URL; |
30 |
|
31 |
import javax.swing.JButton; |
32 |
import javax.swing.JPanel; |
33 |
|
34 |
import org.gvsig.about.AboutLocator; |
35 |
import org.gvsig.about.AboutManager; |
36 |
import org.gvsig.andami.PluginServices; |
37 |
import org.gvsig.andami.PluginsLocator; |
38 |
import org.gvsig.andami.PluginsManager; |
39 |
import org.gvsig.andami.plugins.Extension; |
40 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
41 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
42 |
import org.gvsig.app.ApplicationLocator; |
43 |
import org.gvsig.app.ApplicationManager; |
44 |
import org.gvsig.installer.lib.api.PackageInfo; |
45 |
|
46 |
/**
|
47 |
* Extensi?n que abre una nueva ventana mostrando la informaci?n sobre el gvSIG.
|
48 |
*
|
49 |
*/
|
50 |
public class About extends Extension { |
51 |
|
52 |
/**
|
53 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
54 |
*/
|
55 |
public boolean isEnabled() { |
56 |
return true; |
57 |
} |
58 |
|
59 |
/**
|
60 |
* @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
61 |
*/
|
62 |
public boolean isVisible() { |
63 |
return true; |
64 |
} |
65 |
|
66 |
/**
|
67 |
* @see org.gvsig.andami.plugins.IExtension#initialize()
|
68 |
*/
|
69 |
public void initialize() { |
70 |
} |
71 |
|
72 |
private URL getResource(String name) { |
73 |
URL resource = this.getClass().getClassLoader().getResource(name); |
74 |
return resource;
|
75 |
} |
76 |
|
77 |
public void postInitialize() { |
78 |
super.postInitialize();
|
79 |
|
80 |
PluginsManager pmanager = PluginsLocator.getManager(); |
81 |
|
82 |
ApplicationManager application = ApplicationLocator.getManager(); |
83 |
|
84 |
PackageInfo pinfo = pmanager.getPackageInfo(About.class); |
85 |
|
86 |
AboutManager about = application.getAbout(); |
87 |
|
88 |
about.setProject("gvSIG desktop", getResource("about/about.htm"), |
89 |
getResource("about/gvsig-icon16x16.png"));
|
90 |
about.getProject().set("version", pinfo.getVersion().toString());
|
91 |
about.getProject().set("state", pinfo.getState());
|
92 |
about.getProject().set("java.version",
|
93 |
System.getProperty("java.version")); |
94 |
|
95 |
about.addSponsor( |
96 |
"Generalitat Valenciana",
|
97 |
getResource("about/gva/gva.html"),
|
98 |
1,
|
99 |
getResource("about/gva/logo-gva-16x16-red.png")
|
100 |
); |
101 |
about.addSponsor( |
102 |
"European Union",
|
103 |
getResource("about/eu/eu.html"),
|
104 |
2,
|
105 |
getResource("about/eu/logo-eu-16x16.png")
|
106 |
); |
107 |
|
108 |
|
109 |
|
110 |
about.addDeveloper( |
111 |
"gvSIG association",
|
112 |
getResource("about/gvsigassociation.html"),
|
113 |
1
|
114 |
); |
115 |
|
116 |
about.addDeveloper( |
117 |
"Software Colaborativo",
|
118 |
getResource("about/scolab/scolab.html"),
|
119 |
2
|
120 |
); |
121 |
|
122 |
// about.addDeveloper(
|
123 |
// "DISID",
|
124 |
// getResource("about/disid/disid.html"),
|
125 |
// 3
|
126 |
// );
|
127 |
// about.addDeveloper(
|
128 |
// "PRODEVELOP",
|
129 |
// getResource("about/prodevelop/prodevelop.html"),
|
130 |
// 4
|
131 |
// );
|
132 |
|
133 |
} |
134 |
|
135 |
public void execute(String actionCommand) { |
136 |
ApplicationManager application = ApplicationLocator.getManager(); |
137 |
|
138 |
application.getUIManager().addCentredWindow(new AboutWindow());
|
139 |
} |
140 |
|
141 |
class AboutWindow extends JPanel implements IWindow { |
142 |
|
143 |
/**
|
144 |
*
|
145 |
*/
|
146 |
private static final long serialVersionUID = -3577229971045886621L; |
147 |
|
148 |
AboutWindow() { |
149 |
AboutManager aboutManager = AboutLocator.getManager(); |
150 |
|
151 |
this.setLayout(new BorderLayout()); |
152 |
this.add(aboutManager.getAboutPanel(), BorderLayout.CENTER); |
153 |
this.add(new JPanelButtons(), BorderLayout.SOUTH); |
154 |
} |
155 |
|
156 |
public WindowInfo getWindowInfo() {
|
157 |
WindowInfo winfo = new WindowInfo(
|
158 |
WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE |
159 |
); |
160 |
winfo.setTitle(PluginServices.getText(this, "acerca_de")); |
161 |
winfo.setHeight(500);
|
162 |
winfo.setWidth(750);
|
163 |
return winfo;
|
164 |
} |
165 |
|
166 |
public Object getWindowProfile() { |
167 |
return WindowInfo.DIALOG_PROFILE;
|
168 |
} |
169 |
|
170 |
public void closeWindow() { |
171 |
PluginServices.getMDIManager().closeWindow(this);
|
172 |
} |
173 |
|
174 |
class JPanelButtons extends JPanel { |
175 |
|
176 |
/**
|
177 |
*
|
178 |
*/
|
179 |
private static final long serialVersionUID = 1529755877776747074L; |
180 |
JButton close = null; |
181 |
JButton installedPlugins = null; |
182 |
|
183 |
JPanelButtons() { |
184 |
this.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
185 |
this.close = getCloseButton();
|
186 |
// this.installedPlugins = getInstalledPluginsButton();
|
187 |
this.add(this.close); |
188 |
// this.add(this.installedPlugins);
|
189 |
} |
190 |
|
191 |
private JButton getCloseButton() { |
192 |
JButton button = new JButton( |
193 |
PluginServices.getText(this, "Close")); |
194 |
button.addActionListener(new ActionListener() { |
195 |
public void actionPerformed(ActionEvent e) { |
196 |
closeWindow(); |
197 |
} |
198 |
}); |
199 |
return button;
|
200 |
} |
201 |
|
202 |
private JButton getInstalledPluginsButton() { |
203 |
JButton button = new JButton(PluginServices.getText(this, |
204 |
"Installed plugins"));
|
205 |
button.addActionListener(new ActionListener() { |
206 |
public void actionPerformed(ActionEvent e) { |
207 |
// TODO: Need implementation
|
208 |
} |
209 |
}); |
210 |
return button;
|
211 |
} |
212 |
|
213 |
} |
214 |
} |
215 |
} |