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

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