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
/**
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 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
 *
11
 * 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
 *
16
 * 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
 *
20
 * For any additional information, do not hesitate to contact us at info AT
21
 * gvsig.com, or visit our website www.gvsig.com.
22
 */
23
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
 * Extensi?n que abre una nueva ventana mostrando la informaci?n sobre el gvSIG.
49
 *
50
 */
51
public class About extends Extension {
52

    
53
    /**
54
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
55
     */
56
    public boolean isEnabled() {
57
        return true;
58
    }
59

    
60
    /**
61
     * @see com.iver.mdiApp.plugins.IExtension#isVisible()
62
     */
63
    public boolean isVisible() {
64
        return true;
65
    }
66

    
67
    /**
68
     * @see org.gvsig.andami.plugins.IExtension#initialize()
69
     */
70
    public void initialize() {
71
    }
72

    
73
    private URL getResource(String name) {
74
        URL resource = this.getClass().getClassLoader().getResource(name);
75
        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
        about.setProject("gvSIG desktop", getResource("about/about.htm"),
90
                getResource("about/gvsig-icon16x16.png"));
91
        about.getProject().set("version", pinfo.getVersion().toString());
92
        about.getProject().set("state", pinfo.getState());
93
        about.getProject().set("java.version",
94
                System.getProperty("java.version"));
95

    
96
        about.addSponsor(
97
                "Generalitat Valenciana",
98
                getResource("about/gva/gva.html"),
99
                1,
100
                getResource("about/gva/logo-gva-16x16-red.png")
101
        );
102
        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
        about.addDeveloper(
112
                "gvSIG association",
113
                getResource("about/gvsigassociation.html"),
114
                1
115
        );
116

    
117
        about.addDeveloper(
118
                "Software Colaborativo",
119
                getResource("about/scolab/scolab.html"),
120
                2
121
        );
122

    
123
//        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
    }
135

    
136
    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
            winfo.setHeight(500);
163
            winfo.setWidth(750);
164
            return winfo;
165
        }
166

    
167
        public Object getWindowProfile() {
168
            return WindowInfo.DIALOG_PROFILE;
169
        }
170

    
171
        public void closeWindow() {
172
            PluginServices.getMDIManager().closeWindow(this);
173
        }
174

    
175
        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
                this.setLayout(new FlowLayout(FlowLayout.RIGHT));
186
                this.close = getCloseButton();
187
//                                this.installedPlugins = getInstalledPluginsButton();
188
                this.add(this.close);
189
//                                this.add(this.installedPlugins);
190
            }
191

    
192
            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

    
203
            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

    
214
        }
215
    }
216
}