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

History | View | Annotate | Download (6.59 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 44172 jjdelcerro
                "Generalitat Valenciana",
98
                getResource("about/gva/gva.html"),
99
                1,
100
                getResource("about/gva/logo-gva-16x16-red.png")
101 41155 jjdelcerro
        );
102 44172 jjdelcerro
        about.addSponsor(
103
                "European Union",
104
                getResource("about/eu/eu.html"),
105
                2,
106
                getResource("about/eu/logo-eu-16x16.png")
107
        );
108
109
110
111 41155 jjdelcerro
        about.addDeveloper(
112 44172 jjdelcerro
                "gvSIG association",
113
                getResource("about/gvsigassociation.html"),
114
                1
115 41155 jjdelcerro
        );
116 40435 jjdelcerro
117 41155 jjdelcerro
        about.addDeveloper(
118
                "Software Colaborativo",
119 44172 jjdelcerro
                getResource("about/scolab/scolab.html"),
120
                2
121 41155 jjdelcerro
        );
122 40435 jjdelcerro
123 44172 jjdelcerro
//        about.addDeveloper(
124
//                "DISID",
125
//                getResource("about/disid/disid.html"),
126
//                3
127
//        );
128
//        about.addDeveloper(
129
//                "PRODEVELOP",
130
//                getResource("about/prodevelop/prodevelop.html"),
131
//                4
132
//        );
133
134 41155 jjdelcerro
    }
135 40435 jjdelcerro
136 41155 jjdelcerro
    public void execute(String actionCommand) {
137
        ApplicationManager application = ApplicationLocator.getManager();
138
139
        application.getUIManager().addCentredWindow(new AboutWindow());
140
    }
141
142
    class AboutWindow extends JPanel implements IWindow {
143
144
        /**
145
         *
146
         */
147
        private static final long serialVersionUID = -3577229971045886621L;
148
149
        AboutWindow() {
150
            AboutManager aboutManager = AboutLocator.getManager();
151
152
            this.setLayout(new BorderLayout());
153
            this.add(aboutManager.getAboutPanel(), BorderLayout.CENTER);
154
            this.add(new JPanelButtons(), BorderLayout.SOUTH);
155
        }
156
157
        public WindowInfo getWindowInfo() {
158
            WindowInfo winfo = new WindowInfo(
159
                    WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE
160
            );
161
            winfo.setTitle(PluginServices.getText(this, "acerca_de"));
162 40435 jjdelcerro
            winfo.setHeight(500);
163
            winfo.setWidth(750);
164 41155 jjdelcerro
            return winfo;
165
        }
166 40435 jjdelcerro
167 41155 jjdelcerro
        public Object getWindowProfile() {
168
            return WindowInfo.DIALOG_PROFILE;
169
        }
170 40435 jjdelcerro
171 41155 jjdelcerro
        public void closeWindow() {
172
            PluginServices.getMDIManager().closeWindow(this);
173
        }
174 40435 jjdelcerro
175 41155 jjdelcerro
        class JPanelButtons extends JPanel {
176
177
            /**
178
             *
179
             */
180
            private static final long serialVersionUID = 1529755877776747074L;
181
            JButton close = null;
182
            JButton installedPlugins = null;
183
184
            JPanelButtons() {
185 40435 jjdelcerro
                this.setLayout(new FlowLayout(FlowLayout.RIGHT));
186 41155 jjdelcerro
                this.close = getCloseButton();
187 40623 jjdelcerro
//                                this.installedPlugins = getInstalledPluginsButton();
188 40435 jjdelcerro
                this.add(this.close);
189 40623 jjdelcerro
//                                this.add(this.installedPlugins);
190 41155 jjdelcerro
            }
191 40435 jjdelcerro
192 41155 jjdelcerro
            private JButton getCloseButton() {
193
                JButton button = new JButton(
194
                        PluginServices.getText(this, "Close"));
195
                button.addActionListener(new ActionListener() {
196
                    public void actionPerformed(ActionEvent e) {
197
                        closeWindow();
198
                    }
199
                });
200
                return button;
201
            }
202 40435 jjdelcerro
203 41155 jjdelcerro
            private JButton getInstalledPluginsButton() {
204
                JButton button = new JButton(PluginServices.getText(this,
205
                        "Installed plugins"));
206
                button.addActionListener(new ActionListener() {
207
                    public void actionPerformed(ActionEvent e) {
208
                        // TODO: Need implementation
209
                    }
210
                });
211
                return button;
212
            }
213 40435 jjdelcerro
214 41155 jjdelcerro
        }
215
    }
216 40435 jjdelcerro
}