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