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