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

History | View | Annotate | Download (6.2 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
                "CITMA GVA", //"Conselleria d'infraestructures i transport de la Generalitat Valenciana",
98
                getResource("about/gva-cit.html"),
99
                1
100
        );
101
        about.addDeveloper(
102
                "PRODEVELOP",
103
                getResource("about/prodevelop.html"),
104
                2
105
        );
106

    
107
        about.addDeveloper(
108
                "Software Colaborativo",
109
                getResource("about/scolab.html"),
110
                3
111
        );
112

    
113
        about.addDeveloper(
114
                "DISID",
115
                getResource("about/disid.html"),
116
                4
117
        );
118
    }
119

    
120
    public void execute(String actionCommand) {
121
        ApplicationManager application = ApplicationLocator.getManager();
122

    
123
        application.getUIManager().addCentredWindow(new AboutWindow());
124
    }
125

    
126
    class AboutWindow extends JPanel implements IWindow {
127

    
128
        /**
129
         *
130
         */
131
        private static final long serialVersionUID = -3577229971045886621L;
132

    
133
        AboutWindow() {
134
            AboutManager aboutManager = AboutLocator.getManager();
135

    
136
            this.setLayout(new BorderLayout());
137
            this.add(aboutManager.getAboutPanel(), BorderLayout.CENTER);
138
            this.add(new JPanelButtons(), BorderLayout.SOUTH);
139
        }
140

    
141
        public WindowInfo getWindowInfo() {
142
            WindowInfo winfo = new WindowInfo(
143
                    WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE
144
            );
145
            winfo.setTitle(PluginServices.getText(this, "acerca_de"));
146
            winfo.setHeight(500);
147
            winfo.setWidth(750);
148
            return winfo;
149
        }
150

    
151
        public Object getWindowProfile() {
152
            return WindowInfo.DIALOG_PROFILE;
153
        }
154

    
155
        public void closeWindow() {
156
            PluginServices.getMDIManager().closeWindow(this);
157
        }
158

    
159
        class JPanelButtons extends JPanel {
160

    
161
            /**
162
             *
163
             */
164
            private static final long serialVersionUID = 1529755877776747074L;
165
            JButton close = null;
166
            JButton installedPlugins = null;
167

    
168
            JPanelButtons() {
169
                this.setLayout(new FlowLayout(FlowLayout.RIGHT));
170
                this.close = getCloseButton();
171
//                                this.installedPlugins = getInstalledPluginsButton();
172
                this.add(this.close);
173
//                                this.add(this.installedPlugins);
174
            }
175

    
176
            private JButton getCloseButton() {
177
                JButton button = new JButton(
178
                        PluginServices.getText(this, "Close"));
179
                button.addActionListener(new ActionListener() {
180
                    public void actionPerformed(ActionEvent e) {
181
                        closeWindow();
182
                    }
183
                });
184
                return button;
185
            }
186

    
187
            private JButton getInstalledPluginsButton() {
188
                JButton button = new JButton(PluginServices.getText(this,
189
                        "Installed plugins"));
190
                button.addActionListener(new ActionListener() {
191
                    public void actionPerformed(ActionEvent e) {
192
                        // TODO: Need implementation
193
                    }
194
                });
195
                return button;
196
            }
197

    
198
        }
199
    }
200
}