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 @ 40596
History | View | Annotate | Download (5.35 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
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
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.app.extension; |
26 |
|
27 |
import java.awt.BorderLayout; |
28 |
import java.awt.FlowLayout; |
29 |
import java.awt.event.ActionEvent; |
30 |
import java.awt.event.ActionListener; |
31 |
import java.net.URL; |
32 |
|
33 |
import javax.swing.JButton; |
34 |
import javax.swing.JPanel; |
35 |
|
36 |
import org.gvsig.about.AboutLocator; |
37 |
import org.gvsig.about.AboutManager; |
38 |
import org.gvsig.andami.IconThemeHelper; |
39 |
import org.gvsig.andami.PluginServices; |
40 |
import org.gvsig.andami.PluginsLocator; |
41 |
import org.gvsig.andami.PluginsManager; |
42 |
import org.gvsig.andami.plugins.Extension; |
43 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
44 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
45 |
import org.gvsig.app.ApplicationLocator; |
46 |
import org.gvsig.app.ApplicationManager; |
47 |
import org.gvsig.installer.lib.api.PackageInfo; |
48 |
|
49 |
|
50 |
|
51 |
/**
|
52 |
* Extensi?n que abre una nueva ventana mostrando la informaci?n sobre el
|
53 |
* gvSIG.
|
54 |
*
|
55 |
*/
|
56 |
public class About extends Extension { |
57 |
/**
|
58 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
59 |
*/
|
60 |
public boolean isEnabled() { |
61 |
return true; |
62 |
} |
63 |
|
64 |
/**
|
65 |
* @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
66 |
*/
|
67 |
public boolean isVisible() { |
68 |
return true; |
69 |
} |
70 |
|
71 |
/**
|
72 |
* @see org.gvsig.andami.plugins.IExtension#initialize()
|
73 |
*/
|
74 |
public void initialize() { |
75 |
} |
76 |
|
77 |
private URL getResource(String name) { |
78 |
URL resource = this.getClass().getClassLoader().getResource(name); |
79 |
return resource;
|
80 |
} |
81 |
|
82 |
public void postInitialize() { |
83 |
super.postInitialize();
|
84 |
|
85 |
PluginsManager pmanager = PluginsLocator.getManager(); |
86 |
|
87 |
ApplicationManager application = ApplicationLocator.getManager(); |
88 |
|
89 |
PackageInfo pinfo = pmanager.getPackageInfo(About.class); |
90 |
|
91 |
AboutManager about = application.getAbout(); |
92 |
|
93 |
about.setProject("gvSIG desktop", getResource("about.htm"), |
94 |
getResource("images/gvsig-icon16x16.png"));
|
95 |
about.getProject().set("version", pinfo.getVersion().toString());
|
96 |
about.getProject().set("state", pinfo.getState());
|
97 |
about.getProject().set("java.version",
|
98 |
System.getProperty("java.version")); |
99 |
|
100 |
about.addSponsor( |
101 |
"CITMA GVA", //"Conselleria d'infraestructures i transport de la Generalitat Valenciana", |
102 |
getResource("gva-cit.html"),
|
103 |
1
|
104 |
); |
105 |
about.addDeveloper( |
106 |
"PRODEVELOP",
|
107 |
getResource("prodevelop.html"),
|
108 |
2
|
109 |
); |
110 |
|
111 |
about.addDeveloper( |
112 |
"Software Colaborativo",
|
113 |
getResource("scolab.html"),
|
114 |
3
|
115 |
); |
116 |
|
117 |
about.addDeveloper( |
118 |
"DISID",
|
119 |
getResource("disid.html"),
|
120 |
4
|
121 |
); |
122 |
} |
123 |
|
124 |
public void execute(String actionCommand) { |
125 |
ApplicationManager application = ApplicationLocator.getManager(); |
126 |
|
127 |
application.getUIManager().addCentredWindow(new AboutWindow());
|
128 |
} |
129 |
|
130 |
class AboutWindow extends JPanel implements IWindow { |
131 |
|
132 |
/**
|
133 |
*
|
134 |
*/
|
135 |
private static final long serialVersionUID = -3577229971045886621L; |
136 |
|
137 |
AboutWindow() { |
138 |
AboutManager aboutManager = AboutLocator.getManager(); |
139 |
|
140 |
this.setLayout(new BorderLayout()); |
141 |
this.add(aboutManager.getAboutPanel(), BorderLayout.CENTER); |
142 |
this.add(new JPanelButtons(), BorderLayout.SOUTH); |
143 |
} |
144 |
|
145 |
public WindowInfo getWindowInfo() {
|
146 |
WindowInfo winfo = new WindowInfo(
|
147 |
WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE |
148 |
); |
149 |
winfo.setTitle(PluginServices.getText(this,"acerca_de")); |
150 |
winfo.setHeight(500);
|
151 |
winfo.setWidth(750);
|
152 |
return winfo;
|
153 |
} |
154 |
|
155 |
public Object getWindowProfile() { |
156 |
return WindowInfo.DIALOG_PROFILE;
|
157 |
} |
158 |
|
159 |
public void closeWindow() { |
160 |
PluginServices.getMDIManager().closeWindow(this);
|
161 |
} |
162 |
|
163 |
class JPanelButtons extends JPanel { |
164 |
/**
|
165 |
*
|
166 |
*/
|
167 |
private static final long serialVersionUID = 1529755877776747074L; |
168 |
JButton close = null; |
169 |
JButton installedPlugins = null; |
170 |
|
171 |
JPanelButtons() { |
172 |
this.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
173 |
this.close = getCloseButton();
|
174 |
this.installedPlugins = getInstalledPluginsButton();
|
175 |
this.add(this.close); |
176 |
this.add(this.installedPlugins); |
177 |
} |
178 |
|
179 |
private JButton getCloseButton() { |
180 |
JButton button = new JButton( |
181 |
PluginServices.getText(this, "Close")); |
182 |
button.addActionListener(new ActionListener() { |
183 |
public void actionPerformed(ActionEvent e) { |
184 |
closeWindow(); |
185 |
} |
186 |
}); |
187 |
return button;
|
188 |
} |
189 |
|
190 |
private JButton getInstalledPluginsButton() { |
191 |
JButton button = new JButton(PluginServices.getText(this, |
192 |
"Installed plugins"));
|
193 |
button.addActionListener(new ActionListener() { |
194 |
public void actionPerformed(ActionEvent e) { |
195 |
// TODO: Need implementation
|
196 |
} |
197 |
}); |
198 |
return button;
|
199 |
} |
200 |
|
201 |
} |
202 |
} |
203 |
} |