Statistics
| Revision:

root / tags / v2_0_0_Build_2050 / applications / appgvSIG / src / org / gvsig / app / gui / preferencespage / ViewPage.java @ 38653

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

    
173
import java.awt.Color;
174
import java.awt.Dimension;
175
import java.awt.FlowLayout;
176
import java.awt.event.ActionEvent;
177
import java.awt.event.ActionListener;
178
import java.util.Enumeration;
179

    
180
import javax.swing.DefaultComboBoxModel;
181
import javax.swing.ImageIcon;
182
import javax.swing.JCheckBox;
183
import javax.swing.JLabel;
184
import javax.swing.JPanel;
185
import javax.swing.JTextField;
186
import javax.swing.UIManager;
187
import javax.swing.plaf.FontUIResource;
188

    
189
import org.cresques.cts.IProjection;
190
import org.gvsig.andami.PluginServices;
191
import org.gvsig.andami.preferences.AbstractPreferencePage;
192
import org.gvsig.andami.preferences.StoreException;
193
import org.gvsig.app.addlayer.AddLayerDialog;
194
import org.gvsig.app.gui.panels.CRSSelectPanel;
195
import org.gvsig.app.gui.panels.ColorChooserPanel;
196
import org.gvsig.app.gui.panels.crs.ISelectCrsPanel;
197
import org.gvsig.app.project.DefaultProject;
198
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
199
import org.gvsig.fmap.crs.CRSFactory;
200
import org.gvsig.fmap.mapcontext.MapContext;
201
import org.gvsig.gui.beans.swing.JButton;
202
import org.gvsig.utils.StringUtilities;
203
import org.gvsig.utils.XMLEntity;
204
import org.gvsig.utils.swing.JComboBox;
205

    
206
/**
207
 *  View document configuration page.
208
 *  <b><b>
209
 *  Here the user can establish what settings wants to use by default regarding to
210
 *  the document View.
211
 *
212
 *
213
 * @author jaume dominguez faus - jaume.dominguez@iver.es
214
 */
215
public class ViewPage extends AbstractPreferencePage {
216

    
217
        private static final String DEFAULT_PROJECTION_KEY_NAME = "DefaultProjection";
218
        private static final String FACTORY_DEFAULT_PROJECTION = "EPSG:23030";
219
        private static final String ZOOM_IN_FACTOR_KEY_NAME = "ZoomInFactor";
220
        private static final String ZOOM_OUT_FACTOR_KEY_NAME = "ZoomOutFactor";
221
        public static final String ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME = "NewLayersInInvisibleMode";
222
        private static final String KEEP_SCALE_ON_RESIZING_KEY_NAME = "KeepScaleOnResizing";
223
        private static final String DEFAULT_SELECTION_COLOR_KEY_NAME = "DefaultSelectionColor";
224
        private static final String DEFAULT_VIEW_BACK_COLOR_KEY_NAME = "DefaultViewBackColor";
225
        private static final String DEFAULT_DISTANCE_AREA_KEY_NAME = "DefaultDistanceArea";
226
        private static final String DEFAULT_DISTANCE_UNITS_KEY_NAME = "DefaultDistanceUnits";
227
        private static final String DEFAULT_MAP_UNITS_KEY_NAME = "DefaultMapUnits";
228
        /*
229
         * Locator's background color, for when we let it be possible
230
         * private static final String DEFAULT_MAP_OVERVIEW_BACK_COLOR_KEY_NAME = "DefaultMapOverViewBackColor";
231
         */
232
        private static final double DEFAULT_ZOOM_IN_FACTOR = 2.0;
233
        private static final double DEFAULT_ZOOM_OUT_FACTOR = 0.5;
234
        private static final Color FACTORY_DEFAULT_SELECTION_COLOR = Color.YELLOW;
235
        private static final Color FACTORY_DEFAULT_VIEW_BACK_COLOR = Color.WHITE;
236
        /*
237
         * Locator's background color, for when we let it be possible
238
         * private static final Color FACTORY_DEFAULT_MAP_OVERVIEW_BACK_COLOR = Color.WHITE;
239
         */
240

    
241
        private static String[] unitsNames = null;
242

    
243
        private static int FACTORY_DEFAULT_MAP_UNITS;
244
        private static int FACTORY_DEFAULT_DISTANCE_UNITS;
245
        private static int FACTORY_DEFAULT_DISTANCE_AREA;
246

    
247
        private JTextField txtZoomInFactor;
248
        private JTextField txtZoomOutFactor;
249
        protected static String id = ViewPage.class.getName();
250
        private ImageIcon icon;
251
        private JLabel lblDefaultProjection;
252
        private JButton btnChangeProjection;
253
        private String fontName;
254
        private JCheckBox chkInvisibleNewLayers;
255
        private JCheckBox chkKeepScaleOnResizing;
256
        private ColorChooserPanel jccDefaultSelectionColor;
257
        private ColorChooserPanel jccDefaultViewBackColor;
258
        private JComboBox jCmbMapUnits;
259
        private JComboBox jCmbDistanceUnits;
260
        private JComboBox jCmbDistanceArea;
261
        
262
        CRSSelectPanel jPanelProj = null;
263
        
264
        
265
        /*
266
         * Locator's background color, for when we let it be possible
267
         * private ColorChooserPanel jccDefaultMapOverViewBackColor;
268
         */
269

    
270
        {
271
                Enumeration keys = UIManager.getDefaults().keys();
272
                while (keys.hasMoreElements()) {
273
                        Object key = keys.nextElement();
274
                        Object value = UIManager.get (key);
275
                        if (value instanceof FontUIResource) {
276
                                FontUIResource fur = (FontUIResource) value;
277
                                fontName = fur.getFontName();
278

    
279
                        }
280
                }
281

    
282
                String[] unitNames = MapContext.getDistanceNames();
283
                for (int i = 0; i < unitNames.length; i++) {
284
                        if (unitNames[i].equals("Metros")) {
285
                                FACTORY_DEFAULT_DISTANCE_UNITS = i;
286
                                FACTORY_DEFAULT_DISTANCE_AREA = i;
287
                                FACTORY_DEFAULT_MAP_UNITS = i;
288
                                break;
289
                        }
290
                }
291

    
292
        }
293

    
294
        /**
295
         * Creates a new panel containing View preferences settings.
296
         *
297
         */
298
        public ViewPage() {
299
                super();
300

    
301
                icon = PluginServices.getIconTheme().get("vista-icono");
302

    
303
                // default projection
304
                lblDefaultProjection = new JLabel();
305
                lblDefaultProjection.setFont(new java.awt.Font(
306
                        fontName, java.awt.Font.BOLD, 11));
307
                btnChangeProjection = new JButton(PluginServices.getText(this, "change"));
308
                btnChangeProjection.addActionListener(new ActionListener() {
309
                        public void actionPerformed(ActionEvent e) {
310
                                ISelectCrsPanel panel = CRSSelectPanel.getUIFactory().getSelectCrsPanel(
311
                                                CRSFactory.getCRS(lblDefaultProjection.getText()), false);
312
                                PluginServices.getMDIManager().addWindow(panel);
313
                        if (panel.isOkPressed()) {
314
                                IProjection proj = panel.getProjection();
315
                                lblDefaultProjection.setText(proj.getAbrev());
316
                        }
317
                        }
318
                });
319

    
320
                addComponent(PluginServices.getText(this, "default_projection") + ":", lblDefaultProjection );
321
                
322
                IProjection proj = CRSFactory.getCRS("EPSG:23030");
323
                if (PluginServices.getMainFrame() != null) {
324
                        proj = AddLayerDialog.getLastProjection();
325
                }
326

    
327
                jPanelProj = CRSSelectPanel.getPanel(proj);
328
                jPanelProj.setTransPanelActive(true);
329
                jPanelProj.setBounds(11, 400, 448, 35);
330
                jPanelProj.setPreferredSize(new Dimension(448, 35));
331
                jPanelProj.addActionListener(new ActionListener() {
332
                        public void actionPerformed(ActionEvent e) {
333
                                if (jPanelProj.isOkPressed()) {
334
                                        lblDefaultProjection.setText(jPanelProj.getCurProj().getAbrev());
335
                                }
336
                        }
337
                });
338
                
339
                
340
                JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
341
                aux.add(btnChangeProjection);
342
                addComponent("", aux);
343

    
344
                // just a separator
345
                addComponent(new JLabel(" "));
346

    
347
                // Adding Invisible New Layers
348
                chkInvisibleNewLayers = new JCheckBox(
349
                                PluginServices.getText(this, "options.view.invisible_new_layers"));
350

    
351
                addComponent("", chkInvisibleNewLayers);
352
                chkKeepScaleOnResizing = new JCheckBox(
353
                                PluginServices.getText(this, "options.view.keep_scale_on_resizing"));
354
                chkKeepScaleOnResizing.setEnabled(false);
355
                addComponent("", chkKeepScaleOnResizing);
356

    
357
                // just a separator
358
                addComponent(new JLabel(" "));
359

    
360
                // zoom in factor
361
                addComponent(PluginServices.getText(this, "zoom_in_factor") + ":",
362
                        txtZoomInFactor = new JTextField("", 15));
363
                // zoom out factor
364
                addComponent(PluginServices.getText(this, "zoom_out_factor") + ":",
365
                        txtZoomOutFactor = new JTextField("", 15));
366

    
367
                // just a separator
368
                addComponent(new JLabel(" "));
369

    
370
                // default back color chooser
371
                addComponent(PluginServices.getText(this, "options.view.default_view_back_color"),
372
                                jccDefaultViewBackColor = new ColorChooserPanel());
373

    
374
                /*
375
                 * Locator's background color, for when we let it be possible
376
                 * // default back color chooser
377
                 * addComponent(PluginServices.getText(this, "options.view.default_map_overview_back_color"), jccDefaultMapOverViewBackColor = new ColorChooserPanel());
378
                 */
379

    
380
                // default selection color chooser
381
                addComponent(PluginServices.getText(this, "options.view.default_selection_color"),
382
                                jccDefaultSelectionColor = new ColorChooserPanel());
383

    
384
                // just a separator
385
                addComponent(new JLabel(" "));
386

    
387
                // default map units
388
                addComponent(PluginServices.getText(this, "map_units"),
389
                                jCmbMapUnits = new JComboBox());
390

    
391
                // default distance units
392
                addComponent(PluginServices.getText(this, "distance_units"),
393
                                jCmbDistanceUnits = new JComboBox());
394

    
395
                // default distance area
396
                addComponent(PluginServices.getText(this, "distance_area"),
397
                                jCmbDistanceArea = new JComboBox());
398

    
399
                initializeValues();
400
        }
401

    
402
        public void initializeValues() {
403
                PluginServices ps = PluginServices.getPluginServices(this);
404
                XMLEntity xml = ps.getPersistentXML();
405

    
406
                // Default Projection
407
                if (xml.contains(DEFAULT_PROJECTION_KEY_NAME)) {
408
                        lblDefaultProjection.setText(
409
                                xml.getStringProperty(DEFAULT_PROJECTION_KEY_NAME));
410
                } else {
411
                        lblDefaultProjection.setText(FACTORY_DEFAULT_PROJECTION);
412
                }
413
                DefaultProject.setDefaultProjection( CRSFactory.getCRS(lblDefaultProjection.getText()));
414

    
415
                // Adding invisible new layers
416
                if (xml.contains(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME)) {
417
                        chkInvisibleNewLayers.setSelected(
418
                                xml.getBooleanProperty(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME));
419
                }
420

    
421
                // Keep scale on resizing
422
                if (xml.contains(KEEP_SCALE_ON_RESIZING_KEY_NAME)) {
423
                        chkKeepScaleOnResizing.setSelected(
424
                                xml.getBooleanProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME));
425
                }
426

    
427
                // Zoom-in factor
428
                if (xml.contains(ZOOM_IN_FACTOR_KEY_NAME)) {
429
                        double zoomInFactor = xml.getDoubleProperty(ZOOM_IN_FACTOR_KEY_NAME);
430
                        txtZoomInFactor.setText(String.valueOf( zoomInFactor ));
431
                } else {
432
                        txtZoomInFactor.setText(
433
                                String.valueOf( MapContext.ZOOMINFACTOR ));
434
                }
435
                MapContext.ZOOMINFACTOR = Double.parseDouble(txtZoomInFactor.getText());
436

    
437
                // Zoom-out factor
438
                if (xml.contains(ZOOM_OUT_FACTOR_KEY_NAME)) {
439
                        double zoomOutFactor = xml.getDoubleProperty(ZOOM_OUT_FACTOR_KEY_NAME);
440
                        txtZoomOutFactor.setText(String.valueOf( zoomOutFactor ));
441
                } else {
442
                        txtZoomOutFactor.setText(
443
                                String.valueOf( MapContext.ZOOMOUTFACTOR ));
444
                }
445
                MapContext.ZOOMOUTFACTOR = Double.parseDouble(txtZoomOutFactor.getText());;
446

    
447
                // Default back color
448
                jccDefaultViewBackColor.setColor(DefaultViewPanel.getDefaultBackColor());
449
                jccDefaultViewBackColor.setAlpha(255);
450
                /*
451
                 * Locator's background color, for when we let it be possible
452
                 * // Default map overview back color
453
                 * jccDefaultMapOverViewBackColor.setColor(Project.getDefaultMapOverViewBackColor());
454
                 * jccDefaultMapOverViewBackColor.setAlpha(255);
455
                 */
456

    
457
                // Default selection color
458
                jccDefaultSelectionColor.setColor(DefaultProject.getDefaultSelectionColor());
459
                jccDefaultSelectionColor.setAlpha(255);
460
                String[] distanceNames=MapContext.getDistanceNames();
461
                // Map units
462
                if (DefaultProject.getDefaultMapUnits()<=distanceNames.length && distanceNames.length != jCmbMapUnits.getItemCount()){
463
                        ((DefaultComboBoxModel)jCmbMapUnits.getModel()).removeAllElements();
464
                        //                         default map units
465
                        for (int i = 0; i < distanceNames.length; i++) {
466
                                ((DefaultComboBoxModel)jCmbMapUnits.getModel()).addElement(PluginServices.getText(this,distanceNames[i]));
467
                        }
468
                        jCmbMapUnits.setSelectedIndex(DefaultProject.getDefaultMapUnits());
469
                }
470

    
471
                // Distance units
472
                if (DefaultProject.getDefaultDistanceUnits()<=distanceNames.length&& distanceNames.length != jCmbDistanceUnits.getItemCount()){
473
                        ((DefaultComboBoxModel)jCmbDistanceUnits.getModel()).removeAllElements();
474
                        // default distance units
475
                        for (int i = 0; i < distanceNames.length; i++) {
476
                                ((DefaultComboBoxModel)jCmbDistanceUnits.getModel()).addElement(PluginServices.getText(this,distanceNames[i]));
477
                        }
478
                        jCmbDistanceUnits.setSelectedIndex(DefaultProject.getDefaultDistanceUnits());
479
                }
480
                String[] names=MapContext.getAreaNames();
481

    
482
                // Distance area
483
                if (DefaultProject.getDefaultDistanceArea()<=names.length && names.length != jCmbDistanceArea.getItemCount()){
484
                        ((DefaultComboBoxModel)jCmbDistanceArea.getModel()).removeAllElements();
485
                        for (int i = 0; i < names.length; i++) {
486
                                ((DefaultComboBoxModel)jCmbDistanceArea.getModel()).addElement(PluginServices.getText(this,names[i])+MapContext.getOfLinear(i));
487
                        }
488
                        jCmbDistanceArea.setSelectedIndex(DefaultProject.getDefaultDistanceArea());
489
                }
490
        }
491

    
492
        public String getID() {
493
                return id;
494
        }
495

    
496
        public String getTitle() {
497
                return PluginServices.getText(this, "Vista");
498
        }
499

    
500
        public JPanel getPanel() {
501
                return this;
502
        }
503

    
504
        public void storeValues() throws StoreException {
505
                String projName = lblDefaultProjection.getText();
506
                double zif=1;
507
                double zof=1;
508
                boolean invisibleNewLayers, keepScaleOnResize;
509
                Color selectionColor, viewBackColor;
510
                /*
511
                 * Locator's background color, for when we let it be possible
512
                 * Color mapOverViewBackColor;
513
                 */
514

    
515
                try {
516
//                        try {
517
                                zif=Double.parseDouble(txtZoomInFactor.getText());
518
                                zof=Double.parseDouble(txtZoomOutFactor.getText());
519
                                if (zif==0 || zof==0) {
520
                                        throw new NumberFormatException();
521
                                }
522
//                        }catch (NumberFormatException e) {
523
//                                //JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this,"numero_incorrecto")+" = "+ txtZoomInFactor.getText()+ ", "+txtZoomOutFactor.getText());
524
//                                throw new StoreException(PluginServices.getText(this,"numero_incorrecto")+" = "+ txtZoomInFactor.getText()+ ", "+txtZoomOutFactor.getText());
525
//                        }
526
                        DefaultProject.setDefaultProjection( CRSFactory.getCRS(projName));
527

    
528
                        selectionColor = jccDefaultSelectionColor.getColor();
529
                        DefaultProject.setDefaultSelectionColor( selectionColor );
530

    
531
                        viewBackColor = jccDefaultViewBackColor.getColor();
532
                        DefaultViewPanel.setDefaultBackColor( viewBackColor );
533
                        /*
534
                         * Locator's background color, for when we let it be possible
535
                         * mapOverViewBackColor = jccDefaultMapOverViewBackColor.getColor();
536
                         * View.setDefaultMapOverViewBackColor( mapOverViewBackColor );
537
                         */
538

    
539
                        DefaultProject.setDefaultMapUnits(jCmbMapUnits.getSelectedIndex());
540
                        DefaultProject.setDefaultDistanceUnits(jCmbDistanceUnits.getSelectedIndex());
541
                        DefaultProject.setDefaultDistanceArea(jCmbDistanceArea.getSelectedIndex());
542
                        invisibleNewLayers = chkInvisibleNewLayers.isSelected();
543
                        keepScaleOnResize = chkKeepScaleOnResizing.isSelected();
544
                } catch (Exception e) {
545
                        throw new StoreException(PluginServices.getText(this,"factor_zoom_incorrecto"));
546
                }
547
                MapContext.ZOOMINFACTOR=zif;
548
                MapContext.ZOOMOUTFACTOR=zof;
549
                // MapControl.setScalingOnResize(!keepScaleOnResize);
550

    
551
                PluginServices ps = PluginServices.getPluginServices(this);
552
                XMLEntity xml = ps.getPersistentXML();
553
                xml.putProperty(DEFAULT_PROJECTION_KEY_NAME, projName);
554
                xml.putProperty(ZOOM_IN_FACTOR_KEY_NAME, zif);
555
                xml.putProperty(ZOOM_OUT_FACTOR_KEY_NAME, zof);
556
                xml.putProperty(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME, invisibleNewLayers);
557
                xml.putProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME, keepScaleOnResize);
558
                xml.putProperty(DEFAULT_VIEW_BACK_COLOR_KEY_NAME, StringUtilities.color2String(viewBackColor));
559
                /*
560
                 * Locator's background color, for when we let it be possible
561
                 * xml.putProperty(DEFAULT_MAP_OVERVIEW_BACK_COLOR_KEY_NAME, StringUtilities.color2String(mapOverViewBackColor));
562
                 */
563
                xml.putProperty(DEFAULT_SELECTION_COLOR_KEY_NAME, StringUtilities.color2String(selectionColor));
564
                xml.putProperty(DEFAULT_MAP_UNITS_KEY_NAME, jCmbMapUnits.getSelectedIndex());
565
                xml.putProperty(DEFAULT_DISTANCE_UNITS_KEY_NAME, jCmbDistanceUnits.getSelectedIndex());
566
                xml.putProperty(DEFAULT_DISTANCE_AREA_KEY_NAME, jCmbDistanceArea.getSelectedIndex());
567
        }
568

    
569

    
570
        public void initializeDefaults() {
571
                lblDefaultProjection.setText(FACTORY_DEFAULT_PROJECTION);
572
                txtZoomInFactor.setText(String.valueOf(DEFAULT_ZOOM_IN_FACTOR));
573
                txtZoomOutFactor.setText(String.valueOf(DEFAULT_ZOOM_OUT_FACTOR));
574
                chkInvisibleNewLayers.setSelected(false);
575
                chkKeepScaleOnResizing.setSelected(false);
576
                jccDefaultViewBackColor.setColor(FACTORY_DEFAULT_VIEW_BACK_COLOR);
577
                /*
578
                 * Locator's background color, for when we let it be possible
579
                 * jccDefaultMapOverViewBackColor.setColor(FACTORY_DEFAULT_VIEW_BACK_COLOR);
580
                 */
581
                jccDefaultSelectionColor.setColor(FACTORY_DEFAULT_SELECTION_COLOR);
582
                jCmbMapUnits.setSelectedIndex(FACTORY_DEFAULT_MAP_UNITS);
583
                jCmbDistanceUnits.setSelectedIndex(FACTORY_DEFAULT_DISTANCE_UNITS);
584
                jCmbDistanceArea.setSelectedIndex(FACTORY_DEFAULT_DISTANCE_AREA);
585

    
586
        }
587

    
588
        public ImageIcon getIcon() {
589
                return icon;
590
        }
591

    
592
        public boolean isValueChanged() {
593
                return super.hasChanged();
594
        }
595

    
596
        public void setChangesApplied() {
597
                setChanged(false);
598
        }
599

    
600

    
601
//        private String[] getUnitsNames() {
602
//                if (unitsNames == null) {
603
//                        String[] names=MapContext.getDistanceNames();
604
//                        unitsNames = new String[names.length];
605
//                        for (int i=0;i<names.length;i++) {
606
//                                unitsNames[i]=PluginServices.getText(this, names[i]);
607
//                        }
608
//                }
609
//                return unitsNames;
610
//        }
611
}