Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / extCAD / src / com / iver / cit / gvsig / gui / preferences / EditingPage.java @ 22036

History | View | Annotate | Download (21 KB)

1 11434 caballero
/* 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$
45
* $Log$
46 13881 jaume
* Revision 1.4  2007-09-19 16:01:06  jaume
47
* removed unnecessary imports
48
*
49
* Revision 1.3  2007/05/02 16:55:13  caballero
50 11434 caballero
* Editing colors
51
*
52 11437 caballero
* Revision 1.1.2.2  2007/05/02 15:49:56  caballero
53
* Editing colors
54
*
55 11434 caballero
* Revision 1.1.2.1  2007/05/02 07:50:56  caballero
56
* Editing colors
57
*
58
* Revision 1.4.4.9  2007/02/16 10:30:36  caballero
59
* factor 0 incorrecto
60
*
61
* Revision 1.4.4.8  2006/11/22 01:45:47  luisw2
62
* Recuperados cambios de la RC2 que normalizan la gesti?n de CRSs
63
*
64
* Revision 1.4.4.7  2006/11/15 00:08:09  jjdelcerro
65
* *** empty log message ***
66
*
67
* Revision 1.21  2006/11/08 10:57:55  jaume
68
* remove unecessary imports
69
*
70
* Revision 1.20  2006/10/25 08:34:06  jmvivo
71
* LLamado al PluginServices.getText para las unidades de medida del los combo
72
*
73
* Revision 1.19  2006/10/04 07:23:31  jaume
74
* refactored ambiguous methods and field names and added some more features for preference pages
75
*
76
* Revision 1.18  2006/10/03 09:52:38  jaume
77
* restores to meters
78
*
79
* Revision 1.17  2006/10/03 09:19:12  jaume
80
* *** empty log message ***
81
*
82
* Revision 1.16  2006/10/03 07:26:08  jaume
83
* *** empty log message ***
84
*
85
* Revision 1.15  2006/10/02 15:30:29  jaume
86
* *** empty log message ***
87
*
88
* Revision 1.14  2006/10/02 13:52:34  jaume
89
* organize impots
90
*
91
* Revision 1.13  2006/10/02 13:38:23  jaume
92
* *** empty log message ***
93
*
94
* Revision 1.12  2006/10/02 11:49:23  jaume
95
* *** empty log message ***
96
*
97
* Revision 1.11  2006/09/28 12:04:21  jaume
98
* default selection color now configurable
99
*
100
* Revision 1.10  2006/09/25 10:17:15  caballero
101
* Projection
102
*
103
* Revision 1.9  2006/09/15 10:41:30  caballero
104
* extensibilidad de documentos
105
*
106
* Revision 1.8  2006/09/14 15:43:48  jaume
107
* *** empty log message ***
108
*
109
* Revision 1.7  2006/09/14 15:42:38  jaume
110
* *** empty log message ***
111
*
112
* Revision 1.6  2006/09/14 06:57:18  jaume
113
* *** empty log message ***
114
*
115
* Revision 1.5  2006/09/12 15:56:50  jaume
116
* Default Projection now customizable
117
*
118
* Revision 1.4  2006/08/29 07:21:08  cesar
119
* Rename com.iver.cit.gvsig.fmap.Fmap class to com.iver.cit.gvsig.fmap.MapContext
120
*
121
* Revision 1.3  2006/08/22 12:30:59  jaume
122
* *** empty log message ***
123
*
124
* Revision 1.2  2006/08/22 07:36:04  jaume
125
* *** empty log message ***
126
*
127
* Revision 1.1  2006/08/04 11:41:05  caballero
128
* poder especificar el zoom a aplicar en las vistas
129
*
130
* Revision 1.3  2006/07/31 10:02:31  jaume
131
* *** empty log message ***
132
*
133
* Revision 1.2  2006/06/13 07:43:08  fjp
134
* Ajustes sobre los cuadros de dialogos de preferencias
135
*
136
* Revision 1.1  2006/06/12 16:04:28  caballero
137
* Preferencias
138
*
139
* Revision 1.11  2006/06/06 10:26:31  jaume
140
* *** empty log message ***
141
*
142
* Revision 1.10  2006/06/05 17:07:17  jaume
143
* *** empty log message ***
144
*
145
* Revision 1.9  2006/06/05 17:00:44  jaume
146
* *** empty log message ***
147
*
148
* Revision 1.8  2006/06/05 16:57:59  jaume
149
* *** empty log message ***
150
*
151
* Revision 1.7  2006/06/05 14:45:06  jaume
152
* *** empty log message ***
153
*
154
* Revision 1.6  2006/06/05 11:00:09  jaume
155
* *** empty log message ***
156
*
157
* Revision 1.5  2006/06/05 10:39:02  jaume
158
* *** empty log message ***
159
*
160
* Revision 1.4  2006/06/05 10:13:40  jaume
161
* *** empty log message ***
162
*
163
* Revision 1.3  2006/06/05 10:06:08  jaume
164
* *** empty log message ***
165
*
166
* Revision 1.2  2006/06/05 09:51:56  jaume
167
* *** empty log message ***
168
*
169
* Revision 1.1  2006/06/02 10:50:18  jaume
170
* *** empty log message ***
171
*
172
*
173
*/
174
package com.iver.cit.gvsig.gui.preferences;
175
176
import java.awt.Color;
177
import java.awt.Dimension;
178
import java.awt.GridBagLayout;
179
180
import javax.swing.ImageIcon;
181
import javax.swing.JLabel;
182
import javax.swing.JPanel;
183
import javax.swing.JSlider;
184
import javax.swing.border.TitledBorder;
185
import javax.swing.event.ChangeEvent;
186
import javax.swing.event.ChangeListener;
187
188 21668 vcaballero
import org.gvsig.fmap.geom.Geometry;
189
import org.gvsig.fmap.mapcontext.rendering.symbols.ILineSymbol;
190
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbologyFactory;
191
192 11434 caballero
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.gui.cad.DefaultCADTool;
196
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
197
import com.iver.utiles.StringUtilities;
198
import com.iver.utiles.XMLEntity;
199
/**
200
 *  Editing configuration page.
201
 *  <b><b>
202
 *  Here the user can establish what settings wants to use by default regarding to
203
 *  editing.
204
 *
205
 *
206
 * @author Vicente Caballero Navarro
207
 */
208
public class EditingPage extends AbstractPreferencePage {
209
210 11437 caballero
        public static String DEFAULT_HANDLER_COLOR = "default_editing_handler_color";
211
        public static String DEFAULT_HANDLER_OUTLINE_COLOR = "default_editing_handler_outline_color";
212
213 11434 caballero
        public static String DEFAULT_SELECTION_COLOR = "default_editing_selection_color";
214 11437 caballero
//        public static String DEFAULT_SELECTION_OUTLINE_COLOR = "default_editing_selection_outline_color";
215 11434 caballero
216 11437 caballero
        public static String DEFAULT_AXIS_REFERENCES_COLOR = "default_editing_axis_references_color";
217
//        public static String DEFAULT_AXIS_REFERENCES_OUTLINE_COLOR = "default_editing_axis_references_outline_color";
218 11434 caballero
219 11437 caballero
        public static String DEFAULT_RECTANGLE_SELECTION_COLOR = "default_editing_rectangle_selection_color";
220
//        public static String DEFAULT_GEOMETRY_SELECTION_OUTLINE_COLOR = "default_editing_geometry_selection_outline_color";
221 11434 caballero
222
        protected String id;
223
        private ImageIcon icon;
224
        private ColorChooserPanel jccDefaultSelectionColor;
225 11437 caballero
//        private ColorChooserPanel jccDefaultSelectionOutLineColor;
226
        private ColorChooserPanel jccDefaultAxisReferencesColor;
227
//        private ColorChooserPanel jccDefaultAxisReferencesOutLineColor;
228
        private ColorChooserPanel jccDefaultGeometrySelectionColor;
229
//        private ColorChooserPanel jccDefaultGeometrySelectionOutLineColor;
230 11434 caballero
231 11437 caballero
        private ColorChooserPanel jccDefaultHandlerColor;
232
        private ColorChooserPanel jccDefaultHandlerOutLineColor;
233
234 11434 caballero
        private boolean panelStarted = false;
235
        private JSlider jsDefaultSelectionAlpha;
236 11437 caballero
        private JSlider jsDefaultAxisReferencesAlpha;
237
        private JSlider jsDefaultGeometrySelectionAlpha;
238
        private JSlider jsDefaultHandlerAlpha;
239 11434 caballero
240
        /**
241
         * Creates a new panel containing View preferences settings.
242
         *
243
         */
244
        public EditingPage() {
245
                super();
246
                id = this.getClass().getName();
247 15637 jmvivo
                icon = PluginServices.getIconTheme().get("edition-properties");
248 11434 caballero
        }
249
250
        public void initializeValues() {
251
                if (!panelStarted) getPanel();
252
253
                PluginServices ps = PluginServices.getPluginServices(this);
254
                XMLEntity xml = ps.getPersistentXML();
255
256
                // Default selection color
257
                if (xml.contains(DEFAULT_SELECTION_COLOR)) {
258
                        Color color=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_SELECTION_COLOR));
259
                        jccDefaultSelectionColor.setColor(color);
260
                        jccDefaultSelectionColor.setAlpha(color.getAlpha());
261 11437 caballero
//                        Color colorOutLine=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_SELECTION_OUTLINE_COLOR));
262
//                        jccDefaultSelectionOutLineColor.setColor(colorOutLine);
263
//                        jccDefaultSelectionOutLineColor.setAlpha(color.getAlpha());
264 11434 caballero
                        jsDefaultSelectionAlpha.setValue(color.getAlpha());
265 11437 caballero
                        DefaultCADTool.selectionSymbol = SymbologyFactory.
266 22036 vcaballero
                        createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,color);
267 11437 caballero
//                        DefaultCADTool.selectionSymbol.setOutlineColor(colorOutLine);
268 11434 caballero
                }else{
269 11437 caballero
                        Color color=Color.RED;
270 11434 caballero
                        jccDefaultSelectionColor.setColor(color);
271
                        jccDefaultSelectionColor.setAlpha(color.getAlpha());
272 11437 caballero
//                        jccDefaultSelectionOutLineColor.setColor(color.darker());
273
//                        jccDefaultSelectionOutLineColor.setAlpha(color.getAlpha());
274 11434 caballero
                        jsDefaultSelectionAlpha.setValue(color.getAlpha());
275 11437 caballero
                        DefaultCADTool.selectionSymbol = SymbologyFactory.
276 22036 vcaballero
                        createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,color);
277 11437 caballero
//                        DefaultCADTool.selectionSymbol.setOutlineColor(color.darker());
278 11434 caballero
                }
279
280
281 11437 caballero
                // Default axis references color
282
                if (xml.contains(DEFAULT_AXIS_REFERENCES_COLOR)) {
283
                        Color color=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_AXIS_REFERENCES_COLOR));
284
                        jccDefaultAxisReferencesColor.setColor(color);
285
                        jccDefaultAxisReferencesColor.setAlpha(color.getAlpha());
286
//                        Color colorOutLine=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_AXIS_REFERENCES_OUTLINE_COLOR));
287
//                        jccDefaultAxisReferencesOutLineColor.setColor(colorOutLine);
288
//                        jccDefaultAxisReferencesOutLineColor.setAlpha(color.getAlpha());
289
                        jsDefaultAxisReferencesAlpha.setValue(color.getAlpha());
290
                        DefaultCADTool.axisReferencesSymbol = SymbologyFactory.
291 22036 vcaballero
                        createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,color);
292 11434 caballero
                }else{
293
                        Color color=new Color(100, 100, 100, 100);
294 11437 caballero
                        jccDefaultAxisReferencesColor.setColor(color);
295
                        jccDefaultAxisReferencesColor.setAlpha(color.getAlpha());
296
//                        jccDefaultAxisReferencesOutLineColor.setColor(color.darker());
297
//                        jccDefaultAxisReferencesOutLineColor.setAlpha(color.getAlpha());
298
                        jsDefaultAxisReferencesAlpha.setValue(color.getAlpha());
299
                        DefaultCADTool.axisReferencesSymbol = SymbologyFactory.
300 22036 vcaballero
                        createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,color);
301 11434 caballero
                }
302
303 11437 caballero
                // Default geometry selection color
304
                if (xml.contains(DEFAULT_RECTANGLE_SELECTION_COLOR)) {
305
                        Color color=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_RECTANGLE_SELECTION_COLOR));
306
                        jccDefaultGeometrySelectionColor.setColor(color);
307
                        jccDefaultGeometrySelectionColor.setAlpha(color.getAlpha());
308
//                        Color colorOutLine=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_GEOMETRY_SELECTION_OUTLINE_COLOR));
309
//                        jccDefaultGeometrySelectionOutLineColor.setColor(colorOutLine);
310
//                        jccDefaultGeometrySelectionOutLineColor.setAlpha(color.getAlpha());
311
                        jsDefaultGeometrySelectionAlpha.setValue(color.getAlpha());
312
                        DefaultCADTool.geometrySelectSymbol = SymbologyFactory.
313 22036 vcaballero
                        createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,color);
314 11434 caballero
                }else{
315
                        Color color=new Color(255, 0,0, 100);
316 11437 caballero
                        jccDefaultGeometrySelectionColor.setColor(color);
317
                        jccDefaultGeometrySelectionColor.setAlpha(color.getAlpha());
318
//                        jccDefaultGeometrySelectionOutLineColor.setColor(color.darker());
319
//                        jccDefaultGeometrySelectionOutLineColor.setAlpha(color.getAlpha());
320
                        jsDefaultGeometrySelectionAlpha.setValue(color.getAlpha());
321
                        DefaultCADTool.geometrySelectSymbol = SymbologyFactory.
322 22036 vcaballero
                        createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,color);
323 11437 caballero
                }
324
325
                // Default handler color
326
                if (xml.contains(DEFAULT_HANDLER_COLOR)) {
327
                        Color color=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_HANDLER_COLOR));
328
                        jccDefaultHandlerColor.setColor(color);
329
                        jccDefaultHandlerColor.setAlpha(color.getAlpha());
330
                        Color colorOutLine=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_HANDLER_OUTLINE_COLOR));
331
                        jccDefaultHandlerOutLineColor.setColor(colorOutLine);
332
                        jccDefaultHandlerOutLineColor.setAlpha(color.getAlpha());
333
                        jsDefaultGeometrySelectionAlpha.setValue(color.getAlpha());
334
                        DefaultCADTool.handlerSymbol = SymbologyFactory.
335 22036 vcaballero
                        createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,color);
336 11437 caballero
                        if (DefaultCADTool.handlerSymbol instanceof ILineSymbol) {
337
                                ((ILineSymbol)DefaultCADTool.handlerSymbol).setLineColor(colorOutLine);
338 11434 caballero
                        }
339 11437 caballero
                }else{
340
                        Color color=Color.ORANGE;
341
                        jccDefaultHandlerColor.setColor(color);
342
                        jccDefaultHandlerColor.setAlpha(color.getAlpha());
343
                        jccDefaultHandlerOutLineColor.setColor(color.darker());
344
                        jccDefaultHandlerOutLineColor.setAlpha(color.getAlpha());
345
                        jsDefaultHandlerAlpha.setValue(color.getAlpha());
346
                        DefaultCADTool.handlerSymbol = SymbologyFactory.
347 22036 vcaballero
                        createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,color);
348 11437 caballero
                        if (DefaultCADTool.handlerSymbol instanceof ILineSymbol) {
349
                                ((ILineSymbol)DefaultCADTool.handlerSymbol).setLineColor(color.darker());
350
                        }
351 11434 caballero
                }
352
        }
353
354
        public String getID() {
355
                return id;
356
        }
357
358
        public String getTitle() {
359
                return PluginServices.getText(this, "editing");
360
        }
361
362
        public JPanel getPanel() {
363
                if (panelStarted) return this;
364
                panelStarted = true;
365
366
                // just a separator
367
                addComponent(new JLabel(" "));
368
369
                addComponent(new JLabel(PluginServices.getText(this,"change_the_editing_colors")));
370
                // default selection color chooser
371
                JPanel selectionPanel = new JPanel();
372
                selectionPanel.setBorder(new TitledBorder(PluginServices.getText(this, "options.editing.default_selection_color")));
373
                selectionPanel.setLayout(new GridBagLayout());
374
                selectionPanel.add(new JLabel(PluginServices.getText(this,"fill")));
375
                selectionPanel.add(jccDefaultSelectionColor = new ColorChooserPanel());
376 11437 caballero
//                selectionPanel.add(new JLabel(PluginServices.getText(this,"outline")));
377
//                selectionPanel.add(jccDefaultSelectionOutLineColor=new ColorChooserPanel());
378 11434 caballero
379
380
//                JPanel alphaSelectionPanel= new JPanel();
381
                selectionPanel.add(new JLabel(PluginServices.getText(this,"alpha")));
382
                selectionPanel.add(jsDefaultSelectionAlpha = new JSlider(0,255));
383
                jsDefaultSelectionAlpha.setPreferredSize(new Dimension(100,30));
384
385
                jsDefaultSelectionAlpha.addChangeListener(new ChangeListener(){
386
                        public void stateChanged(ChangeEvent e) {
387
                                jccDefaultSelectionColor.setAlpha(((JSlider)e.getSource()).getValue());
388 11437 caballero
//                                jccDefaultSelectionOutLineColor.setAlpha(((JSlider)e.getSource()).getValue());
389 11434 caballero
390
                        }});
391
392
                addComponent(selectionPanel);
393
                addComponent(new JLabel(" "));
394
395
                // default selection color chooser
396
                JPanel modifyPanel = new JPanel();
397 11437 caballero
                modifyPanel.setBorder(new TitledBorder(PluginServices.getText(this, "options.editing.default_axis_references_color")));
398 11434 caballero
                modifyPanel.setLayout(new GridBagLayout());
399
                modifyPanel.add(new JLabel(PluginServices.getText(this,"fill")));
400 11437 caballero
                modifyPanel.add(jccDefaultAxisReferencesColor = new ColorChooserPanel());
401
//                modifyPanel.add(new JLabel(PluginServices.getText(this,"outline")));
402
//                modifyPanel.add(jccDefaultAxisReferencesOutLineColor=new ColorChooserPanel());
403 11434 caballero
404
//                JPanel alphaModifyPanel= new JPanel();
405
//                alphaModifyPanel.setPreferredSize(new Dimension(120,30));
406
                modifyPanel.add(new JLabel(PluginServices.getText(this,"alpha")));
407 11437 caballero
                modifyPanel.add(jsDefaultAxisReferencesAlpha = new JSlider(0,255));
408
                jsDefaultAxisReferencesAlpha.setPreferredSize(new Dimension(100,30));
409 11434 caballero
410 11437 caballero
                jsDefaultAxisReferencesAlpha.addChangeListener(new ChangeListener(){
411 11434 caballero
                        public void stateChanged(ChangeEvent e) {
412 11437 caballero
                                jccDefaultAxisReferencesColor.setAlpha(((JSlider)e.getSource()).getValue());
413
//                                jccDefaultAxisReferencesOutLineColor.setAlpha(((JSlider)e.getSource()).getValue());
414 11434 caballero
415
                        }});
416
417
                addComponent(modifyPanel);
418
                addComponent(new JLabel(" "));
419
420
                // default drawing color chooser
421
                JPanel drawingPanel = new JPanel();
422 11437 caballero
                drawingPanel.setBorder(new TitledBorder(PluginServices.getText(this, "options.editing.default_rectangle_selection_color")));
423 11434 caballero
                drawingPanel.setLayout(new GridBagLayout());
424
                drawingPanel.add(new JLabel(PluginServices.getText(this,"fill")));
425 11437 caballero
                drawingPanel.add(jccDefaultGeometrySelectionColor = new ColorChooserPanel());
426
//                drawingPanel.add(new JLabel(PluginServices.getText(this,"outline")));
427
//                drawingPanel.add(jccDefaultGeometrySelectionOutLineColor=new ColorChooserPanel());
428 11434 caballero
429
//                JPanel alphaDrawingPanel= new JPanel();
430
//                alphaDrawingPanel.setPreferredSize(new Dimension(120,30));
431
                drawingPanel.add(new JLabel(PluginServices.getText(this,"alpha")));
432 11437 caballero
                drawingPanel.add(jsDefaultGeometrySelectionAlpha = new JSlider(0,255));
433
                jsDefaultGeometrySelectionAlpha.setPreferredSize(new Dimension(100,30));
434 11434 caballero
435 11437 caballero
                jsDefaultGeometrySelectionAlpha.addChangeListener(new ChangeListener(){
436 11434 caballero
                        public void stateChanged(ChangeEvent e) {
437 11437 caballero
                                jccDefaultGeometrySelectionColor.setAlpha(((JSlider)e.getSource()).getValue());
438
//                                jccDefaultGeometrySelectionOutLineColor.setAlpha(((JSlider)e.getSource()).getValue());
439 11434 caballero
440
                        }});
441
442
                addComponent(drawingPanel);
443 11437 caballero
                addComponent(new JLabel(" "));
444 11434 caballero
445 11437 caballero
                // default selection color chooser
446
                JPanel handlerPanel = new JPanel();
447
                handlerPanel.setBorder(new TitledBorder(PluginServices.getText(this, "options.editing.default_handler_color")));
448
                handlerPanel.setLayout(new GridBagLayout());
449
                handlerPanel.add(new JLabel(PluginServices.getText(this,"fill")));
450
                handlerPanel.add(jccDefaultHandlerColor = new ColorChooserPanel());
451
                handlerPanel.add(new JLabel(PluginServices.getText(this,"outline")));
452
                handlerPanel.add(jccDefaultHandlerOutLineColor=new ColorChooserPanel());
453
454
//                JPanel alphaModifyPanel= new JPanel();
455
//                alphaModifyPanel.setPreferredSize(new Dimension(120,30));
456
                handlerPanel.add(new JLabel(PluginServices.getText(this,"alpha")));
457
                handlerPanel.add(jsDefaultHandlerAlpha = new JSlider(0,255));
458
                jsDefaultHandlerAlpha.setPreferredSize(new Dimension(100,30));
459
460
                jsDefaultHandlerAlpha.addChangeListener(new ChangeListener(){
461
                        public void stateChanged(ChangeEvent e) {
462
                                jccDefaultHandlerColor.setAlpha(((JSlider)e.getSource()).getValue());
463
                                jccDefaultHandlerOutLineColor.setAlpha(((JSlider)e.getSource()).getValue());
464
465
                        }});
466
467
                addComponent(handlerPanel);
468 11434 caballero
                addComponent(new JLabel(" "));
469
470
                initializeValues();
471
                return this;
472
        }
473
474
        public void storeValues() throws StoreException {
475 11437 caballero
                Color selectionColor, modifyColor, drawingColor, handlerColor, handlerOutLineColor;// selectionOutLineColor, modifyOutLineColor, drawingOutLineColor;
476 11434 caballero
                selectionColor = jccDefaultSelectionColor.getColor();
477 11437 caballero
//                selectionOutLineColor = jccDefaultSelectionOutLineColor.getColor();
478
                modifyColor = jccDefaultAxisReferencesColor.getColor();
479
//                modifyOutLineColor = jccDefaultAxisReferencesOutLineColor.getColor();
480
                drawingColor = jccDefaultGeometrySelectionColor.getColor();
481
//                drawingOutLineColor = jccDefaultGeometrySelectionOutLineColor.getColor();
482 11434 caballero
483 11437 caballero
                handlerColor = jccDefaultHandlerColor.getColor();
484
                handlerOutLineColor = jccDefaultHandlerOutLineColor.getColor();
485
486
487 11434 caballero
                PluginServices ps = PluginServices.getPluginServices(this);
488
                XMLEntity xml = ps.getPersistentXML();
489
                xml.putProperty(DEFAULT_SELECTION_COLOR,
490
                        StringUtilities.color2String(selectionColor));
491 11437 caballero
//                xml.putProperty(DEFAULT_SELECTION_OUTLINE_COLOR,
492
//                                StringUtilities.color2String(selectionOutLineColor));
493
                DefaultCADTool.selectionSymbol = SymbologyFactory.
494 22036 vcaballero
                createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,selectionColor);
495 11437 caballero
//                DefaultCADTool.selectionSymbol.setOutlineColor(selectionOutLineColor);
496 11434 caballero
497 11437 caballero
                xml.putProperty(DEFAULT_AXIS_REFERENCES_COLOR,
498 11434 caballero
                        StringUtilities.color2String(modifyColor));
499 11437 caballero
//                xml.putProperty(DEFAULT_AXIS_REFERENCES_OUTLINE_COLOR,
500
//                                StringUtilities.color2String(modifyOutLineColor));
501
                DefaultCADTool.axisReferencesSymbol = SymbologyFactory.
502 22036 vcaballero
                createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,modifyColor);
503 11437 caballero
//                DefaultCADTool.axisReferencesSymbol.setOutlineColor(modifyOutLineColor);
504 11434 caballero
505 11437 caballero
                xml.putProperty(DEFAULT_RECTANGLE_SELECTION_COLOR,
506 11434 caballero
                                StringUtilities.color2String(drawingColor));
507 11437 caballero
//                xml.putProperty(DEFAULT_GEOMETRY_SELECTION_OUTLINE_COLOR,
508
//                                StringUtilities.color2String(drawingOutLineColor));
509
                DefaultCADTool.geometrySelectSymbol = SymbologyFactory.
510 22036 vcaballero
                createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,drawingColor);
511 11437 caballero
//                DefaultCADTool.geometrySelectSymbol.setOutlineColor(drawingOutLineColor);
512
513
                xml.putProperty(DEFAULT_HANDLER_COLOR,
514
                                StringUtilities.color2String(handlerColor));
515
                xml.putProperty(DEFAULT_HANDLER_OUTLINE_COLOR,
516
                                StringUtilities.color2String(handlerOutLineColor));
517
                DefaultCADTool.handlerSymbol = SymbologyFactory.
518 22036 vcaballero
                createDefaultSymbolByShapeType(Geometry.TYPES.GEOMETRY,handlerColor);
519 11437 caballero
                if (DefaultCADTool.handlerSymbol instanceof ILineSymbol) {
520
                        ((ILineSymbol)DefaultCADTool.handlerSymbol).setLineColor(handlerOutLineColor);
521 11434 caballero
                }
522
        }
523
524
525
        public void initializeDefaults() {
526
                jccDefaultSelectionColor.setColor(Color.ORANGE);
527 11437 caballero
//                jccDefaultSelectionOutLineColor.setColor(Color.ORANGE.darker());
528 11434 caballero
                jsDefaultSelectionAlpha.setValue(255);
529
530 11437 caballero
                jccDefaultAxisReferencesColor.setColor(new Color(100, 100, 100, 100));
531
//                jccDefaultAxisReferencesOutLineColor.setColor(new Color(100, 100, 100, 100).darker());
532
                jsDefaultAxisReferencesAlpha.setValue(100);
533 11434 caballero
534 11437 caballero
                jccDefaultGeometrySelectionColor.setColor(new Color(255, 0,0, 100));
535
//                jccDefaultGeometrySelectionOutLineColor.setColor(new Color(255, 0, 0, 100).darker());
536
                jsDefaultGeometrySelectionAlpha.setValue(100);
537
538
                jccDefaultHandlerColor.setColor(new Color(255, 0,0, 100));
539
                jccDefaultHandlerOutLineColor.setColor(new Color(255, 0, 0, 100).darker());
540
                jsDefaultHandlerAlpha.setValue(100);
541
542 11434 caballero
        }
543
544
        public ImageIcon getIcon() {
545
                return icon;
546
        }
547
548
        public boolean isValueChanged() {
549
                return super.hasChanged();
550
        }
551
552
        public void setChangesApplied() {
553
                setChanged(false);
554
        }
555
}