Statistics
| Revision:

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 @ 40558

History | View | Annotate | Download (6.7 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
 * Created on 17-feb-2004
26
 *
27
 * To change the template for this generated file go to
28
 * Window>Preferences>Java>Code Generation>Code and Comments
29
 */
30
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
31
 *
32
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
33
 *
34
 * This program is free software; you can redistribute it and/or
35
 * modify it under the terms of the GNU General Public License
36
 * as published by the Free Software Foundation; either version 2
37
 * of the License, or (at your option) any later version.
38
 *
39
 * This program is distributed in the hope that it will be useful,
40
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
42
 * GNU General Public License for more details.
43
 *
44
 * You should have received a copy of the GNU General Public License
45
 * along with this program; if not, write to the Free Software
46
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
47
 *
48
 * For more information, contact:
49
 *
50
 *  Generalitat Valenciana
51
 *   Conselleria d'Infraestructures i Transport
52
 *   Av. Blasco Ib??ez, 50
53
 *   46010 VALENCIA
54
 *   SPAIN
55
 *
56
 *      +34 963862235
57
 *   gvsig@gva.es
58
 *      www.gvsig.gva.es
59
 *
60
 *    or
61
 *
62
 *   IVER T.I. S.A
63
 *   Salamanca 50
64
 *   46005 Valencia
65
 *   Spain
66
 *
67
 *   +34 963163400
68
 *   dac@iver.es
69
 */
70
package org.gvsig.app.extension;
71

    
72
import java.awt.BorderLayout;
73
import java.awt.FlowLayout;
74
import java.awt.event.ActionEvent;
75
import java.awt.event.ActionListener;
76
import java.net.URL;
77

    
78
import javax.swing.JButton;
79
import javax.swing.JPanel;
80

    
81
import org.gvsig.about.AboutLocator;
82
import org.gvsig.about.AboutManager;
83
import org.gvsig.andami.IconThemeHelper;
84
import org.gvsig.andami.PluginServices;
85
import org.gvsig.andami.PluginsLocator;
86
import org.gvsig.andami.PluginsManager;
87
import org.gvsig.andami.plugins.Extension;
88
import org.gvsig.andami.ui.mdiManager.IWindow;
89
import org.gvsig.andami.ui.mdiManager.WindowInfo;
90
import org.gvsig.app.ApplicationLocator;
91
import org.gvsig.app.ApplicationManager;
92
import org.gvsig.installer.lib.api.PackageInfo;
93

    
94

    
95

    
96
/**
97
 * Extensi?n que abre una nueva ventana mostrando la informaci?n sobre el
98
 * gvSIG.
99
 *
100
 */
101
public class About extends Extension {
102
        /**
103
         * @see org.gvsig.andami.plugins.IExtension#isEnabled()
104
         */
105
        public boolean isEnabled() {
106
                return true;
107
        }
108

    
109
        /**
110
         * @see com.iver.mdiApp.plugins.IExtension#isVisible()
111
         */
112
        public boolean isVisible() {
113
                return true;
114
        }
115

    
116
        /**
117
         * @see org.gvsig.andami.plugins.IExtension#initialize()
118
         */
119
        public void initialize() {
120
        }
121

    
122
        private URL getResource(String name) {
123
        URL resource = this.getClass().getClassLoader().getResource(name);
124
                return resource;
125
        }
126
        
127
        public void postInitialize() {
128
                super.postInitialize();
129
                
130
                PluginsManager pmanager = PluginsLocator.getManager();
131
                
132
                ApplicationManager application = ApplicationLocator.getManager();
133
                
134
                PackageInfo pinfo = pmanager.getPackageInfo(About.class);
135
                
136
                AboutManager about = application.getAbout();
137
                
138
        about.setProject("gvSIG desktop", getResource("about.htm"),
139
            getResource("images/gvsig-icon16x16.png"));
140
        about.getProject().set("version", pinfo.getVersion().toString());
141
        about.getProject().set("state", pinfo.getState());
142
        about.getProject().set("java.version",
143
            System.getProperty("java.version"));
144
                
145
                about.addSponsor(
146
                        "CITMA GVA", //"Conselleria d'infraestructures i transport de la Generalitat Valenciana",
147
                        getResource("gva-cit.html"),
148
                        1
149
                );
150
                about.addDeveloper(
151
                        "PRODEVELOP",
152
                        getResource("prodevelop.html"),
153
                        2
154
                );
155
                
156
                about.addDeveloper(
157
                        "Software Colaborativo",
158
                        getResource("scolab.html"),
159
                        3
160
                );
161
                
162
                about.addDeveloper(
163
                        "DISID",
164
                        getResource("disid.html"),
165
                        4
166
                );
167
        }
168

    
169
        public void execute(String actionCommand) {
170
                ApplicationManager application = ApplicationLocator.getManager();
171
                
172
                application.getUIManager().addCentredWindow(new AboutWindow());
173
        }
174
    
175
        class AboutWindow extends JPanel implements IWindow {
176

    
177
                /**
178
                 * 
179
                 */
180
                private static final long serialVersionUID = -3577229971045886621L;
181

    
182
                AboutWindow() {
183
                        AboutManager aboutManager = AboutLocator.getManager();
184

    
185
                        this.setLayout(new BorderLayout());
186
                        this.add(aboutManager.getAboutPanel(), BorderLayout.CENTER);
187
                        this.add(new JPanelButtons(), BorderLayout.SOUTH);
188
                }
189
                
190
                public WindowInfo getWindowInfo() {
191
                        WindowInfo winfo = new WindowInfo(
192
                                        WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE
193
                        );
194
                        winfo.setTitle(PluginServices.getText(this,"acerca_de"));
195
            winfo.setHeight(500);
196
            winfo.setWidth(750);
197
                        return winfo;
198
                }
199

    
200
                public Object getWindowProfile() {
201
                        return WindowInfo.DIALOG_PROFILE;
202
                }
203
                
204
                public void closeWindow() {
205
                        PluginServices.getMDIManager().closeWindow(this);
206
                }
207

    
208
                class JPanelButtons extends JPanel {
209
                        /**
210
                         * 
211
                         */
212
                        private static final long serialVersionUID = 1529755877776747074L;
213
                        JButton close = null;
214
                        JButton installedPlugins = null;
215

    
216
                        JPanelButtons() {
217
                this.setLayout(new FlowLayout(FlowLayout.RIGHT));
218
                                this.close = getCloseButton();
219
                                this.installedPlugins = getInstalledPluginsButton();
220
                this.add(this.close);
221
                                this.add(this.installedPlugins);
222
                        }
223

    
224
                        private JButton getCloseButton() {
225
                                JButton button = new JButton(
226
                                                PluginServices.getText(this, "Close"));
227
                                button.addActionListener(new ActionListener() {
228
                                        public void actionPerformed(ActionEvent e) {
229
                                                closeWindow();
230
                                        }
231
                                });
232
                                return button;
233
                        }
234

    
235
                        private JButton getInstalledPluginsButton() {
236
                                JButton button = new JButton(PluginServices.getText(this,
237
                                                "Installed plugins"));
238
                                button.addActionListener(new ActionListener() {
239
                                        public void actionPerformed(ActionEvent e) {
240
                                                // TODO: Need implementation
241
                                        }
242
                                });
243
                                return button;
244
                        }
245

    
246
                }
247
        }
248
}