Statistics
| Revision:

root / trunk / extensions / extWMS / src / com / iver / cit / gvsig / gui / panels / WebMapContextSettingsPanel.java @ 7304

History | View | Annotate | Download (38.7 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 7304 2006-09-15 10:44:24Z caballero $
45
* $Log$
46
* Revision 1.16  2006-09-15 10:44:24  caballero
47
* extensibilidad de documentos
48
*
49
* Revision 1.15  2006/08/30 10:20:51  jaume
50
* *** empty log message ***
51
*
52
* Revision 1.14  2006/08/29 07:56:15  cesar
53
* Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
54
*
55
* Revision 1.13  2006/08/29 07:21:03  cesar
56
* Rename com.iver.cit.gvsig.fmap.Fmap class to com.iver.cit.gvsig.fmap.MapContext
57
*
58
* Revision 1.12  2006/08/23 09:42:32  jaume
59
* *** empty log message ***
60
*
61
* Revision 1.11  2006/08/23 09:40:03  jaume
62
* *** empty log message ***
63
*
64
* Revision 1.10  2006/07/21 11:51:13  jaume
65
* improved appearance in wms panel and a wmc bug fixed
66
*
67
* Revision 1.9  2006/06/30 08:02:57  jaume
68
* added a normative-sized button
69
*
70
* Revision 1.8  2006/05/25 10:28:12  jaume
71
* *** empty log message ***
72
*
73
* Revision 1.7  2006/05/25 07:42:55  jaume
74
* *** empty log message ***
75
*
76
* Revision 1.6  2006/05/12 07:47:39  jaume
77
* removed unnecessary imports
78
*
79
* Revision 1.5  2006/05/03 07:51:21  jaume
80
* *** empty log message ***
81
*
82
* Revision 1.4  2006/04/25 11:40:55  jaume
83
* *** empty log message ***
84
*
85
* Revision 1.3  2006/04/21 10:27:32  jaume
86
* exporting now supported
87
*
88
* Revision 1.2  2006/04/20 17:11:54  jaume
89
* Attempting to export
90
*
91
* Revision 1.1  2006/04/19 07:57:29  jaume
92
* *** empty log message ***
93
*
94
* Revision 1.1  2006/04/07 12:10:37  jaume
95
* *** empty log message ***
96
*
97
*
98
*/
99
package com.iver.cit.gvsig.gui.panels;
100

    
101
import java.awt.Component;
102
import java.awt.Dimension;
103
import java.io.File;
104
import java.util.ArrayList;
105
import java.util.prefs.Preferences;
106

    
107
import javax.swing.ButtonGroup;
108
import org.gvsig.gui.beans.swing.JButton;
109
import javax.swing.JComboBox;
110
import javax.swing.JFileChooser;
111
import javax.swing.JLabel;
112
import javax.swing.JOptionPane;
113
import javax.swing.JPanel;
114
import javax.swing.JRadioButton;
115
import javax.swing.JScrollPane;
116
import javax.swing.JTextArea;
117
import javax.swing.JTextField;
118
import javax.swing.SwingConstants;
119
import javax.swing.filechooser.FileFilter;
120

    
121
import com.iver.andami.PluginServices;
122
import com.iver.andami.messages.NotificationManager;
123
import com.iver.andami.ui.mdiManager.SingletonWindow;
124
import com.iver.andami.ui.mdiManager.WindowInfo;
125
import com.iver.cit.gvsig.fmap.DriverException;
126
import com.iver.cit.gvsig.fmap.MapContext;
127
import com.iver.cit.gvsig.project.documents.view.ProjectView;
128
import com.iver.cit.gvsig.wmc.ExportWebMapContextExtension;
129
import com.iver.cit.gvsig.wmc.WebMapContext;
130
import com.iver.cit.gvsig.wmc.WebMapContextTags;
131
import java.awt.FlowLayout;
132
/**
133
 * A graphical form to fill up the customizable information of a destinantion
134
 * Web Map Context file.
135
 *
136
 * @author jaume dominguez faus - jaume.dominguez@iver.es
137
 *
138
 */
139
public class WebMapContextSettingsPanel extends JPanel implements SingletonWindow {
140
        public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.mapcontext-settingspanel" );
141
        private JPanel simplePanel = null;
142
        private JPanel advancedPanel = null;
143
        private JPanel buttonsPanel = null;
144
        private JComboBox cmbVersion = null;
145
        private JLabel lblTitle = null;
146
        private JButton btnBrowseFileSystem = null;
147
        private JTextField txtTitle = null;
148
        private JLabel lblVersion = null;
149
        private JLabel lblId = null;
150
        private JTextField txtId = null;
151
        private JLabel lblFile = null;
152
        private JTextField txtFile = null;
153
        private JButton btnAdvanced = null;
154
        private JButton btnOk = null;
155
        private JButton btnCancel = null;
156
        private JLabel lblAbstract = null;
157
        private JLabel lblLogoURL = null;
158
        private JLabel lblDescriptionURL = null;
159
        private JTextArea txtAbstract = null;
160
        private JScrollPane scrlAbstract = null;
161
        private JTextField txtLogoURL = null;
162
        private JTextField txtDescriptionURL = null;
163
        private JPanel pnlMapSize = null;
164
        private JRadioButton rdBtnUseViewSize = null;
165
        private JRadioButton rdBtnCustomSize = null;
166
        private JLabel lblWidth = null;
167
        private JLabel lblHeight = null;
168
        private JTextField txtWidth = null;
169
        private JTextField txtHeight = null;
170
        private JPanel pnlContactInfo = null;
171
        private JTextField txtKeyWords = null;
172
        private JLabel lblKeyWords = null;
173
        private JLabel lblContactPerson = null;
174
        private JTextField txtContactPerson = null;
175
        private JLabel lblContactOrganization = null;
176
        private JTextField txtOrganization = null;
177
        private JLabel lblContactPosition = null;
178
        private JTextField txtContactPosition = null;
179
        private JLabel lblAddress = null;
180
        private JTextField txtAddress = null;
181
        private JLabel lblCity = null;
182
        private JTextField txtCity = null;
183
        private JLabel lblStateProvince = null;
184
        private JTextField txtStateOrProvince = null;
185
        private JLabel lblPostCode = null;
186
        private JTextField txtPostCode = null;
187
        private JLabel lblCountry = null;
188
        private JComboBox cmbCountries = null;
189
        private JLabel lblPhone = null;
190
        private JTextField txtTelephone = null;
191
        private JLabel lblFax = null;
192
        private JTextField txtFax = null;
193
        private JLabel lblEMail = null;
194
        private JTextField txtEMail = null;
195
        private boolean first = true;
196
        private boolean advanced = fPrefs.getBoolean("advanced-panel", false);
197
        private WindowInfo m_viewInfo;
198
        private String strAdvanced = PluginServices.getText(this, "advanced");
199
        private File targetFile;
200
        private WebMapContext wmc;
201
        private ProjectView[] exportableViews;
202
        private JLabel lblView = null;
203
        private JComboBox cmbViews = null;
204
        private String lastWidth, lastHeight;
205
        private int defaultWidth = 500;
206
        private int defaultHeight = 450;
207
        private JLabel lblExtent = null;
208
        private JRadioButton rdBtnCurrentViewExtent = null;
209
        private JRadioButton rdBtnFullExtent = null;
210
        protected boolean useFullExtent = fPrefs.getBoolean("use_full_extent", false);
211

    
212
        public WebMapContextSettingsPanel(ProjectView[] views) {
213
                super();
214
                exportableViews = views;
215
                initialize();
216
        }
217

    
218
        /**
219
         * This method initializes this
220
         *
221
         * @return void
222
         */
223
        private void initialize() {
224
                this.setLayout(null);
225

    
226
                switchPanels();
227
        }
228

    
229
        private void switchPanels() {
230
                this.removeAll();
231
                Dimension sz;
232
                this.add(getSimplePanel(), java.awt.BorderLayout.NORTH);
233
                if (advanced) {
234
                        this.add(getAdvancedPanel(), java.awt.BorderLayout.CENTER);
235
                        sz = new Dimension(535, 640);
236
                        btnAdvanced.setText(strAdvanced+"  <<");
237

    
238
                } else {
239
                        sz = new Dimension(535, 260);
240
                        btnAdvanced.setText(strAdvanced+"  >>");
241

    
242
                }
243

    
244
                this.setSize(sz);
245

    
246

    
247
                this.add(getButtonsPanel(), java.awt.BorderLayout.SOUTH);
248
                fPrefs.putBoolean("advanced-panel", advanced);
249
                if (!first) {
250
                        PluginServices.getMDIManager().changeWindowInfo(this, getWindowInfo());
251

    
252
                        PluginServices.getMDIManager().closeWindow(this);
253
                        PluginServices.getMDIManager().addWindow(this);
254
                }
255
                first = false;
256
        }
257

    
258
        public WindowInfo getWindowInfo() {
259

    
260
                m_viewInfo = new WindowInfo(WindowInfo.ICONIFIABLE);
261
                m_viewInfo.setTitle(PluginServices.getText(this, "web_map_context_settings"));
262
                m_viewInfo.setWidth(this.getWidth()+8);
263
                m_viewInfo.setHeight(getHeight());
264
                return m_viewInfo;
265
        }
266

    
267
        /**
268
         * This method initializes simplePanel
269
         *
270
         * @return javax.swing.JPanel
271
         */
272
        private JPanel getSimplePanel() {
273
                if (simplePanel == null) {
274
                        ButtonGroup group = new ButtonGroup();
275
                        lblExtent = new JLabel();
276
                        lblExtent.setBounds(9, 146, 79, 20);
277
                        lblExtent.setHorizontalTextPosition(SwingConstants.RIGHT);
278
                        lblExtent.setHorizontalAlignment(SwingConstants.RIGHT);
279
                        lblExtent.setText(PluginServices.getText(this, "map_extent")+":");
280
                        lblView = new JLabel();
281
                        lblView.setBounds(9, 24, 79, 20);
282
                        lblView.setHorizontalTextPosition(SwingConstants.RIGHT);
283
                        lblView.setHorizontalAlignment(SwingConstants.RIGHT);
284
                        lblView.setText(PluginServices.getText(this, "ProjectView")+":");
285
                        lblTitle = new JLabel();
286
                        lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
287
                        lblTitle.setBounds(9, 48, 79, 20);
288
                        lblTitle.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
289
                        lblTitle.setText(PluginServices.getText(this, "title")+":");
290
                        lblId = new JLabel();
291
                        lblId.setBounds(9, 72, 79, 20);
292
                        lblId.setHorizontalTextPosition(SwingConstants.RIGHT);
293
                        lblId.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
294
                        lblId.setText(PluginServices.getText(this, "id")+":");
295
                        lblVersion = new JLabel();
296
                        lblVersion.setBounds(9, 120, 79, 20);
297
                        lblVersion.setHorizontalTextPosition(SwingConstants.RIGHT);
298
                        lblVersion.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
299
                        lblVersion.setText(PluginServices.getText(this, "version")+":");
300
                        lblFile = new JLabel();
301
                        lblFile.setBounds(9, 96, 79, 20);
302
                        lblFile.setHorizontalTextPosition(SwingConstants.RIGHT);
303
                        lblFile.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
304
                        lblFile.setText(PluginServices.getText(this, "file_name")+":");
305
                        simplePanel = new JPanel();
306
                        simplePanel.setLayout(null);
307
                        simplePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
308
                                          null, PluginServices.getText(this, "options"),
309
                                          javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
310
                                          javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
311
                        simplePanel.setBounds(new java.awt.Rectangle(0,0,535,196));
312
                        simplePanel.add(lblView, null);
313
                        simplePanel.add(getCmbViews(), null);
314
                        simplePanel.add(getTxtTitle(), null);
315
                        simplePanel.add(lblTitle, null);
316
                        simplePanel.add(getBtnBrowseFileSystem(), null);
317
                        simplePanel.add(lblVersion, null);
318
                        simplePanel.add(lblId, null);
319
                        simplePanel.add(getTxtId(), null);
320
                        simplePanel.add(lblFile, null);
321
                        simplePanel.add(getTxtFile(), null);
322
                        simplePanel.add(getBtnAdvanced(), null);
323
                        simplePanel.add(getCmbVersion(), null);
324
                        simplePanel.add(lblExtent, null);
325
                        simplePanel.add(getRdBtnCurrentViewExtent(), null);
326
                        simplePanel.add(getRdBtnFullExtent(), null);
327
                        group.add(getRdBtnCurrentViewExtent());
328
                        group.add(getRdBtnFullExtent());
329
                }
330
                return simplePanel;
331
        }
332

    
333
        /**
334
         * This method initializes advancedPanel
335
         *
336
         * @return javax.swing.JPanel
337
         */
338
        private JPanel getAdvancedPanel() {
339
                if (advancedPanel == null) {
340
                        lblKeyWords = new JLabel();
341
                        lblKeyWords.setBounds(10, 79, 99, 20);
342
                        lblKeyWords.setHorizontalTextPosition(SwingConstants.RIGHT);
343
                        lblKeyWords.setHorizontalAlignment(SwingConstants.RIGHT);
344
                        lblKeyWords.setText(PluginServices.getText(this, "keywords")+":");
345
                        lblDescriptionURL = new JLabel();
346
                        lblDescriptionURL.setBounds(10, 104, 99, 20);
347
                        lblDescriptionURL.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
348
                        lblDescriptionURL.setText(PluginServices.getText(this, "description_URL")+":");
349
                        lblDescriptionURL.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
350
                        lblLogoURL = new JLabel();
351
                        lblLogoURL.setBounds(10, 130, 99, 20);
352
                        lblLogoURL.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
353
                        lblLogoURL.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
354
                        lblLogoURL.setText(PluginServices.getText(this, "logo_URL")+":");
355
                        lblAbstract = new JLabel();
356
                        lblAbstract.setText(PluginServices.getText(this, "abstract")+":");
357
                        lblAbstract.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
358
                        lblAbstract.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
359
                        lblAbstract.setBounds(10, 27, 99, 20);
360
                        advancedPanel = new JPanel();
361
                        advancedPanel.setLayout(null);
362
                        advancedPanel.setBounds(0, 194, 535, 386);
363
                        advancedPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
364
                                          null, PluginServices.getText(this, "advanced_settings"),
365
                                          javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
366
                                          javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
367
                        advancedPanel.add(lblAbstract, null);
368
                        advancedPanel.add(lblKeyWords, null);
369
                        advancedPanel.add(lblLogoURL, null);
370
                        advancedPanel.add(lblDescriptionURL, null);
371
                        advancedPanel.add(getScrlAbstract(), null);
372
                        advancedPanel.add(getTxtLogoURL(), null);
373
                        advancedPanel.add(getTxtDescriptionURL(), null);
374
                        advancedPanel.add(getPnlMapSize(), null);
375
                        advancedPanel.add(getPnlContactInfo(), null);
376
                        advancedPanel.add(getTxtKeyWords(), null);
377
                }
378
                return advancedPanel;
379
        }
380

    
381
        /**
382
         * This method initializes buttonsPanel
383
         *
384
         * @return javax.swing.JPanel
385
         */
386
        private JPanel getButtonsPanel() {
387
                if (buttonsPanel == null) {
388
                        FlowLayout flowLayout = new FlowLayout();
389
                        flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
390
                        flowLayout.setVgap(1);
391
                        buttonsPanel = new JPanel();
392
                        buttonsPanel.setLayout(flowLayout);
393
                        buttonsPanel.add(getBtnOk(), null);
394
                        buttonsPanel.add(getBtnCancel(), null);
395
                }
396
                buttonsPanel.setBounds(0, this.getHeight()-60, 535, 38);
397

    
398
                return buttonsPanel;
399
        }
400

    
401
        /**
402
         * This method initializes cmbVersion
403
         *
404
         * @return javax.swing.JComboBox
405
         */
406
        private JComboBox getCmbVersion() {
407
                if (cmbVersion == null) {
408
                        cmbVersion = new JComboBox();
409
                        cmbVersion.setSize(89, 20);
410
                        cmbVersion.setLocation(91, 120);
411
                        for (int i = 0; i < WebMapContext.exportVersions.size(); i++) {
412
                                cmbVersion.addItem(WebMapContext.exportVersions.get(i));
413
                        }
414

    
415
                }
416
                return cmbVersion;
417
        }
418

    
419

    
420

    
421
        /**
422
         * This method initializes btnBrowseFileSystem
423
         *
424
         * @return javax.swing.JButton
425
         */
426
        private JButton getBtnBrowseFileSystem() {
427
                if (btnBrowseFileSystem == null) {
428
                        btnBrowseFileSystem = new JButton();
429
                        btnBrowseFileSystem.setBounds(403, 95, 120, 22);
430
                        btnBrowseFileSystem.addActionListener(new java.awt.event.ActionListener() {
431
                                public void actionPerformed(java.awt.event.ActionEvent e) {
432
                                        JFileChooser fc = new JFileChooser();
433
                                        fc.setFileFilter(new FileFilter() {
434
                                                public boolean accept(File f) {
435
                                                        return f.isDirectory() || f.getAbsolutePath().toLowerCase().endsWith(WebMapContext.FILE_EXTENSION);
436
                                                }
437

    
438
                                                public String getDescription() {
439
                                                        return PluginServices.getText(this, "ogc_mapcontext_file")+" (*.cml)";
440
                                                }
441
                                        });
442
                                        if (fc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION){
443

    
444
                                                String fileName = fc.getSelectedFile().getAbsolutePath();
445
                                                if (!fileName.toLowerCase().endsWith(WebMapContext.FILE_EXTENSION))
446
                                                        fileName += WebMapContext.FILE_EXTENSION;
447
                                                targetFile = new File(fileName);
448
                                                getTxtFile().setText(fileName);
449
                                        }
450
                                        fc = null;
451
                                }
452
                        });
453
                        btnBrowseFileSystem.setText(PluginServices.getText(this, "browse"));
454
                }
455
                return btnBrowseFileSystem;
456
        }
457

    
458
        /**
459
         * This method initializes txtTitle
460
         *
461
         * @return javax.swing.JTextField
462
         */
463
        private JTextField getTxtTitle() {
464
                if (txtTitle == null) {
465
                        txtTitle = new JTextField();
466
                        txtTitle.setBounds(91, 48, 432, 20);
467
                        txtTitle.setName(PluginServices.getText(this, "title"));
468
                }
469
                return txtTitle;
470
        }
471

    
472
        /**
473
         * This method initializes jTextField
474
         *
475
         * @return javax.swing.JTextField
476
         */
477
        private JTextField getTxtId() {
478
                if (txtId == null) {
479
                        txtId = new JTextField();
480
                        txtId.setBounds(91, 72, 432, 20);
481
                        txtId.setName(PluginServices.getText(this, "id"));
482
                }
483
                return txtId;
484
        }
485

    
486
        /**
487
         * This method initializes txtFile
488
         *
489
         * @return javax.swing.JTextField
490
         */
491
        private JTextField getTxtFile() {
492
                if (txtFile == null) {
493
                        txtFile = new JTextField();
494
                        txtFile.setBounds(91, 96, 308, 20);
495
                }
496
                return txtFile;
497
        }
498

    
499
        /**
500
         * This method initializes btnAdvanced
501
         *
502
         * @return javax.swing.JButton
503
         */
504
        private JButton getBtnAdvanced() {
505
                if (btnAdvanced == null) {
506
                        btnAdvanced = new JButton();
507
//                        btnAdvanced.setBounds(403, 160, 120, 25);
508
                        btnAdvanced.setLocation(403, 160);
509
                        btnAdvanced.addActionListener(new java.awt.event.ActionListener() {
510
                                public void actionPerformed(java.awt.event.ActionEvent e) {
511
                                        advanced = !advanced;
512
                                        switchPanels();
513
                                }
514
                        });
515
                }
516
                return btnAdvanced;
517
        }
518

    
519
        /**
520
         * This method initializes btnAceptar
521
         *
522
         * @return javax.swing.JButton
523
         */
524
        private JButton getBtnOk() {
525
                if (btnOk == null) {
526
                        btnOk = new JButton();
527
                        btnOk.setText(PluginServices.getText(this, "Ok"));
528
                        btnOk.addActionListener(new java.awt.event.ActionListener() {
529
                                public void actionPerformed(java.awt.event.ActionEvent e) {
530
                                        execute("OK");
531
                                }
532
                        });
533
                }
534
                return btnOk;
535
        }
536

    
537
        /**
538
         * This method initializes btnCancel
539
         *
540
         * @return javax.swing.JButton
541
         */
542
        private JButton getBtnCancel() {
543
                if (btnCancel == null) {
544
                        btnCancel = new JButton();
545
                        btnCancel.setText(PluginServices.getText(this, "cancel"));
546
                        btnCancel.addActionListener(new java.awt.event.ActionListener() {
547
                                public void actionPerformed(java.awt.event.ActionEvent e) {
548
                                        execute("CANCEL");
549
                                }
550
                        });
551
                }
552
                return btnCancel;
553
        }
554

    
555
        /**
556
         * This method initializes txtAbstract
557
         *
558
         * @return javax.swing.JTextArea
559
         */
560
        private JTextArea getTxtAbstract() {
561
                if (txtAbstract == null) {
562
                        txtAbstract = new JTextArea();
563
                }
564
                return txtAbstract;
565
        }
566

    
567
        /**
568
         * This method initializes scrlAbstract
569
         *
570
         * @return javax.swing.JScrollPane
571
         */
572
        private JScrollPane getScrlAbstract() {
573
                if (scrlAbstract == null) {
574
                        scrlAbstract = new JScrollPane();
575
                        scrlAbstract.setBounds(115, 27, 232, 48);
576
                        scrlAbstract.setViewportView(getTxtAbstract());
577
                }
578
                return scrlAbstract;
579
        }
580

    
581
        /**
582
         * This method initializes txtLogoURL
583
         *
584
         * @return javax.swing.JTextField
585
         */
586
        private JTextField getTxtLogoURL() {
587
                if (txtLogoURL == null) {
588
                        txtLogoURL = new JTextField();
589
                        txtLogoURL.setBounds(115, 130, 407, 20);
590
                }
591
                return txtLogoURL;
592
        }
593

    
594
        /**
595
         * This method initializes jTextField
596
         *
597
         * @return javax.swing.JTextField
598
         */
599
        private JTextField getTxtDescriptionURL() {
600
                if (txtDescriptionURL == null) {
601
                        txtDescriptionURL = new JTextField();
602
                        txtDescriptionURL.setBounds(115, 104, 232, 20);
603
                }
604
                return txtDescriptionURL;
605
        }
606

    
607
        /**
608
         * This method initializes pnlMapSize
609
         *
610
         * @return javax.swing.JPanel
611
         */
612
        private JPanel getPnlMapSize() {
613
                if (pnlMapSize == null) {
614
                        ButtonGroup group = new ButtonGroup();
615
                        lblHeight = new JLabel();
616
                        lblHeight.setText(PluginServices.getText(this, "height"));
617
                        lblHeight.setBounds(11, 79, 52, 20);
618
                        lblHeight.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
619
                        lblHeight.setEnabled(false);
620
                        lblHeight.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
621
                        lblWidth = new JLabel();
622
                        lblWidth.setText(PluginServices.getText(this, "width"));
623
                        lblWidth.setBounds(11, 56, 52, 20);
624
                        lblWidth.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
625
                        lblWidth.setEnabled(false);
626
                        lblWidth.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
627
                        pnlMapSize = new JPanel();
628
                        pnlMapSize.setLayout(null);
629
                        pnlMapSize.setBounds(351, 19, 179, 108);
630
                        pnlMapSize.setBorder(javax.swing.BorderFactory.createTitledBorder(
631
                                          null, PluginServices.getText(this, "map_size_in_pixels"),
632
                                          javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
633
                                          javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
634
                        pnlMapSize.add(getRdBtnUseViewSize(), null);
635
                        pnlMapSize.add(getRdBtnCustomSize(), null);
636
                        pnlMapSize.add(lblWidth, null);
637
                        pnlMapSize.add(lblHeight, null);
638
                        pnlMapSize.add(getTxtWidth(), null);
639
                        pnlMapSize.add(getTxtHeight(), null);
640
                        group.add(getRdBtnUseViewSize());
641
                        group.add(getRdBtnCustomSize());
642

    
643
                }
644
                return pnlMapSize;
645
        }
646

    
647
        /**
648
         * This method initializes rdBtnUseViewSize
649
         *
650
         * @return javax.swing.JRadioButton
651
         */
652
        private JRadioButton getRdBtnUseViewSize() {
653
                if (rdBtnUseViewSize == null) {
654
                        rdBtnUseViewSize = new JRadioButton();
655
                        rdBtnUseViewSize.setBounds(8, 16, 142, 20);
656
                        rdBtnUseViewSize.setText(PluginServices.getText(this, "use_view_size"));
657
                        rdBtnUseViewSize.addItemListener(new java.awt.event.ItemListener() {
658
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
659
                                        boolean b = !getRdBtnUseViewSize().isSelected();
660

    
661
                                        getTxtWidth().setEnabled(b);
662
                                        getTxtHeight().setEnabled(b);
663
                                }
664
                        });
665
                        rdBtnUseViewSize.setSelected(true);
666
                }
667
                return rdBtnUseViewSize;
668
        }
669

    
670
        /**
671
         * This method initializes jRadioButton
672
         *
673
         * @return javax.swing.JRadioButton
674
         */
675
        private JRadioButton getRdBtnCustomSize() {
676
                if (rdBtnCustomSize == null) {
677
                        rdBtnCustomSize = new JRadioButton();
678
                        rdBtnCustomSize.setBounds(8, 34, 142, 20);
679
                        rdBtnCustomSize.setText(PluginServices.getText(this, "use_custom_size"));
680
                }
681
                return rdBtnCustomSize;
682
        }
683

    
684
        /**
685
         * This method initializes txtWidth
686
         *
687
         * @return javax.swing.JTextField
688
         */
689
        private JTextField getTxtWidth() {
690
                if (txtWidth == null) {
691
                        txtWidth = new JTextField();
692
                        txtWidth.setBounds(66, 56, 105, 20);
693
                        txtWidth.setEnabled(false);
694
                        txtWidth.addKeyListener(new java.awt.event.KeyAdapter() {
695
                                public void keyTyped(java.awt.event.KeyEvent e) {
696
                                        try {
697
                                                String text = getTxtWidth().getText();
698
                                                Integer.parseInt(text);
699
                                                lastWidth = text;
700
                                        } catch (Exception ex) {
701
                                                getTxtWidth().setText(lastWidth);
702
                                        }
703
                                }
704
                        });
705
                        Dimension sz = exportableViews[getCmbViews()
706
                                                            .getSelectedIndex()]
707
                                                            .getMapContext()
708
                                                            .getViewPort()
709
                                                            .getImageSize();
710
                        lastWidth = (sz != null)? (int) sz.getWidth()+"": defaultWidth+"";
711

    
712
                        txtWidth.setText(lastWidth);
713
                }
714
                return txtWidth;
715
        }
716

    
717
        /**
718
         * This method initializes jTextField
719
         *
720
         * @return javax.swing.JTextField
721
         */
722
        private JTextField getTxtHeight() {
723
                if (txtHeight == null) {
724
                        txtHeight = new JTextField();
725
                        txtHeight.setBounds(66, 79, 105, 20);
726
                        txtHeight.setEnabled(false);
727
                        txtHeight.addKeyListener(new java.awt.event.KeyAdapter() {
728
                                public void keyTyped(java.awt.event.KeyEvent e) {
729
                                        try {
730
                                                String text = getTxtHeight().getText();
731
                                                Integer.parseInt(text);
732
                                                lastHeight = text;
733
                                        } catch (Exception ex) {
734
                                                getTxtHeight().setText(lastHeight);
735
                                        }
736
                                }
737
                        });
738
                        Dimension sz = exportableViews[getCmbViews()
739
                                                            .getSelectedIndex()]
740
                                                            .getMapContext()
741
                                                            .getViewPort()
742
                                                            .getImageSize();
743
                        lastHeight = (sz != null)? (int) sz.getHeight()+"": defaultHeight+"";
744
                        txtHeight.setText(lastHeight);
745
                }
746
                return txtHeight;
747
        }
748

    
749
        /**
750
         * This method initializes pnlContactInfo
751
         *
752
         * @return javax.swing.JPanel
753
         */
754
        private JPanel getPnlContactInfo() {
755
                if (pnlContactInfo == null) {
756
                        lblEMail = new JLabel();
757
                        lblEMail.setBounds(7, 193, 98, 20);
758
                        lblEMail.setHorizontalTextPosition(SwingConstants.RIGHT);
759
                        lblEMail.setHorizontalAlignment(SwingConstants.RIGHT);
760
                        lblEMail.setText(PluginServices.getText(this, "e-mail")+":");
761
                        lblFax = new JLabel();
762
                        lblFax.setBounds(274, 168, 57, 20);
763
                        lblFax.setHorizontalTextPosition(SwingConstants.RIGHT);
764
                        lblFax.setHorizontalAlignment(SwingConstants.RIGHT);
765
                        lblFax.setText(PluginServices.getText(this, "fax")+":");
766
                        lblPostCode = new JLabel();
767
                        lblPostCode.setBounds(7, 143, 98, 20);
768
                        lblPostCode.setHorizontalTextPosition(SwingConstants.RIGHT);
769
                        lblPostCode.setHorizontalAlignment(SwingConstants.RIGHT);
770
                        lblPostCode.setText(PluginServices.getText(this, "postcode")+":");
771
                        lblPhone = new JLabel();
772
                        lblPhone.setBounds(7, 168, 98, 20);
773
                        lblPhone.setHorizontalTextPosition(SwingConstants.RIGHT);
774
                        lblPhone.setHorizontalAlignment(SwingConstants.RIGHT);
775
                        lblPhone.setText(PluginServices.getText(this, "telephone")+":");
776
                        lblCountry = new JLabel();
777
                        lblCountry.setBounds(274, 143, 57, 20);
778
                        lblCountry.setText(PluginServices.getText(this, "country")+":");
779
                        lblCountry.setHorizontalTextPosition(SwingConstants.RIGHT);
780
                        lblCountry.setHorizontalAlignment(SwingConstants.RIGHT);
781
                        lblStateProvince = new JLabel();
782
                        lblStateProvince.setBounds(252, 119, 111, 20);
783
                        lblStateProvince.setText(PluginServices.getText(this, "state_or_province")+":");
784
                        lblStateProvince.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
785
                        lblStateProvince.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
786

    
787
                        lblCity = new JLabel();
788
                        lblCity.setBounds(7, 119, 98, 20);
789
                        lblCity.setText(PluginServices.getText(this, "city")+":");
790
                        lblCity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
791
                        lblCity.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
792
                        lblContactPosition = new JLabel();
793
                        lblContactPosition.setBounds(6, 69, 99, 20);
794
                        lblContactPosition.setHorizontalTextPosition(SwingConstants.RIGHT);
795
                        lblContactPosition.setHorizontalAlignment(SwingConstants.RIGHT);
796
                        lblContactPosition.setText(PluginServices.getText(this, "contact_position"));
797
                        lblContactOrganization = new JLabel();
798
                        lblContactOrganization.setBounds(6, 44, 99, 20);
799
                        lblContactOrganization.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
800
                        lblContactOrganization.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
801
                        lblContactOrganization.setText(PluginServices.getText(this, "contact_organization")+":");
802
                        lblAddress = new JLabel();
803
                        lblAddress.setBounds(6, 94, 99, 20);
804
                        lblAddress.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
805
                        lblAddress.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
806
                        lblAddress.setText(PluginServices.getText(this, "address"));
807

    
808
                        lblContactPerson = new JLabel();
809
                        lblContactPerson.setText(PluginServices.getText(this, "contact_person")+":");
810
                        lblContactPerson.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
811
                        lblContactPerson.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
812
                        lblContactPerson.setBounds(6, 19, 99, 20);
813
                        pnlContactInfo = new JPanel();
814
                        pnlContactInfo.setLayout(null);
815
                        pnlContactInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(
816
                                          null, PluginServices.getText(this, "contact_info"),
817
                                          javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
818
                                          javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
819
                        pnlContactInfo.setLocation(4, 158);
820
                        pnlContactInfo.setSize(527, 223);
821
                        pnlContactInfo.add(lblContactPerson, null);
822
                        pnlContactInfo.add(getTxtContactPerson(), null);
823
                        pnlContactInfo.add(lblContactOrganization, null);
824
                        pnlContactInfo.add(getTxtOrganization(), null);
825
                        pnlContactInfo.add(lblContactPosition, null);
826
                        pnlContactInfo.add(getTxtContactPosition(), null);
827
                        pnlContactInfo.add(lblAddress, null);
828
                        pnlContactInfo.add(getTxtAddress(), null);
829
                        pnlContactInfo.add(lblCity, null);
830
                        pnlContactInfo.add(getTxtCity(), null);
831
                        pnlContactInfo.add(lblStateProvince, null);
832
                        pnlContactInfo.add(getCmbCountries(), null);
833
                        pnlContactInfo.add(getTxtStateOrProvince(), null);
834
                        pnlContactInfo.add(lblPostCode, null);
835
                        pnlContactInfo.add(getTxtPostCode(), null);
836
                        pnlContactInfo.add(lblCountry, null);
837
                        pnlContactInfo.add(lblPhone, null);
838
                        pnlContactInfo.add(getTxtTelephone(), null);
839
                        pnlContactInfo.add(lblFax, null);
840
                        pnlContactInfo.add(getTxtFax(), null);
841
                        pnlContactInfo.add(lblEMail, null);
842
                        pnlContactInfo.add(getTxtEMail(), null);
843
                }
844
                return pnlContactInfo;
845
        }
846

    
847
        /**
848
         * This method initializes jTextField1
849
         *
850
         * @return javax.swing.JTextField
851
         */
852
        private JTextField getTxtKeyWords() {
853
                if (txtKeyWords == null) {
854
                        txtKeyWords = new JTextField();
855
                        txtKeyWords.setBounds(115, 79, 232, 20);
856
                }
857
                return txtKeyWords;
858
        }
859

    
860
        /**
861
         * This method initializes jTextField1
862
         *
863
         * @return javax.swing.JTextField
864
         */
865
        private JTextField getTxtContactPerson() {
866
                if (txtContactPerson == null) {
867
                        txtContactPerson = new JTextField();
868
                        txtContactPerson.setBounds(111, 19, 407, 20);
869
                }
870
                return txtContactPerson;
871
        }
872

    
873
        /**
874
         * This method initializes jTextField2
875
         *
876
         * @return javax.swing.JTextField
877
         */
878
        private JTextField getTxtOrganization() {
879
                if (txtOrganization == null) {
880
                        txtOrganization = new JTextField();
881
                        txtOrganization.setBounds(111, 44, 407, 20);
882
                }
883
                return txtOrganization;
884
        }
885

    
886
        /**
887
         * This method initializes jTextField
888
         *
889
         * @return javax.swing.JTextField
890
         */
891
        private JTextField getTxtContactPosition() {
892
                if (txtContactPosition == null) {
893
                        txtContactPosition = new JTextField();
894
                        txtContactPosition.setBounds(111, 69, 407, 20);
895
                }
896
                return txtContactPosition;
897
        }
898

    
899
        /**
900
         * This method initializes txtAddress
901
         *
902
         * @return javax.swing.JTextField
903
         */
904
        private JTextField getTxtAddress() {
905
                if (txtAddress == null) {
906
                        txtAddress = new JTextField();
907
                        txtAddress.setBounds(111, 94, 407, 20);
908
                }
909
                return txtAddress;
910
        }
911

    
912
        /**
913
         * This method initializes txtCity
914
         *
915
         * @return javax.swing.JTextField
916
         */
917
        private JTextField getTxtCity() {
918
                if (txtCity == null) {
919
                        txtCity = new JTextField();
920
                        txtCity.setBounds(111, 119, 135, 20);
921
                }
922
                return txtCity;
923
        }
924

    
925
        /**
926
         * This method initializes txtStateOrProvince
927
         *
928
         * @return javax.swing.JTextField
929
         */
930
        private JTextField getTxtStateOrProvince() {
931
                if (txtStateOrProvince == null) {
932
                        txtStateOrProvince = new JTextField();
933
                        txtStateOrProvince.setBounds(368, 119, 150, 20);
934
                }
935
                return txtStateOrProvince;
936
        }
937

    
938
        /**
939
         * This method initializes txtPostCode
940
         *
941
         * @return javax.swing.JTextField
942
         */
943
        private JTextField getTxtPostCode() {
944
                if (txtPostCode == null) {
945
                        txtPostCode = new JTextField();
946
                        txtPostCode.setBounds(111, 143, 159, 20);
947
                }
948
                return txtPostCode;
949
        }
950

    
951
        /**
952
         * This method initializes cmbCountries
953
         *
954
         * @return javax.swing.JComboBox
955
         */
956
        private JComboBox getCmbCountries() {
957
                if (cmbCountries == null) {
958
                        cmbCountries = new JComboBox();
959
                        cmbCountries.setBounds(336, 143, 182, 20);
960
                        String[] countries = PluginServices.getText(this, "countries_of_the_world").split(";");
961
                        for (int i = 0; i < countries.length; i++) {
962
                                cmbCountries.addItem(countries[i]);
963
                        }
964
                }
965
                return cmbCountries;
966
        }
967

    
968
        /**
969
         * This method initializes txtTelephone
970
         *
971
         * @return javax.swing.JTextField
972
         */
973
        private JTextField getTxtTelephone() {
974
                if (txtTelephone == null) {
975
                        txtTelephone = new JTextField();
976
                        txtTelephone.setBounds(111, 168, 159, 20);
977
                }
978
                return txtTelephone;
979
        }
980

    
981
        /**
982
         * This method initializes txtFax
983
         *
984
         * @return javax.swing.JTextField
985
         */
986
        private JTextField getTxtFax() {
987
                if (txtFax == null) {
988
                        txtFax = new JTextField();
989
                        txtFax.setBounds(336, 168, 182, 20);
990
                }
991
                return txtFax;
992
        }
993

    
994
        /**
995
         * This method initializes txtEMail
996
         *
997
         * @return javax.swing.JTextField
998
         */
999
        private JTextField getTxtEMail() {
1000
                if (txtEMail == null) {
1001
                        txtEMail = new JTextField();
1002
                        txtEMail.setBounds(111, 193, 407, 20);
1003
                }
1004
                return txtEMail;
1005
        }
1006

    
1007
        public Object getWindowModel() {
1008
                return PluginServices.getText(this, "web_map_context_settings");
1009
        }
1010

    
1011
        private void execute(String actionCommand) {
1012
                if ("OK".equals(actionCommand)) {
1013
                        String str = getTxtFile().getText();
1014
                        if (str==null || str.equals("")) {
1015
                                JOptionPane.showMessageDialog(this, PluginServices.getText(this, "must_specify_a_file"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE);
1016
                                return;
1017
                        }
1018
                        ProjectView theView = exportableViews[getCmbViews().getSelectedIndex()];
1019
                        MapContext mc = theView.getMapContext();
1020
                        wmc = new WebMapContext();
1021

    
1022
                        // Version
1023
                        wmc.fileVersion = (String) getCmbVersion().getSelectedItem();
1024

    
1025
                        // Web Map Context size
1026
                        if (advanced) {
1027
                                if (getRdBtnUseViewSize().isSelected()) {
1028
                                        // View's size
1029
                                        Dimension sz = null;
1030
                                        if (mc.getViewPort().getImageSize()!=null)
1031
                                                sz = new Dimension(mc.getViewPort().getImageSize());
1032
                                        if (sz == null || (int) sz.getHeight()==0 || (int) sz.getWidth()==0)
1033
                                                // View's size is not initialized, will use default size.
1034
                                                sz = new Dimension(defaultWidth, defaultHeight);
1035
                                        wmc.windowSize = sz;
1036
                                } else {
1037
                                        // User defined size
1038
                                        try {
1039
                                        wmc.windowSize = new Dimension(Integer.parseInt(getTxtWidth().getText()),
1040
                                                                                                   Integer.parseInt(getTxtHeight().getText()));
1041
                                        } catch (Exception e) {
1042
                                                JOptionPane.showMessageDialog(this, PluginServices.getText(this, "invalid_dimension_values"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE);
1043
                                                return;
1044
                                        }
1045
                                }
1046
                        }
1047
                        // SRS
1048
                        wmc.srs = mc.getProjection().getAbrev();
1049

    
1050
                        // Bounding Box
1051
                        if (useFullExtent)
1052
                                try {
1053
                                wmc.bBox = mc.getFullExtent();
1054
                                } catch (DriverException dEx) {
1055
                                        NotificationManager.addError(dEx);
1056
                                        return;
1057
                                }
1058
                        else
1059
                                wmc.bBox = mc.getViewPort().getAdjustedExtent();
1060

    
1061
                        // Title
1062
                        str = getTxtTitle().getText();
1063
                        if (str!=null && !str.equals(""))
1064
                                wmc.title = str;
1065
                        else {
1066
                                JOptionPane.showMessageDialog(this, getTxtTitle().getName()+" "+PluginServices.getText(this, "is_required"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE);
1067
                                return;
1068
                        }
1069

    
1070
                        // ID
1071
                        str = getTxtId().getText();
1072
                        if (str!=null && !str.equals(""))
1073
                                wmc.id = str;
1074
                        else {
1075
                                JOptionPane.showMessageDialog(this, getTxtId().getName()+" "+PluginServices.getText(this, "is_required"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE);
1076
                                return;
1077
                        }
1078

    
1079
                        wmc.xmlns = WebMapContextTags.XMLNS_VALUE;
1080
                        wmc.xmlns_xlink = WebMapContextTags.XMLNS_XLINK_VALUE;
1081
                        wmc.xmlns_xsi = WebMapContextTags.XMLNS_XSI_VALUE;
1082
                        wmc.xsi_schemaLocation = WebMapContextTags.XSI_SCHEMA_LOCATION_VALUE;
1083

    
1084
                        // Abstract
1085
                        str = getTxtAbstract().getText();
1086
                        if (str!=null && !str.equals(""))
1087
                                wmc._abstract = str;
1088

    
1089
                        // Keyword list
1090
                        str = getTxtKeyWords().getText();
1091
                        if (str!=null && !str.equals("")) {
1092
                                String[] ss = str.split("[, ;:]+"); // sequence of spaces, commas, colons or semicolons will be treated as word separator
1093
                                for (int i = 0; i < ss.length; i++) {
1094
                                        if (wmc.keywordList==null) wmc.keywordList = new ArrayList();
1095
                                        wmc.keywordList.add(ss[i]);
1096
                                }
1097
                        }
1098

    
1099
                        // Logo URL
1100
                        str = getTxtLogoURL().getText();
1101
                        if (str!=null && !str.equals(""))
1102
                                wmc.logoURL = str;
1103

    
1104
                        wmc.logoURLSize = null;                        // yet skiped
1105
                        wmc.logoURLFormat = null;                // yet skiped
1106
                        wmc.descriptionURLFormat = null;// yet skiped
1107

    
1108
                        // Description URL
1109
                        str = getTxtLogoURL().getText();
1110
                        if (str!=null && !str.equals(""))
1111
                                wmc.descriptionURL = str;
1112

    
1113
                        // Contact Person
1114
                        str = getTxtContactPerson().getText();
1115
                        if (str!=null && !str.equals("")) {
1116
                                wmc.contactPerson = str;
1117
                                wmc.contactInfo = true;
1118
                        }
1119

    
1120
                        // Contact Organization
1121
                        str = getTxtOrganization().getText();
1122
                        if (str!=null && !str.equals("")) {
1123
                                wmc.contactOrganization = str;
1124
                                wmc.contactInfo = true;
1125
                        }
1126

    
1127
                        // Contact Position
1128
                        str = getTxtContactPosition().getText();
1129
                        if (str!=null && !str.equals("")) {
1130
                                wmc.contactPosition = str;
1131
                                wmc.contactInfo = true;
1132
                        }
1133

    
1134
                        // Address
1135
                        str = getTxtAddress().getText();
1136
                        if (str!=null && !str.equals("")) {
1137
                                wmc.address = str;
1138
                                wmc.contactInfo = true;
1139
                        }
1140

    
1141
                        // City
1142
                        str = getTxtCity().getText();
1143
                        if (str!=null && !str.equals("")) {
1144
                                wmc.city = str;
1145
                                wmc.contactInfo = true;
1146
                        }
1147

    
1148
                        // State/Province
1149
                        str = getTxtStateOrProvince().getText();
1150
                        if (str!=null && !str.equals("")) {
1151
                                wmc.stateOrProvince = str;
1152
                                wmc.contactInfo = true;
1153
                        }
1154

    
1155
                        // Postcode
1156
                        str = getTxtPostCode().getText();
1157
                        if (str!=null && !str.equals("")) {
1158
                                wmc.postCode = str;
1159
                        }
1160

    
1161
                        // Country
1162
                        str = (String) getCmbCountries().getSelectedItem();
1163
                        if (str!=null && !str.equals("")) {
1164
                                wmc.country = str;
1165
                        }
1166

    
1167
                        // Telephone
1168
                        str = getTxtTelephone().getText();
1169
                        if (str!=null && !str.equals("")) {
1170
                                wmc.telephone = str;
1171
                                wmc.contactInfo = true;
1172
                        }
1173

    
1174
                        // Fax
1175
                        str = getTxtFax().getText();
1176
                        if (str!=null && !str.equals("")) {
1177
                                wmc.fax = str;
1178
                                wmc.contactInfo = true;
1179
                        }
1180

    
1181
                        // e-mail
1182
                        str = getTxtEMail().getText();
1183
                        if (str!=null && !str.equals("")) {
1184
                                wmc.email = str;
1185
                                wmc.contactInfo = true;
1186
                        }
1187

    
1188
                        ExportWebMapContextExtension exp = (ExportWebMapContextExtension)
1189
                        PluginServices.
1190
                        getExtension(ExportWebMapContextExtension.class);
1191
                        exp.execute("DO_EXPORT");
1192
                        PluginServices.getMDIManager().closeWindow(this);
1193
                } else if ("CANCEL".equals(actionCommand)) {
1194
                        PluginServices.getMDIManager().closeWindow(this);
1195
                }
1196
        }
1197

    
1198
        public String getXML() {
1199
                return wmc.toXML(exportableViews[getCmbViews().getSelectedIndex()]);
1200
        }
1201

    
1202
        public File getTargetFile() {
1203
                if (targetFile == null) {
1204
                        String fileName = getTxtFile().getText();
1205
                        if (fileName != null)
1206
                                targetFile = new File(fileName);
1207
                }
1208
                return targetFile;
1209
        }
1210

    
1211
        /**
1212
         * This method initializes cmbViews
1213
         *
1214
         * @return javax.swing.JComboBox
1215
         */
1216
        private JComboBox getCmbViews() {
1217
                if (cmbViews == null) {
1218
                        cmbViews = new JComboBox();
1219
                        cmbViews.setBounds(91, 24, 432, 21);
1220
                        cmbViews.addItemListener(new java.awt.event.ItemListener() {
1221
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1222
                                        ProjectView theView = exportableViews[getCmbViews().getSelectedIndex()];
1223
                                        Dimension sz = theView.getMapContext().
1224
                                                                                   getViewPort().
1225
                                                                                   getImageSize();
1226
                                        if (sz == null || (int) sz.getHeight()==0 || (int) sz.getWidth()==0)
1227
                                                sz = new Dimension(defaultWidth, defaultHeight);
1228

    
1229
                                        getTxtWidth().setText((int) sz.getWidth()+"");
1230
                                        getTxtHeight().setText((int) sz.getHeight()+"");
1231
                                        getTxtTitle().setText(theView.getName());
1232
                                }
1233
                        });
1234
                        for (int i = 0; i < exportableViews.length; i++) {
1235
                                cmbViews.addItem(exportableViews[i].getName());
1236
                        }
1237
                }
1238
                return cmbViews;
1239
        }
1240

    
1241
        /**
1242
         * This method initializes rdCurrentViewExtent
1243
         *
1244
         * @return javax.swing.JRadioButton
1245
         */
1246
        private JRadioButton getRdBtnCurrentViewExtent() {
1247
                if (rdBtnCurrentViewExtent == null) {
1248
                        rdBtnCurrentViewExtent = new JRadioButton();
1249
                        rdBtnCurrentViewExtent.setBounds(91, 146, 270, 20);
1250
                        rdBtnCurrentViewExtent.setText(PluginServices.getText(this, "defined_by_view_extent"));
1251
                        rdBtnCurrentViewExtent.addItemListener(new java.awt.event.ItemListener() {
1252
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1253
                                        fPrefs.putBoolean("use_full_extent", !getRdBtnFullExtent().isEnabled());
1254
                                }
1255
                        });
1256
                        rdBtnCurrentViewExtent.setEnabled(!useFullExtent);
1257
                }
1258
                return rdBtnCurrentViewExtent;
1259
        }
1260

    
1261
        /**
1262
         * This method initializes rdBtnFullExtent
1263
         *
1264
         * @return javax.swing.JRadioButton
1265
         */
1266
        private JRadioButton getRdBtnFullExtent() {
1267
                if (rdBtnFullExtent == null) {
1268
                        rdBtnFullExtent = new JRadioButton();
1269
                        rdBtnFullExtent.setBounds(91, 164, 270, 20);
1270
                        rdBtnFullExtent.setText(PluginServices.getText(this, "use_full_extent"));
1271
                        rdBtnFullExtent.addItemListener(new java.awt.event.ItemListener() {
1272
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1273
                                        boolean b = getRdBtnFullExtent().isEnabled();
1274
                                        fPrefs.putBoolean("use_full_extent", getRdBtnFullExtent().isEnabled());
1275
                                        useFullExtent = b;
1276
                                }
1277
                        });
1278
                        rdBtnFullExtent.setSelected(useFullExtent);
1279
                }
1280
                return rdBtnFullExtent;
1281
        }
1282
}