Statistics
| Revision:

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

History | View | Annotate | Download (5.36 KB)

1
/*
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
/* 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
package org.gvsig.app.extension;
48

    
49
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
import org.gvsig.andami.PluginServices;
61
import org.gvsig.andami.plugins.Extension;
62
import org.gvsig.andami.ui.mdiManager.IWindow;
63
import org.gvsig.andami.ui.mdiManager.WindowInfo;
64
import org.gvsig.app.ApplicationLocator;
65
import org.gvsig.app.ApplicationManager;
66

    
67

    
68

    
69
/**
70
 * Extensi?n que abre una nueva ventana mostrando la informaci?n sobre el
71
 * gvSIG.
72
 *
73
 */
74
public class About extends Extension {
75
        /**
76
         * @see org.gvsig.andami.plugins.IExtension#isEnabled()
77
         */
78
        public boolean isEnabled() {
79
                return true;
80
        }
81

    
82
        /**
83
         * @see com.iver.mdiApp.plugins.IExtension#isVisible()
84
         */
85
        public boolean isVisible() {
86
                return true;
87
        }
88

    
89
        /**
90
         * @see org.gvsig.andami.plugins.IExtension#initialize()
91
         */
92
        public void initialize() {
93
        }
94

    
95
        private URL getResource(String name) {
96
        URL resource = this.getClass().getClassLoader().getResource(name);
97
                return resource;
98
        }
99
        
100
        public void postInitialize() {
101
                super.postInitialize();
102
                ApplicationManager application = ApplicationLocator.getManager();
103
                
104
                Version version = application.getVersion();
105
                AboutManager about = application.getAbout();
106
                
107
        about.setProject("gvSIG desktop", getResource("about.htm"),
108
            getResource("images/gvsig.png"));
109
                about.getProject().set("build",version.getBuildId());
110
                about.getProject().set("version",version.getFormat());
111
                
112
                about.addSponsor(
113
                        "CIT GVA", //"Conselleria d'infraestructures i transport de la Generalitat Valenciana",
114
                        getResource("gva-cit.html"),
115
                        1
116
                );
117

    
118
                about.addDeveloper(
119
                        "IVER",
120
                        getResource("iver.html"),
121
                        1
122
                );
123
                
124
                about.addDeveloper(
125
                        "PRODEVELOP",
126
                        getResource("prodevelop.html"),
127
                        2
128
                );
129
                
130
                about.addDeveloper(
131
                        "Software Colaborativo",
132
                        getResource("scolab.html"),
133
                        3
134
                );
135
                
136
                about.addDeveloper(
137
                        "DISID",
138
                        getResource("disid.html"),
139
                        4
140
                );
141
        }
142

    
143
        public void execute(String actionCommand) {
144
                ApplicationManager application = ApplicationLocator.getManager();
145
                
146
                application.getUIManager().addCentredWindow(new AboutWindow());
147
        }
148
    
149
        class AboutWindow extends JPanel implements IWindow {
150

    
151
                /**
152
                 * 
153
                 */
154
                private static final long serialVersionUID = -3577229971045886621L;
155

    
156
                AboutWindow() {
157
                        AboutManager aboutManager = AboutLocator.getManager();
158

    
159
                        this.setLayout(new BorderLayout());
160
                        this.add(aboutManager.getAboutPanel(), BorderLayout.CENTER);
161
                        this.add(new JPanelButtons(), BorderLayout.SOUTH);
162
                }
163
                
164
                public WindowInfo getWindowInfo() {
165
                        WindowInfo winfo = new WindowInfo(
166
                                        WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE
167
                        );
168
                        winfo.setTitle(PluginServices.getText(this,"acerca_de"));
169
                        return winfo;
170
                }
171

    
172
                public Object getWindowProfile() {
173
                        return WindowInfo.DIALOG_PROFILE;
174
                }
175
                
176
                public void closeWindow() {
177
                        PluginServices.getMDIManager().closeWindow(this);
178
                }
179

    
180
                class JPanelButtons extends JPanel {
181
                        /**
182
                         * 
183
                         */
184
                        private static final long serialVersionUID = 1529755877776747074L;
185
                        JButton close = null;
186
                        JButton installedPlugins = null;
187

    
188
                        JPanelButtons() {
189
                                this.setLayout(new FlowLayout());
190
                                this.close = getCloseButton();
191
                                this.installedPlugins = getInstalledPluginsButton();
192
                                this.add(this.close);
193
                                this.add(this.installedPlugins);
194
                        }
195

    
196
                        private JButton getCloseButton() {
197
                                JButton button = new JButton(
198
                                                PluginServices.getText(this, "Close"));
199
                                button.addActionListener(new ActionListener() {
200
                                        public void actionPerformed(ActionEvent e) {
201
                                                closeWindow();
202
                                        }
203
                                });
204
                                return button;
205
                        }
206

    
207
                        private JButton getInstalledPluginsButton() {
208
                                JButton button = new JButton(PluginServices.getText(this,
209
                                                "Installed plugins"));
210
                                button.addActionListener(new ActionListener() {
211
                                        public void actionPerformed(ActionEvent e) {
212
                                                // TODO: Need implementation
213
                                        }
214
                                });
215
                                return button;
216
                        }
217

    
218
                }
219
        }
220
}