Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / preferencespage / ViewPage.java @ 30507

History | View | Annotate | Download (20.4 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 30507 2009-08-13 10:33:46Z vcaballero $
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 com.iver.cit.gvsig.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.gui.beans.swing.JButton;
191

    
192
import com.iver.andami.PluginServices;
193
import com.iver.andami.preferences.AbstractPreferencePage;
194
import com.iver.andami.preferences.StoreException;
195
import com.iver.cit.gvsig.addlayer.AddLayerDialog;
196
import com.iver.cit.gvsig.fmap.MapContext;
197
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
198
import com.iver.cit.gvsig.gui.panels.CRSSelectPanel;
199
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
200
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel;
201
import com.iver.cit.gvsig.project.Project;
202
import com.iver.cit.gvsig.project.documents.view.gui.View;
203
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog;
204
import com.iver.utiles.StringUtilities;
205
import com.iver.utiles.XMLEntity;
206
import com.iver.utiles.swing.JComboBox;
207
/**
208
 *  View document configuration page.
209
 *  <b><b>
210
 *  Here the user can establish what settings wants to use by default regarding to
211
 *  the document View.
212
 *
213
 *
214
 * @author jaume dominguez faus - jaume.dominguez@iver.es
215
 */
216
public class ViewPage extends AbstractPreferencePage {
217

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

    
242
        private static String[] unitsNames = null;
243

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

    
248
        private JTextField txtZoomInFactor;
249
        private JTextField txtZoomOutFactor;
250
        protected static String id = ViewPage.class.getName();
251
        private ImageIcon icon;
252
        private JLabel lblDefaultProjection;
253
        private JButton btnChangeProjection;
254
        private String fontName;
255
        private JCheckBox chkInvisibleNewLayers;
256
        private JCheckBox chkKeepScaleOnResizing;
257
        private ColorChooserPanel jccDefaultSelectionColor;
258
        private ColorChooserPanel jccDefaultViewBackColor;
259
        private JComboBox jCmbMapUnits;
260
        private JComboBox jCmbDistanceUnits;
261
        private JComboBox jCmbDistanceArea;
262

    
263
        CRSSelectPanel jPanelProj = null;
264

    
265

    
266
        /*
267
         * Locator's background color, for when we let it be possible
268
         * private ColorChooserPanel jccDefaultMapOverViewBackColor;
269
         */
270

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

    
280
                        }
281
                }
282

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

    
293
        }
294

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

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

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

    
321
                addComponent(PluginServices.getText(this, "default_projection") + ":", lblDefaultProjection );
322

    
323
                IProjection proj = CRSFactory.getCRS("EPSG:23030");
324
                if (PluginServices.getMainFrame() != null) {
325
                        proj = AddLayerDialog.getLastProjection();
326
                }
327

    
328
                jPanelProj = CRSSelectPanel.getPanel(proj);
329
                jPanelProj.setTransPanelActive(true);
330
                jPanelProj.setBounds(11, 400, 448, 35);
331
                jPanelProj.setPreferredSize(new Dimension(448, 35));
332
                jPanelProj.addActionListener(new ActionListener() {
333
                        public void actionPerformed(ActionEvent e) {
334
                                if (jPanelProj.isOkPressed()) {
335
                                        lblDefaultProjection.setText(jPanelProj.getCurProj().getAbrev());
336
                                }
337
                        }
338
                });
339

    
340

    
341
                JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
342
                aux.add(btnChangeProjection);
343
                addComponent("", aux);
344

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

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

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

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

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

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

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

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

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

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

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

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

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

    
400
                initializeValues();
401
        }
402

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

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

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

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

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

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

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

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

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

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

    
492

    
493
        }
494

    
495
        public String getID() {
496
                return id;
497
        }
498

    
499
        public String getTitle() {
500
                return PluginServices.getText(this, "Vista");
501
        }
502

    
503
        public JPanel getPanel() {
504
                return this;
505
        }
506

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

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

    
531
                        selectionColor = jccDefaultSelectionColor.getColor();
532
                        Project.setDefaultSelectionColor( selectionColor );
533

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

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

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

    
572

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

    
589
        }
590

    
591
        public ImageIcon getIcon() {
592
                return icon;
593
        }
594

    
595
        public boolean isValueChanged() {
596
                return super.hasChanged();
597
        }
598

    
599
        public void setChangesApplied() {
600
                setChanged(false);
601
        }
602

    
603

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