Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / view / gui / ViewProperties.java @ 38877

History | View | Annotate | Download (23.1 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.app.project.documents.view.gui;
23

    
24
import java.awt.BorderLayout;
25
import java.awt.Color;
26
import java.awt.Component;
27
import java.awt.Dimension;
28
import java.awt.GridBagConstraints;
29
import java.awt.GridBagLayout;
30
import java.awt.GridLayout;
31
import java.awt.Insets;
32
import java.awt.event.ActionListener;
33
import java.awt.event.MouseEvent;
34
import java.awt.event.MouseListener;
35
import java.util.List;
36

    
37
import javax.swing.BorderFactory;
38
import javax.swing.JButton;
39
import javax.swing.JCheckBox;
40
import javax.swing.JColorChooser;
41
import javax.swing.JComboBox;
42
import javax.swing.JComponent;
43
import javax.swing.JLabel;
44
import javax.swing.JOptionPane;
45
import javax.swing.JPanel;
46

    
47
import org.cresques.cts.IProjection;
48

    
49
import org.gvsig.andami.PluginServices;
50
import org.gvsig.andami.ui.mdiManager.SingletonWindow;
51
import org.gvsig.andami.ui.mdiManager.WindowInfo;
52
import org.gvsig.app.gui.JComboBoxUnits;
53
import org.gvsig.app.gui.panels.CRSSelectPanel;
54
import org.gvsig.app.gui.preferencespage.ViewPage;
55
import org.gvsig.app.project.DefaultProject;
56
import org.gvsig.app.project.Project;
57
import org.gvsig.app.project.ProjectManager;
58
import org.gvsig.app.project.ProjectPreferences;
59
import org.gvsig.app.project.documents.Document;
60
import org.gvsig.app.project.documents.view.DefaultViewDocument;
61
import org.gvsig.app.project.documents.view.ViewManager;
62
import org.gvsig.fmap.crs.CRSFactory;
63
import org.gvsig.fmap.mapcontext.MapContext;
64
import org.gvsig.gui.beans.AcceptCancelPanel;
65
import org.gvsig.i18n.Messages;
66
import org.gvsig.utils.XMLEntity;
67

    
68
/**
69
 * Dialogo donde se muestran las propiedades de una vista
70
 * 
71
 * @author Fernando Gonz?lez Cort?s
72
 * @author gvSIG Team
73
 */
74
public class ViewProperties extends JPanel implements SingletonWindow {
75

    
76
    private static final long serialVersionUID = 5328865370833315385L;
77
    
78
    public static final int FIXED_WIDTH = 300;
79
    
80
    private javax.swing.JLabel jLabelName = null;
81
    private javax.swing.JTextField txtName = null;
82
    private javax.swing.JLabel jLabelDate = null;
83
    private javax.swing.JTextField txtDate = null;
84
    private javax.swing.JLabel jLabelOwner = null;
85
    private javax.swing.JTextField txtOwner = null;
86
    private javax.swing.JLabel jLabelMapUnits = null;
87
    private javax.swing.JComboBox cmbMapUnits = null;
88
    private javax.swing.JLabel jLabelDistanceUnits = null;
89
    private javax.swing.JComboBox cmbDistanceUnits = null;
90
    private javax.swing.JLabel jLabelAreaUnits = null;
91
    private javax.swing.JTextArea txtComments = null;
92
    private javax.swing.JLabel jLabelColor = null;
93
    private javax.swing.JLabel jLabelComments = null;
94
    private javax.swing.JLabel lblColor = null;
95
    
96
    private JCheckBox setAsDefCrsChk = null;
97
    private ViewProperties self = null;
98

    
99
    private Color backColor = null;
100

    
101
    private JButton btnColor = null;
102
    private DefaultViewDocument view = null;
103
    private javax.swing.JScrollPane jScrollPane = null;
104
    protected CRSSelectPanel jPanelProj = null;
105
    private AcceptCancelPanel okCancelPanel = null;
106
    private boolean isAcceppted = false;
107
    private JComboBox cmbDistanceArea = null;
108

    
109
    /**
110
     * This is the default constructor
111
     * 
112
     * @param f
113
     *            Frame padre del dialogo
114
     * @param v
115
     *            Vista que se representa
116
     */
117
    public ViewProperties(DefaultViewDocument v) {
118
        view = v;
119
        initialize();
120
        self = this;
121
    }
122

    
123
    /**
124
     * This method initializes this
125
     */
126
    private void initialize() {
127
        setLayout(new GridBagLayout());
128
        setBorder(BorderFactory.createEmptyBorder(4, 5, 4, 5));
129

    
130
        GridBagConstraints c = new GridBagConstraints();
131
        c.insets = new Insets(2, 5, 2, 5);
132
        c.gridy = -1;
133

    
134
        addRow(c, getJLabelName(), getTxtName());
135
        addRow(c, getJLabelDate(), getTxtDate());
136
        addRow(c, getJLabelOwner(), getTxtOwner());
137
        addRow(c, getJLabelMapUnits(), getCmbMapUnits());
138
        addRow(c, getJLabelDistanceUnits(), getCmbDistanceUnits());
139
        addRow(c, getJLabelAreaUnits(), getCmbDistanceArea());
140

    
141
        // some extra space
142
        addRow(c, new JLabel(" "), new JLabel(" "));
143

    
144
        GridLayout gl = new GridLayout(1,2);
145
        JPanel colorPanel = new JPanel(gl);
146
        colorPanel.add(getJLabelColor());
147
        JPanel secondHalfPanel = new JPanel(gl);
148
        
149
        secondHalfPanel.add(getLblColor(secondHalfPanel.getBackground()));
150
        
151
        secondHalfPanel.add(getBtnColor());
152
        colorPanel.add(secondHalfPanel);
153
        
154
        c.gridx = 0;
155
        c.gridwidth = 2;
156
        c.gridy++;
157
        add(colorPanel, c);
158
        c.gridwidth = 1;
159

    
160
        c.anchor = GridBagConstraints.WEST;
161
        c.weightx = 0.0d;
162
        c.gridx = 0;
163
        c.gridwidth = GridBagConstraints.REMAINDER;
164
        c.gridy++;
165
        c.weightx = 1.0d;
166
        c.fill = GridBagConstraints.HORIZONTAL;
167
        add(getJPanelProj(), c);
168
        
169
        // ============ set current as app default CRS
170
        c.anchor = GridBagConstraints.CENTER;
171
        c.gridy++;
172
        JPanel auxp = new JPanel(new BorderLayout());
173
        auxp.add(getSetAsDefaultCrsCheckbox(), BorderLayout.CENTER);
174
        add(auxp, c);
175
        // =============================
176
        
177
        // some extra space
178
        addRow(c, new JLabel(" "), new JLabel(" "));
179

    
180
        c.anchor = GridBagConstraints.WEST;
181
        c.weightx = 0.0d;
182
        c.gridx = 0;
183
        c.gridy++;
184
        add(getJLabelComments(), c);
185

    
186
        c.fill = GridBagConstraints.BOTH;
187
        c.weightx = 1.0d;
188
        c.gridy++;
189
        c.gridwidth = 2;
190
        add(getJScrollPaneComments(), c);
191

    
192
        c.anchor = GridBagConstraints.EAST;
193
        c.gridx = 0;
194
        c.gridwidth = 2;
195
        c.gridy++;
196
        c.weightx = 1.0d;
197

    
198
        add(getOkCancelPanel(), c);
199
    }
200

    
201

    
202

    
203

    
204
    /**
205
     * @return
206
     */
207
    private JCheckBox getSetAsDefaultCrsCheckbox() {
208
        
209
        if (setAsDefCrsChk == null) {
210
            setAsDefCrsChk = new JCheckBox(Messages.getText(
211
                "_Set_this_CRS_as_app_default"));
212
            updateSetAsDefaultCRSChk();
213
        }
214
        return setAsDefCrsChk;
215
    }
216
    
217

    
218
    private String getAppDefaultCRS() {
219
        ProjectPreferences pp = new ProjectPreferences();
220
        IProjection curr_def = pp.getDefaultProjection();
221
        return curr_def.getAbrev();
222
    }
223
    
224
    private void setAppDefaultCRS(String abbrev) {
225
        PluginServices ps = PluginServices.getPluginServices(this);
226
        XMLEntity xml = ps.getPersistentXML();
227
        xml.putProperty(ViewPage.DEFAULT_PROJECTION_KEY_NAME, abbrev);
228
        IProjection proj = CRSFactory.getCRS(abbrev);
229
        DefaultProject.setDefaultProjection(proj);
230
    }
231
    
232
    private void updateSetAsDefaultCRSChk() {
233
        
234
        IProjection view_proj = this.jPanelProj.getCurProj();
235
        String view_abbrev = view_proj.getAbrev();
236
        
237
        String curr_app_crs_def = getAppDefaultCRS();
238
        if (view_abbrev.compareToIgnoreCase(curr_app_crs_def) == 0) {
239
            // same as curr default
240
            this.getSetAsDefaultCrsCheckbox().setSelected(true);
241
            this.getSetAsDefaultCrsCheckbox().setEnabled(false);
242
        } else {
243
            this.getSetAsDefaultCrsCheckbox().setEnabled(true);
244
            this.getSetAsDefaultCrsCheckbox().setSelected(false);
245
        }
246
    }
247

    
248
    private void addRow(GridBagConstraints c, JComponent label, JComponent text) {
249
        c.anchor = GridBagConstraints.WEST;
250
        c.weightx = 0.0d;
251
        c.gridx = 0;
252
        c.gridy++;
253
        add(label, c);
254

    
255
        c.fill = GridBagConstraints.HORIZONTAL;
256
        c.weightx = 1.0d;
257
        c.gridx = 1;
258
        add(text, c);
259
    }
260
    
261

    
262

    
263
    /**
264
     * This method initializes jLabel
265
     * 
266
     * @return javax.swing.JLabel
267
     */
268
    private javax.swing.JLabel getJLabelName() {
269
        if (jLabelName == null) {
270
            jLabelName =
271
                new javax.swing.JLabel(Messages.getText("nombre") + ":");
272
        }
273

    
274
        return jLabelName;
275
    }
276

    
277
    /**
278
     * This method initializes txtName
279
     * 
280
     * @return javax.swing.JTextField
281
     */
282
    private javax.swing.JTextField getTxtName() {
283
        if (txtName == null) {
284
            txtName = new javax.swing.JTextField(view.getName());
285
        }
286

    
287
        return txtName;
288
    }
289

    
290
    /**
291
     * This method initializes jLabel1
292
     * 
293
     * @return javax.swing.JLabel
294
     */
295
    private javax.swing.JLabel getJLabelDate() {
296
        if (jLabelDate == null) {
297
            jLabelDate =
298
                new javax.swing.JLabel(Messages.getText("creation_date") + ":");
299
        }
300

    
301
        return jLabelDate;
302
    }
303

    
304
    /**
305
     * This method initializes txtDate
306
     * 
307
     * @return javax.swing.JTextField
308
     */
309
    private javax.swing.JTextField getTxtDate() {
310
        if (txtDate == null) {
311
            txtDate = new javax.swing.JTextField(view.getCreationDate());
312
            txtDate.setEditable(false);
313
            txtDate.setBackground(java.awt.Color.white);
314
        }
315

    
316
        return txtDate;
317
    }
318

    
319
    /**
320
     * This method initializes jLabel2
321
     * 
322
     * @return javax.swing.JLabel
323
     */
324
    private javax.swing.JLabel getJLabelOwner() {
325
        if (jLabelOwner == null) {
326
            jLabelOwner =
327
                new javax.swing.JLabel(Messages.getText("owner") + ":");
328
        }
329

    
330
        return jLabelOwner;
331
    }
332

    
333
    /**
334
     * This method initializes txtOwner
335
     * 
336
     * @return javax.swing.JTextField
337
     */
338
    private javax.swing.JTextField getTxtOwner() {
339
        if (txtOwner == null) {
340
            txtOwner = new javax.swing.JTextField(view.getOwner());
341
        }
342

    
343
        return txtOwner;
344
    }
345

    
346
    /**
347
     * This method initializes jLabel4
348
     * 
349
     * @return javax.swing.JLabel
350
     */
351
    private javax.swing.JLabel getJLabelMapUnits() {
352
        if (jLabelMapUnits == null) {
353
            jLabelMapUnits =
354
                new javax.swing.JLabel(Messages.getText("map_units") + ":");
355
        }
356

    
357
        return jLabelMapUnits;
358
    }
359

    
360
    /**
361
     * This method initializes cmbMapUnits
362
     * 
363
     * @return javax.swing.JComboBox
364
     */
365
    private javax.swing.JComboBox getCmbMapUnits() {
366
        if (cmbMapUnits == null
367
            || MapContext.getDistanceNames().length > cmbMapUnits
368
                .getItemCount()) {
369
            cmbMapUnits = new JComboBoxUnits(false);
370

    
371
            IProjection proj = view.getProjection();
372
            if (!proj.isProjected()) {
373
                cmbMapUnits.setSelectedItem(Messages.getText("Grados")); // deegree
374
                cmbMapUnits.setEnabled(false);
375
            } else {
376
                if (!(cmbMapUnits.getItemCount() == MapContext
377
                    .getDistanceNames().length)) {
378
                    cmbMapUnits.removeItem(Messages.getText("Grados")); // deegree
379
                    view.getMapContext().getViewPort().setMapUnits(1);
380
                }
381
                cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort()
382
                    .getMapUnits());
383
                cmbMapUnits.setEnabled(true);
384
            }
385
        }
386

    
387
        return cmbMapUnits;
388
    }
389

    
390
    /**
391
     * This method initializes jLabel5
392
     * 
393
     * @return javax.swing.JLabel
394
     */
395
    private javax.swing.JLabel getJLabelDistanceUnits() {
396
        if (jLabelDistanceUnits == null) {
397
            jLabelDistanceUnits =
398
                new javax.swing.JLabel(Messages.getText("distance_units") + ":");
399
        }
400

    
401
        return jLabelDistanceUnits;
402
    }
403

    
404
    /**
405
     * This method initializes jLabel6
406
     * 
407
     * @return javax.swing.JLabel
408
     */
409
    private javax.swing.JLabel getJLabelAreaUnits() {
410
        if (jLabelAreaUnits == null) {
411
            jLabelAreaUnits =
412
                new javax.swing.JLabel(Messages.getText("unidades_area") + ":");
413
        }
414

    
415
        return jLabelAreaUnits;
416
    }
417

    
418
    /**
419
     * This method initializes cmbDistanceUnits
420
     * 
421
     * @return javax.swing.JComboBox
422
     */
423
    private javax.swing.JComboBox getCmbDistanceUnits() {
424
        if (cmbDistanceUnits == null
425
            || MapContext.getDistanceNames().length > cmbDistanceUnits
426
                .getItemCount()) {
427
            cmbDistanceUnits = new JComboBoxUnits(false);
428
            cmbDistanceUnits.setSelectedIndex(view.getMapContext()
429
                .getViewPort().getDistanceUnits());
430
        }
431

    
432
        return cmbDistanceUnits;
433
    }
434

    
435
    /**
436
     * This method initializes jLabel6
437
     * 
438
     * @return javax.swing.JLabel
439
     */
440
    private javax.swing.JLabel getJLabelComments() {
441
        if (jLabelComments == null) {
442
            jLabelComments =
443
                new javax.swing.JLabel(Messages.getText("comentarios") + ":");
444
            jLabelComments
445
                .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
446
            jLabelComments
447
                .setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
448
        }
449

    
450
        return jLabelComments;
451
    }
452

    
453
    /**
454
     * This method initializes txtComments
455
     * 
456
     * @return javax.swing.JTextArea
457
     */
458
    private javax.swing.JTextArea getTxtComments() {
459
        if (txtComments == null) {
460
            txtComments = new javax.swing.JTextArea(view.getComment());
461
            txtComments.setRows(3);
462
            txtComments.setColumns(20);
463
        }
464

    
465
        return txtComments;
466
    }
467

    
468
    /**
469
     * This method initializes jLabel7
470
     * 
471
     * @return javax.swing.JLabel
472
     */
473
    private javax.swing.JLabel getJLabelColor() {
474
        if (jLabelColor == null) {
475
            jLabelColor =
476
                new javax.swing.JLabel(Messages.getText("background_color")
477
                    + ":");
478
        }
479

    
480
        return jLabelColor;
481
    }
482

    
483
    /**
484
     * This method initializes lblColor
485
     * 
486
     * @return javax.swing.JLabel
487
     */
488
    private javax.swing.JLabel getLblColor(Color surround_color) {
489
        if (lblColor == null) {
490
            lblColor = new javax.swing.JLabel("");
491
            // lblColor.setMaximumSize(new java.awt.Dimension(30, 20));
492
            Color theColor = view.getMapContext().getViewPort().getBackColor();
493
            backColor = theColor;
494
            if (theColor == null) {
495
                theColor = Color.WHITE;
496
            }
497
            lblColor.setBackground(theColor);
498
            lblColor.setBorder(BorderFactory.createLineBorder(surround_color, 3));
499
            lblColor.setOpaque(true);
500
        }
501

    
502
        return lblColor;
503
    }
504

    
505
    /**
506
     * This method initializes btnColor
507
     * 
508
     * @return javax.swing.JButton
509
     */
510
    private JButton getBtnColor() {
511
        if (btnColor == null) {
512
            btnColor = new JButton();
513
            // ToolsSwingLocator.getUsabilitySwingManager().createJButton();
514

    
515
            btnColor.setText("...");
516

    
517
            btnColor.addActionListener(new java.awt.event.ActionListener() {
518

    
519
                public void actionPerformed(java.awt.event.ActionEvent e) {
520
                    Color ret =
521
                        JColorChooser.showDialog(ViewProperties.this,
522
                            Messages.getText("background_color"),
523
                            lblColor.getBackground());
524

    
525
                    if (ret != null) {
526
                        lblColor.setBackground(ret);
527
                        backColor = ret;
528
                    } else {
529
                        lblColor.setBackground(Color.WHITE);
530
                    }
531
                }
532
            });
533
        }
534

    
535
        return btnColor;
536
    }
537

    
538
    /**
539
     * This method initializes jScrollPane
540
     * 
541
     * @return javax.swing.JScrollPane
542
     */
543
    private javax.swing.JScrollPane getJScrollPaneComments() {
544
        if (jScrollPane == null) {
545
            jScrollPane = new javax.swing.JScrollPane();
546
            jScrollPane.setViewportView(getTxtComments());
547
            Dimension dim = getTxtComments().getPreferredSize();
548
            jScrollPane
549
                .setMinimumSize(new Dimension(dim.width, dim.height + 10));
550
        }
551

    
552
        return jScrollPane;
553
    }
554

    
555
    /**
556
     * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
557
     */
558
    public WindowInfo getWindowInfo() {
559
        WindowInfo m_viewinfo = new WindowInfo();
560
        this.validate();
561
        m_viewinfo.setTitle(Messages.getText("propiedades_vista"));
562
        Dimension dim = getPreferredSize();
563
        m_viewinfo.setWidth(FIXED_WIDTH);
564
        m_viewinfo.setHeight(dim.height
565
            + getOkCancelPanel().getPreferredSize().height);
566
        return m_viewinfo;
567
    }
568

    
569
    /**
570
     * This method initializes jPanel4
571
     * 
572
     * @return javax.swing.JPanel
573
     */
574
    private CRSSelectPanel getJPanelProj() {
575
        if (jPanelProj == null) {
576
            IProjection proj = view.getProjection();
577
            jPanelProj = CRSSelectPanel.getPanel(proj);
578
            jPanelProj.addActionListener(new java.awt.event.ActionListener() {
579

    
580
                public void actionPerformed(java.awt.event.ActionEvent e) {
581
                    if (jPanelProj.isOkPressed()) {
582
                        if (!jPanelProj.getCurProj().isProjected()) {
583
                            getCmbMapUnits().setSelectedItem(
584
                                PluginServices
585
                                    .getText(this, "Grados"));
586
                            getCmbMapUnits().setEnabled(false);
587
                        } else {
588
                            if (getCmbMapUnits().getSelectedItem().equals(
589
                                PluginServices
590
                                    .getText(this, "Grados"))) {
591
                                getCmbMapUnits().setSelectedIndex(1);
592
                            }
593
                            getCmbMapUnits().setEnabled(true);
594
                        }
595
                        self.updateSetAsDefaultCRSChk();
596
                    }
597
                }
598
            });
599
        }
600
        return jPanelProj;
601
    }
602

    
603
    /**
604
     * @see org.gvsig.andami.ui.mdiManager.SingletonWindow#getWindowModel()
605
     */
606
    public Object getWindowModel() {
607
        return view;
608
    }
609

    
610
    /**
611
     * This method initializes okCancelPanel
612
     * 
613
     * @return javax.swing.JPanel
614
     */
615
    private AcceptCancelPanel getOkCancelPanel() {
616
        if (okCancelPanel == null) {
617
            ActionListener okAction, cancelAction;
618
            okAction = new java.awt.event.ActionListener() {
619

    
620
                public void actionPerformed(java.awt.event.ActionEvent e) {
621
                    String name = txtName.getText();
622
                    if (name == null || name.length() == 0) {
623
                        return;
624
                    }
625
                    Project project =
626
                        ProjectManager.getInstance().getCurrentProject();
627
                    List<Document> views =
628
                        project.getDocuments(ViewManager.TYPENAME);
629
                    for (Document theView : views) {
630
                        if (view.equals(theView)) {
631
                            continue;
632
                        }
633
                        if (theView.getName().equals(name)) {
634
                            JOptionPane.showMessageDialog(
635
                                (Component) PluginServices.getMainFrame(),
636
                                Messages.getText("elemento_ya_existe"));
637
                            return;
638
                        }
639
                    }
640

    
641
                    view.setName(name);
642
                    view.setCreationDate(txtDate.getText());
643
                    view.setOwner(txtOwner.getText());
644
                    view.setComment(txtComments.getText());
645
                    view.getMapContext().getViewPort()
646
                        .setMapUnits(cmbMapUnits.getSelectedIndex());
647
                    view.getMapContext().getViewPort()
648
                        .setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
649
                    view.getMapContext().getViewPort()
650
                        .setDistanceArea(cmbDistanceArea.getSelectedIndex());
651
                    view.setBackColor(backColor);
652

    
653
                    // Select the projection
654
                    if (jPanelProj.isOkPressed()) {
655
                        if (!jPanelProj.getCurProj().isProjected()) {
656
                            getCmbMapUnits().setSelectedItem(
657
                                Messages.getText("Grados"));
658
                            getCmbMapUnits().setEnabled(false);
659
                        } else {
660
                            if (getCmbMapUnits().getSelectedItem().equals(
661
                                Messages.getText("Grados"))) {
662
                                getCmbMapUnits().setSelectedIndex(1);
663
                            }
664
                            getCmbMapUnits().setEnabled(true);
665
                        }
666
                        view.setProjection(jPanelProj.getCurProj());
667
                        if (self.getSetAsDefaultCrsCheckbox().isSelected()) {
668
                            self.setAppDefaultCRS(jPanelProj.getCurProj().getAbrev());
669
                        }
670
                    }
671

    
672
                    isAcceppted = true;
673
                    PluginServices.getMDIManager().closeWindow(
674
                        ViewProperties.this);
675
                }
676
            };
677
            cancelAction = new java.awt.event.ActionListener() {
678

    
679
                public void actionPerformed(java.awt.event.ActionEvent e) {
680
                    isAcceppted = false;
681
                    PluginServices.getMDIManager().closeWindow(
682
                        ViewProperties.this);
683
                }
684
            };
685
            okCancelPanel = new AcceptCancelPanel(okAction, cancelAction);
686
        }
687
        return okCancelPanel;
688
    }
689

    
690
    public boolean isAcceppted() {
691
        return isAcceppted;
692
    }
693

    
694
    /**
695
     * This method initializes jComboBox
696
     * 
697
     * @return javax.swing.JComboBox
698
     */
699
    private JComboBox getCmbDistanceArea() {
700
        String[] names = MapContext.getAreaNames();
701
        if (cmbDistanceArea == null
702
            || names.length > cmbDistanceArea.getItemCount()) {
703
            for (int i = 0; i < names.length; i++) {
704
                names[i] =
705
                    Messages.getText(names[i]) + MapContext.getOfLinear(i);
706
            }
707
            cmbDistanceArea = new javax.swing.JComboBox(names);
708
            cmbDistanceArea.setEditable(false);
709
            cmbDistanceArea.setSelectedIndex(view.getMapContext().getViewPort()
710
                .getDistanceArea());
711
            cmbDistanceArea
712
                .addActionListener(new java.awt.event.ActionListener() {
713

    
714
                    public void actionPerformed(java.awt.event.ActionEvent e) {
715
                        // view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
716
                    }
717
                });
718
        }
719

    
720
        return cmbDistanceArea;
721

    
722
    }
723

    
724
    public Object getWindowProfile() {
725
        return WindowInfo.PROPERTIES_PROFILE;
726
    }
727
    
728

    
729

    
730

    
731
}