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