svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / gui / panels / FPanelAbout.java @ 34002
History | View | Annotate | Download (7.32 KB)
1 | 6117 | jaume | /*
|
---|---|---|---|
2 | * Created on 02-sep-2004
|
||
3 | *
|
||
4 | * TODO 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 | 29596 | jpiera | package org.gvsig.app.gui.panels; |
48 | 6117 | jaume | |
49 | import java.awt.BorderLayout; |
||
50 | import java.io.FileNotFoundException; |
||
51 | import java.io.IOException; |
||
52 | import java.net.URL; |
||
53 | |||
54 | import javax.swing.JButton; |
||
55 | import javax.swing.JDialog; |
||
56 | import javax.swing.JEditorPane; |
||
57 | import javax.swing.JLabel; |
||
58 | import javax.swing.JPanel; |
||
59 | import javax.swing.JScrollPane; |
||
60 | 7738 | jaume | import javax.swing.JTabbedPane; |
61 | 6117 | jaume | import javax.swing.event.HyperlinkEvent; |
62 | |||
63 | 29596 | jpiera | import org.gvsig.andami.PluginServices; |
64 | import org.gvsig.andami.ui.mdiManager.IWindow; |
||
65 | import org.gvsig.andami.ui.mdiManager.WindowInfo; |
||
66 | import org.gvsig.app.extension.Version; |
||
67 | import org.gvsig.utils.BrowserControl; |
||
68 | 28033 | cordinyana | import org.slf4j.Logger; |
69 | import org.slf4j.LoggerFactory; |
||
70 | 6117 | jaume | |
71 | /**
|
||
72 | * @author FJP
|
||
73 | *
|
||
74 | * A Window with panels showing web pages. A developer
|
||
75 | * can write a web page with information about his/her plugin
|
||
76 | * and call addAboutUrl to add his/her about to gvSIG's about and
|
||
77 | * others.
|
||
78 | 34002 | jjdelcerro | *
|
79 | * @deprecated see the AboutManager
|
||
80 | 6117 | jaume | */
|
81 | 6877 | cesar | public class FPanelAbout extends JPanel implements IWindow { |
82 | 28033 | cordinyana | private static final Logger logger = LoggerFactory |
83 | .getLogger(FPanelAbout.class); |
||
84 | |||
85 | 6117 | jaume | private JEditorPane jEditorPane = null; |
86 | private JScrollPane jScrollPane = null; |
||
87 | private JEditorPane jEditorPane1 = null; |
||
88 | private JPanel jPanel = null; |
||
89 | private JButton jButton = null; |
||
90 | 9637 | jaume | |
91 | 6117 | jaume | private JLabel jLblVersion = null; |
92 | 10734 | jmvivo | private JLabel jLblJavaVersion = null; |
93 | 6117 | jaume | private JTabbedPane jTabbedPane = null; |
94 | /**
|
||
95 | * This is the default constructor
|
||
96 | * @throws FileNotFoundException
|
||
97 | */
|
||
98 | public FPanelAbout(){
|
||
99 | super();
|
||
100 | initialize(); |
||
101 | } |
||
102 | /**
|
||
103 | * This method initializes this
|
||
104 | 9637 | jaume | *
|
105 | 6117 | jaume | * @return void
|
106 | * @throws FileNotFoundException
|
||
107 | */
|
||
108 | private void initialize(){ |
||
109 | this.setLayout(new BorderLayout()); |
||
110 | this.setSize(600, 450); |
||
111 | this.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
|
||
112 | 9637 | jaume | |
113 | 6117 | jaume | this.add(getJPanel(), java.awt.BorderLayout.SOUTH);
|
114 | } |
||
115 | |||
116 | /**
|
||
117 | 9637 | jaume | * This method initializes jScrollPane
|
118 | *
|
||
119 | * @return javax.swing.JScrollPane
|
||
120 | */
|
||
121 | 6117 | jaume | private JScrollPane getJScrollPane(URL url) { |
122 | // if (jScrollPane == null) {
|
||
123 | jScrollPane = new JScrollPane(); |
||
124 | jScrollPane.setPreferredSize(new java.awt.Dimension(300,400)); |
||
125 | jScrollPane.setViewportView(getJEditorPane(url)); |
||
126 | // }
|
||
127 | return jScrollPane;
|
||
128 | } |
||
129 | /**
|
||
130 | 9637 | jaume | * This method initializes jEditorPane1
|
131 | *
|
||
132 | * @return javax.swing.JEditorPane
|
||
133 | */
|
||
134 | 6117 | jaume | private JEditorPane getJEditorPane(URL aboutURL) { |
135 | // if (jEditorPane == null) {
|
||
136 | jEditorPane = new JEditorPane(); |
||
137 | 9637 | jaume | |
138 | 6117 | jaume | jEditorPane.setEditable(false);
|
139 | jEditorPane.setContentType("text/html");
|
||
140 | jEditorPane.setPreferredSize(new java.awt.Dimension(300,200)); |
||
141 | 9637 | jaume | |
142 | 6117 | jaume | if (aboutURL != null) { |
143 | try {
|
||
144 | jEditorPane.setPage(aboutURL); |
||
145 | 9637 | jaume | jEditorPane.addHyperlinkListener(new javax.swing.event.HyperlinkListener() {
|
146 | 6117 | jaume | public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e) { |
147 | if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) |
||
148 | { |
||
149 | JEditorPane pane = (JEditorPane) e.getSource(); |
||
150 | System.out.println("hyperlinkUpdate()"); // TODO Auto-generated Event stub hyperlinkUpdate() |
||
151 | BrowserControl.displayURL(e.getURL().toString()); |
||
152 | // if (e instanceof HTMLFrameHyperlinkEvent) {
|
||
153 | } |
||
154 | |||
155 | 9637 | jaume | |
156 | 6117 | jaume | } |
157 | }); |
||
158 | } catch (IOException e) { |
||
159 | System.err.println("Attempted to read a bad URL: " + aboutURL); |
||
160 | } |
||
161 | } else {
|
||
162 | System.err.println("Couldn't find file: about.html" + aboutURL.getPath()); |
||
163 | } |
||
164 | 9637 | jaume | |
165 | 6117 | jaume | // }
|
166 | return jEditorPane;
|
||
167 | } |
||
168 | /**
|
||
169 | 9637 | jaume | * This method initializes jPanel
|
170 | *
|
||
171 | * @return javax.swing.JPanel
|
||
172 | */
|
||
173 | 6117 | jaume | private JPanel getJPanel() { |
174 | if (jPanel == null) { |
||
175 | jLblVersion = new JLabel(); |
||
176 | 10734 | jmvivo | jLblJavaVersion = new JLabel(); |
177 | 6117 | jaume | jPanel = new JPanel(); |
178 | jPanel.setLayout(null);
|
||
179 | jPanel.setPreferredSize(new java.awt.Dimension(10,50)); |
||
180 | 10734 | jmvivo | jLblVersion.setBounds(10, 16, 205, 17); |
181 | 8184 | jmvivo | jLblVersion.setText("Version "+Version.longFormat());
|
182 | 10734 | jmvivo | jLblJavaVersion.setBounds(415, 16, 150, 17); |
183 | jLblJavaVersion.setText("Java "+System.getProperties().get("java.version")); |
||
184 | 6117 | jaume | jPanel.add(getJButton(), null);
|
185 | jPanel.add(jLblVersion, null);
|
||
186 | 10734 | jmvivo | jPanel.add(jLblJavaVersion, null);
|
187 | 6117 | jaume | } |
188 | return jPanel;
|
||
189 | } |
||
190 | /**
|
||
191 | 9637 | jaume | * This method initializes jButton
|
192 | *
|
||
193 | * @return javax.swing.JButton
|
||
194 | */
|
||
195 | 6117 | jaume | private JButton getJButton() { |
196 | if (jButton == null) { |
||
197 | jButton = new JButton(); |
||
198 | jButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
||
199 | jButton.setText(PluginServices.getText(this,"Cerrar")); |
||
200 | jButton.setBounds(266, 12, 94, 25); |
||
201 | 9637 | jaume | jButton.addActionListener(new java.awt.event.ActionListener() {
|
202 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
203 | 6117 | jaume | System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed() |
204 | if (PluginServices.getMainFrame() != null) |
||
205 | { |
||
206 | 6880 | cesar | PluginServices.getMDIManager().closeWindow(FPanelAbout.this); |
207 | 6117 | jaume | } |
208 | 9637 | jaume | else
|
209 | 6117 | jaume | { |
210 | ((JDialog) (getParent().getParent().getParent().getParent())).dispose();
|
||
211 | } |
||
212 | 9637 | jaume | |
213 | 6117 | jaume | } |
214 | }); |
||
215 | } |
||
216 | return jButton;
|
||
217 | } |
||
218 | /* (non-Javadoc)
|
||
219 | * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
||
220 | */
|
||
221 | 6880 | cesar | public WindowInfo getWindowInfo() {
|
222 | WindowInfo m_ViewInfo = new WindowInfo(WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE);
|
||
223 | 6117 | jaume | m_ViewInfo.setTitle(PluginServices.getText(this,"acerca_de")); |
224 | |||
225 | return m_ViewInfo;
|
||
226 | } |
||
227 | /* (non-Javadoc)
|
||
228 | * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
||
229 | */
|
||
230 | public void viewActivated() { |
||
231 | // TODO Auto-generated method stub
|
||
232 | 9637 | jaume | |
233 | 6117 | jaume | } |
234 | public void addAboutUrl(String pluginName, URL url) |
||
235 | { |
||
236 | getJTabbedPane().addTab(pluginName, getJScrollPane(url)); |
||
237 | 9637 | jaume | // this.add(getJScrollPane(url), java.awt.BorderLayout.CENTER);
|
238 | 6117 | jaume | } |
239 | /**
|
||
240 | 9637 | jaume | * This method initializes jTabbedPane
|
241 | *
|
||
242 | * @return javax.swing.JTabbedPane
|
||
243 | */
|
||
244 | 6117 | jaume | private JTabbedPane getJTabbedPane() { |
245 | if (jTabbedPane == null) { |
||
246 | jTabbedPane = new JTabbedPane(); |
||
247 | jTabbedPane.setPreferredSize(new java.awt.Dimension(5,50)); |
||
248 | } |
||
249 | return jTabbedPane;
|
||
250 | } |
||
251 | 26449 | jmvivo | public Object getWindowProfile() { |
252 | return WindowInfo.DIALOG_PROFILE;
|
||
253 | } |
||
254 | 6117 | jaume | } // @jve:decl-index=0:visual-constraint="10,10" |