Statistics
| Revision:

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

History | View | Annotate | Download (38.2 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 6819 2006-08-23 09:42:32Z jaume $
45
* $Log$
46
* Revision 1.12  2006-08-23 09:42:32  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.11  2006/08/23 09:40:03  jaume
50
* *** empty log message ***
51
*
52
* Revision 1.10  2006/07/21 11:51:13  jaume
53
* improved appearance in wms panel and a wmc bug fixed
54
*
55
* Revision 1.9  2006/06/30 08:02:57  jaume
56
* added a normative-sized button
57
*
58
* Revision 1.8  2006/05/25 10:28:12  jaume
59
* *** empty log message ***
60
*
61
* Revision 1.7  2006/05/25 07:42:55  jaume
62
* *** empty log message ***
63
*
64
* Revision 1.6  2006/05/12 07:47:39  jaume
65
* removed unnecessary imports
66
*
67
* Revision 1.5  2006/05/03 07:51:21  jaume
68
* *** empty log message ***
69
*
70
* Revision 1.4  2006/04/25 11:40:55  jaume
71
* *** empty log message ***
72
*
73
* Revision 1.3  2006/04/21 10:27:32  jaume
74
* exporting now supported
75
*
76
* Revision 1.2  2006/04/20 17:11:54  jaume
77
* Attempting to export
78
*
79
* Revision 1.1  2006/04/19 07:57:29  jaume
80
* *** empty log message ***
81
*
82
* Revision 1.1  2006/04/07 12:10:37  jaume
83
* *** empty log message ***
84
*
85
*
86
*/
87
package com.iver.cit.gvsig.gui.panels;
88

    
89
import java.awt.Component;
90
import java.awt.Dimension;
91
import java.io.File;
92
import java.util.ArrayList;
93
import java.util.prefs.Preferences;
94

    
95
import javax.swing.ButtonGroup;
96
import org.gvsig.gui.beans.swing.JButton;
97
import javax.swing.JComboBox;
98
import javax.swing.JFileChooser;
99
import javax.swing.JLabel;
100
import javax.swing.JOptionPane;
101
import javax.swing.JPanel;
102
import javax.swing.JRadioButton;
103
import javax.swing.JScrollPane;
104
import javax.swing.JTextArea;
105
import javax.swing.JTextField;
106
import javax.swing.SwingConstants;
107
import javax.swing.filechooser.FileFilter;
108

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

    
200
        public WebMapContextSettingsPanel(ProjectView[] views) {
201
                super();
202
                exportableViews = views;
203
                initialize();
204
        }
205

    
206
        /**
207
         * This method initializes this
208
         *
209
         * @return void
210
         */
211
        private void initialize() {
212
                this.setLayout(null);
213

    
214
                switchPanels();
215
        }
216

    
217
        private void switchPanels() {
218
                this.removeAll();
219
                Dimension sz;
220
                this.add(getSimplePanel(), java.awt.BorderLayout.NORTH);
221
                if (advanced) {
222
                        this.add(getAdvancedPanel(), java.awt.BorderLayout.CENTER);
223
                        sz = new Dimension(535, 640);
224
                        btnAdvanced.setText(strAdvanced+"  <<");
225

    
226
                } else {
227
                        sz = new Dimension(535, 260);
228
                        btnAdvanced.setText(strAdvanced+"  >>");
229

    
230
                }
231

    
232
                this.setSize(sz);
233

    
234

    
235
                this.add(getButtonsPanel(), java.awt.BorderLayout.SOUTH);
236
                fPrefs.putBoolean("advanced-panel", advanced);
237
                if (!first) {
238
                        PluginServices.getMDIManager().changeViewInfo(this, getViewInfo());
239

    
240
                        PluginServices.getMDIManager().closeView(this);
241
                        PluginServices.getMDIManager().addView(this);
242
                }
243
                first = false;
244
        }
245

    
246
        public ViewInfo getViewInfo() {
247

    
248
                m_viewInfo = new ViewInfo(ViewInfo.ICONIFIABLE);
249
                m_viewInfo.setTitle(PluginServices.getText(this, "web_map_context_settings"));
250
                m_viewInfo.setWidth(this.getWidth()+8);
251
                m_viewInfo.setHeight(getHeight());
252
                return m_viewInfo;
253
        }
254

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

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

    
369
        /**
370
         * This method initializes buttonsPanel
371
         *
372
         * @return javax.swing.JPanel
373
         */
374
        private JPanel getButtonsPanel() {
375
                if (buttonsPanel == null) {
376
                        FlowLayout flowLayout = new FlowLayout();
377
                        flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
378
                        buttonsPanel = new JPanel();
379
                        buttonsPanel.setLayout(flowLayout);
380
                        buttonsPanel.add(getBtnOk(), null);
381
                        buttonsPanel.add(getBtnCancel(), null);
382
                }
383
                buttonsPanel.setBounds(0, this.getHeight()-60, 535, 38);
384

    
385
                return buttonsPanel;
386
        }
387

    
388
        /**
389
         * This method initializes cmbVersion
390
         *
391
         * @return javax.swing.JComboBox
392
         */
393
        private JComboBox getCmbVersion() {
394
                if (cmbVersion == null) {
395
                        cmbVersion = new JComboBox();
396
                        cmbVersion.setSize(89, 20);
397
                        cmbVersion.setLocation(91, 120);
398
                        for (int i = 0; i < WebMapContext.exportVersions.size(); i++) {
399
                                cmbVersion.addItem(WebMapContext.exportVersions.get(i));
400
                        }
401

    
402
                }
403
                return cmbVersion;
404
        }
405

    
406

    
407

    
408
        /**
409
         * This method initializes btnBrowseFileSystem
410
         *
411
         * @return javax.swing.JButton
412
         */
413
        private JButton getBtnBrowseFileSystem() {
414
                if (btnBrowseFileSystem == null) {
415
                        btnBrowseFileSystem = new JButton();
416
                        btnBrowseFileSystem.setBounds(403, 95, 120, 22);
417
                        btnBrowseFileSystem.addActionListener(new java.awt.event.ActionListener() {
418
                                public void actionPerformed(java.awt.event.ActionEvent e) {
419
                                        JFileChooser fc = new JFileChooser();
420
                                        fc.setFileFilter(new FileFilter() {
421
                                                public boolean accept(File f) {
422
                                                        return f.isDirectory() || f.getAbsolutePath().toLowerCase().endsWith(WebMapContext.FILE_EXTENSION);
423
                                                }
424

    
425
                                                public String getDescription() {
426
                                                        return PluginServices.getText(this, "ogc_mapcontext_file")+" (*.cml)";
427
                                                }
428
                                        });
429
                                        if (fc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION){
430

    
431
                                                String fileName = fc.getSelectedFile().getAbsolutePath();
432
                                                if (!fileName.toLowerCase().endsWith(WebMapContext.FILE_EXTENSION))
433
                                                        fileName += WebMapContext.FILE_EXTENSION;
434
                                                targetFile = new File(fileName);
435
                                                getTxtFile().setText(fileName);
436
                                        }
437
                                        fc = null;
438
                                }
439
                        });
440
                        btnBrowseFileSystem.setText(PluginServices.getText(this, "browse"));
441
                }
442
                return btnBrowseFileSystem;
443
        }
444

    
445
        /**
446
         * This method initializes txtTitle
447
         *
448
         * @return javax.swing.JTextField
449
         */
450
        private JTextField getTxtTitle() {
451
                if (txtTitle == null) {
452
                        txtTitle = new JTextField();
453
                        txtTitle.setBounds(91, 48, 432, 20);
454
                        txtTitle.setName(PluginServices.getText(this, "title"));
455
                }
456
                return txtTitle;
457
        }
458

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

    
473
        /**
474
         * This method initializes txtFile
475
         *
476
         * @return javax.swing.JTextField
477
         */
478
        private JTextField getTxtFile() {
479
                if (txtFile == null) {
480
                        txtFile = new JTextField();
481
                        txtFile.setBounds(91, 96, 308, 20);
482
                }
483
                return txtFile;
484
        }
485

    
486
        /**
487
         * This method initializes btnAdvanced
488
         *
489
         * @return javax.swing.JButton
490
         */
491
        private JButton getBtnAdvanced() {
492
                if (btnAdvanced == null) {
493
                        btnAdvanced = new JButton();
494
//                        btnAdvanced.setBounds(403, 160, 120, 25);
495
                        btnAdvanced.setLocation(403, 160);
496
                        btnAdvanced.addActionListener(new java.awt.event.ActionListener() {
497
                                public void actionPerformed(java.awt.event.ActionEvent e) {
498
                                        advanced = !advanced;
499
                                        switchPanels();
500
                                }
501
                        });
502
                }
503
                return btnAdvanced;
504
        }
505

    
506
        /**
507
         * This method initializes btnAceptar
508
         *
509
         * @return javax.swing.JButton
510
         */
511
        private JButton getBtnOk() {
512
                if (btnOk == null) {
513
                        btnOk = new JButton();
514
                        btnOk.setText(PluginServices.getText(this, "Ok"));
515
                        btnOk.addActionListener(new java.awt.event.ActionListener() {
516
                                public void actionPerformed(java.awt.event.ActionEvent e) {
517
                                        execute("OK");
518
                                }
519
                        });
520
                }
521
                return btnOk;
522
        }
523

    
524
        /**
525
         * This method initializes btnCancel
526
         *
527
         * @return javax.swing.JButton
528
         */
529
        private JButton getBtnCancel() {
530
                if (btnCancel == null) {
531
                        btnCancel = new JButton();
532
                        btnCancel.setText(PluginServices.getText(this, "cancel"));
533
                        btnCancel.addActionListener(new java.awt.event.ActionListener() {
534
                                public void actionPerformed(java.awt.event.ActionEvent e) {
535
                                        execute("CANCEL");
536
                                }
537
                        });
538
                }
539
                return btnCancel;
540
        }
541

    
542
        /**
543
         * This method initializes txtAbstract
544
         *
545
         * @return javax.swing.JTextArea
546
         */
547
        private JTextArea getTxtAbstract() {
548
                if (txtAbstract == null) {
549
                        txtAbstract = new JTextArea();
550
                }
551
                return txtAbstract;
552
        }
553

    
554
        /**
555
         * This method initializes scrlAbstract
556
         *
557
         * @return javax.swing.JScrollPane
558
         */
559
        private JScrollPane getScrlAbstract() {
560
                if (scrlAbstract == null) {
561
                        scrlAbstract = new JScrollPane();
562
                        scrlAbstract.setBounds(115, 27, 232, 48);
563
                        scrlAbstract.setViewportView(getTxtAbstract());
564
                }
565
                return scrlAbstract;
566
        }
567

    
568
        /**
569
         * This method initializes txtLogoURL
570
         *
571
         * @return javax.swing.JTextField
572
         */
573
        private JTextField getTxtLogoURL() {
574
                if (txtLogoURL == null) {
575
                        txtLogoURL = new JTextField();
576
                        txtLogoURL.setBounds(115, 130, 407, 20);
577
                }
578
                return txtLogoURL;
579
        }
580

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

    
594
        /**
595
         * This method initializes pnlMapSize
596
         *
597
         * @return javax.swing.JPanel
598
         */
599
        private JPanel getPnlMapSize() {
600
                if (pnlMapSize == null) {
601
                        ButtonGroup group = new ButtonGroup();
602
                        lblHeight = new JLabel();
603
                        lblHeight.setText(PluginServices.getText(this, "height"));
604
                        lblHeight.setBounds(11, 79, 52, 20);
605
                        lblHeight.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
606
                        lblHeight.setEnabled(false);
607
                        lblHeight.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
608
                        lblWidth = new JLabel();
609
                        lblWidth.setText(PluginServices.getText(this, "width"));
610
                        lblWidth.setBounds(11, 56, 52, 20);
611
                        lblWidth.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
612
                        lblWidth.setEnabled(false);
613
                        lblWidth.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
614
                        pnlMapSize = new JPanel();
615
                        pnlMapSize.setLayout(null);
616
                        pnlMapSize.setBounds(351, 19, 179, 108);
617
                        pnlMapSize.setBorder(javax.swing.BorderFactory.createTitledBorder(
618
                                          null, PluginServices.getText(this, "map_size_in_pixels"),
619
                                          javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
620
                                          javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
621
                        pnlMapSize.add(getRdBtnUseViewSize(), null);
622
                        pnlMapSize.add(getRdBtnCustomSize(), null);
623
                        pnlMapSize.add(lblWidth, null);
624
                        pnlMapSize.add(lblHeight, null);
625
                        pnlMapSize.add(getTxtWidth(), null);
626
                        pnlMapSize.add(getTxtHeight(), null);
627
                        group.add(getRdBtnUseViewSize());
628
                        group.add(getRdBtnCustomSize());
629

    
630
                }
631
                return pnlMapSize;
632
        }
633

    
634
        /**
635
         * This method initializes rdBtnUseViewSize
636
         *
637
         * @return javax.swing.JRadioButton
638
         */
639
        private JRadioButton getRdBtnUseViewSize() {
640
                if (rdBtnUseViewSize == null) {
641
                        rdBtnUseViewSize = new JRadioButton();
642
                        rdBtnUseViewSize.setBounds(8, 16, 142, 20);
643
                        rdBtnUseViewSize.setText(PluginServices.getText(this, "use_view_size"));
644
                        rdBtnUseViewSize.addItemListener(new java.awt.event.ItemListener() {
645
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
646
                                        boolean b = !getRdBtnUseViewSize().isSelected();
647

    
648
                                        getTxtWidth().setEnabled(b);
649
                                        getTxtHeight().setEnabled(b);
650
                                }
651
                        });
652
                        rdBtnUseViewSize.setSelected(true);
653
                }
654
                return rdBtnUseViewSize;
655
        }
656

    
657
        /**
658
         * This method initializes jRadioButton
659
         *
660
         * @return javax.swing.JRadioButton
661
         */
662
        private JRadioButton getRdBtnCustomSize() {
663
                if (rdBtnCustomSize == null) {
664
                        rdBtnCustomSize = new JRadioButton();
665
                        rdBtnCustomSize.setBounds(8, 34, 142, 20);
666
                        rdBtnCustomSize.setText(PluginServices.getText(this, "use_custom_size"));
667
                }
668
                return rdBtnCustomSize;
669
        }
670

    
671
        /**
672
         * This method initializes txtWidth
673
         *
674
         * @return javax.swing.JTextField
675
         */
676
        private JTextField getTxtWidth() {
677
                if (txtWidth == null) {
678
                        txtWidth = new JTextField();
679
                        txtWidth.setBounds(66, 56, 105, 20);
680
                        txtWidth.setEnabled(false);
681
                        txtWidth.addKeyListener(new java.awt.event.KeyAdapter() {
682
                                public void keyTyped(java.awt.event.KeyEvent e) {
683
                                        try {
684
                                                String text = getTxtWidth().getText();
685
                                                Integer.parseInt(text);
686
                                                lastWidth = text;
687
                                        } catch (Exception ex) {
688
                                                getTxtWidth().setText(lastWidth);
689
                                        }
690
                                }
691
                        });
692
                        Dimension sz = exportableViews[getCmbViews()
693
                                                            .getSelectedIndex()]
694
                                                            .getMapContext()
695
                                                            .getViewPort()
696
                                                            .getImageSize();
697
                        lastWidth = (sz != null)? (int) sz.getWidth()+"": defaultWidth+"";
698

    
699
                        txtWidth.setText(lastWidth);
700
                }
701
                return txtWidth;
702
        }
703

    
704
        /**
705
         * This method initializes jTextField
706
         *
707
         * @return javax.swing.JTextField
708
         */
709
        private JTextField getTxtHeight() {
710
                if (txtHeight == null) {
711
                        txtHeight = new JTextField();
712
                        txtHeight.setBounds(66, 79, 105, 20);
713
                        txtHeight.setEnabled(false);
714
                        txtHeight.addKeyListener(new java.awt.event.KeyAdapter() {
715
                                public void keyTyped(java.awt.event.KeyEvent e) {
716
                                        try {
717
                                                String text = getTxtHeight().getText();
718
                                                Integer.parseInt(text);
719
                                                lastHeight = text;
720
                                        } catch (Exception ex) {
721
                                                getTxtHeight().setText(lastHeight);
722
                                        }
723
                                }
724
                        });
725
                        Dimension sz = exportableViews[getCmbViews()
726
                                                            .getSelectedIndex()]
727
                                                            .getMapContext()
728
                                                            .getViewPort()
729
                                                            .getImageSize();
730
                        lastHeight = (sz != null)? (int) sz.getHeight()+"": defaultHeight+"";
731
                        txtHeight.setText(lastHeight);
732
                }
733
                return txtHeight;
734
        }
735

    
736
        /**
737
         * This method initializes pnlContactInfo
738
         *
739
         * @return javax.swing.JPanel
740
         */
741
        private JPanel getPnlContactInfo() {
742
                if (pnlContactInfo == null) {
743
                        lblEMail = new JLabel();
744
                        lblEMail.setBounds(7, 193, 98, 20);
745
                        lblEMail.setHorizontalTextPosition(SwingConstants.RIGHT);
746
                        lblEMail.setHorizontalAlignment(SwingConstants.RIGHT);
747
                        lblEMail.setText(PluginServices.getText(this, "e-mail")+":");
748
                        lblFax = new JLabel();
749
                        lblFax.setBounds(274, 168, 57, 20);
750
                        lblFax.setHorizontalTextPosition(SwingConstants.RIGHT);
751
                        lblFax.setHorizontalAlignment(SwingConstants.RIGHT);
752
                        lblFax.setText(PluginServices.getText(this, "fax")+":");
753
                        lblPostCode = new JLabel();
754
                        lblPostCode.setBounds(7, 143, 98, 20);
755
                        lblPostCode.setHorizontalTextPosition(SwingConstants.RIGHT);
756
                        lblPostCode.setHorizontalAlignment(SwingConstants.RIGHT);
757
                        lblPostCode.setText(PluginServices.getText(this, "postcode")+":");
758
                        lblPhone = new JLabel();
759
                        lblPhone.setBounds(7, 168, 98, 20);
760
                        lblPhone.setHorizontalTextPosition(SwingConstants.RIGHT);
761
                        lblPhone.setHorizontalAlignment(SwingConstants.RIGHT);
762
                        lblPhone.setText(PluginServices.getText(this, "telephone")+":");
763
                        lblCountry = new JLabel();
764
                        lblCountry.setBounds(274, 143, 57, 20);
765
                        lblCountry.setText(PluginServices.getText(this, "country")+":");
766
                        lblCountry.setHorizontalTextPosition(SwingConstants.RIGHT);
767
                        lblCountry.setHorizontalAlignment(SwingConstants.RIGHT);
768
                        lblStateProvince = new JLabel();
769
                        lblStateProvince.setBounds(252, 119, 111, 20);
770
                        lblStateProvince.setText(PluginServices.getText(this, "state_or_province")+":");
771
                        lblStateProvince.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
772
                        lblStateProvince.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
773

    
774
                        lblCity = new JLabel();
775
                        lblCity.setBounds(7, 119, 98, 20);
776
                        lblCity.setText(PluginServices.getText(this, "city")+":");
777
                        lblCity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
778
                        lblCity.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
779
                        lblContactPosition = new JLabel();
780
                        lblContactPosition.setBounds(6, 69, 99, 20);
781
                        lblContactPosition.setHorizontalTextPosition(SwingConstants.RIGHT);
782
                        lblContactPosition.setHorizontalAlignment(SwingConstants.RIGHT);
783
                        lblContactPosition.setText(PluginServices.getText(this, "contact_position"));
784
                        lblContactOrganization = new JLabel();
785
                        lblContactOrganization.setBounds(6, 44, 99, 20);
786
                        lblContactOrganization.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
787
                        lblContactOrganization.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
788
                        lblContactOrganization.setText(PluginServices.getText(this, "contact_organization")+":");
789
                        lblAddress = new JLabel();
790
                        lblAddress.setBounds(6, 94, 99, 20);
791
                        lblAddress.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
792
                        lblAddress.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
793
                        lblAddress.setText(PluginServices.getText(this, "address"));
794

    
795
                        lblContactPerson = new JLabel();
796
                        lblContactPerson.setText(PluginServices.getText(this, "contact_person")+":");
797
                        lblContactPerson.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
798
                        lblContactPerson.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
799
                        lblContactPerson.setBounds(6, 19, 99, 20);
800
                        pnlContactInfo = new JPanel();
801
                        pnlContactInfo.setLayout(null);
802
                        pnlContactInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(
803
                                          null, PluginServices.getText(this, "contact_info"),
804
                                          javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
805
                                          javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
806
                        pnlContactInfo.setLocation(4, 158);
807
                        pnlContactInfo.setSize(527, 223);
808
                        pnlContactInfo.add(lblContactPerson, null);
809
                        pnlContactInfo.add(getTxtContactPerson(), null);
810
                        pnlContactInfo.add(lblContactOrganization, null);
811
                        pnlContactInfo.add(getTxtOrganization(), null);
812
                        pnlContactInfo.add(lblContactPosition, null);
813
                        pnlContactInfo.add(getTxtContactPosition(), null);
814
                        pnlContactInfo.add(lblAddress, null);
815
                        pnlContactInfo.add(getTxtAddress(), null);
816
                        pnlContactInfo.add(lblCity, null);
817
                        pnlContactInfo.add(getTxtCity(), null);
818
                        pnlContactInfo.add(lblStateProvince, null);
819
                        pnlContactInfo.add(getCmbCountries(), null);
820
                        pnlContactInfo.add(getTxtStateOrProvince(), null);
821
                        pnlContactInfo.add(lblPostCode, null);
822
                        pnlContactInfo.add(getTxtPostCode(), null);
823
                        pnlContactInfo.add(lblCountry, null);
824
                        pnlContactInfo.add(lblPhone, null);
825
                        pnlContactInfo.add(getTxtTelephone(), null);
826
                        pnlContactInfo.add(lblFax, null);
827
                        pnlContactInfo.add(getTxtFax(), null);
828
                        pnlContactInfo.add(lblEMail, null);
829
                        pnlContactInfo.add(getTxtEMail(), null);
830
                }
831
                return pnlContactInfo;
832
        }
833

    
834
        /**
835
         * This method initializes jTextField1
836
         *
837
         * @return javax.swing.JTextField
838
         */
839
        private JTextField getTxtKeyWords() {
840
                if (txtKeyWords == null) {
841
                        txtKeyWords = new JTextField();
842
                        txtKeyWords.setBounds(115, 79, 232, 20);
843
                }
844
                return txtKeyWords;
845
        }
846

    
847
        /**
848
         * This method initializes jTextField1
849
         *
850
         * @return javax.swing.JTextField
851
         */
852
        private JTextField getTxtContactPerson() {
853
                if (txtContactPerson == null) {
854
                        txtContactPerson = new JTextField();
855
                        txtContactPerson.setBounds(111, 19, 407, 20);
856
                }
857
                return txtContactPerson;
858
        }
859

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

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

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

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

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

    
925
        /**
926
         * This method initializes txtPostCode
927
         *
928
         * @return javax.swing.JTextField
929
         */
930
        private JTextField getTxtPostCode() {
931
                if (txtPostCode == null) {
932
                        txtPostCode = new JTextField();
933
                        txtPostCode.setBounds(111, 143, 159, 20);
934
                }
935
                return txtPostCode;
936
        }
937

    
938
        /**
939
         * This method initializes cmbCountries
940
         *
941
         * @return javax.swing.JComboBox
942
         */
943
        private JComboBox getCmbCountries() {
944
                if (cmbCountries == null) {
945
                        cmbCountries = new JComboBox();
946
                        cmbCountries.setBounds(336, 143, 182, 20);
947
                        String[] countries = PluginServices.getText(this, "countries_of_the_world").split(";");
948
                        for (int i = 0; i < countries.length; i++) {
949
                                cmbCountries.addItem(countries[i]);
950
                        }
951
                }
952
                return cmbCountries;
953
        }
954

    
955
        /**
956
         * This method initializes txtTelephone
957
         *
958
         * @return javax.swing.JTextField
959
         */
960
        private JTextField getTxtTelephone() {
961
                if (txtTelephone == null) {
962
                        txtTelephone = new JTextField();
963
                        txtTelephone.setBounds(111, 168, 159, 20);
964
                }
965
                return txtTelephone;
966
        }
967

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

    
981
        /**
982
         * This method initializes txtEMail
983
         *
984
         * @return javax.swing.JTextField
985
         */
986
        private JTextField getTxtEMail() {
987
                if (txtEMail == null) {
988
                        txtEMail = new JTextField();
989
                        txtEMail.setBounds(111, 193, 407, 20);
990
                }
991
                return txtEMail;
992
        }
993

    
994
        public Object getViewModel() {
995
                return PluginServices.getText(this, "web_map_context_settings");
996
        }
997

    
998
        private void execute(String actionCommand) {
999
                if ("OK".equals(actionCommand)) {
1000
                        String str = getTxtFile().getText();
1001
                        if (str==null || str.equals("")) {
1002
                                JOptionPane.showMessageDialog(this, PluginServices.getText(this, "must_specify_a_file"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE);
1003
                                return;
1004
                        }
1005
                        ProjectView theView = exportableViews[getCmbViews().getSelectedIndex()];
1006
                        FMap mc = theView.getMapContext();
1007
                        wmc = new WebMapContext();
1008

    
1009
                        // Version
1010
                        wmc.fileVersion = (String) getCmbVersion().getSelectedItem();
1011

    
1012
                        // Web Map Context size
1013
                        if (advanced) {
1014
                                if (getRdBtnUseViewSize().isSelected()) {
1015
                                        // View's size
1016
                                        Dimension sz = null;
1017
                                        if (mc.getViewPort().getImageSize()!=null)
1018
                                                sz = new Dimension(mc.getViewPort().getImageSize());
1019
                                        if (sz == null || (int) sz.getHeight()==0 || (int) sz.getWidth()==0)
1020
                                                // View's size is not initialized, will use default size.
1021
                                                sz = new Dimension(defaultWidth, defaultHeight);
1022
                                        wmc.windowSize = sz;
1023
                                } else {
1024
                                        // User defined size
1025
                                        try {
1026
                                        wmc.windowSize = new Dimension(Integer.parseInt(getTxtWidth().getText()),
1027
                                                                                                   Integer.parseInt(getTxtHeight().getText()));
1028
                                        } catch (Exception e) {
1029
                                                JOptionPane.showMessageDialog(this, PluginServices.getText(this, "invalid_dimension_values"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE);
1030
                                                return;
1031
                                        }
1032
                                }
1033
                        }
1034
                        // SRS
1035
                        wmc.srs = mc.getProjection().getAbrev();
1036

    
1037
                        // Bounding Box
1038
                        if (useFullExtent)
1039
                                try {
1040
                                wmc.bBox = mc.getFullExtent();
1041
                                } catch (DriverException dEx) {
1042
                                        NotificationManager.addError(dEx);
1043
                                        return;
1044
                                }
1045
                        else
1046
                                wmc.bBox = mc.getViewPort().getAdjustedExtent();
1047

    
1048
                        // Title
1049
                        str = getTxtTitle().getText();
1050
                        if (str!=null && !str.equals(""))
1051
                                wmc.title = str;
1052
                        else {
1053
                                JOptionPane.showMessageDialog(this, getTxtTitle().getName()+" "+PluginServices.getText(this, "is_required"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE);
1054
                                return;
1055
                        }
1056

    
1057
                        // ID
1058
                        str = getTxtId().getText();
1059
                        if (str!=null && !str.equals(""))
1060
                                wmc.id = str;
1061
                        else {
1062
                                JOptionPane.showMessageDialog(this, getTxtId().getName()+" "+PluginServices.getText(this, "is_required"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE);
1063
                                return;
1064
                        }
1065

    
1066
                        wmc.xmlns = WebMapContextTags.XMLNS_VALUE;
1067
                        wmc.xmlns_xlink = WebMapContextTags.XMLNS_XLINK_VALUE;
1068
                        wmc.xmlns_xsi = WebMapContextTags.XMLNS_XSI_VALUE;
1069
                        wmc.xsi_schemaLocation = WebMapContextTags.XSI_SCHEMA_LOCATION_VALUE;
1070

    
1071
                        // Abstract
1072
                        str = getTxtAbstract().getText();
1073
                        if (str!=null && !str.equals(""))
1074
                                wmc._abstract = str;
1075

    
1076
                        // Keyword list
1077
                        str = getTxtKeyWords().getText();
1078
                        if (str!=null && !str.equals("")) {
1079
                                String[] ss = str.split("[, ;:]+"); // sequence of spaces, commas, colons or semicolons will be treated as word separator
1080
                                for (int i = 0; i < ss.length; i++) {
1081
                                        if (wmc.keywordList==null) wmc.keywordList = new ArrayList();
1082
                                        wmc.keywordList.add(ss[i]);
1083
                                }
1084
                        }
1085

    
1086
                        // Logo URL
1087
                        str = getTxtLogoURL().getText();
1088
                        if (str!=null && !str.equals(""))
1089
                                wmc.logoURL = str;
1090

    
1091
                        wmc.logoURLSize = null;                        // yet skiped
1092
                        wmc.logoURLFormat = null;                // yet skiped
1093
                        wmc.descriptionURLFormat = null;// yet skiped
1094

    
1095
                        // Description URL
1096
                        str = getTxtLogoURL().getText();
1097
                        if (str!=null && !str.equals(""))
1098
                                wmc.descriptionURL = str;
1099

    
1100
                        // Contact Person
1101
                        str = getTxtContactPerson().getText();
1102
                        if (str!=null && !str.equals("")) {
1103
                                wmc.contactPerson = str;
1104
                                wmc.contactInfo = true;
1105
                        }
1106

    
1107
                        // Contact Organization
1108
                        str = getTxtOrganization().getText();
1109
                        if (str!=null && !str.equals("")) {
1110
                                wmc.contactOrganization = str;
1111
                                wmc.contactInfo = true;
1112
                        }
1113

    
1114
                        // Contact Position
1115
                        str = getTxtContactPosition().getText();
1116
                        if (str!=null && !str.equals("")) {
1117
                                wmc.contactPosition = str;
1118
                                wmc.contactInfo = true;
1119
                        }
1120

    
1121
                        // Address
1122
                        str = getTxtAddress().getText();
1123
                        if (str!=null && !str.equals("")) {
1124
                                wmc.address = str;
1125
                                wmc.contactInfo = true;
1126
                        }
1127

    
1128
                        // City
1129
                        str = getTxtCity().getText();
1130
                        if (str!=null && !str.equals("")) {
1131
                                wmc.city = str;
1132
                                wmc.contactInfo = true;
1133
                        }
1134

    
1135
                        // State/Province
1136
                        str = getTxtStateOrProvince().getText();
1137
                        if (str!=null && !str.equals("")) {
1138
                                wmc.stateOrProvince = str;
1139
                                wmc.contactInfo = true;
1140
                        }
1141

    
1142
                        // Postcode
1143
                        str = getTxtPostCode().getText();
1144
                        if (str!=null && !str.equals("")) {
1145
                                wmc.postCode = str;
1146
                        }
1147

    
1148
                        // Country
1149
                        str = (String) getCmbCountries().getSelectedItem();
1150
                        if (str!=null && !str.equals("")) {
1151
                                wmc.country = str;
1152
                        }
1153

    
1154
                        // Telephone
1155
                        str = getTxtTelephone().getText();
1156
                        if (str!=null && !str.equals("")) {
1157
                                wmc.telephone = str;
1158
                                wmc.contactInfo = true;
1159
                        }
1160

    
1161
                        // Fax
1162
                        str = getTxtFax().getText();
1163
                        if (str!=null && !str.equals("")) {
1164
                                wmc.fax = str;
1165
                                wmc.contactInfo = true;
1166
                        }
1167

    
1168
                        // e-mail
1169
                        str = getTxtEMail().getText();
1170
                        if (str!=null && !str.equals("")) {
1171
                                wmc.email = str;
1172
                                wmc.contactInfo = true;
1173
                        }
1174

    
1175
                        ExportWebMapContextExtension exp = (ExportWebMapContextExtension)
1176
                        PluginServices.
1177
                        getExtension(ExportWebMapContextExtension.class);
1178
                        exp.execute("DO_EXPORT");
1179
                        PluginServices.getMDIManager().closeView(this);
1180
                } else if ("CANCEL".equals(actionCommand)) {
1181
                        PluginServices.getMDIManager().closeView(this);
1182
                }
1183
        }
1184

    
1185
        public String getXML() {
1186
                return wmc.toXML(exportableViews[getCmbViews().getSelectedIndex()]);
1187
        }
1188

    
1189
        public File getTargetFile() {
1190
                if (targetFile == null) {
1191
                        String fileName = getTxtFile().getText();
1192
                        if (fileName != null)
1193
                                targetFile = new File(fileName);
1194
                }
1195
                return targetFile;
1196
        }
1197

    
1198
        /**
1199
         * This method initializes cmbViews
1200
         *
1201
         * @return javax.swing.JComboBox
1202
         */
1203
        private JComboBox getCmbViews() {
1204
                if (cmbViews == null) {
1205
                        cmbViews = new JComboBox();
1206
                        cmbViews.setBounds(91, 24, 432, 21);
1207
                        cmbViews.addItemListener(new java.awt.event.ItemListener() {
1208
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1209
                                        ProjectView theView = exportableViews[getCmbViews().getSelectedIndex()];
1210
                                        Dimension sz = theView.getMapContext().
1211
                                                                                   getViewPort().
1212
                                                                                   getImageSize();
1213
                                        if (sz == null || (int) sz.getHeight()==0 || (int) sz.getWidth()==0)
1214
                                                sz = new Dimension(defaultWidth, defaultHeight);
1215

    
1216
                                        getTxtWidth().setText((int) sz.getWidth()+"");
1217
                                        getTxtHeight().setText((int) sz.getHeight()+"");
1218
                                        getTxtTitle().setText(theView.getName());
1219
                                }
1220
                        });
1221
                        for (int i = 0; i < exportableViews.length; i++) {
1222
                                cmbViews.addItem(exportableViews[i].getName());
1223
                        }
1224
                }
1225
                return cmbViews;
1226
        }
1227

    
1228
        /**
1229
         * This method initializes rdCurrentViewExtent
1230
         *
1231
         * @return javax.swing.JRadioButton
1232
         */
1233
        private JRadioButton getRdBtnCurrentViewExtent() {
1234
                if (rdBtnCurrentViewExtent == null) {
1235
                        rdBtnCurrentViewExtent = new JRadioButton();
1236
                        rdBtnCurrentViewExtent.setBounds(91, 146, 270, 20);
1237
                        rdBtnCurrentViewExtent.setText(PluginServices.getText(this, "defined_by_view_extent"));
1238
                        rdBtnCurrentViewExtent.addItemListener(new java.awt.event.ItemListener() {
1239
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1240
                                        fPrefs.putBoolean("use_full_extent", !getRdBtnFullExtent().isEnabled());
1241
                                }
1242
                        });
1243
                        rdBtnCurrentViewExtent.setEnabled(!useFullExtent);
1244
                }
1245
                return rdBtnCurrentViewExtent;
1246
        }
1247

    
1248
        /**
1249
         * This method initializes rdBtnFullExtent
1250
         *
1251
         * @return javax.swing.JRadioButton
1252
         */
1253
        private JRadioButton getRdBtnFullExtent() {
1254
                if (rdBtnFullExtent == null) {
1255
                        rdBtnFullExtent = new JRadioButton();
1256
                        rdBtnFullExtent.setBounds(91, 164, 270, 20);
1257
                        rdBtnFullExtent.setText(PluginServices.getText(this, "use_full_extent"));
1258
                        rdBtnFullExtent.addItemListener(new java.awt.event.ItemListener() {
1259
                                public void itemStateChanged(java.awt.event.ItemEvent e) {
1260
                                        boolean b = getRdBtnFullExtent().isEnabled();
1261
                                        fPrefs.putBoolean("use_full_extent", getRdBtnFullExtent().isEnabled());
1262
                                        useFullExtent = b;
1263
                                }
1264
                        });
1265
                        rdBtnFullExtent.setSelected(useFullExtent);
1266
                }
1267
                return rdBtnFullExtent;
1268
        }
1269
}