svn-gvsig-desktop / tags / v1_1_Build_1005 / extensions / extWMS / src / com / iver / cit / gvsig / gui / panels / WebMapContextSettingsPanel.java @ 12355
History | View | Annotate | Download (39.2 KB)
1 | 4876 | jaume | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
||
4 | *
|
||
5 | * This program is free software; you can redistribute it and/or
|
||
6 | * modify it under the terms of the GNU General Public License
|
||
7 | * as published by the Free Software Foundation; either version 2
|
||
8 | * of the License, or (at your option) any later version.
|
||
9 | *
|
||
10 | * This program is distributed in the hope that it will be useful,
|
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | * GNU General Public License for more details.
|
||
14 | *
|
||
15 | * You should have received a copy of the GNU General Public License
|
||
16 | * along with this program; if not, write to the Free Software
|
||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
18 | *
|
||
19 | * For more information, contact:
|
||
20 | *
|
||
21 | * Generalitat Valenciana
|
||
22 | * Conselleria d'Infraestructures i Transport
|
||
23 | * Av. Blasco Ib??ez, 50
|
||
24 | * 46010 VALENCIA
|
||
25 | * SPAIN
|
||
26 | *
|
||
27 | * +34 963862235
|
||
28 | * gvsig@gva.es
|
||
29 | * www.gvsig.gva.es
|
||
30 | *
|
||
31 | * or
|
||
32 | *
|
||
33 | * IVER T.I. S.A
|
||
34 | * Salamanca 50
|
||
35 | * 46005 Valencia
|
||
36 | * Spain
|
||
37 | *
|
||
38 | * +34 963163400
|
||
39 | * dac@iver.es
|
||
40 | */
|
||
41 | |||
42 | /* CVS MESSAGES:
|
||
43 | *
|
||
44 | * $Id$
|
||
45 | * $Log$
|
||
46 | 8765 | jjdelcerro | * Revision 1.15.2.2 2006-11-15 00:08:21 jjdelcerro
|
47 | 6913 | jaume | * *** empty log message ***
|
48 | *
|
||
49 | 8765 | jjdelcerro | * Revision 1.18 2006/09/20 10:09:37 jaume
|
50 | * *** empty log message ***
|
||
51 | *
|
||
52 | * Revision 1.17 2006/09/20 07:45:21 caballero
|
||
53 | * constante registerName
|
||
54 | *
|
||
55 | * Revision 1.16 2006/09/15 10:44:24 caballero
|
||
56 | * extensibilidad de documentos
|
||
57 | *
|
||
58 | 7386 | jaume | * Revision 1.15 2006/08/30 10:20:51 jaume
|
59 | * *** empty log message ***
|
||
60 | *
|
||
61 | 6913 | jaume | * Revision 1.14 2006/08/29 07:56:15 cesar
|
62 | 6880 | cesar | * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
|
63 | *
|
||
64 | * Revision 1.13 2006/08/29 07:21:03 cesar
|
||
65 | 6878 | cesar | * Rename com.iver.cit.gvsig.fmap.Fmap class to com.iver.cit.gvsig.fmap.MapContext
|
66 | *
|
||
67 | * Revision 1.12 2006/08/23 09:42:32 jaume
|
||
68 | 6818 | jaume | * *** empty log message ***
|
69 | *
|
||
70 | 6819 | jaume | * Revision 1.11 2006/08/23 09:40:03 jaume
|
71 | * *** empty log message ***
|
||
72 | *
|
||
73 | 6818 | jaume | * Revision 1.10 2006/07/21 11:51:13 jaume
|
74 | 6500 | jaume | * improved appearance in wms panel and a wmc bug fixed
|
75 | *
|
||
76 | * Revision 1.9 2006/06/30 08:02:57 jaume
|
||
77 | 6115 | jaume | * added a normative-sized button
|
78 | *
|
||
79 | * Revision 1.8 2006/05/25 10:28:12 jaume
|
||
80 | 5420 | jaume | * *** empty log message ***
|
81 | *
|
||
82 | 5430 | jaume | * Revision 1.7 2006/05/25 07:42:55 jaume
|
83 | * *** empty log message ***
|
||
84 | *
|
||
85 | 5420 | jaume | * Revision 1.6 2006/05/12 07:47:39 jaume
|
86 | 5158 | jaume | * removed unnecessary imports
|
87 | *
|
||
88 | * Revision 1.5 2006/05/03 07:51:21 jaume
|
||
89 | 4940 | jaume | * *** empty log message ***
|
90 | *
|
||
91 | 5023 | jaume | * Revision 1.4 2006/04/25 11:40:55 jaume
|
92 | * *** empty log message ***
|
||
93 | *
|
||
94 | 4940 | jaume | * Revision 1.3 2006/04/21 10:27:32 jaume
|
95 | 4915 | jaume | * exporting now supported
|
96 | *
|
||
97 | * Revision 1.2 2006/04/20 17:11:54 jaume
|
||
98 | 4913 | jaume | * Attempting to export
|
99 | *
|
||
100 | * Revision 1.1 2006/04/19 07:57:29 jaume
|
||
101 | 4876 | jaume | * *** empty log message ***
|
102 | *
|
||
103 | * Revision 1.1 2006/04/07 12:10:37 jaume
|
||
104 | * *** empty log message ***
|
||
105 | *
|
||
106 | *
|
||
107 | */
|
||
108 | package com.iver.cit.gvsig.gui.panels; |
||
109 | |||
110 | 4913 | jaume | import java.awt.Component; |
111 | import java.awt.Dimension; |
||
112 | import java.io.File; |
||
113 | import java.util.ArrayList; |
||
114 | import java.util.prefs.Preferences; |
||
115 | |||
116 | 4876 | jaume | import javax.swing.ButtonGroup; |
117 | 6115 | jaume | import org.gvsig.gui.beans.swing.JButton; |
118 | 4876 | jaume | import javax.swing.JComboBox; |
119 | 4913 | jaume | import javax.swing.JFileChooser; |
120 | 4876 | jaume | import javax.swing.JLabel; |
121 | 4913 | jaume | import javax.swing.JOptionPane; |
122 | 4876 | jaume | import javax.swing.JPanel; |
123 | import javax.swing.JRadioButton; |
||
124 | import javax.swing.JScrollPane; |
||
125 | import javax.swing.JTextArea; |
||
126 | import javax.swing.JTextField; |
||
127 | import javax.swing.SwingConstants; |
||
128 | 4913 | jaume | import javax.swing.filechooser.FileFilter; |
129 | 4876 | jaume | |
130 | import com.iver.andami.PluginServices; |
||
131 | 5158 | jaume | import com.iver.andami.messages.NotificationManager; |
132 | 6880 | cesar | import com.iver.andami.ui.mdiManager.SingletonWindow; |
133 | import com.iver.andami.ui.mdiManager.WindowInfo; |
||
134 | 5158 | jaume | import com.iver.cit.gvsig.fmap.DriverException; |
135 | 6878 | cesar | import com.iver.cit.gvsig.fmap.MapContext; |
136 | 8765 | jjdelcerro | import com.iver.cit.gvsig.project.Project; |
137 | import com.iver.cit.gvsig.project.documents.view.ProjectView; |
||
138 | import com.iver.cit.gvsig.project.documents.view.ProjectViewFactory; |
||
139 | 5023 | jaume | import com.iver.cit.gvsig.wmc.ExportWebMapContextExtension; |
140 | import com.iver.cit.gvsig.wmc.WebMapContext; |
||
141 | import com.iver.cit.gvsig.wmc.WebMapContextTags; |
||
142 | 6818 | jaume | import java.awt.FlowLayout; |
143 | 5158 | jaume | /**
|
144 | * A graphical form to fill up the customizable information of a destinantion
|
||
145 | * Web Map Context file.
|
||
146 | 6115 | jaume | *
|
147 | 5158 | jaume | * @author jaume dominguez faus - jaume.dominguez@iver.es
|
148 | *
|
||
149 | */
|
||
150 | 6880 | cesar | public class WebMapContextSettingsPanel extends JPanel implements SingletonWindow { |
151 | 4913 | jaume | public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.mapcontext-settingspanel" ); |
152 | 4876 | jaume | private JPanel simplePanel = null; |
153 | private JPanel advancedPanel = null; |
||
154 | private JPanel buttonsPanel = null; |
||
155 | private JComboBox cmbVersion = null; |
||
156 | private JLabel lblTitle = null; |
||
157 | private JButton btnBrowseFileSystem = null; |
||
158 | private JTextField txtTitle = null; |
||
159 | private JLabel lblVersion = null; |
||
160 | private JLabel lblId = null; |
||
161 | private JTextField txtId = null; |
||
162 | private JLabel lblFile = null; |
||
163 | private JTextField txtFile = null; |
||
164 | private JButton btnAdvanced = null; |
||
165 | private JButton btnOk = null; |
||
166 | private JButton btnCancel = null; |
||
167 | private JLabel lblAbstract = null; |
||
168 | private JLabel lblLogoURL = null; |
||
169 | private JLabel lblDescriptionURL = null; |
||
170 | private JTextArea txtAbstract = null; |
||
171 | private JScrollPane scrlAbstract = null; |
||
172 | private JTextField txtLogoURL = null; |
||
173 | private JTextField txtDescriptionURL = null; |
||
174 | private JPanel pnlMapSize = null; |
||
175 | private JRadioButton rdBtnUseViewSize = null; |
||
176 | private JRadioButton rdBtnCustomSize = null; |
||
177 | private JLabel lblWidth = null; |
||
178 | private JLabel lblHeight = null; |
||
179 | private JTextField txtWidth = null; |
||
180 | private JTextField txtHeight = null; |
||
181 | private JPanel pnlContactInfo = null; |
||
182 | private JTextField txtKeyWords = null; |
||
183 | private JLabel lblKeyWords = null; |
||
184 | private JLabel lblContactPerson = null; |
||
185 | private JTextField txtContactPerson = null; |
||
186 | private JLabel lblContactOrganization = null; |
||
187 | private JTextField txtOrganization = null; |
||
188 | private JLabel lblContactPosition = null; |
||
189 | private JTextField txtContactPosition = null; |
||
190 | private JLabel lblAddress = null; |
||
191 | private JTextField txtAddress = null; |
||
192 | private JLabel lblCity = null; |
||
193 | private JTextField txtCity = null; |
||
194 | private JLabel lblStateProvince = null; |
||
195 | private JTextField txtStateOrProvince = null; |
||
196 | private JLabel lblPostCode = null; |
||
197 | private JTextField txtPostCode = null; |
||
198 | private JLabel lblCountry = null; |
||
199 | private JComboBox cmbCountries = null; |
||
200 | private JLabel lblPhone = null; |
||
201 | private JTextField txtTelephone = null; |
||
202 | private JLabel lblFax = null; |
||
203 | private JTextField txtFax = null; |
||
204 | private JLabel lblEMail = null; |
||
205 | private JTextField txtEMail = null; |
||
206 | 4913 | jaume | private boolean first = true; |
207 | private boolean advanced = fPrefs.getBoolean("advanced-panel", false); |
||
208 | 6880 | cesar | private WindowInfo m_viewInfo;
|
209 | 4913 | jaume | private String strAdvanced = PluginServices.getText(this, "advanced"); |
210 | private File targetFile; |
||
211 | private WebMapContext wmc;
|
||
212 | private ProjectView[] exportableViews; |
||
213 | private JLabel lblView = null; |
||
214 | private JComboBox cmbViews = null; |
||
215 | private String lastWidth, lastHeight; |
||
216 | private int defaultWidth = 500; |
||
217 | private int defaultHeight = 450; |
||
218 | 5158 | jaume | private JLabel lblExtent = null; |
219 | private JRadioButton rdBtnCurrentViewExtent = null; |
||
220 | private JRadioButton rdBtnFullExtent = null; |
||
221 | 8765 | jjdelcerro | private static String lastPath = null; |
222 | |||
223 | 5420 | jaume | protected boolean useFullExtent = fPrefs.getBoolean("use_full_extent", false); |
224 | 6115 | jaume | |
225 | 4913 | jaume | public WebMapContextSettingsPanel(ProjectView[] views) { |
226 | 4876 | jaume | super();
|
227 | 4913 | jaume | exportableViews = views; |
228 | 4876 | jaume | initialize(); |
229 | } |
||
230 | |||
231 | /**
|
||
232 | * This method initializes this
|
||
233 | 6115 | jaume | *
|
234 | 4876 | jaume | * @return void
|
235 | */
|
||
236 | private void initialize() { |
||
237 | this.setLayout(null); |
||
238 | 6115 | jaume | |
239 | 4913 | jaume | switchPanels(); |
240 | 4876 | jaume | } |
241 | 6115 | jaume | |
242 | 4913 | jaume | private void switchPanels() { |
243 | 4876 | jaume | this.removeAll();
|
244 | 4913 | jaume | Dimension sz;
|
245 | 4876 | jaume | this.add(getSimplePanel(), java.awt.BorderLayout.NORTH);
|
246 | 4913 | jaume | if (advanced) {
|
247 | 4876 | jaume | this.add(getAdvancedPanel(), java.awt.BorderLayout.CENTER);
|
248 | 5158 | jaume | sz = new Dimension(535, 640); |
249 | 4913 | jaume | btnAdvanced.setText(strAdvanced+" <<");
|
250 | 6115 | jaume | |
251 | 4913 | jaume | } else {
|
252 | 5158 | jaume | sz = new Dimension(535, 260); |
253 | 4913 | jaume | btnAdvanced.setText(strAdvanced+" >>");
|
254 | 6115 | jaume | |
255 | 4913 | jaume | } |
256 | 6115 | jaume | |
257 | 4913 | jaume | this.setSize(sz);
|
258 | 6115 | jaume | |
259 | |||
260 | 4876 | jaume | this.add(getButtonsPanel(), java.awt.BorderLayout.SOUTH);
|
261 | 4913 | jaume | fPrefs.putBoolean("advanced-panel", advanced);
|
262 | if (!first) {
|
||
263 | 6880 | cesar | PluginServices.getMDIManager().changeWindowInfo(this, getWindowInfo());
|
264 | 6115 | jaume | |
265 | 6880 | cesar | PluginServices.getMDIManager().closeWindow(this);
|
266 | PluginServices.getMDIManager().addWindow(this);
|
||
267 | 4913 | jaume | } |
268 | first = false;
|
||
269 | 4876 | jaume | } |
270 | |||
271 | 6880 | cesar | public WindowInfo getWindowInfo() {
|
272 | 6115 | jaume | |
273 | 6880 | cesar | m_viewInfo = new WindowInfo(WindowInfo.ICONIFIABLE);
|
274 | 5420 | jaume | m_viewInfo.setTitle(PluginServices.getText(this, "web_map_context_settings")); |
275 | 4876 | jaume | m_viewInfo.setWidth(this.getWidth()+8); |
276 | 6818 | jaume | m_viewInfo.setHeight(getHeight()); |
277 | 4876 | jaume | return m_viewInfo;
|
278 | } |
||
279 | |||
280 | /**
|
||
281 | 6115 | jaume | * This method initializes simplePanel
|
282 | *
|
||
283 | * @return javax.swing.JPanel
|
||
284 | */
|
||
285 | 4876 | jaume | private JPanel getSimplePanel() { |
286 | if (simplePanel == null) { |
||
287 | 5158 | jaume | ButtonGroup group = new ButtonGroup(); |
288 | lblExtent = new JLabel(); |
||
289 | lblExtent.setBounds(9, 146, 79, 20); |
||
290 | lblExtent.setHorizontalTextPosition(SwingConstants.RIGHT);
|
||
291 | lblExtent.setHorizontalAlignment(SwingConstants.RIGHT);
|
||
292 | lblExtent.setText(PluginServices.getText(this, "map_extent")+":"); |
||
293 | 4913 | jaume | lblView = new JLabel(); |
294 | lblView.setBounds(9, 24, 79, 20); |
||
295 | lblView.setHorizontalTextPosition(SwingConstants.RIGHT);
|
||
296 | lblView.setHorizontalAlignment(SwingConstants.RIGHT);
|
||
297 | 8765 | jjdelcerro | lblView.setText(PluginServices.getText(this, ProjectViewFactory.registerName)+":"); |
298 | 4876 | jaume | lblTitle = new JLabel(); |
299 | lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
300 | 4913 | jaume | lblTitle.setBounds(9, 48, 79, 20); |
301 | 4876 | jaume | lblTitle.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
302 | lblTitle.setText(PluginServices.getText(this, "title")+":"); |
||
303 | lblId = new JLabel(); |
||
304 | 4913 | jaume | lblId.setBounds(9, 72, 79, 20); |
305 | 4876 | jaume | lblId.setHorizontalTextPosition(SwingConstants.RIGHT);
|
306 | lblId.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
307 | lblId.setText(PluginServices.getText(this, "id")+":"); |
||
308 | lblVersion = new JLabel(); |
||
309 | 4913 | jaume | lblVersion.setBounds(9, 120, 79, 20); |
310 | 4876 | jaume | lblVersion.setHorizontalTextPosition(SwingConstants.RIGHT);
|
311 | lblVersion.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
312 | 5158 | jaume | lblVersion.setText(PluginServices.getText(this, "version")+":"); |
313 | 4876 | jaume | lblFile = new JLabel(); |
314 | 4913 | jaume | lblFile.setBounds(9, 96, 79, 20); |
315 | 4876 | jaume | lblFile.setHorizontalTextPosition(SwingConstants.RIGHT);
|
316 | lblFile.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
317 | 5158 | jaume | lblFile.setText(PluginServices.getText(this, "file_name")+":"); |
318 | 4876 | jaume | simplePanel = new JPanel(); |
319 | simplePanel.setLayout(null);
|
||
320 | simplePanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
||
321 | 4913 | jaume | null, PluginServices.getText(this, "options"), |
322 | 6115 | jaume | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
323 | 4876 | jaume | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
324 | 5158 | jaume | simplePanel.setBounds(new java.awt.Rectangle(0,0,535,196)); |
325 | 4913 | jaume | simplePanel.add(lblView, null);
|
326 | simplePanel.add(getCmbViews(), null);
|
||
327 | 4876 | jaume | simplePanel.add(getTxtTitle(), null);
|
328 | simplePanel.add(lblTitle, null);
|
||
329 | simplePanel.add(getBtnBrowseFileSystem(), null);
|
||
330 | simplePanel.add(lblVersion, null);
|
||
331 | simplePanel.add(lblId, null);
|
||
332 | simplePanel.add(getTxtId(), null);
|
||
333 | simplePanel.add(lblFile, null);
|
||
334 | simplePanel.add(getTxtFile(), null);
|
||
335 | simplePanel.add(getBtnAdvanced(), null);
|
||
336 | simplePanel.add(getCmbVersion(), null);
|
||
337 | 5158 | jaume | simplePanel.add(lblExtent, null);
|
338 | simplePanel.add(getRdBtnCurrentViewExtent(), null);
|
||
339 | simplePanel.add(getRdBtnFullExtent(), null);
|
||
340 | group.add(getRdBtnCurrentViewExtent()); |
||
341 | group.add(getRdBtnFullExtent()); |
||
342 | 4876 | jaume | } |
343 | return simplePanel;
|
||
344 | } |
||
345 | |||
346 | /**
|
||
347 | 6115 | jaume | * This method initializes advancedPanel
|
348 | *
|
||
349 | * @return javax.swing.JPanel
|
||
350 | */
|
||
351 | 4876 | jaume | private JPanel getAdvancedPanel() { |
352 | if (advancedPanel == null) { |
||
353 | lblKeyWords = new JLabel(); |
||
354 | 4913 | jaume | lblKeyWords.setBounds(10, 79, 99, 20); |
355 | 4876 | jaume | lblKeyWords.setHorizontalTextPosition(SwingConstants.RIGHT);
|
356 | lblKeyWords.setHorizontalAlignment(SwingConstants.RIGHT);
|
||
357 | lblKeyWords.setText(PluginServices.getText(this, "keywords")+":"); |
||
358 | lblDescriptionURL = new JLabel(); |
||
359 | 4913 | jaume | lblDescriptionURL.setBounds(10, 104, 99, 20); |
360 | 4876 | jaume | lblDescriptionURL.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
361 | lblDescriptionURL.setText(PluginServices.getText(this, "description_URL")+":"); |
||
362 | lblDescriptionURL.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
363 | lblLogoURL = new JLabel(); |
||
364 | 4913 | jaume | lblLogoURL.setBounds(10, 130, 99, 20); |
365 | 4876 | jaume | lblLogoURL.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
366 | lblLogoURL.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
367 | lblLogoURL.setText(PluginServices.getText(this, "logo_URL")+":"); |
||
368 | lblAbstract = new JLabel(); |
||
369 | lblAbstract.setText(PluginServices.getText(this, "abstract")+":"); |
||
370 | lblAbstract.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
||
371 | lblAbstract.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
372 | 4913 | jaume | lblAbstract.setBounds(10, 27, 99, 20); |
373 | 4876 | jaume | advancedPanel = new JPanel(); |
374 | advancedPanel.setLayout(null);
|
||
375 | 5158 | jaume | advancedPanel.setBounds(0, 194, 535, 386); |
376 | 4876 | jaume | advancedPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
377 | null, PluginServices.getText(this, "advanced_settings"), |
||
378 | 6115 | jaume | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
379 | 4876 | jaume | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
380 | advancedPanel.add(lblAbstract, null);
|
||
381 | advancedPanel.add(lblKeyWords, null);
|
||
382 | advancedPanel.add(lblLogoURL, null);
|
||
383 | advancedPanel.add(lblDescriptionURL, null);
|
||
384 | advancedPanel.add(getScrlAbstract(), null);
|
||
385 | advancedPanel.add(getTxtLogoURL(), null);
|
||
386 | advancedPanel.add(getTxtDescriptionURL(), null);
|
||
387 | advancedPanel.add(getPnlMapSize(), null);
|
||
388 | advancedPanel.add(getPnlContactInfo(), null);
|
||
389 | advancedPanel.add(getTxtKeyWords(), null);
|
||
390 | } |
||
391 | return advancedPanel;
|
||
392 | } |
||
393 | |||
394 | /**
|
||
395 | 6115 | jaume | * This method initializes buttonsPanel
|
396 | *
|
||
397 | * @return javax.swing.JPanel
|
||
398 | */
|
||
399 | 4876 | jaume | private JPanel getButtonsPanel() { |
400 | if (buttonsPanel == null) { |
||
401 | 6818 | jaume | FlowLayout flowLayout = new FlowLayout(); |
402 | flowLayout.setAlignment(java.awt.FlowLayout.RIGHT); |
||
403 | 6913 | jaume | flowLayout.setVgap(1);
|
404 | 4876 | jaume | buttonsPanel = new JPanel(); |
405 | 6818 | jaume | buttonsPanel.setLayout(flowLayout); |
406 | 4876 | jaume | buttonsPanel.add(getBtnOk(), null);
|
407 | buttonsPanel.add(getBtnCancel(), null);
|
||
408 | } |
||
409 | 6818 | jaume | buttonsPanel.setBounds(0, this.getHeight()-60, 535, 38); |
410 | 6115 | jaume | |
411 | 4876 | jaume | return buttonsPanel;
|
412 | } |
||
413 | |||
414 | /**
|
||
415 | 6115 | jaume | * This method initializes cmbVersion
|
416 | *
|
||
417 | * @return javax.swing.JComboBox
|
||
418 | */
|
||
419 | 4876 | jaume | private JComboBox getCmbVersion() { |
420 | if (cmbVersion == null) { |
||
421 | cmbVersion = new JComboBox(); |
||
422 | 4913 | jaume | cmbVersion.setSize(89, 20); |
423 | cmbVersion.setLocation(91, 120); |
||
424 | for (int i = 0; i < WebMapContext.exportVersions.size(); i++) { |
||
425 | cmbVersion.addItem(WebMapContext.exportVersions.get(i)); |
||
426 | } |
||
427 | 6115 | jaume | |
428 | 4876 | jaume | } |
429 | return cmbVersion;
|
||
430 | } |
||
431 | |||
432 | |||
433 | |||
434 | /**
|
||
435 | 6115 | jaume | * This method initializes btnBrowseFileSystem
|
436 | *
|
||
437 | * @return javax.swing.JButton
|
||
438 | */
|
||
439 | 4876 | jaume | private JButton getBtnBrowseFileSystem() { |
440 | if (btnBrowseFileSystem == null) { |
||
441 | btnBrowseFileSystem = new JButton(); |
||
442 | 4913 | jaume | btnBrowseFileSystem.setBounds(403, 95, 120, 22); |
443 | 6115 | jaume | btnBrowseFileSystem.addActionListener(new java.awt.event.ActionListener() {
|
444 | 7386 | jaume | |
445 | 6115 | jaume | public void actionPerformed(java.awt.event.ActionEvent e) { |
446 | 7386 | jaume | JFileChooser fc = new JFileChooser(lastPath); |
447 | 4913 | jaume | fc.setFileFilter(new FileFilter() { |
448 | public boolean accept(File f) { |
||
449 | return f.isDirectory() || f.getAbsolutePath().toLowerCase().endsWith(WebMapContext.FILE_EXTENSION);
|
||
450 | } |
||
451 | |||
452 | public String getDescription() { |
||
453 | return PluginServices.getText(this, "ogc_mapcontext_file")+" (*.cml)"; |
||
454 | } |
||
455 | }); |
||
456 | if (fc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION){ |
||
457 | 6115 | jaume | |
458 | 4940 | jaume | String fileName = fc.getSelectedFile().getAbsolutePath();
|
459 | 4913 | jaume | if (!fileName.toLowerCase().endsWith(WebMapContext.FILE_EXTENSION))
|
460 | fileName += WebMapContext.FILE_EXTENSION; |
||
461 | 4940 | jaume | targetFile = new File(fileName); |
462 | 4913 | jaume | getTxtFile().setText(fileName); |
463 | 7386 | jaume | lastPath = fileName.substring(0, fileName.lastIndexOf(File.separatorChar)); |
464 | 4913 | jaume | } |
465 | 8765 | jjdelcerro | |
466 | 4913 | jaume | fc = null;
|
467 | } |
||
468 | }); |
||
469 | 4876 | jaume | btnBrowseFileSystem.setText(PluginServices.getText(this, "browse")); |
470 | } |
||
471 | return btnBrowseFileSystem;
|
||
472 | } |
||
473 | |||
474 | /**
|
||
475 | 6115 | jaume | * This method initializes txtTitle
|
476 | *
|
||
477 | * @return javax.swing.JTextField
|
||
478 | */
|
||
479 | 4876 | jaume | private JTextField getTxtTitle() { |
480 | if (txtTitle == null) { |
||
481 | txtTitle = new JTextField(); |
||
482 | 4913 | jaume | txtTitle.setBounds(91, 48, 432, 20); |
483 | txtTitle.setName(PluginServices.getText(this, "title")); |
||
484 | 4876 | jaume | } |
485 | return txtTitle;
|
||
486 | } |
||
487 | |||
488 | /**
|
||
489 | 6115 | jaume | * This method initializes jTextField
|
490 | *
|
||
491 | * @return javax.swing.JTextField
|
||
492 | */
|
||
493 | 4876 | jaume | private JTextField getTxtId() { |
494 | if (txtId == null) { |
||
495 | txtId = new JTextField(); |
||
496 | 4913 | jaume | txtId.setBounds(91, 72, 432, 20); |
497 | txtId.setName(PluginServices.getText(this, "id")); |
||
498 | 4876 | jaume | } |
499 | return txtId;
|
||
500 | } |
||
501 | |||
502 | /**
|
||
503 | 6115 | jaume | * This method initializes txtFile
|
504 | *
|
||
505 | * @return javax.swing.JTextField
|
||
506 | */
|
||
507 | 4876 | jaume | private JTextField getTxtFile() { |
508 | if (txtFile == null) { |
||
509 | txtFile = new JTextField(); |
||
510 | 4913 | jaume | txtFile.setBounds(91, 96, 308, 20); |
511 | 4876 | jaume | } |
512 | return txtFile;
|
||
513 | } |
||
514 | |||
515 | /**
|
||
516 | 6115 | jaume | * This method initializes btnAdvanced
|
517 | *
|
||
518 | * @return javax.swing.JButton
|
||
519 | */
|
||
520 | 4876 | jaume | private JButton getBtnAdvanced() { |
521 | if (btnAdvanced == null) { |
||
522 | btnAdvanced = new JButton(); |
||
523 | 6115 | jaume | // btnAdvanced.setBounds(403, 160, 120, 25);
|
524 | btnAdvanced.setLocation(403, 160); |
||
525 | btnAdvanced.addActionListener(new java.awt.event.ActionListener() {
|
||
526 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
527 | 4913 | jaume | advanced = !advanced; |
528 | switchPanels(); |
||
529 | } |
||
530 | }); |
||
531 | 4876 | jaume | } |
532 | return btnAdvanced;
|
||
533 | } |
||
534 | |||
535 | /**
|
||
536 | 6115 | jaume | * This method initializes btnAceptar
|
537 | *
|
||
538 | * @return javax.swing.JButton
|
||
539 | */
|
||
540 | 4876 | jaume | private JButton getBtnOk() { |
541 | if (btnOk == null) { |
||
542 | btnOk = new JButton(); |
||
543 | btnOk.setText(PluginServices.getText(this, "Ok")); |
||
544 | 6115 | jaume | btnOk.addActionListener(new java.awt.event.ActionListener() {
|
545 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
546 | 4913 | jaume | execute("OK");
|
547 | } |
||
548 | }); |
||
549 | 4876 | jaume | } |
550 | return btnOk;
|
||
551 | } |
||
552 | |||
553 | /**
|
||
554 | 6115 | jaume | * This method initializes btnCancel
|
555 | *
|
||
556 | * @return javax.swing.JButton
|
||
557 | */
|
||
558 | 4876 | jaume | private JButton getBtnCancel() { |
559 | if (btnCancel == null) { |
||
560 | btnCancel = new JButton(); |
||
561 | btnCancel.setText(PluginServices.getText(this, "cancel")); |
||
562 | 6115 | jaume | btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
563 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
564 | 4913 | jaume | execute("CANCEL");
|
565 | } |
||
566 | }); |
||
567 | 4876 | jaume | } |
568 | return btnCancel;
|
||
569 | } |
||
570 | |||
571 | /**
|
||
572 | 6115 | jaume | * This method initializes txtAbstract
|
573 | *
|
||
574 | * @return javax.swing.JTextArea
|
||
575 | */
|
||
576 | 4876 | jaume | private JTextArea getTxtAbstract() { |
577 | if (txtAbstract == null) { |
||
578 | txtAbstract = new JTextArea(); |
||
579 | } |
||
580 | return txtAbstract;
|
||
581 | } |
||
582 | |||
583 | /**
|
||
584 | 6115 | jaume | * This method initializes scrlAbstract
|
585 | *
|
||
586 | * @return javax.swing.JScrollPane
|
||
587 | */
|
||
588 | 4876 | jaume | private JScrollPane getScrlAbstract() { |
589 | if (scrlAbstract == null) { |
||
590 | scrlAbstract = new JScrollPane(); |
||
591 | 4913 | jaume | scrlAbstract.setBounds(115, 27, 232, 48); |
592 | 4876 | jaume | scrlAbstract.setViewportView(getTxtAbstract()); |
593 | } |
||
594 | return scrlAbstract;
|
||
595 | } |
||
596 | |||
597 | /**
|
||
598 | 6115 | jaume | * This method initializes txtLogoURL
|
599 | *
|
||
600 | * @return javax.swing.JTextField
|
||
601 | */
|
||
602 | 4876 | jaume | private JTextField getTxtLogoURL() { |
603 | if (txtLogoURL == null) { |
||
604 | txtLogoURL = new JTextField(); |
||
605 | 4913 | jaume | txtLogoURL.setBounds(115, 130, 407, 20); |
606 | 4876 | jaume | } |
607 | return txtLogoURL;
|
||
608 | } |
||
609 | |||
610 | /**
|
||
611 | 6115 | jaume | * This method initializes jTextField
|
612 | *
|
||
613 | * @return javax.swing.JTextField
|
||
614 | */
|
||
615 | 4876 | jaume | private JTextField getTxtDescriptionURL() { |
616 | if (txtDescriptionURL == null) { |
||
617 | txtDescriptionURL = new JTextField(); |
||
618 | 4913 | jaume | txtDescriptionURL.setBounds(115, 104, 232, 20); |
619 | 4876 | jaume | } |
620 | return txtDescriptionURL;
|
||
621 | } |
||
622 | |||
623 | /**
|
||
624 | 6115 | jaume | * This method initializes pnlMapSize
|
625 | *
|
||
626 | * @return javax.swing.JPanel
|
||
627 | */
|
||
628 | 4876 | jaume | private JPanel getPnlMapSize() { |
629 | if (pnlMapSize == null) { |
||
630 | ButtonGroup group = new ButtonGroup(); |
||
631 | lblHeight = new JLabel(); |
||
632 | lblHeight.setText(PluginServices.getText(this, "height")); |
||
633 | lblHeight.setBounds(11, 79, 52, 20); |
||
634 | lblHeight.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
||
635 | 4913 | jaume | lblHeight.setEnabled(false);
|
636 | 4876 | jaume | lblHeight.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
637 | lblWidth = new JLabel(); |
||
638 | lblWidth.setText(PluginServices.getText(this, "width")); |
||
639 | lblWidth.setBounds(11, 56, 52, 20); |
||
640 | lblWidth.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
641 | 4913 | jaume | lblWidth.setEnabled(false);
|
642 | 4876 | jaume | lblWidth.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
643 | pnlMapSize = new JPanel(); |
||
644 | pnlMapSize.setLayout(null);
|
||
645 | 4913 | jaume | pnlMapSize.setBounds(351, 19, 179, 108); |
646 | 4876 | jaume | pnlMapSize.setBorder(javax.swing.BorderFactory.createTitledBorder( |
647 | null, PluginServices.getText(this, "map_size_in_pixels"), |
||
648 | 6115 | jaume | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
649 | 4876 | jaume | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
650 | pnlMapSize.add(getRdBtnUseViewSize(), null);
|
||
651 | pnlMapSize.add(getRdBtnCustomSize(), null);
|
||
652 | pnlMapSize.add(lblWidth, null);
|
||
653 | pnlMapSize.add(lblHeight, null);
|
||
654 | pnlMapSize.add(getTxtWidth(), null);
|
||
655 | pnlMapSize.add(getTxtHeight(), null);
|
||
656 | 4913 | jaume | group.add(getRdBtnUseViewSize()); |
657 | group.add(getRdBtnCustomSize()); |
||
658 | 6115 | jaume | |
659 | 4876 | jaume | } |
660 | return pnlMapSize;
|
||
661 | } |
||
662 | |||
663 | /**
|
||
664 | 6115 | jaume | * This method initializes rdBtnUseViewSize
|
665 | *
|
||
666 | * @return javax.swing.JRadioButton
|
||
667 | */
|
||
668 | 4876 | jaume | private JRadioButton getRdBtnUseViewSize() { |
669 | if (rdBtnUseViewSize == null) { |
||
670 | rdBtnUseViewSize = new JRadioButton(); |
||
671 | rdBtnUseViewSize.setBounds(8, 16, 142, 20); |
||
672 | rdBtnUseViewSize.setText(PluginServices.getText(this, "use_view_size")); |
||
673 | 6115 | jaume | rdBtnUseViewSize.addItemListener(new java.awt.event.ItemListener() {
|
674 | public void itemStateChanged(java.awt.event.ItemEvent e) { |
||
675 | 4913 | jaume | boolean b = !getRdBtnUseViewSize().isSelected();
|
676 | 6115 | jaume | |
677 | 4913 | jaume | getTxtWidth().setEnabled(b); |
678 | getTxtHeight().setEnabled(b); |
||
679 | } |
||
680 | }); |
||
681 | 4876 | jaume | rdBtnUseViewSize.setSelected(true);
|
682 | } |
||
683 | return rdBtnUseViewSize;
|
||
684 | } |
||
685 | |||
686 | /**
|
||
687 | 6115 | jaume | * This method initializes jRadioButton
|
688 | *
|
||
689 | * @return javax.swing.JRadioButton
|
||
690 | */
|
||
691 | 4876 | jaume | private JRadioButton getRdBtnCustomSize() { |
692 | if (rdBtnCustomSize == null) { |
||
693 | rdBtnCustomSize = new JRadioButton(); |
||
694 | rdBtnCustomSize.setBounds(8, 34, 142, 20); |
||
695 | rdBtnCustomSize.setText(PluginServices.getText(this, "use_custom_size")); |
||
696 | } |
||
697 | return rdBtnCustomSize;
|
||
698 | } |
||
699 | |||
700 | /**
|
||
701 | 6115 | jaume | * This method initializes txtWidth
|
702 | *
|
||
703 | * @return javax.swing.JTextField
|
||
704 | */
|
||
705 | 4876 | jaume | private JTextField getTxtWidth() { |
706 | if (txtWidth == null) { |
||
707 | txtWidth = new JTextField(); |
||
708 | 4913 | jaume | txtWidth.setBounds(66, 56, 105, 20); |
709 | txtWidth.setEnabled(false);
|
||
710 | 6115 | jaume | txtWidth.addKeyListener(new java.awt.event.KeyAdapter() {
|
711 | 4913 | jaume | public void keyTyped(java.awt.event.KeyEvent e) { |
712 | try {
|
||
713 | String text = getTxtWidth().getText();
|
||
714 | Integer.parseInt(text);
|
||
715 | lastWidth = text; |
||
716 | } catch (Exception ex) { |
||
717 | getTxtWidth().setText(lastWidth); |
||
718 | } |
||
719 | } |
||
720 | }); |
||
721 | Dimension sz = exportableViews[getCmbViews()
|
||
722 | .getSelectedIndex()] |
||
723 | .getMapContext() |
||
724 | .getViewPort() |
||
725 | .getImageSize(); |
||
726 | lastWidth = (sz != null)? (int) sz.getWidth()+"": defaultWidth+""; |
||
727 | 6115 | jaume | |
728 | 4913 | jaume | txtWidth.setText(lastWidth); |
729 | 4876 | jaume | } |
730 | return txtWidth;
|
||
731 | } |
||
732 | |||
733 | /**
|
||
734 | 6115 | jaume | * This method initializes jTextField
|
735 | *
|
||
736 | * @return javax.swing.JTextField
|
||
737 | */
|
||
738 | 4876 | jaume | private JTextField getTxtHeight() { |
739 | if (txtHeight == null) { |
||
740 | txtHeight = new JTextField(); |
||
741 | 4913 | jaume | txtHeight.setBounds(66, 79, 105, 20); |
742 | txtHeight.setEnabled(false);
|
||
743 | 6115 | jaume | txtHeight.addKeyListener(new java.awt.event.KeyAdapter() {
|
744 | 4913 | jaume | public void keyTyped(java.awt.event.KeyEvent e) { |
745 | try {
|
||
746 | String text = getTxtHeight().getText();
|
||
747 | Integer.parseInt(text);
|
||
748 | lastHeight = text; |
||
749 | } catch (Exception ex) { |
||
750 | getTxtHeight().setText(lastHeight); |
||
751 | } |
||
752 | } |
||
753 | }); |
||
754 | Dimension sz = exportableViews[getCmbViews()
|
||
755 | .getSelectedIndex()] |
||
756 | .getMapContext() |
||
757 | .getViewPort() |
||
758 | .getImageSize(); |
||
759 | lastHeight = (sz != null)? (int) sz.getHeight()+"": defaultHeight+""; |
||
760 | txtHeight.setText(lastHeight); |
||
761 | 4876 | jaume | } |
762 | return txtHeight;
|
||
763 | } |
||
764 | |||
765 | /**
|
||
766 | 6115 | jaume | * This method initializes pnlContactInfo
|
767 | *
|
||
768 | * @return javax.swing.JPanel
|
||
769 | */
|
||
770 | 4876 | jaume | private JPanel getPnlContactInfo() { |
771 | if (pnlContactInfo == null) { |
||
772 | lblEMail = new JLabel(); |
||
773 | 4913 | jaume | lblEMail.setBounds(7, 193, 98, 20); |
774 | 4876 | jaume | lblEMail.setHorizontalTextPosition(SwingConstants.RIGHT);
|
775 | lblEMail.setHorizontalAlignment(SwingConstants.RIGHT);
|
||
776 | lblEMail.setText(PluginServices.getText(this, "e-mail")+":"); |
||
777 | lblFax = new JLabel(); |
||
778 | 4913 | jaume | lblFax.setBounds(274, 168, 57, 20); |
779 | 4876 | jaume | lblFax.setHorizontalTextPosition(SwingConstants.RIGHT);
|
780 | lblFax.setHorizontalAlignment(SwingConstants.RIGHT);
|
||
781 | lblFax.setText(PluginServices.getText(this, "fax")+":"); |
||
782 | lblPostCode = new JLabel(); |
||
783 | 4913 | jaume | lblPostCode.setBounds(7, 143, 98, 20); |
784 | 4876 | jaume | lblPostCode.setHorizontalTextPosition(SwingConstants.RIGHT);
|
785 | lblPostCode.setHorizontalAlignment(SwingConstants.RIGHT);
|
||
786 | lblPostCode.setText(PluginServices.getText(this, "postcode")+":"); |
||
787 | lblPhone = new JLabel(); |
||
788 | 4913 | jaume | lblPhone.setBounds(7, 168, 98, 20); |
789 | 4876 | jaume | lblPhone.setHorizontalTextPosition(SwingConstants.RIGHT);
|
790 | lblPhone.setHorizontalAlignment(SwingConstants.RIGHT);
|
||
791 | lblPhone.setText(PluginServices.getText(this, "telephone")+":"); |
||
792 | lblCountry = new JLabel(); |
||
793 | 4913 | jaume | lblCountry.setBounds(274, 143, 57, 20); |
794 | 4876 | jaume | lblCountry.setText(PluginServices.getText(this, "country")+":"); |
795 | lblCountry.setHorizontalTextPosition(SwingConstants.RIGHT);
|
||
796 | lblCountry.setHorizontalAlignment(SwingConstants.RIGHT);
|
||
797 | lblStateProvince = new JLabel(); |
||
798 | 4913 | jaume | lblStateProvince.setBounds(252, 119, 111, 20); |
799 | 4876 | jaume | lblStateProvince.setText(PluginServices.getText(this, "state_or_province")+":"); |
800 | lblStateProvince.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
801 | lblStateProvince.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
||
802 | 6115 | jaume | |
803 | 4876 | jaume | lblCity = new JLabel(); |
804 | 4913 | jaume | lblCity.setBounds(7, 119, 98, 20); |
805 | 4876 | jaume | lblCity.setText(PluginServices.getText(this, "city")+":"); |
806 | lblCity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
807 | lblCity.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
||
808 | lblContactPosition = new JLabel(); |
||
809 | 4913 | jaume | lblContactPosition.setBounds(6, 69, 99, 20); |
810 | 4876 | jaume | lblContactPosition.setHorizontalTextPosition(SwingConstants.RIGHT);
|
811 | lblContactPosition.setHorizontalAlignment(SwingConstants.RIGHT);
|
||
812 | lblContactPosition.setText(PluginServices.getText(this, "contact_position")); |
||
813 | lblContactOrganization = new JLabel(); |
||
814 | 4913 | jaume | lblContactOrganization.setBounds(6, 44, 99, 20); |
815 | 4876 | jaume | lblContactOrganization.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
816 | lblContactOrganization.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
817 | lblContactOrganization.setText(PluginServices.getText(this, "contact_organization")+":"); |
||
818 | lblAddress = new JLabel(); |
||
819 | 4913 | jaume | lblAddress.setBounds(6, 94, 99, 20); |
820 | 4876 | jaume | lblAddress.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
821 | lblAddress.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
||
822 | lblAddress.setText(PluginServices.getText(this, "address")); |
||
823 | 6115 | jaume | |
824 | 4876 | jaume | lblContactPerson = new JLabel(); |
825 | lblContactPerson.setText(PluginServices.getText(this, "contact_person")+":"); |
||
826 | lblContactPerson.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||
827 | lblContactPerson.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
||
828 | 4913 | jaume | lblContactPerson.setBounds(6, 19, 99, 20); |
829 | 4876 | jaume | pnlContactInfo = new JPanel(); |
830 | pnlContactInfo.setLayout(null);
|
||
831 | pnlContactInfo.setBorder(javax.swing.BorderFactory.createTitledBorder( |
||
832 | null, PluginServices.getText(this, "contact_info"), |
||
833 | 6115 | jaume | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
834 | 4876 | jaume | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
835 | 4913 | jaume | pnlContactInfo.setLocation(4, 158); |
836 | pnlContactInfo.setSize(527, 223); |
||
837 | 4876 | jaume | pnlContactInfo.add(lblContactPerson, null);
|
838 | pnlContactInfo.add(getTxtContactPerson(), null);
|
||
839 | pnlContactInfo.add(lblContactOrganization, null);
|
||
840 | pnlContactInfo.add(getTxtOrganization(), null);
|
||
841 | pnlContactInfo.add(lblContactPosition, null);
|
||
842 | pnlContactInfo.add(getTxtContactPosition(), null);
|
||
843 | pnlContactInfo.add(lblAddress, null);
|
||
844 | pnlContactInfo.add(getTxtAddress(), null);
|
||
845 | pnlContactInfo.add(lblCity, null);
|
||
846 | pnlContactInfo.add(getTxtCity(), null);
|
||
847 | pnlContactInfo.add(lblStateProvince, null);
|
||
848 | pnlContactInfo.add(getCmbCountries(), null);
|
||
849 | pnlContactInfo.add(getTxtStateOrProvince(), null);
|
||
850 | pnlContactInfo.add(lblPostCode, null);
|
||
851 | pnlContactInfo.add(getTxtPostCode(), null);
|
||
852 | pnlContactInfo.add(lblCountry, null);
|
||
853 | pnlContactInfo.add(lblPhone, null);
|
||
854 | pnlContactInfo.add(getTxtTelephone(), null);
|
||
855 | pnlContactInfo.add(lblFax, null);
|
||
856 | pnlContactInfo.add(getTxtFax(), null);
|
||
857 | pnlContactInfo.add(lblEMail, null);
|
||
858 | pnlContactInfo.add(getTxtEMail(), null);
|
||
859 | } |
||
860 | return pnlContactInfo;
|
||
861 | } |
||
862 | |||
863 | /**
|
||
864 | 6115 | jaume | * This method initializes jTextField1
|
865 | *
|
||
866 | * @return javax.swing.JTextField
|
||
867 | */
|
||
868 | 4876 | jaume | private JTextField getTxtKeyWords() { |
869 | if (txtKeyWords == null) { |
||
870 | txtKeyWords = new JTextField(); |
||
871 | 4913 | jaume | txtKeyWords.setBounds(115, 79, 232, 20); |
872 | 4876 | jaume | } |
873 | return txtKeyWords;
|
||
874 | } |
||
875 | |||
876 | /**
|
||
877 | 6115 | jaume | * This method initializes jTextField1
|
878 | *
|
||
879 | * @return javax.swing.JTextField
|
||
880 | */
|
||
881 | 4876 | jaume | private JTextField getTxtContactPerson() { |
882 | if (txtContactPerson == null) { |
||
883 | txtContactPerson = new JTextField(); |
||
884 | 4913 | jaume | txtContactPerson.setBounds(111, 19, 407, 20); |
885 | 4876 | jaume | } |
886 | return txtContactPerson;
|
||
887 | } |
||
888 | |||
889 | /**
|
||
890 | 6115 | jaume | * This method initializes jTextField2
|
891 | *
|
||
892 | * @return javax.swing.JTextField
|
||
893 | */
|
||
894 | 4876 | jaume | private JTextField getTxtOrganization() { |
895 | if (txtOrganization == null) { |
||
896 | txtOrganization = new JTextField(); |
||
897 | 4913 | jaume | txtOrganization.setBounds(111, 44, 407, 20); |
898 | 4876 | jaume | } |
899 | return txtOrganization;
|
||
900 | } |
||
901 | |||
902 | /**
|
||
903 | 6115 | jaume | * This method initializes jTextField
|
904 | *
|
||
905 | * @return javax.swing.JTextField
|
||
906 | */
|
||
907 | 4876 | jaume | private JTextField getTxtContactPosition() { |
908 | if (txtContactPosition == null) { |
||
909 | txtContactPosition = new JTextField(); |
||
910 | 4913 | jaume | txtContactPosition.setBounds(111, 69, 407, 20); |
911 | 4876 | jaume | } |
912 | return txtContactPosition;
|
||
913 | } |
||
914 | |||
915 | /**
|
||
916 | 6115 | jaume | * This method initializes txtAddress
|
917 | *
|
||
918 | * @return javax.swing.JTextField
|
||
919 | */
|
||
920 | 4876 | jaume | private JTextField getTxtAddress() { |
921 | if (txtAddress == null) { |
||
922 | txtAddress = new JTextField(); |
||
923 | 4913 | jaume | txtAddress.setBounds(111, 94, 407, 20); |
924 | 4876 | jaume | } |
925 | return txtAddress;
|
||
926 | } |
||
927 | |||
928 | /**
|
||
929 | 6115 | jaume | * This method initializes txtCity
|
930 | *
|
||
931 | * @return javax.swing.JTextField
|
||
932 | */
|
||
933 | 4876 | jaume | private JTextField getTxtCity() { |
934 | if (txtCity == null) { |
||
935 | txtCity = new JTextField(); |
||
936 | 4913 | jaume | txtCity.setBounds(111, 119, 135, 20); |
937 | 4876 | jaume | } |
938 | return txtCity;
|
||
939 | } |
||
940 | |||
941 | /**
|
||
942 | 6115 | jaume | * This method initializes txtStateOrProvince
|
943 | *
|
||
944 | * @return javax.swing.JTextField
|
||
945 | */
|
||
946 | 4876 | jaume | private JTextField getTxtStateOrProvince() { |
947 | if (txtStateOrProvince == null) { |
||
948 | txtStateOrProvince = new JTextField(); |
||
949 | 4913 | jaume | txtStateOrProvince.setBounds(368, 119, 150, 20); |
950 | 4876 | jaume | } |
951 | return txtStateOrProvince;
|
||
952 | } |
||
953 | |||
954 | /**
|
||
955 | 6115 | jaume | * This method initializes txtPostCode
|
956 | *
|
||
957 | * @return javax.swing.JTextField
|
||
958 | */
|
||
959 | 4876 | jaume | private JTextField getTxtPostCode() { |
960 | if (txtPostCode == null) { |
||
961 | txtPostCode = new JTextField(); |
||
962 | 4913 | jaume | txtPostCode.setBounds(111, 143, 159, 20); |
963 | 4876 | jaume | } |
964 | return txtPostCode;
|
||
965 | } |
||
966 | |||
967 | /**
|
||
968 | 6115 | jaume | * This method initializes cmbCountries
|
969 | *
|
||
970 | * @return javax.swing.JComboBox
|
||
971 | */
|
||
972 | 4876 | jaume | private JComboBox getCmbCountries() { |
973 | if (cmbCountries == null) { |
||
974 | cmbCountries = new JComboBox(); |
||
975 | 4913 | jaume | cmbCountries.setBounds(336, 143, 182, 20); |
976 | 4876 | jaume | String[] countries = PluginServices.getText(this, "countries_of_the_world").split(";"); |
977 | for (int i = 0; i < countries.length; i++) { |
||
978 | cmbCountries.addItem(countries[i]); |
||
979 | } |
||
980 | } |
||
981 | return cmbCountries;
|
||
982 | } |
||
983 | |||
984 | /**
|
||
985 | 6115 | jaume | * This method initializes txtTelephone
|
986 | *
|
||
987 | * @return javax.swing.JTextField
|
||
988 | */
|
||
989 | 4876 | jaume | private JTextField getTxtTelephone() { |
990 | if (txtTelephone == null) { |
||
991 | txtTelephone = new JTextField(); |
||
992 | 4913 | jaume | txtTelephone.setBounds(111, 168, 159, 20); |
993 | 4876 | jaume | } |
994 | return txtTelephone;
|
||
995 | } |
||
996 | |||
997 | /**
|
||
998 | 6115 | jaume | * This method initializes txtFax
|
999 | *
|
||
1000 | * @return javax.swing.JTextField
|
||
1001 | */
|
||
1002 | 4876 | jaume | private JTextField getTxtFax() { |
1003 | if (txtFax == null) { |
||
1004 | txtFax = new JTextField(); |
||
1005 | 4913 | jaume | txtFax.setBounds(336, 168, 182, 20); |
1006 | 4876 | jaume | } |
1007 | return txtFax;
|
||
1008 | } |
||
1009 | |||
1010 | /**
|
||
1011 | 6115 | jaume | * This method initializes txtEMail
|
1012 | *
|
||
1013 | * @return javax.swing.JTextField
|
||
1014 | */
|
||
1015 | 4876 | jaume | private JTextField getTxtEMail() { |
1016 | if (txtEMail == null) { |
||
1017 | txtEMail = new JTextField(); |
||
1018 | 4913 | jaume | txtEMail.setBounds(111, 193, 407, 20); |
1019 | 4876 | jaume | } |
1020 | return txtEMail;
|
||
1021 | } |
||
1022 | 4913 | jaume | |
1023 | 6880 | cesar | public Object getWindowModel() { |
1024 | 4913 | jaume | return PluginServices.getText(this, "web_map_context_settings"); |
1025 | } |
||
1026 | 6115 | jaume | |
1027 | 4913 | jaume | private void execute(String actionCommand) { |
1028 | if ("OK".equals(actionCommand)) { |
||
1029 | String str = getTxtFile().getText();
|
||
1030 | if (str==null || str.equals("")) { |
||
1031 | JOptionPane.showMessageDialog(this, PluginServices.getText(this, "must_specify_a_file"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE); |
||
1032 | return;
|
||
1033 | } |
||
1034 | ProjectView theView = exportableViews[getCmbViews().getSelectedIndex()]; |
||
1035 | 6878 | cesar | MapContext mc = theView.getMapContext(); |
1036 | 4913 | jaume | wmc = new WebMapContext();
|
1037 | 6115 | jaume | |
1038 | 4913 | jaume | // Version
|
1039 | wmc.fileVersion = (String) getCmbVersion().getSelectedItem();
|
||
1040 | 6115 | jaume | |
1041 | 4913 | jaume | // Web Map Context size
|
1042 | if (advanced) {
|
||
1043 | if (getRdBtnUseViewSize().isSelected()) {
|
||
1044 | // View's size
|
||
1045 | 4915 | jaume | Dimension sz = null; |
1046 | if (mc.getViewPort().getImageSize()!=null) |
||
1047 | sz = new Dimension(mc.getViewPort().getImageSize()); |
||
1048 | 4913 | jaume | if (sz == null || (int) sz.getHeight()==0 || (int) sz.getWidth()==0) |
1049 | // View's size is not initialized, will use default size.
|
||
1050 | sz = new Dimension(defaultWidth, defaultHeight); |
||
1051 | wmc.windowSize = sz; |
||
1052 | } else {
|
||
1053 | // User defined size
|
||
1054 | 6500 | jaume | try {
|
1055 | 4913 | jaume | wmc.windowSize = new Dimension(Integer.parseInt(getTxtWidth().getText()), |
1056 | Integer.parseInt(getTxtHeight().getText()));
|
||
1057 | 6500 | jaume | } catch (Exception e) { |
1058 | JOptionPane.showMessageDialog(this, PluginServices.getText(this, "invalid_dimension_values"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE); |
||
1059 | return;
|
||
1060 | } |
||
1061 | 4913 | jaume | } |
1062 | 6115 | jaume | } |
1063 | 4913 | jaume | // SRS
|
1064 | wmc.srs = mc.getProjection().getAbrev(); |
||
1065 | 6115 | jaume | |
1066 | 4913 | jaume | // Bounding Box
|
1067 | 5158 | jaume | if (useFullExtent)
|
1068 | try {
|
||
1069 | wmc.bBox = mc.getFullExtent(); |
||
1070 | } catch (DriverException dEx) {
|
||
1071 | NotificationManager.addError(dEx); |
||
1072 | return;
|
||
1073 | } |
||
1074 | else
|
||
1075 | wmc.bBox = mc.getViewPort().getAdjustedExtent(); |
||
1076 | 6115 | jaume | |
1077 | 4913 | jaume | // Title
|
1078 | str = getTxtTitle().getText(); |
||
1079 | if (str!=null && !str.equals("")) |
||
1080 | wmc.title = str; |
||
1081 | else {
|
||
1082 | JOptionPane.showMessageDialog(this, getTxtTitle().getName()+" "+PluginServices.getText(this, "is_required"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE); |
||
1083 | return;
|
||
1084 | } |
||
1085 | 6115 | jaume | |
1086 | 4913 | jaume | // ID
|
1087 | str = getTxtId().getText(); |
||
1088 | if (str!=null && !str.equals("")) |
||
1089 | wmc.id = str; |
||
1090 | else {
|
||
1091 | JOptionPane.showMessageDialog(this, getTxtId().getName()+" "+PluginServices.getText(this, "is_required"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE); |
||
1092 | return;
|
||
1093 | } |
||
1094 | 6115 | jaume | |
1095 | 4913 | jaume | wmc.xmlns = WebMapContextTags.XMLNS_VALUE; |
1096 | wmc.xmlns_xlink = WebMapContextTags.XMLNS_XLINK_VALUE; |
||
1097 | wmc.xmlns_xsi = WebMapContextTags.XMLNS_XSI_VALUE; |
||
1098 | wmc.xsi_schemaLocation = WebMapContextTags.XSI_SCHEMA_LOCATION_VALUE; |
||
1099 | 6115 | jaume | |
1100 | 4913 | jaume | // Abstract
|
1101 | str = getTxtAbstract().getText(); |
||
1102 | if (str!=null && !str.equals("")) |
||
1103 | wmc._abstract = str; |
||
1104 | 6115 | jaume | |
1105 | 4913 | jaume | // Keyword list
|
1106 | str = getTxtKeyWords().getText(); |
||
1107 | if (str!=null && !str.equals("")) { |
||
1108 | 4915 | jaume | String[] ss = str.split("[, ;:]+"); // sequence of spaces, commas, colons or semicolons will be treated as word separator |
1109 | 4913 | jaume | for (int i = 0; i < ss.length; i++) { |
1110 | if (wmc.keywordList==null) wmc.keywordList = new ArrayList(); |
||
1111 | wmc.keywordList.add(ss[i]); |
||
1112 | } |
||
1113 | } |
||
1114 | 6115 | jaume | |
1115 | 4913 | jaume | // Logo URL
|
1116 | str = getTxtLogoURL().getText(); |
||
1117 | if (str!=null && !str.equals("")) |
||
1118 | wmc.logoURL = str; |
||
1119 | 6115 | jaume | |
1120 | 4913 | jaume | wmc.logoURLSize = null; // yet skiped |
1121 | wmc.logoURLFormat = null; // yet skiped |
||
1122 | wmc.descriptionURLFormat = null;// yet skiped |
||
1123 | 6115 | jaume | |
1124 | 4913 | jaume | // Description URL
|
1125 | str = getTxtLogoURL().getText(); |
||
1126 | if (str!=null && !str.equals("")) |
||
1127 | wmc.descriptionURL = str; |
||
1128 | 6115 | jaume | |
1129 | 4913 | jaume | // Contact Person
|
1130 | str = getTxtContactPerson().getText(); |
||
1131 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1132 | 4913 | jaume | wmc.contactPerson = str; |
1133 | 4915 | jaume | wmc.contactInfo = true;
|
1134 | } |
||
1135 | 6115 | jaume | |
1136 | 4913 | jaume | // Contact Organization
|
1137 | str = getTxtOrganization().getText(); |
||
1138 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1139 | 4913 | jaume | wmc.contactOrganization = str; |
1140 | 4915 | jaume | wmc.contactInfo = true;
|
1141 | } |
||
1142 | 6115 | jaume | |
1143 | 4913 | jaume | // Contact Position
|
1144 | str = getTxtContactPosition().getText(); |
||
1145 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1146 | 4913 | jaume | wmc.contactPosition = str; |
1147 | 4915 | jaume | wmc.contactInfo = true;
|
1148 | } |
||
1149 | 6115 | jaume | |
1150 | 4913 | jaume | // Address
|
1151 | str = getTxtAddress().getText(); |
||
1152 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1153 | 4913 | jaume | wmc.address = str; |
1154 | 4915 | jaume | wmc.contactInfo = true;
|
1155 | } |
||
1156 | 6115 | jaume | |
1157 | 4913 | jaume | // City
|
1158 | str = getTxtCity().getText(); |
||
1159 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1160 | 4913 | jaume | wmc.city = str; |
1161 | 4915 | jaume | wmc.contactInfo = true;
|
1162 | } |
||
1163 | 6115 | jaume | |
1164 | 4913 | jaume | // State/Province
|
1165 | str = getTxtStateOrProvince().getText(); |
||
1166 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1167 | 4913 | jaume | wmc.stateOrProvince = str; |
1168 | 4915 | jaume | wmc.contactInfo = true;
|
1169 | } |
||
1170 | 6115 | jaume | |
1171 | 4913 | jaume | // Postcode
|
1172 | str = getTxtPostCode().getText(); |
||
1173 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1174 | 4913 | jaume | wmc.postCode = str; |
1175 | 4915 | jaume | } |
1176 | 6115 | jaume | |
1177 | 4913 | jaume | // Country
|
1178 | str = (String) getCmbCountries().getSelectedItem();
|
||
1179 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1180 | 4913 | jaume | wmc.country = str; |
1181 | 4915 | jaume | } |
1182 | 6115 | jaume | |
1183 | 4913 | jaume | // Telephone
|
1184 | str = getTxtTelephone().getText(); |
||
1185 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1186 | 4913 | jaume | wmc.telephone = str; |
1187 | 4915 | jaume | wmc.contactInfo = true;
|
1188 | } |
||
1189 | 6115 | jaume | |
1190 | 4913 | jaume | // Fax
|
1191 | str = getTxtFax().getText(); |
||
1192 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1193 | 4913 | jaume | wmc.fax = str; |
1194 | 4915 | jaume | wmc.contactInfo = true;
|
1195 | } |
||
1196 | 6115 | jaume | |
1197 | 4913 | jaume | // e-mail
|
1198 | str = getTxtEMail().getText(); |
||
1199 | 4915 | jaume | if (str!=null && !str.equals("")) { |
1200 | 4913 | jaume | wmc.email = str; |
1201 | 4915 | jaume | wmc.contactInfo = true;
|
1202 | } |
||
1203 | 6115 | jaume | |
1204 | ExportWebMapContextExtension exp = (ExportWebMapContextExtension) |
||
1205 | 4915 | jaume | PluginServices. |
1206 | getExtension(ExportWebMapContextExtension.class); |
||
1207 | 4913 | jaume | exp.execute("DO_EXPORT");
|
1208 | 6880 | cesar | PluginServices.getMDIManager().closeWindow(this);
|
1209 | 4913 | jaume | } else if ("CANCEL".equals(actionCommand)) { |
1210 | 6880 | cesar | PluginServices.getMDIManager().closeWindow(this);
|
1211 | 4913 | jaume | } |
1212 | } |
||
1213 | |||
1214 | public String getXML() { |
||
1215 | return wmc.toXML(exportableViews[getCmbViews().getSelectedIndex()]);
|
||
1216 | } |
||
1217 | |||
1218 | public File getTargetFile() { |
||
1219 | 5430 | jaume | if (targetFile == null) { |
1220 | String fileName = getTxtFile().getText();
|
||
1221 | if (fileName != null) |
||
1222 | targetFile = new File(fileName); |
||
1223 | } |
||
1224 | 4913 | jaume | return targetFile;
|
1225 | } |
||
1226 | |||
1227 | /**
|
||
1228 | 6115 | jaume | * This method initializes cmbViews
|
1229 | *
|
||
1230 | * @return javax.swing.JComboBox
|
||
1231 | */
|
||
1232 | 4913 | jaume | private JComboBox getCmbViews() { |
1233 | if (cmbViews == null) { |
||
1234 | cmbViews = new JComboBox(); |
||
1235 | cmbViews.setBounds(91, 24, 432, 21); |
||
1236 | 6115 | jaume | cmbViews.addItemListener(new java.awt.event.ItemListener() {
|
1237 | 4913 | jaume | public void itemStateChanged(java.awt.event.ItemEvent e) { |
1238 | ProjectView theView = exportableViews[getCmbViews().getSelectedIndex()]; |
||
1239 | Dimension sz = theView.getMapContext().
|
||
1240 | getViewPort(). |
||
1241 | getImageSize(); |
||
1242 | if (sz == null || (int) sz.getHeight()==0 || (int) sz.getWidth()==0) |
||
1243 | sz = new Dimension(defaultWidth, defaultHeight); |
||
1244 | 6115 | jaume | |
1245 | 4913 | jaume | getTxtWidth().setText((int) sz.getWidth()+""); |
1246 | getTxtHeight().setText((int) sz.getHeight()+""); |
||
1247 | getTxtTitle().setText(theView.getName()); |
||
1248 | } |
||
1249 | }); |
||
1250 | for (int i = 0; i < exportableViews.length; i++) { |
||
1251 | cmbViews.addItem(exportableViews[i].getName()); |
||
1252 | } |
||
1253 | } |
||
1254 | return cmbViews;
|
||
1255 | } |
||
1256 | 5158 | jaume | |
1257 | /**
|
||
1258 | 6115 | jaume | * This method initializes rdCurrentViewExtent
|
1259 | *
|
||
1260 | * @return javax.swing.JRadioButton
|
||
1261 | */
|
||
1262 | 5158 | jaume | private JRadioButton getRdBtnCurrentViewExtent() { |
1263 | if (rdBtnCurrentViewExtent == null) { |
||
1264 | rdBtnCurrentViewExtent = new JRadioButton(); |
||
1265 | rdBtnCurrentViewExtent.setBounds(91, 146, 270, 20); |
||
1266 | rdBtnCurrentViewExtent.setText(PluginServices.getText(this, "defined_by_view_extent")); |
||
1267 | 6115 | jaume | rdBtnCurrentViewExtent.addItemListener(new java.awt.event.ItemListener() {
|
1268 | public void itemStateChanged(java.awt.event.ItemEvent e) { |
||
1269 | 5158 | jaume | fPrefs.putBoolean("use_full_extent", !getRdBtnFullExtent().isEnabled());
|
1270 | } |
||
1271 | }); |
||
1272 | 5430 | jaume | rdBtnCurrentViewExtent.setEnabled(!useFullExtent); |
1273 | 5158 | jaume | } |
1274 | return rdBtnCurrentViewExtent;
|
||
1275 | } |
||
1276 | |||
1277 | /**
|
||
1278 | 6115 | jaume | * This method initializes rdBtnFullExtent
|
1279 | *
|
||
1280 | * @return javax.swing.JRadioButton
|
||
1281 | */
|
||
1282 | 5158 | jaume | private JRadioButton getRdBtnFullExtent() { |
1283 | if (rdBtnFullExtent == null) { |
||
1284 | rdBtnFullExtent = new JRadioButton(); |
||
1285 | rdBtnFullExtent.setBounds(91, 164, 270, 20); |
||
1286 | rdBtnFullExtent.setText(PluginServices.getText(this, "use_full_extent")); |
||
1287 | 6115 | jaume | rdBtnFullExtent.addItemListener(new java.awt.event.ItemListener() {
|
1288 | 5158 | jaume | public void itemStateChanged(java.awt.event.ItemEvent e) { |
1289 | boolean b = getRdBtnFullExtent().isEnabled();
|
||
1290 | fPrefs.putBoolean("use_full_extent", getRdBtnFullExtent().isEnabled());
|
||
1291 | useFullExtent = b; |
||
1292 | } |
||
1293 | }); |
||
1294 | rdBtnFullExtent.setSelected(useFullExtent); |
||
1295 | } |
||
1296 | return rdBtnFullExtent;
|
||
1297 | } |
||
1298 | 6115 | jaume | } |