Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / gui / ViewProperties.java @ 20334

History | View | Annotate | Download (21 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 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
package com.iver.cit.gvsig.project.documents.view.gui;
42

    
43

    
44
import java.awt.Color;
45
import java.awt.Dimension;
46
import java.awt.GridLayout;
47
import java.awt.event.ActionListener;
48

    
49
import javax.swing.JColorChooser;
50
import javax.swing.JPanel;
51

    
52
import org.cresques.cts.IProjection;
53
import org.gvsig.gui.beans.AcceptCancelPanel;
54
import org.gvsig.gui.beans.swing.JButton;
55

    
56
import com.iver.andami.PluginServices;
57
import com.iver.andami.ui.mdiManager.SingletonWindow;
58
import com.iver.andami.ui.mdiManager.WindowInfo;
59
import com.iver.cit.gvsig.fmap.MapContext;
60
import com.iver.cit.gvsig.gui.JComboBoxUnits;
61
import com.iver.cit.gvsig.gui.panels.CRSSelectPanel;
62
import com.iver.cit.gvsig.project.documents.layout.Attributes;
63
import com.iver.cit.gvsig.project.documents.view.ProjectView;
64
import javax.swing.JLabel;
65
import javax.swing.JComboBox;
66
/**
67
 * Dialogo donde se muestran las propiedades de una vista
68
 *
69
 * @author Fernando Gonz?lez Cort?s
70
 */
71
public class ViewProperties extends JPanel implements SingletonWindow{
72
        /*private String[] units = new String[] {
73
         PluginServices.getText(this, "metros"),
74
         PluginServices.getText(this, "kilometros"),
75
         };
76
         */
77
        private static String[] unitsNames = null;
78
        private javax.swing.JLabel jLabel = null;
79
        private javax.swing.JTextField txtName = null;
80
        private javax.swing.JLabel jLabel1 = null;
81
        private javax.swing.JTextField txtDate = null;
82
        private javax.swing.JLabel jLabel2 = null;
83
        private javax.swing.JTextField txtOwner = null;
84
        private javax.swing.JLabel jLabel4 = null;
85
        private javax.swing.JComboBox cmbMapUnits = null;
86
        private javax.swing.JLabel jLabel5 = null;
87
        private javax.swing.JComboBox cmbDistanceUnits = null;
88
        private javax.swing.JLabel jLabel6 = null;
89
        private javax.swing.JTextArea txtComments = null;
90
        private javax.swing.JLabel jLabel7 = null;
91
        private javax.swing.JLabel lblColor = null;
92

    
93
        private Color backColor = null;
94

    
95
        private JButton btnColor = null;
96
        private ProjectView view=null;
97
        private javax.swing.JScrollPane jScrollPane = null;
98
        private javax.swing.JPanel jPanel = null;
99
        private javax.swing.JPanel jPanel1 = null;
100
        private javax.swing.JPanel jPanel2 = null;
101
        private javax.swing.JPanel jPanel3 = null;
102

    
103
        private javax.swing.JLabel jLabel3 = null;
104
        private javax.swing.JLabel jLabelSep1 = null;
105
        private WindowInfo m_viewinfo = null;
106
        //private JLabel jLblProj = null;
107
        //private JLabel jLblProjName = null;
108
        //private JButton jBtnChangeProj = null;
109
        protected CRSSelectPanel jPanelProj = null;
110
        private AcceptCancelPanel okCancelPanel = null;
111
        private boolean isAcceppted=false;
112
        private JLabel jLabel8 = null;
113
        private JComboBox cmbDistanceArea = null;
114
        /**
115
         * This is the default constructor
116
         *
117
         * @param f Frame padre del dialogo
118
         * @param v Vista que se representa
119
         */
120
        public ViewProperties(ProjectView v) {
121
                view = v;
122
                initialize();
123
        }
124

    
125
        /**
126
         * This method initializes this
127
         */
128
        private void initialize() {
129
                this.setSize(386, 436);
130
                java.awt.FlowLayout layFlowLayout3 = new java.awt.FlowLayout();
131
                layFlowLayout3.setHgap(0);
132
                setLayout(layFlowLayout3);
133
                /*      jLblProjName = new JLabel();
134
                 jLblProj = new JLabel();
135
                 jLblProj.setText(view.getProjection().getAbrev());
136
                 jLblProj.setPreferredSize(new java.awt.Dimension(180,20));
137
                 jLblProjName.setText("Proyecci?n actual:");
138
                 jLblProjName.setPreferredSize(new java.awt.Dimension(95,15));*/
139
                this.setPreferredSize(new java.awt.Dimension(365,463));
140
                add(getJPanel(), null);
141
                add(getJPanel1(), null);
142
                add(getJPanel2(), null);
143
                add(getJPanel3(), null);
144
                add(getJLabelSep1(), null);
145
                this.add(getJPanelProj(), null);
146
                this.add(getJLabel6(), null);
147
                add(getJScrollPane(), null);
148

    
149

    
150
                this.add(getJLabel7(), null);
151
                this.add(getLblColor(), null);
152
                this.add(getBtnColor(), null);
153

    
154

    
155
                add(getJLabel3(), null);
156
                this.add(getOkCancelPanel(), null);
157
                txtName.setText(view.getName());
158
                txtDate.setText(view.getCreationDate());
159
                txtOwner.setText(view.getOwner());
160

    
161
                cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits());
162
                cmbDistanceUnits.setSelectedIndex(view.getMapContext().getViewPort().getDistanceUnits());
163
                cmbDistanceArea.setSelectedIndex(view.getMapContext().getViewPort().getDistanceArea());
164
                txtComments.setText(view.getComment());
165

    
166
                lblColor.setBackground(view.getMapContext().getViewPort().getBackColor());
167
        }
168

    
169
        /**
170
         * This method initializes jLabel
171
         *
172
         * @return javax.swing.JLabel
173
         */
174
        private javax.swing.JLabel getJLabel() {
175
                if (jLabel == null) {
176
                        jLabel = new javax.swing.JLabel();
177
                        jLabel.setText(PluginServices.getText(this, "nombre") + ":");
178
                }
179

    
180
                return jLabel;
181
        }
182

    
183
        private javax.swing.JLabel getJLabelSep1() {
184
                if (jLabelSep1 == null) {
185
                        jLabelSep1 = new javax.swing.JLabel();
186
                        jLabelSep1.setPreferredSize(new java.awt.Dimension(200, 10));
187
                }
188
                return jLabelSep1;
189
        }
190

    
191
        /**
192
         * This method initializes txtName
193
         *
194
         * @return javax.swing.JTextField
195
         */
196
        private javax.swing.JTextField getTxtName() {
197
                if (txtName == null) {
198
                        txtName = new javax.swing.JTextField();
199
                        txtName.setPreferredSize(new java.awt.Dimension(200, 20));
200
                }
201

    
202
                return txtName;
203
        }
204

    
205
        /**
206
         * This method initializes jLabel1
207
         *
208
         * @return javax.swing.JLabel
209
         */
210
        private javax.swing.JLabel getJLabel1() {
211
                if (jLabel1 == null) {
212
                        jLabel1 = new javax.swing.JLabel();
213
                        jLabel1.setText(PluginServices.getText(this, "creation_date") + ":");
214
                }
215

    
216
                return jLabel1;
217
        }
218

    
219
        /**
220
         * This method initializes txtDate
221
         *
222
         * @return javax.swing.JTextField
223
         */
224
        private javax.swing.JTextField getTxtDate() {
225
                if (txtDate == null) {
226
                        txtDate = new javax.swing.JTextField();
227
                        txtDate.setPreferredSize(new java.awt.Dimension(200, 20));
228
                        txtDate.setEditable(false);
229
                        txtDate.setBackground(java.awt.Color.white);
230
                }
231

    
232
                return txtDate;
233
        }
234

    
235
        /**
236
         * This method initializes jLabel2
237
         *
238
         * @return javax.swing.JLabel
239
         */
240
        private javax.swing.JLabel getJLabel2() {
241
                if (jLabel2 == null) {
242
                        jLabel2 = new javax.swing.JLabel();
243
                        jLabel2.setText(PluginServices.getText(this, "owner") + ":");
244
                }
245

    
246
                return jLabel2;
247
        }
248

    
249
        /**
250
         * This method initializes txtOwner
251
         *
252
         * @return javax.swing.JTextField
253
         */
254
        private javax.swing.JTextField getTxtOwner() {
255
                if (txtOwner == null) {
256
                        txtOwner = new javax.swing.JTextField();
257
                        txtOwner.setPreferredSize(new java.awt.Dimension(200, 20));
258
                }
259

    
260
                return txtOwner;
261
        }
262

    
263
        /**
264
         * This method initializes jLabel4
265
         *
266
         * @return javax.swing.JLabel
267
         */
268
        private javax.swing.JLabel getJLabel4() {
269
                if (jLabel4 == null) {
270
                        jLabel4 = new javax.swing.JLabel();
271
                        jLabel4.setText(PluginServices.getText(this, "map_units") + ":");
272
                        jLabel4.setName("jLabel4");
273
                }
274

    
275
                return jLabel4;
276
        }
277

    
278
        /**
279
         * This method initializes cmbMapUnits
280
         *
281
         * @return javax.swing.JComboBox
282
         */
283
        private javax.swing.JComboBox getCmbMapUnits() {
284
                if (cmbMapUnits == null|| MapContext.getDistanceNames().length>cmbMapUnits.getItemCount()) {
285
                        boolean includePixels;
286
                        cmbMapUnits = new JComboBoxUnits(includePixels = false);
287

    
288
//                        cmbMapUnits = new javax.swing.JComboBox(getUnitsNames());
289
                        cmbMapUnits.setPreferredSize(new java.awt.Dimension(200, 20));
290
                        IProjection proj=view.getProjection();
291
                        if (!proj.isProjected()) {
292
//                                if (cmbMapUnits.getItemCount()==MapContext.NAMES.length) {
293
//                                        cmbMapUnits.addItem(PluginServices.getText(this, Attributes.DEGREES));
294
//                                }
295
                                cmbMapUnits.setSelectedItem(PluginServices.getText(this,"Grados")); // deegree
296
                                cmbMapUnits.setEnabled(false);
297
                        }else {
298
                                if (!(cmbMapUnits.getItemCount()==MapContext.getDistanceNames().length)) {
299
                                        cmbMapUnits.removeItem(PluginServices.getText(this,"Grados")); // deegree
300
                                        view.getMapContext().getViewPort().setMapUnits(1);
301
                                }
302
                                cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits());
303
                                cmbMapUnits.setEnabled(true);
304
                        }
305
                        cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits());
306

    
307
//
308
//                        cmbMapUnits.addActionListener(new java.awt.event.ActionListener() {
309
//                                public void actionPerformed(java.awt.event.ActionEvent e) {
310
//                                        //view.getMapContext().getViewPort().setMapUnits(cmbMapUnits.getSelectedIndex());
311
//                                }
312
//                        });
313
                }
314

    
315
                return cmbMapUnits;
316
        }
317

    
318
        /**
319
         * This method initializes jLabel5
320
         *
321
         * @return javax.swing.JLabel
322
         */
323
        private javax.swing.JLabel getJLabel5() {
324
                if (jLabel5 == null) {
325
                        jLabel5 = new javax.swing.JLabel();
326
                        jLabel5.setText(PluginServices.getText(this, "distance_units") + ":");
327
                        jLabel5.setName("jLabel5");
328
                }
329

    
330
                return jLabel5;
331
        }
332

    
333
        /**
334
         * This method initializes cmbDistanceUnits
335
         *
336
         * @return javax.swing.JComboBox
337
         */
338
        private javax.swing.JComboBox getCmbDistanceUnits() {
339
                if (cmbDistanceUnits == null|| MapContext.getDistanceNames().length>cmbDistanceUnits.getItemCount()){
340
                        boolean includePixels;
341
                        cmbDistanceUnits = new JComboBoxUnits(includePixels = false);
342
//                        cmbDistanceUnits = new javax.swing.JComboBox(getUnitsNames());
343
                        cmbDistanceUnits.setPreferredSize(new java.awt.Dimension(200, 20));
344
//                        cmbDistanceUnits.setEditable(false);
345
//                        cmbDistanceUnits.setSelectedIndex(view.getMapContext().getViewPort().getDistanceUnits());
346
//                        cmbDistanceUnits.addActionListener(new java.awt.event.ActionListener() {
347
//                                public void actionPerformed(java.awt.event.ActionEvent e) {
348
//                                        //view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
349
//                                }
350
//                        });
351
                }
352

    
353
                return cmbDistanceUnits;
354
        }
355

    
356
        /**
357
         * This method initializes jLabel6
358
         *
359
         * @return javax.swing.JLabel
360
         */
361
        private javax.swing.JLabel getJLabel6() {
362
                if (jLabel6 == null) {
363
                        jLabel6 = new javax.swing.JLabel();
364
                        jLabel6.setText(PluginServices.getText(this, "comentarios") + ":");
365
                        jLabel6.setPreferredSize(new java.awt.Dimension(340,35));
366
                        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
367
                        jLabel6.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
368
                }
369

    
370
                return jLabel6;
371
        }
372

    
373
        /**
374
         * This method initializes txtComments
375
         *
376
         * @return javax.swing.JTextArea
377
         */
378
        private javax.swing.JTextArea getTxtComments() {
379
                if (txtComments == null) {
380
                        txtComments = new javax.swing.JTextArea();
381
                        txtComments.setRows(1);
382
                        txtComments.setColumns(28);
383
                }
384

    
385
                return txtComments;
386
        }
387

    
388
        /**
389
         * This method initializes jLabel7
390
         *
391
         * @return javax.swing.JLabel
392
         */
393
        private javax.swing.JLabel getJLabel7() {
394
                if (jLabel7 == null) {
395
                        jLabel7 = new javax.swing.JLabel();
396
                        jLabel7.setText(PluginServices.getText(this, "background_color") +
397
                        ":");
398
                        jLabel7.setPreferredSize(new java.awt.Dimension(190,16));
399
                }
400

    
401
                return jLabel7;
402
        }
403

    
404
        /**
405
         * This method initializes lblColor
406
         *
407
         * @return javax.swing.JLabel
408
         */
409
        private javax.swing.JLabel getLblColor() {
410
                if (lblColor == null) {
411
                        lblColor = new javax.swing.JLabel();
412
                        lblColor.setText("");
413
                        lblColor.setPreferredSize(new java.awt.Dimension(30, 16));
414
                        Color theColor = view.getMapContext().getViewPort().getBackColor();
415
                        backColor=theColor;
416
                        if (theColor == null) theColor = Color.WHITE;
417
                        lblColor.setBackground(theColor);
418
                        lblColor.setOpaque(true);
419
                }
420

    
421
                return lblColor;
422
        }
423

    
424
        /**
425
         * This method initializes btnColor
426
         *
427
         * @return javax.swing.JButton
428
         */
429
        private JButton getBtnColor() {
430
                if (btnColor == null) {
431
                        btnColor = new JButton();
432

    
433
                        btnColor.setText("...");
434

    
435
                        btnColor.addActionListener(new java.awt.event.ActionListener() {
436
                                public void actionPerformed(java.awt.event.ActionEvent e) {
437
                                        Color ret = JColorChooser.showDialog(ViewProperties.this,
438
                                                        PluginServices.getText(this, "background_color"),
439
                                                        lblColor.getBackground());
440

    
441
                                        if (ret != null) {
442
                                                lblColor.setBackground(ret);
443
                                                backColor = ret;
444
                                        }
445
                                        else
446
                                                lblColor.setBackground(Color.WHITE);
447
                                }
448
                        });
449
                }
450

    
451
                return btnColor;
452
        }
453

    
454
        /**
455
         * This method initializes jScrollPane
456
         *
457
         * @return javax.swing.JScrollPane
458
         */
459
        private javax.swing.JScrollPane getJScrollPane() {
460
                if (jScrollPane == null) {
461
                        jScrollPane = new javax.swing.JScrollPane();
462
                        jScrollPane.setViewportView(getTxtComments());
463
                        jScrollPane.setPreferredSize(new java.awt.Dimension(340, 70));
464
                }
465

    
466
                return jScrollPane;
467
        }
468

    
469
        /**
470
         * This method initializes jPanel
471
         *
472
         * @return javax.swing.JPanel
473
         */
474
        private javax.swing.JPanel getJPanel() {
475
                if (jPanel == null) {
476
                        jPanel = new javax.swing.JPanel();
477

    
478
                        /*
479
                        java.awt.FlowLayout layFlowLayout4 = new java.awt.FlowLayout();
480
                        layFlowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
481
                        layFlowLayout4.setVgap(9);
482
                        jPanel.setLayout(layFlowLayout4);
483
                        */
484

    
485
            GridLayout layout = new GridLayout(3,1);
486
            layout.setVgap(5);
487
            jPanel.setLayout(layout);
488

    
489

    
490
                        jPanel.add(getJLabel(), null);
491
                        jPanel.add(getJLabel1(), null);
492
                        jPanel.add(getJLabel2(), null);
493
                        jPanel.setPreferredSize(new java.awt.Dimension(140, 80));
494
                }
495

    
496
                return jPanel;
497
        }
498

    
499
        /**
500
         * This method initializes jPanel1
501
         *
502
         * @return javax.swing.JPanel
503
         */
504
        private javax.swing.JPanel getJPanel1() {
505
                if (jPanel1 == null) {
506
                        jPanel1 = new javax.swing.JPanel();
507

    
508
                        java.awt.FlowLayout layFlowLayout2 = new java.awt.FlowLayout();
509
                        layFlowLayout2.setHgap(5);
510
                        layFlowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
511
                        jPanel1.setLayout(layFlowLayout2);
512
                        jPanel1.add(getTxtName(), null);
513
                        jPanel1.add(getTxtDate(), null);
514
                        jPanel1.add(getTxtOwner(), null);
515
                        jPanel1.setPreferredSize(new java.awt.Dimension(210, 80));
516
                }
517

    
518
                return jPanel1;
519
        }
520

    
521
        /**
522
         * This method initializes jPanel2
523
         *
524
         * @return javax.swing.JPanel
525
         */
526
        private javax.swing.JPanel getJPanel2() {
527
                if (jPanel2 == null) {
528
                        jLabel8 = new JLabel();
529
                        jLabel8.setText("unidades_area");
530
                        GridLayout gridLayout = new GridLayout();
531
                        gridLayout.setRows(3);
532
                        jPanel2 = new javax.swing.JPanel();
533

    
534
                        jPanel2.setLayout(gridLayout);
535
                        jPanel2.setPreferredSize(new java.awt.Dimension(140,80));
536
                        jPanel2.add(getJLabel4(), null);
537
                        jPanel2.add(getJLabel5(), null);
538
                        jPanel2.add(jLabel8, null);
539
                }
540

    
541
                return jPanel2;
542
        }
543

    
544
        /**
545
         * This method initializes jPanel3
546
         *
547
         * @return javax.swing.JPanel
548
         */
549
        private javax.swing.JPanel getJPanel3() {
550
                if (jPanel3 == null) {
551
                        jPanel3 = new javax.swing.JPanel();
552

    
553
                        java.awt.FlowLayout layFlowLayout6 = new java.awt.FlowLayout();
554
                        layFlowLayout6.setAlignment(java.awt.FlowLayout.LEFT);
555
                        jPanel3.setLayout(layFlowLayout6);
556
                        jPanel3.add(getCmbMapUnits(), null);
557
                        jPanel3.add(getCmbDistanceUnits(), null);
558
                        jPanel3.setPreferredSize(new java.awt.Dimension(210,80));
559
                        jPanel3.add(getCmbDistanceArea(), null);
560
                }
561

    
562
                return jPanel3;
563
        }
564

    
565

    
566
        /**
567
         * This method initializes jLabel3
568
         *
569
         * @return javax.swing.JLabel
570
         */
571
        private javax.swing.JLabel getJLabel3() {
572
                if (jLabel3 == null) {
573
                        jLabel3 = new javax.swing.JLabel();
574
                        jLabel3.setText("");
575
                        jLabel3.setPreferredSize(new java.awt.Dimension(30, 0));
576
                }
577

    
578
                return jLabel3;
579
        }
580

    
581
        /**
582
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
583
         */
584
        public WindowInfo getWindowInfo() {
585
                WindowInfo m_viewinfo=new WindowInfo();
586
                m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_vista"));
587
                m_viewinfo.setHeight(410);
588
                return m_viewinfo;
589
        }
590

    
591
        /**
592
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
593
         */
594
        public void viewActivated() {
595
        }
596
        /**
597
         * This method initializes jButton
598
         *
599
         * @return javax.swing.JButton
600
         * /
601
         private JButton getJBtnChangeProj() {
602
         if (jBtnChangeProj == null) {
603
         jBtnChangeProj = new JButton();
604
         jBtnChangeProj.setText("...");
605
         jBtnChangeProj.setPreferredSize(new java.awt.Dimension(34,16));
606
         jBtnChangeProj.addActionListener(new java.awt.event.ActionListener() {
607
         public void actionPerformed(java.awt.event.ActionEvent e) {
608
         CSSelectionDialog csSelect = new CSSelectionDialog();
609
         csSelect.setProjection(view.getProjection());
610

611
         PluginServices.getMDIManager().addView(csSelect);
612

613
         if (csSelect.isOkPressed()) {
614
         view.getMapContext().setProjection(csSelect.getProjection());
615
         jLblProj.setText(view.getProjection().getAbrev());
616
         }
617
         }
618
         });
619
         }
620
         return jBtnChangeProj;
621
         } */
622
        /**
623
         * This method initializes jPanel4
624
         *
625
         * @return javax.swing.JPanel
626
         */
627
        private CRSSelectPanel getJPanelProj() {
628
                if (jPanelProj == null) {
629
                        IProjection proj=view.getProjection();
630
                        jPanelProj = CRSSelectPanel.getPanel(proj);
631
                        jPanelProj.setPreferredSize(new java.awt.Dimension(330,35));
632
                        jPanelProj.addActionListener(new java.awt.event.ActionListener() {
633
                                public void actionPerformed(java.awt.event.ActionEvent e) {
634
                                        if (jPanelProj.isOkPressed()) {
635
                                                if (!jPanelProj.getCurProj().isProjected()) {
636
//                                                        if (getCmbMapUnits().getItemCount()==MapContext.NAMES.length) {
637
//                                                                getCmbMapUnits().addItem(PluginServices.getText(this, Attributes.DEGREES));
638
//                                                        }
639
                                                        getCmbMapUnits().setSelectedItem(PluginServices.getText(this, Attributes.DEGREES));
640
                                                        getCmbMapUnits().setEnabled(false);
641
                                                }else {
642
                                                        if (getCmbMapUnits().getSelectedItem().equals(PluginServices.getText(this, Attributes.DEGREES))) {
643
                                                                getCmbMapUnits().setSelectedIndex(1);
644
                                                                getCmbMapUnits().setEnabled(true);
645
                                                        }
646
//                                                        if (!(getCmbMapUnits().getItemCount()==MapContext.NAMES.length)) {
647
//                                                                getCmbMapUnits().removeItem(PluginServices.getText(this, Attributes.DEGREES));
648
//                                                        }
649
                                                }
650
                                                view.setProjection(jPanelProj.getCurProj());
651
                                        }
652
                                }
653
                        });
654

    
655
//                        jPanelProj.add(jLblProjName, null);
656
//                        jPanelProj.add(jLblProj, null);
657
//                        jPanelProj.add(getJBtnChangeProj(), null);
658
                }
659
                return jPanelProj;
660
        }
661

    
662
        /**
663
         * @see com.iver.andami.ui.mdiManager.SingletonWindow#getWindowModel()
664
         */
665
        public Object getWindowModel() {
666
                return view;
667
        }
668

    
669
        /**
670
         * This method initializes okCancelPanel
671
         *
672
         * @return javax.swing.JPanel
673
         */
674
        private AcceptCancelPanel getOkCancelPanel() {
675
                if (okCancelPanel == null) {
676
                        ActionListener okAction, cancelAction;
677
                        okAction = new java.awt.event.ActionListener() {
678
                                public void actionPerformed(java.awt.event.ActionEvent e) {
679
                                        view.setName(txtName.getText());
680
                                        view.setCreationDate(txtDate.getText());
681
                                        view.setOwner(txtOwner.getText());
682
                                        view.setComment(txtComments.getText());
683
                                        view.getMapContext().getViewPort().setMapUnits(cmbMapUnits.getSelectedIndex());
684
                                        view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
685
                                        view.getMapContext().getViewPort().setDistanceArea(cmbDistanceArea.getSelectedIndex());
686
                                        view.setBackColor(backColor);
687
                                        isAcceppted=true;
688
                                        PluginServices.getMDIManager().closeWindow(ViewProperties.this);
689
                                }
690
                        };
691
                        cancelAction = new java.awt.event.ActionListener() {
692

    
693
                                public void actionPerformed(java.awt.event.ActionEvent e) {
694
                                        isAcceppted=false;
695
                                        PluginServices.getMDIManager().closeWindow(ViewProperties.this);
696
                                }
697
                        };
698
                        okCancelPanel = new AcceptCancelPanel(okAction, cancelAction);
699
                        Dimension sz = this.getSize();
700
                        sz.setSize((int)sz.getWidth()-20, (int) sz.getHeight());
701
                        okCancelPanel.setPreferredSize(sz);
702
                }
703
                return okCancelPanel;
704
        }
705

    
706
//        private String[] getUnitsNames() {
707
//                if (unitsNames == null) {
708
//                        unitsNames = new String[MapContext.NAMES.length];
709
//                        int i=0;
710
//                        for (i=0;i<MapContext.NAMES.length;i++) {
711
//                                unitsNames[i]=PluginServices.getText(this, MapContext.NAMES[i]);
712
//                        }
713
//                        //unitsNames[i]=PluginServices.getText(this, Attributes.DEGREES);
714
//                }
715
//                return unitsNames;
716
//        }
717

    
718
        public boolean isAcceppted() {
719
                return isAcceppted;
720
        }
721
        /**
722
         * This method initializes jComboBox
723
         *
724
         * @return javax.swing.JComboBox
725
         */
726
        private JComboBox getCmbDistanceArea() {
727
                if (cmbDistanceArea == null || MapContext.getAreaNames().length>cmbDistanceArea.getItemCount()) {
728
                        String[] names=MapContext.getAreaNames();
729
                        for (int i = 0; i < names.length; i++) {
730
                                names[i]+=String.valueOf((char)178);
731
                        }
732
                        cmbDistanceArea = new javax.swing.JComboBox(names);
733
                        cmbDistanceArea.setPreferredSize(new java.awt.Dimension(200, 20));
734
                        cmbDistanceArea.setEditable(false);
735
                        cmbDistanceArea.setSelectedIndex(view.getMapContext().getViewPort().getDistanceArea());
736
                        cmbDistanceArea.addActionListener(new java.awt.event.ActionListener() {
737
                                public void actionPerformed(java.awt.event.ActionEvent e) {
738
                                        //view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
739
                                }
740
                        });
741
                }
742

    
743
                return cmbDistanceArea;
744

    
745
        }
746
}  //  @jve:decl-index=0:visual-constraint="10,10"