Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / extension / About.java @ 39104

History | View | Annotate | Download (5.83 KB)

1 312 fernando
/*
2
 * Created on 17-feb-2004
3
 *
4
 * To change the template for this generated file go to
5
 * Window>Preferences>Java>Code Generation>Code and Comments
6
 */
7 1103 fjp
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47 29596 jpiera
package org.gvsig.app.extension;
48 312 fernando
49 34002 jjdelcerro
import java.awt.BorderLayout;
50
import java.awt.FlowLayout;
51
import java.awt.event.ActionEvent;
52
import java.awt.event.ActionListener;
53
import java.net.URL;
54
55
import javax.swing.JButton;
56
import javax.swing.JPanel;
57
58
import org.gvsig.about.AboutLocator;
59
import org.gvsig.about.AboutManager;
60 38902 jldominguez
import org.gvsig.andami.IconThemeHelper;
61 29596 jpiera
import org.gvsig.andami.PluginServices;
62 39065 jldominguez
import org.gvsig.andami.PluginsLocator;
63
import org.gvsig.andami.PluginsManager;
64 29596 jpiera
import org.gvsig.andami.plugins.Extension;
65 34002 jjdelcerro
import org.gvsig.andami.ui.mdiManager.IWindow;
66
import org.gvsig.andami.ui.mdiManager.WindowInfo;
67
import org.gvsig.app.ApplicationLocator;
68
import org.gvsig.app.ApplicationManager;
69 39065 jldominguez
import org.gvsig.installer.lib.api.PackageInfo;
70 312 fernando
71 1219 vcaballero
72 29596 jpiera
73 312 fernando
/**
74 1219 vcaballero
 * Extensi?n que abre una nueva ventana mostrando la informaci?n sobre el
75
 * gvSIG.
76 312 fernando
 *
77
 */
78 5005 jorpiell
public class About extends Extension {
79 312 fernando
        /**
80 29596 jpiera
         * @see org.gvsig.andami.plugins.IExtension#isEnabled()
81 312 fernando
         */
82
        public boolean isEnabled() {
83
                return true;
84
        }
85
86
        /**
87 5005 jorpiell
         * @see com.iver.mdiApp.plugins.IExtension#isVisible()
88 312 fernando
         */
89
        public boolean isVisible() {
90
                return true;
91
        }
92
93 595 fernando
        /**
94 29596 jpiera
         * @see org.gvsig.andami.plugins.IExtension#initialize()
95 595 fernando
         */
96 5005 jorpiell
        public void initialize() {
97 34002 jjdelcerro
        }
98 2789 fjp
99 34002 jjdelcerro
        private URL getResource(String name) {
100 34007 cordinyana
        URL resource = this.getClass().getClassLoader().getResource(name);
101 34002 jjdelcerro
                return resource;
102
        }
103
104
        public void postInitialize() {
105
                super.postInitialize();
106 39065 jldominguez
107
                PluginsManager pmanager = PluginsLocator.getManager();
108
109 34002 jjdelcerro
                ApplicationManager application = ApplicationLocator.getManager();
110
111 39065 jldominguez
                PackageInfo pinfo = pmanager.getPackageInfo(About.class);
112
113 34002 jjdelcerro
                AboutManager about = application.getAbout();
114
115 34007 cordinyana
        about.setProject("gvSIG desktop", getResource("about.htm"),
116 38529 cordinyana
            getResource("images/gvsig-icon16x16.png"));
117 39065 jldominguez
        about.getProject().set("version", pinfo.getVersion().toString());
118
        about.getProject().set("state", pinfo.getState());
119 34441 cordinyana
        about.getProject().set("java.version",
120
            System.getProperty("java.version"));
121 34002 jjdelcerro
122
                about.addSponsor(
123
                        "CIT GVA", //"Conselleria d'infraestructures i transport de la Generalitat Valenciana",
124
                        getResource("gva-cit.html"),
125
                        1
126
                );
127 2789 fjp
128 34002 jjdelcerro
                about.addDeveloper(
129
                        "IVER",
130
                        getResource("iver.html"),
131
                        1
132
                );
133
134
                about.addDeveloper(
135
                        "PRODEVELOP",
136
                        getResource("prodevelop.html"),
137
                        2
138
                );
139
140
                about.addDeveloper(
141
                        "Software Colaborativo",
142
                        getResource("scolab.html"),
143
                        3
144
                );
145
146
                about.addDeveloper(
147
                        "DISID",
148
                        getResource("disid.html"),
149
                        4
150
                );
151 595 fernando
        }
152 312 fernando
153 595 fernando
        public void execute(String actionCommand) {
154 34002 jjdelcerro
                ApplicationManager application = ApplicationLocator.getManager();
155
156
                application.getUIManager().addCentredWindow(new AboutWindow());
157 595 fernando
        }
158 2789 fjp
159 34002 jjdelcerro
        class AboutWindow extends JPanel implements IWindow {
160
161
                /**
162
                 *
163
                 */
164
                private static final long serialVersionUID = -3577229971045886621L;
165
166
                AboutWindow() {
167
                        AboutManager aboutManager = AboutLocator.getManager();
168
169
                        this.setLayout(new BorderLayout());
170
                        this.add(aboutManager.getAboutPanel(), BorderLayout.CENTER);
171
                        this.add(new JPanelButtons(), BorderLayout.SOUTH);
172
                }
173
174
                public WindowInfo getWindowInfo() {
175
                        WindowInfo winfo = new WindowInfo(
176
                                        WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE
177
                        );
178
                        winfo.setTitle(PluginServices.getText(this,"acerca_de"));
179 34013 cordinyana
            winfo.setHeight(500);
180
            winfo.setWidth(750);
181 34002 jjdelcerro
                        return winfo;
182
                }
183
184
                public Object getWindowProfile() {
185
                        return WindowInfo.DIALOG_PROFILE;
186
                }
187
188
                public void closeWindow() {
189
                        PluginServices.getMDIManager().closeWindow(this);
190
                }
191
192
                class JPanelButtons extends JPanel {
193
                        /**
194
                         *
195
                         */
196
                        private static final long serialVersionUID = 1529755877776747074L;
197
                        JButton close = null;
198
                        JButton installedPlugins = null;
199
200
                        JPanelButtons() {
201 34013 cordinyana
                this.setLayout(new FlowLayout(FlowLayout.RIGHT));
202 34002 jjdelcerro
                                this.close = getCloseButton();
203
                                this.installedPlugins = getInstalledPluginsButton();
204 34013 cordinyana
                this.add(this.close);
205 34002 jjdelcerro
                                this.add(this.installedPlugins);
206
                        }
207
208
                        private JButton getCloseButton() {
209
                                JButton button = new JButton(
210
                                                PluginServices.getText(this, "Close"));
211
                                button.addActionListener(new ActionListener() {
212
                                        public void actionPerformed(ActionEvent e) {
213
                                                closeWindow();
214
                                        }
215
                                });
216
                                return button;
217
                        }
218
219
                        private JButton getInstalledPluginsButton() {
220
                                JButton button = new JButton(PluginServices.getText(this,
221
                                                "Installed plugins"));
222
                                button.addActionListener(new ActionListener() {
223
                                        public void actionPerformed(ActionEvent e) {
224
                                                // TODO: Need implementation
225
                                        }
226
                                });
227
                                return button;
228
                        }
229
230
                }
231
        }
232 1219 vcaballero
}