Statistics
| Revision:

root / branches / piloto3d / applications / appgvSIG / src / com / iver / cit / gvsig / gui / preferencespage / ViewPage.java @ 9529

History | View | Annotate | Download (17.8 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: ViewPage.java 9529 2007-01-03 17:07:31Z sbayarri $
45
* $Log$
46
* Revision 1.4.2.1  2007-01-03 17:07:29  sbayarri
47
* Fix wrong files
48
*
49
* Revision 1.4.4.8  2006/11/22 01:45:47  luisw2
50
* Recuperados cambios de la RC2 que normalizan la gesti?n de CRSs
51
*
52
* Revision 1.4.4.7  2006/11/15 00:08:09  jjdelcerro
53
* *** empty log message ***
54
*
55
* Revision 1.21  2006/11/08 10:57:55  jaume
56
* remove unecessary imports
57
*
58
* Revision 1.20  2006/10/25 08:34:06  jmvivo
59
* LLamado al PluginServices.getText para las unidades de medida del los combo
60
*
61
* Revision 1.19  2006/10/04 07:23:31  jaume
62
* refactored ambiguous methods and field names and added some more features for preference pages
63
*
64
* Revision 1.18  2006/10/03 09:52:38  jaume
65
* restores to meters
66
*
67
* Revision 1.17  2006/10/03 09:19:12  jaume
68
* *** empty log message ***
69
*
70
* Revision 1.16  2006/10/03 07:26:08  jaume
71
* *** empty log message ***
72
*
73
* Revision 1.15  2006/10/02 15:30:29  jaume
74
* *** empty log message ***
75
*
76
* Revision 1.14  2006/10/02 13:52:34  jaume
77
* organize impots
78
*
79
* Revision 1.13  2006/10/02 13:38:23  jaume
80
* *** empty log message ***
81
*
82
* Revision 1.12  2006/10/02 11:49:23  jaume
83
* *** empty log message ***
84
*
85
* Revision 1.11  2006/09/28 12:04:21  jaume
86
* default selection color now configurable
87
*
88
* Revision 1.10  2006/09/25 10:17:15  caballero
89
* Projection
90
*
91
* Revision 1.9  2006/09/15 10:41:30  caballero
92
* extensibilidad de documentos
93
*
94
* Revision 1.8  2006/09/14 15:43:48  jaume
95
* *** empty log message ***
96
*
97
* Revision 1.7  2006/09/14 15:42:38  jaume
98
* *** empty log message ***
99
*
100
* Revision 1.6  2006/09/14 06:57:18  jaume
101
* *** empty log message ***
102
*
103
* Revision 1.5  2006/09/12 15:56:50  jaume
104
* Default Projection now customizable
105
*
106
* Revision 1.4  2006/08/29 07:21:08  cesar
107
* Rename com.iver.cit.gvsig.fmap.Fmap class to com.iver.cit.gvsig.fmap.MapContext
108
*
109
* Revision 1.3  2006/08/22 12:30:59  jaume
110
* *** empty log message ***
111
*
112
* Revision 1.2  2006/08/22 07:36:04  jaume
113
* *** empty log message ***
114
*
115
* Revision 1.1  2006/08/04 11:41:05  caballero
116
* poder especificar el zoom a aplicar en las vistas
117
*
118
* Revision 1.3  2006/07/31 10:02:31  jaume
119
* *** empty log message ***
120
*
121
* Revision 1.2  2006/06/13 07:43:08  fjp
122
* Ajustes sobre los cuadros de dialogos de preferencias
123
*
124
* Revision 1.1  2006/06/12 16:04:28  caballero
125
* Preferencias
126
*
127
* Revision 1.11  2006/06/06 10:26:31  jaume
128
* *** empty log message ***
129
*
130
* Revision 1.10  2006/06/05 17:07:17  jaume
131
* *** empty log message ***
132
*
133
* Revision 1.9  2006/06/05 17:00:44  jaume
134
* *** empty log message ***
135
*
136
* Revision 1.8  2006/06/05 16:57:59  jaume
137
* *** empty log message ***
138
*
139
* Revision 1.7  2006/06/05 14:45:06  jaume
140
* *** empty log message ***
141
*
142
* Revision 1.6  2006/06/05 11:00:09  jaume
143
* *** empty log message ***
144
*
145
* Revision 1.5  2006/06/05 10:39:02  jaume
146
* *** empty log message ***
147
*
148
* Revision 1.4  2006/06/05 10:13:40  jaume
149
* *** empty log message ***
150
*
151
* Revision 1.3  2006/06/05 10:06:08  jaume
152
* *** empty log message ***
153
*
154
* Revision 1.2  2006/06/05 09:51:56  jaume
155
* *** empty log message ***
156
*
157
* Revision 1.1  2006/06/02 10:50:18  jaume
158
* *** empty log message ***
159
*
160
*
161
*/
162
package com.iver.cit.gvsig.gui.preferencespage;
163

    
164
import java.awt.Color;
165
import java.util.Enumeration;
166

    
167
import javax.swing.ImageIcon;
168
import javax.swing.JCheckBox;
169
import javax.swing.JLabel;
170
import javax.swing.JPanel;
171
import javax.swing.JTextField;
172
import javax.swing.UIManager;
173
import javax.swing.plaf.FontUIResource;
174

    
175
import com.iver.andami.PluginServices;
176
import com.iver.andami.preferences.AbstractPreferencePage;
177
import com.iver.andami.preferences.StoreException;
178
import com.iver.cit.gvsig.fmap.MapContext;
179
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
180
import com.iver.cit.gvsig.gui.layout.Attributes;
181
import com.iver.cit.gvsig.gui.panels.CRSSelectPanel;
182
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
183
import com.iver.cit.gvsig.project.Project;
184
import com.iver.cit.gvsig.project.documents.view.gui.View;
185
import com.iver.utiles.StringUtilities;
186
import com.iver.utiles.XMLEntity;
187
import com.iver.utiles.swing.JComboBox;
188
/**
189
 *  View document configuration page.
190
 *  <b><b>
191
 *  Here the user can establish what settings wants to use by default regarding to
192
 *  the document View.
193
 *
194
 *
195
 * @author jaume dominguez faus - jaume.dominguez@iver.es
196
 */
197
public class ViewPage extends AbstractPreferencePage {
198

    
199
        private static final String DEFAULT_PROJECTION_KEY_NAME = "DefaultProjection";
200
        private static final String FACTORY_DEFAULT_PROJECTION = "EPSG:23030";
201
        private static final String ZOOM_IN_FACTOR_KEY_NAME = "ZoomInFactor";
202
        private static final String ZOOM_OUT_FACTOR_KEY_NAME = "ZoomOutFactor";
203
        private static final String ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME = "NewLayersInInvisibleMode";
204
        private static final String KEEP_SCALE_ON_RESIZING_KEY_NAME = "KeepScaleOnResizing";
205
        private static final String DEFAULT_SELECTION_COLOR_KEY_NAME = "DefaultSelectionColor";
206
        private static final String DEFAULT_VIEW_BACK_COLOR_KEY_NAME = "DefaultViewBackColor";
207
        private static final String DEFAULT_DISTANCE_UNITS_KEY_NAME = "DefaultDistanceUnits";
208
        private static final String DEFAULT_MAP_UNITS_KEY_NAME = "DefaultMapUnits";
209
        /*
210
         * Locator's background color, for when we let it be possible
211
         * private static final String DEFAULT_MAP_OVERVIEW_BACK_COLOR_KEY_NAME = "DefaultMapOverViewBackColor";
212
         */
213
        private static final double DEFAULT_ZOOM_IN_FACTOR = 2.0;
214
        private static final double DEFAULT_ZOOM_OUT_FACTOR = 0.5;
215
        private static final Color FACTORY_DEFAULT_SELECTION_COLOR = Color.YELLOW;
216
        private static final Color FACTORY_DEFAULT_VIEW_BACK_COLOR = Color.WHITE;
217
        /*
218
         * Locator's background color, for when we let it be possible
219
         * private static final Color FACTORY_DEFAULT_MAP_OVERVIEW_BACK_COLOR = Color.WHITE;
220
         */
221
        
222
        private static String[] unitsNames = null;
223
        
224
        private static int FACTORY_DEFAULT_MAP_UNITS;
225
        private static int FACTORY_DEFAULT_DISTANCE_UNITS;
226

    
227
        private JTextField txtZoomInFactor;
228
        private JTextField txtZoomOutFactor;
229
        protected String id;
230
        private ImageIcon icon;
231
        //private JLabel lblDefaultProjection;
232
        //private JButton btnChangeProjection;
233
        private String fontName;
234
        private JCheckBox chkInvisibleNewLayers;
235
        private JCheckBox chkKeepScaleOnResizing;
236
        private ColorChooserPanel jccDefaultSelectionColor;
237
        private ColorChooserPanel jccDefaultViewBackColor;
238
        private JComboBox jCmbMapUnits;
239
        private JComboBox jCmbDistanceUnits;
240

    
241
        private boolean panelStarted = false;
242
        private boolean panelInitialized = false;
243
        
244
        private CRSSelectPanel jPanelProj = null;
245

    
246
        /*
247
         * Locator's background color, for when we let it be possible
248
         * private ColorChooserPanel jccDefaultMapOverViewBackColor;
249
         */
250

    
251
        {
252
                Enumeration keys = UIManager.getDefaults().keys();
253
                while (keys.hasMoreElements()) {
254
                        Object key = keys.nextElement();
255
                        Object value = UIManager.get (key);
256
                        if (value instanceof FontUIResource) {
257
                                FontUIResource fur = (FontUIResource) value;
258
                                fontName = fur.getFontName();
259

    
260
                        }
261
                }
262

    
263
                String[] unitNames = Attributes.NAMES;
264
                for (int i = 0; i < unitNames.length; i++) {
265
                        if (unitNames[i].equals(PluginServices.getText(this, "Metros"))) {
266
                                FACTORY_DEFAULT_DISTANCE_UNITS = i;
267
                                FACTORY_DEFAULT_MAP_UNITS = i;
268
                                break;
269
                        }
270
                }
271

    
272
        }
273

    
274
        /**
275
         * Creates a new panel containing View preferences settings.
276
         *
277
         */
278
        public ViewPage() {
279
                super();
280
                id = this.getClass().getName();
281
                icon = new ImageIcon(this.getClass().getClassLoader().getResource("images/Vista.png"));
282
        }
283

    
284
        /**
285
         * This method jPanelProj
286
         *
287
         * @return javax.swing.JPanel
288
         */
289
        private CRSSelectPanel getJPanelProj() {
290
                if (jPanelProj == null) {
291
                        jPanelProj = CRSSelectPanel.getPanel(Project.getDefaultProjection());
292
                        jPanelProj.setPreferredSize(new java.awt.Dimension(330,35));
293
                        jPanelProj.addActionListener(new java.awt.event.ActionListener() {
294
                                public void actionPerformed(java.awt.event.ActionEvent e) {
295
                                        if (jPanelProj.isOkPressed()) {
296
                                                Project.setDefaultProjection(jPanelProj.getCurProj());
297
                                        }
298
                                }
299
                        });
300

    
301
                }
302
                return jPanelProj;
303
        }
304
        public void initializeValues() {
305
                if (!panelStarted) getPanel();
306
                
307
                PluginServices ps = PluginServices.getPluginServices(this);
308
                XMLEntity xml = ps.getPersistentXML();
309

    
310
                // Default Projection
311
                String projCode = null; 
312
                if (xml.contains(DEFAULT_PROJECTION_KEY_NAME)) {
313
                        projCode = xml.getStringProperty(DEFAULT_PROJECTION_KEY_NAME);
314
                } else {
315
                        projCode = FACTORY_DEFAULT_PROJECTION;
316
                }
317
                Project.setDefaultProjection(CRSFactory.getCRS(projCode));
318

    
319
                // Adding invisible new layers
320
                if (xml.contains(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME)) {
321
                        chkInvisibleNewLayers.setSelected(
322
                                xml.getBooleanProperty(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME));
323
                }
324

    
325
                // Keep scale on resizing
326
                if (xml.contains(KEEP_SCALE_ON_RESIZING_KEY_NAME)) {
327
                        chkKeepScaleOnResizing.setSelected(
328
                                xml.getBooleanProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME));
329
                }
330

    
331
                // Zoom-in factor
332
                if (xml.contains(ZOOM_IN_FACTOR_KEY_NAME)) {
333
                        double zoomInFactor = xml.getDoubleProperty(ZOOM_IN_FACTOR_KEY_NAME);
334
                        txtZoomInFactor.setText(String.valueOf( zoomInFactor ));
335
                } else {
336
                        txtZoomInFactor.setText(
337
                                String.valueOf( MapContext.ZOOMINFACTOR ));
338
                }
339
                MapContext.ZOOMINFACTOR = Double.parseDouble(txtZoomInFactor.getText());
340

    
341
                // Zoom-out factor
342
                if (xml.contains(ZOOM_OUT_FACTOR_KEY_NAME)) {
343
                        double zoomOutFactor = xml.getDoubleProperty(ZOOM_OUT_FACTOR_KEY_NAME);
344
                        txtZoomOutFactor.setText(String.valueOf( zoomOutFactor ));
345
                } else {
346
                        txtZoomOutFactor.setText(
347
                                String.valueOf( MapContext.ZOOMOUTFACTOR ));
348
                }
349
                MapContext.ZOOMOUTFACTOR = Double.parseDouble(txtZoomOutFactor.getText());;
350

    
351
                // Default back color
352
                jccDefaultViewBackColor.setColor(View.getDefaultBackColor());
353
                jccDefaultViewBackColor.setAlpha(255);
354
                /*
355
                 * Locator's background color, for when we let it be possible
356
                 * // Default map overview back color
357
                 * jccDefaultMapOverViewBackColor.setColor(Project.getDefaultMapOverViewBackColor());
358
                 * jccDefaultMapOverViewBackColor.setAlpha(255);
359
                 */
360

    
361
                // Default selection color
362
                jccDefaultSelectionColor.setColor(Project.getDefaultSelectionColor());
363
                jccDefaultSelectionColor.setAlpha(255);
364

    
365
                // Map units
366
                jCmbMapUnits.setSelectedIndex(Project.getDefaultMapUnits());
367

    
368
                // Distance units
369
                jCmbDistanceUnits.setSelectedIndex(Project.getDefaultDistanceUnits());
370

    
371
        }
372

    
373
        public String getID() {
374
                return id;
375
        }
376

    
377
        public String getTitle() {
378
                return PluginServices.getText(this, "Vista");
379
        }
380

    
381
        public JPanel getPanel() {
382
                if (panelStarted) return this;
383
                panelStarted = true;
384
                // default projection
385
                addComponent(getJPanelProj());
386
/*                lblDefaultProjection = new JLabel();
387
                lblDefaultProjection.setFont(new java.awt.Font(
388
                        fontName, java.awt.Font.BOLD, 11));
389
                btnChangeProjection = new JButton(PluginServices.getText(this, "change"));
390
                btnChangeProjection.addActionListener(new ActionListener() {
391
                        public void actionPerformed(ActionEvent e) {
392
                                CSSelectionDialog csSelect = new CSSelectionDialog();
393
                                csSelect.setProjection( CRSFactory.getCRS(
394
                                                lblDefaultProjection.getText()));
395
                                PluginServices.getMDIManager().addWindow(csSelect);
396

397
                        if (csSelect.isOkPressed()) {
398
                                IProjection proj = csSelect.getProjection();
399
                                lblDefaultProjection.setText(proj.getAbrev());
400
                        }
401
                        }
402
                });
403

404
                addComponent(PluginServices.getText(this, "default_projection") + ":", lblDefaultProjection );
405
                JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
406
                aux.add(btnChangeProjection);
407
                addComponent("", aux);*/
408

    
409
                // just a separator
410
                addComponent(new JLabel(" "));
411

    
412
                // Adding Invisible New Layers
413
                chkInvisibleNewLayers = new JCheckBox(
414
                                PluginServices.getText(this, "options.view.invisible_new_layers"));
415

    
416
                addComponent("", chkInvisibleNewLayers);
417
                chkKeepScaleOnResizing = new JCheckBox(
418
                                PluginServices.getText(this, "options.view.keep_scale_on_resizing"));
419
                chkKeepScaleOnResizing.setEnabled(false);
420
                addComponent("", chkKeepScaleOnResizing);
421

    
422
                // just a separator
423
                addComponent(new JLabel(" "));
424

    
425
                // zoom in factor
426
                addComponent(PluginServices.getText(this, "zoom_in_factor") + ":",
427
                        txtZoomInFactor = new JTextField("", 15));
428
                // zoom out factor
429
                addComponent(PluginServices.getText(this, "zoom_out_factor") + ":",
430
                        txtZoomOutFactor = new JTextField("", 15));
431

    
432
                // just a separator
433
                addComponent(new JLabel(" "));
434

    
435
                // default back color chooser
436
                addComponent(PluginServices.getText(this, "options.view.default_view_back_color"),
437
                                jccDefaultViewBackColor = new ColorChooserPanel());
438

    
439
                /*
440
                 * Locator's background color, for when we let it be possible
441
                 * // default back color chooser
442
                 * addComponent(PluginServices.getText(this, "options.view.default_map_overview_back_color"), jccDefaultMapOverViewBackColor = new ColorChooserPanel());
443
                 */
444

    
445
                // default selection color chooser
446
                addComponent(PluginServices.getText(this, "options.view.default_selection_color"),
447
                                jccDefaultSelectionColor = new ColorChooserPanel());
448

    
449
                // just a separator
450
                addComponent(new JLabel(" "));
451

    
452
                // default map units
453
                addComponent(PluginServices.getText(this, "map_units"),
454
                                jCmbMapUnits = new JComboBox(getUnitsNames()));
455

    
456
                // default distance units
457
                addComponent(PluginServices.getText(this, "distance_units"),
458
                                jCmbDistanceUnits = new JComboBox(getUnitsNames()));
459

    
460
                initializeValues();
461
                return this;
462
        }
463

    
464
        public void storeValues() throws StoreException {
465
                //String projName = lblDefaultProjection.getText();
466
                double zif;
467
                double zof;
468
                boolean invisibleNewLayers, keepScaleOnResize;
469
                Color selectionColor, viewBackColor;
470
                /*
471
                 * Locator's background color, for when we let it be possible
472
                 * Color mapOverViewBackColor;
473
                 */
474

    
475
                try {
476
                        zif=Double.parseDouble(txtZoomInFactor.getText());
477
                        zof=Double.parseDouble(txtZoomOutFactor.getText());
478

    
479
                        //Project.setDefaultProjection( CRSFactory.getCRS(projName));
480

    
481
                        selectionColor = jccDefaultSelectionColor.getColor();
482
                        Project.setDefaultSelectionColor( selectionColor );
483

    
484
                        viewBackColor = jccDefaultViewBackColor.getColor();
485
                        View.setDefaultBackColor( viewBackColor );
486
                        /*
487
                         * Locator's background color, for when we let it be possible
488
                         * mapOverViewBackColor = jccDefaultMapOverViewBackColor.getColor();
489
                         * View.setDefaultMapOverViewBackColor( mapOverViewBackColor );
490
                         */
491

    
492
                        Project.setDefaultMapUnits(jCmbMapUnits.getSelectedIndex());
493
                        Project.setDefaultDistanceUnits(jCmbDistanceUnits.getSelectedIndex());
494
                        invisibleNewLayers = chkInvisibleNewLayers.isSelected();
495
                        keepScaleOnResize = chkKeepScaleOnResizing.isSelected();
496
                } catch (Exception e) {
497
                        throw new StoreException(PluginServices.getText(this,"factor_zoom_incorrecto"));
498
                }
499
                MapContext.ZOOMINFACTOR=zif;
500
                MapContext.ZOOMOUTFACTOR=zof;
501
                // MapControl.setScalingOnResize(!keepScaleOnResize);
502

    
503
                PluginServices ps = PluginServices.getPluginServices(this);
504
                XMLEntity xml = ps.getPersistentXML();
505
                xml.putProperty(DEFAULT_PROJECTION_KEY_NAME,
506
                        Project.getDefaultProjection().getAbrev());
507
                xml.putProperty(ZOOM_IN_FACTOR_KEY_NAME, zif);
508
                xml.putProperty(ZOOM_OUT_FACTOR_KEY_NAME, zof);
509
                xml.putProperty(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME, invisibleNewLayers);
510
                xml.putProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME, keepScaleOnResize);
511
                xml.putProperty(DEFAULT_VIEW_BACK_COLOR_KEY_NAME, StringUtilities.color2String(viewBackColor));
512
                /*
513
                 * Locator's background color, for when we let it be possible
514
                 * xml.putProperty(DEFAULT_MAP_OVERVIEW_BACK_COLOR_KEY_NAME, StringUtilities.color2String(mapOverViewBackColor));
515
                 */
516
                xml.putProperty(DEFAULT_SELECTION_COLOR_KEY_NAME, StringUtilities.color2String(selectionColor));
517
                xml.putProperty(DEFAULT_MAP_UNITS_KEY_NAME, jCmbMapUnits.getSelectedIndex());
518
                xml.putProperty(DEFAULT_DISTANCE_UNITS_KEY_NAME, jCmbDistanceUnits.getSelectedIndex());
519
        }
520

    
521

    
522
        public void initializeDefaults() {
523
                //lblDefaultProjection.setText(FACTORY_DEFAULT_PROJECTION);
524
                txtZoomInFactor.setText(String.valueOf(DEFAULT_ZOOM_IN_FACTOR));
525
                txtZoomOutFactor.setText(String.valueOf(DEFAULT_ZOOM_OUT_FACTOR));
526
                chkInvisibleNewLayers.setSelected(false);
527
                chkKeepScaleOnResizing.setSelected(false);
528
                jccDefaultViewBackColor.setColor(FACTORY_DEFAULT_VIEW_BACK_COLOR);
529
                /*
530
                 * Locator's background color, for when we let it be possible
531
                 * jccDefaultMapOverViewBackColor.setColor(FACTORY_DEFAULT_VIEW_BACK_COLOR);
532
                 */
533
                jccDefaultSelectionColor.setColor(FACTORY_DEFAULT_SELECTION_COLOR);
534
                jCmbMapUnits.setSelectedIndex(FACTORY_DEFAULT_MAP_UNITS);
535
                jCmbDistanceUnits.setSelectedIndex(FACTORY_DEFAULT_DISTANCE_UNITS);
536

    
537
        }
538

    
539
        public ImageIcon getIcon() {
540
                return icon;
541
        }
542

    
543
        public boolean isValueChanged() {
544
                return super.hasChanged();
545
        }
546

    
547
        public void setChangesApplied() {
548
                setChanged(false);
549
        }
550
        
551
        
552
        private String[] getUnitsNames() {
553
                if (unitsNames == null) {
554
                        unitsNames = new String[Attributes.NAMES.length];
555
                        for (int i=0;i<Attributes.NAMES.length;i++) {
556
                                unitsNames[i]=PluginServices.getText(this, Attributes.NAMES[i]);
557
                        }
558
                }
559
                return unitsNames;
560
        }
561
}