root / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / gui / preferences / EditingPage.java @ 30335
History | View | Annotate | Download (21.6 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: EditingPage.java 30335 2009-08-06 06:58:54Z jpiera $
|
45 |
* $Log$
|
46 |
* 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 |
* Editing colors
|
51 |
*
|
52 |
* Revision 1.1.2.2 2007/05/02 15:49:56 caballero
|
53 |
* Editing colors
|
54 |
*
|
55 |
* 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 org.gvsig.editing.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 |
import org.gvsig.andami.PluginServices; |
189 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
190 |
import org.gvsig.andami.preferences.StoreException; |
191 |
import org.gvsig.app.gui.panels.ColorChooserPanel; |
192 |
import org.gvsig.editing.gui.cad.DefaultCADTool; |
193 |
import org.gvsig.fmap.geom.Geometry; |
194 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
195 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
196 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
197 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
198 |
import org.gvsig.fmap.mapcontrol.MapControlManager; |
199 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
200 |
import org.gvsig.utils.StringUtilities; |
201 |
import org.gvsig.utils.XMLEntity; |
202 |
|
203 |
|
204 |
/**
|
205 |
* Editing configuration page.
|
206 |
* <b><b>
|
207 |
* Here the user can establish what settings wants to use by default regarding to
|
208 |
* editing.
|
209 |
*
|
210 |
*
|
211 |
* @author Vicente Caballero Navarro
|
212 |
*/
|
213 |
public class EditingPage extends AbstractPreferencePage { |
214 |
|
215 |
public static String DEFAULT_HANDLER_COLOR = "default_editing_handler_color"; |
216 |
public static String DEFAULT_HANDLER_OUTLINE_COLOR = "default_editing_handler_outline_color"; |
217 |
|
218 |
public static String DEFAULT_SELECTION_COLOR = "default_editing_selection_color"; |
219 |
// public static String DEFAULT_SELECTION_OUTLINE_COLOR = "default_editing_selection_outline_color";
|
220 |
|
221 |
public static String DEFAULT_AXIS_REFERENCES_COLOR = "default_editing_axis_references_color"; |
222 |
// public static String DEFAULT_AXIS_REFERENCES_OUTLINE_COLOR = "default_editing_axis_references_outline_color";
|
223 |
|
224 |
public static String DEFAULT_RECTANGLE_SELECTION_COLOR = "default_editing_rectangle_selection_color"; |
225 |
// public static String DEFAULT_GEOMETRY_SELECTION_OUTLINE_COLOR = "default_editing_geometry_selection_outline_color";
|
226 |
|
227 |
protected String id; |
228 |
private ImageIcon icon; |
229 |
private ColorChooserPanel jccDefaultSelectionColor;
|
230 |
// private ColorChooserPanel jccDefaultSelectionOutLineColor;
|
231 |
private ColorChooserPanel jccDefaultAxisReferencesColor;
|
232 |
// private ColorChooserPanel jccDefaultAxisReferencesOutLineColor;
|
233 |
private ColorChooserPanel jccDefaultGeometrySelectionColor;
|
234 |
// private ColorChooserPanel jccDefaultGeometrySelectionOutLineColor;
|
235 |
|
236 |
private ColorChooserPanel jccDefaultHandlerColor;
|
237 |
private ColorChooserPanel jccDefaultHandlerOutLineColor;
|
238 |
|
239 |
private boolean panelStarted = false; |
240 |
private JSlider jsDefaultSelectionAlpha; |
241 |
private JSlider jsDefaultAxisReferencesAlpha; |
242 |
private JSlider jsDefaultGeometrySelectionAlpha; |
243 |
private JSlider jsDefaultHandlerAlpha; |
244 |
|
245 |
private MapContextManager mapContextManager = MapContextLocator.getMapContextManager();
|
246 |
private MapControlManager mapControlManager = MapControlLocator.getMapControlManager();
|
247 |
|
248 |
/**
|
249 |
* Creates a new panel containing View preferences settings.
|
250 |
*
|
251 |
*/
|
252 |
public EditingPage() {
|
253 |
super();
|
254 |
id = this.getClass().getName();
|
255 |
icon = PluginServices.getIconTheme().get("edition-properties");
|
256 |
} |
257 |
|
258 |
public void initializeValues() { |
259 |
if (!panelStarted) getPanel();
|
260 |
|
261 |
PluginServices ps = PluginServices.getPluginServices(this);
|
262 |
XMLEntity xml = ps.getPersistentXML(); |
263 |
|
264 |
// Default selection color
|
265 |
if (xml.contains(DEFAULT_SELECTION_COLOR)) {
|
266 |
Color color=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_SELECTION_COLOR));
|
267 |
jccDefaultSelectionColor.setColor(color); |
268 |
jccDefaultSelectionColor.setAlpha(color.getAlpha()); |
269 |
// Color colorOutLine=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_SELECTION_OUTLINE_COLOR));
|
270 |
// jccDefaultSelectionOutLineColor.setColor(colorOutLine);
|
271 |
// jccDefaultSelectionOutLineColor.setAlpha(color.getAlpha());
|
272 |
jsDefaultSelectionAlpha.setValue(color.getAlpha()); |
273 |
mapControlManager.setSelectionSymbol(mapContextManager.createSymbol( |
274 |
Geometry.TYPES.GEOMETRY, color)); |
275 |
// DefaultCADTool.selectionSymbol.setOutlineColor(colorOutLine);
|
276 |
}else{
|
277 |
Color color=Color.RED; |
278 |
jccDefaultSelectionColor.setColor(color); |
279 |
jccDefaultSelectionColor.setAlpha(color.getAlpha()); |
280 |
// jccDefaultSelectionOutLineColor.setColor(color.darker());
|
281 |
// jccDefaultSelectionOutLineColor.setAlpha(color.getAlpha());
|
282 |
jsDefaultSelectionAlpha.setValue(color.getAlpha()); |
283 |
mapControlManager.setSelectionSymbol(mapContextManager.createSymbol( |
284 |
Geometry.TYPES.GEOMETRY, color)); |
285 |
// DefaultCADTool.selectionSymbol.setOutlineColor(color.darker());
|
286 |
} |
287 |
|
288 |
|
289 |
// Default axis references color
|
290 |
if (xml.contains(DEFAULT_AXIS_REFERENCES_COLOR)) {
|
291 |
Color color=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_AXIS_REFERENCES_COLOR));
|
292 |
jccDefaultAxisReferencesColor.setColor(color); |
293 |
jccDefaultAxisReferencesColor.setAlpha(color.getAlpha()); |
294 |
// Color colorOutLine=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_AXIS_REFERENCES_OUTLINE_COLOR));
|
295 |
// jccDefaultAxisReferencesOutLineColor.setColor(colorOutLine);
|
296 |
// jccDefaultAxisReferencesOutLineColor.setAlpha(color.getAlpha());
|
297 |
jsDefaultAxisReferencesAlpha.setValue(color.getAlpha()); |
298 |
ISymbol symbol = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, color); |
299 |
mapControlManager.setAxisReferenceSymbol(symbol); |
300 |
}else{
|
301 |
Color color=new Color(100, 100, 100, 100); |
302 |
jccDefaultAxisReferencesColor.setColor(color); |
303 |
jccDefaultAxisReferencesColor.setAlpha(color.getAlpha()); |
304 |
// jccDefaultAxisReferencesOutLineColor.setColor(color.darker());
|
305 |
// jccDefaultAxisReferencesOutLineColor.setAlpha(color.getAlpha());
|
306 |
jsDefaultAxisReferencesAlpha.setValue(color.getAlpha()); |
307 |
ISymbol symbol = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, color); |
308 |
mapControlManager.setAxisReferenceSymbol(symbol); |
309 |
} |
310 |
|
311 |
// Default geometry selection color
|
312 |
if (xml.contains(DEFAULT_RECTANGLE_SELECTION_COLOR)) {
|
313 |
Color color=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_RECTANGLE_SELECTION_COLOR));
|
314 |
jccDefaultGeometrySelectionColor.setColor(color); |
315 |
jccDefaultGeometrySelectionColor.setAlpha(color.getAlpha()); |
316 |
// Color colorOutLine=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_GEOMETRY_SELECTION_OUTLINE_COLOR));
|
317 |
// jccDefaultGeometrySelectionOutLineColor.setColor(colorOutLine);
|
318 |
// jccDefaultGeometrySelectionOutLineColor.setAlpha(color.getAlpha());
|
319 |
jsDefaultGeometrySelectionAlpha.setValue(color.getAlpha()); |
320 |
ISymbol symbol = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, color); |
321 |
mapControlManager.setGeometrySelectionSymbol(symbol); |
322 |
}else{
|
323 |
Color color=new Color(255, 0,0, 100); |
324 |
jccDefaultGeometrySelectionColor.setColor(color); |
325 |
jccDefaultGeometrySelectionColor.setAlpha(color.getAlpha()); |
326 |
// jccDefaultGeometrySelectionOutLineColor.setColor(color.darker());
|
327 |
// jccDefaultGeometrySelectionOutLineColor.setAlpha(color.getAlpha());
|
328 |
jsDefaultGeometrySelectionAlpha.setValue(color.getAlpha()); |
329 |
ISymbol symbol = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, color); |
330 |
mapControlManager.setGeometrySelectionSymbol(symbol); |
331 |
} |
332 |
|
333 |
// Default handler color
|
334 |
if (xml.contains(DEFAULT_HANDLER_COLOR)) {
|
335 |
Color color=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_HANDLER_COLOR));
|
336 |
jccDefaultHandlerColor.setColor(color); |
337 |
jccDefaultHandlerColor.setAlpha(color.getAlpha()); |
338 |
Color colorOutLine=StringUtilities.string2Color(xml.getStringProperty(DEFAULT_HANDLER_OUTLINE_COLOR));
|
339 |
jccDefaultHandlerOutLineColor.setColor(colorOutLine); |
340 |
jccDefaultHandlerOutLineColor.setAlpha(color.getAlpha()); |
341 |
jsDefaultGeometrySelectionAlpha.setValue(color.getAlpha()); |
342 |
ISymbol symbol = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, color); |
343 |
mapControlManager.setHandlerSymbol(symbol); |
344 |
if (mapControlManager.getHandlerSymbol()instanceof ILineSymbol) { |
345 |
((ILineSymbol)mapControlManager.getHandlerSymbol()).setLineColor(colorOutLine); |
346 |
} |
347 |
}else{
|
348 |
Color color=Color.ORANGE; |
349 |
jccDefaultHandlerColor.setColor(color); |
350 |
jccDefaultHandlerColor.setAlpha(color.getAlpha()); |
351 |
jccDefaultHandlerOutLineColor.setColor(color.darker()); |
352 |
jccDefaultHandlerOutLineColor.setAlpha(color.getAlpha()); |
353 |
jsDefaultHandlerAlpha.setValue(color.getAlpha()); |
354 |
ISymbol symbol = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, color); |
355 |
mapControlManager.setHandlerSymbol(symbol); |
356 |
if (mapControlManager.getHandlerSymbol() instanceof ILineSymbol) { |
357 |
((ILineSymbol)mapControlManager.getHandlerSymbol()).setLineColor(color.darker()); |
358 |
} |
359 |
} |
360 |
} |
361 |
|
362 |
public String getID() { |
363 |
return id;
|
364 |
} |
365 |
|
366 |
public String getTitle() { |
367 |
return PluginServices.getText(this, "editing"); |
368 |
} |
369 |
|
370 |
public JPanel getPanel() { |
371 |
if (panelStarted) return this; |
372 |
panelStarted = true;
|
373 |
|
374 |
// just a separator
|
375 |
addComponent(new JLabel(" ")); |
376 |
|
377 |
addComponent(new JLabel(PluginServices.getText(this,"change_the_editing_colors"))); |
378 |
// default selection color chooser
|
379 |
JPanel selectionPanel = new JPanel(); |
380 |
selectionPanel.setBorder(new TitledBorder(PluginServices.getText(this, "options.editing.default_selection_color"))); |
381 |
selectionPanel.setLayout(new GridBagLayout()); |
382 |
selectionPanel.add(new JLabel(PluginServices.getText(this,"fill"))); |
383 |
selectionPanel.add(jccDefaultSelectionColor = new ColorChooserPanel());
|
384 |
// selectionPanel.add(new JLabel(PluginServices.getText(this,"outline")));
|
385 |
// selectionPanel.add(jccDefaultSelectionOutLineColor=new ColorChooserPanel());
|
386 |
|
387 |
|
388 |
// JPanel alphaSelectionPanel= new JPanel();
|
389 |
selectionPanel.add(new JLabel(PluginServices.getText(this,"alpha"))); |
390 |
selectionPanel.add(jsDefaultSelectionAlpha = new JSlider(0,255)); |
391 |
jsDefaultSelectionAlpha.setPreferredSize(new Dimension(100,30)); |
392 |
|
393 |
jsDefaultSelectionAlpha.addChangeListener(new ChangeListener(){ |
394 |
public void stateChanged(ChangeEvent e) { |
395 |
jccDefaultSelectionColor.setAlpha(((JSlider)e.getSource()).getValue());
|
396 |
// jccDefaultSelectionOutLineColor.setAlpha(((JSlider)e.getSource()).getValue());
|
397 |
|
398 |
}}); |
399 |
|
400 |
addComponent(selectionPanel); |
401 |
addComponent(new JLabel(" ")); |
402 |
|
403 |
// default selection color chooser
|
404 |
JPanel modifyPanel = new JPanel(); |
405 |
modifyPanel.setBorder(new TitledBorder(PluginServices.getText(this, "options.editing.default_axis_references_color"))); |
406 |
modifyPanel.setLayout(new GridBagLayout()); |
407 |
modifyPanel.add(new JLabel(PluginServices.getText(this,"fill"))); |
408 |
modifyPanel.add(jccDefaultAxisReferencesColor = new ColorChooserPanel());
|
409 |
// modifyPanel.add(new JLabel(PluginServices.getText(this,"outline")));
|
410 |
// modifyPanel.add(jccDefaultAxisReferencesOutLineColor=new ColorChooserPanel());
|
411 |
|
412 |
// JPanel alphaModifyPanel= new JPanel();
|
413 |
// alphaModifyPanel.setPreferredSize(new Dimension(120,30));
|
414 |
modifyPanel.add(new JLabel(PluginServices.getText(this,"alpha"))); |
415 |
modifyPanel.add(jsDefaultAxisReferencesAlpha = new JSlider(0,255)); |
416 |
jsDefaultAxisReferencesAlpha.setPreferredSize(new Dimension(100,30)); |
417 |
|
418 |
jsDefaultAxisReferencesAlpha.addChangeListener(new ChangeListener(){ |
419 |
public void stateChanged(ChangeEvent e) { |
420 |
jccDefaultAxisReferencesColor.setAlpha(((JSlider)e.getSource()).getValue());
|
421 |
// jccDefaultAxisReferencesOutLineColor.setAlpha(((JSlider)e.getSource()).getValue());
|
422 |
|
423 |
}}); |
424 |
|
425 |
addComponent(modifyPanel); |
426 |
addComponent(new JLabel(" ")); |
427 |
|
428 |
// default drawing color chooser
|
429 |
JPanel drawingPanel = new JPanel(); |
430 |
drawingPanel.setBorder(new TitledBorder(PluginServices.getText(this, "options.editing.default_rectangle_selection_color"))); |
431 |
drawingPanel.setLayout(new GridBagLayout()); |
432 |
drawingPanel.add(new JLabel(PluginServices.getText(this,"fill"))); |
433 |
drawingPanel.add(jccDefaultGeometrySelectionColor = new ColorChooserPanel());
|
434 |
// drawingPanel.add(new JLabel(PluginServices.getText(this,"outline")));
|
435 |
// drawingPanel.add(jccDefaultGeometrySelectionOutLineColor=new ColorChooserPanel());
|
436 |
|
437 |
// JPanel alphaDrawingPanel= new JPanel();
|
438 |
// alphaDrawingPanel.setPreferredSize(new Dimension(120,30));
|
439 |
drawingPanel.add(new JLabel(PluginServices.getText(this,"alpha"))); |
440 |
drawingPanel.add(jsDefaultGeometrySelectionAlpha = new JSlider(0,255)); |
441 |
jsDefaultGeometrySelectionAlpha.setPreferredSize(new Dimension(100,30)); |
442 |
|
443 |
jsDefaultGeometrySelectionAlpha.addChangeListener(new ChangeListener(){ |
444 |
public void stateChanged(ChangeEvent e) { |
445 |
jccDefaultGeometrySelectionColor.setAlpha(((JSlider)e.getSource()).getValue());
|
446 |
// jccDefaultGeometrySelectionOutLineColor.setAlpha(((JSlider)e.getSource()).getValue());
|
447 |
|
448 |
}}); |
449 |
|
450 |
addComponent(drawingPanel); |
451 |
addComponent(new JLabel(" ")); |
452 |
|
453 |
// default selection color chooser
|
454 |
JPanel handlerPanel = new JPanel(); |
455 |
handlerPanel.setBorder(new TitledBorder(PluginServices.getText(this, "options.editing.default_handler_color"))); |
456 |
handlerPanel.setLayout(new GridBagLayout()); |
457 |
handlerPanel.add(new JLabel(PluginServices.getText(this,"fill"))); |
458 |
handlerPanel.add(jccDefaultHandlerColor = new ColorChooserPanel());
|
459 |
handlerPanel.add(new JLabel(PluginServices.getText(this,"outline"))); |
460 |
handlerPanel.add(jccDefaultHandlerOutLineColor=new ColorChooserPanel());
|
461 |
|
462 |
// JPanel alphaModifyPanel= new JPanel();
|
463 |
// alphaModifyPanel.setPreferredSize(new Dimension(120,30));
|
464 |
handlerPanel.add(new JLabel(PluginServices.getText(this,"alpha"))); |
465 |
handlerPanel.add(jsDefaultHandlerAlpha = new JSlider(0,255)); |
466 |
jsDefaultHandlerAlpha.setPreferredSize(new Dimension(100,30)); |
467 |
|
468 |
jsDefaultHandlerAlpha.addChangeListener(new ChangeListener(){ |
469 |
public void stateChanged(ChangeEvent e) { |
470 |
jccDefaultHandlerColor.setAlpha(((JSlider)e.getSource()).getValue());
|
471 |
jccDefaultHandlerOutLineColor.setAlpha(((JSlider)e.getSource()).getValue());
|
472 |
|
473 |
}}); |
474 |
|
475 |
addComponent(handlerPanel); |
476 |
addComponent(new JLabel(" ")); |
477 |
|
478 |
initializeValues(); |
479 |
return this; |
480 |
} |
481 |
|
482 |
public void storeValues() throws StoreException { |
483 |
Color selectionColor, modifyColor, drawingColor, handlerColor, handlerOutLineColor;// selectionOutLineColor, modifyOutLineColor, drawingOutLineColor; |
484 |
selectionColor = jccDefaultSelectionColor.getColor(); |
485 |
// selectionOutLineColor = jccDefaultSelectionOutLineColor.getColor();
|
486 |
modifyColor = jccDefaultAxisReferencesColor.getColor(); |
487 |
// modifyOutLineColor = jccDefaultAxisReferencesOutLineColor.getColor();
|
488 |
drawingColor = jccDefaultGeometrySelectionColor.getColor(); |
489 |
// drawingOutLineColor = jccDefaultGeometrySelectionOutLineColor.getColor();
|
490 |
|
491 |
handlerColor = jccDefaultHandlerColor.getColor(); |
492 |
handlerOutLineColor = jccDefaultHandlerOutLineColor.getColor(); |
493 |
|
494 |
|
495 |
PluginServices ps = PluginServices.getPluginServices(this);
|
496 |
XMLEntity xml = ps.getPersistentXML(); |
497 |
xml.putProperty(DEFAULT_SELECTION_COLOR, |
498 |
StringUtilities.color2String(selectionColor)); |
499 |
// xml.putProperty(DEFAULT_SELECTION_OUTLINE_COLOR,
|
500 |
// StringUtilities.color2String(selectionOutLineColor));
|
501 |
ISymbol symbol = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, selectionColor); |
502 |
mapControlManager.setSelectionSymbol(symbol); |
503 |
|
504 |
// DefaultCADTool.selectionSymbol.setOutlineColor(selectionOutLineColor);
|
505 |
|
506 |
xml.putProperty(DEFAULT_AXIS_REFERENCES_COLOR, |
507 |
StringUtilities.color2String(modifyColor)); |
508 |
// xml.putProperty(DEFAULT_AXIS_REFERENCES_OUTLINE_COLOR,
|
509 |
// StringUtilities.color2String(modifyOutLineColor));
|
510 |
ISymbol symbol2 = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, modifyColor); |
511 |
mapControlManager.setAxisReferenceSymbol(symbol2); |
512 |
// DefaultCADTool.axisReferencesSymbol.setOutlineColor(modifyOutLineColor);
|
513 |
|
514 |
xml.putProperty(DEFAULT_RECTANGLE_SELECTION_COLOR, |
515 |
StringUtilities.color2String(drawingColor)); |
516 |
// xml.putProperty(DEFAULT_GEOMETRY_SELECTION_OUTLINE_COLOR,
|
517 |
// StringUtilities.color2String(drawingOutLineColor));
|
518 |
ISymbol symbol3 = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, drawingColor); |
519 |
mapControlManager.setGeometrySelectionSymbol(symbol3); |
520 |
|
521 |
// DefaultCADTool.geometrySelectSymbol.setOutlineColor(drawingOutLineColor);
|
522 |
|
523 |
xml.putProperty(DEFAULT_HANDLER_COLOR, |
524 |
StringUtilities.color2String(handlerColor)); |
525 |
xml.putProperty(DEFAULT_HANDLER_OUTLINE_COLOR, |
526 |
StringUtilities.color2String(handlerOutLineColor)); |
527 |
|
528 |
ISymbol symbol4 = mapContextManager.createSymbol(Geometry.TYPES.GEOMETRY, handlerColor); |
529 |
mapControlManager.setHandlerSymbol(symbol4); |
530 |
|
531 |
if (mapControlManager.getHandlerSymbol() instanceof ILineSymbol) { |
532 |
((ILineSymbol)mapControlManager.getHandlerSymbol()).setLineColor(handlerOutLineColor); |
533 |
} |
534 |
} |
535 |
|
536 |
|
537 |
public void initializeDefaults() { |
538 |
jccDefaultSelectionColor.setColor(Color.ORANGE);
|
539 |
// jccDefaultSelectionOutLineColor.setColor(Color.ORANGE.darker());
|
540 |
jsDefaultSelectionAlpha.setValue(255);
|
541 |
|
542 |
jccDefaultAxisReferencesColor.setColor(new Color(100, 100, 100, 100)); |
543 |
// jccDefaultAxisReferencesOutLineColor.setColor(new Color(100, 100, 100, 100).darker());
|
544 |
jsDefaultAxisReferencesAlpha.setValue(100);
|
545 |
|
546 |
jccDefaultGeometrySelectionColor.setColor(new Color(255, 0,0, 100)); |
547 |
// jccDefaultGeometrySelectionOutLineColor.setColor(new Color(255, 0, 0, 100).darker());
|
548 |
jsDefaultGeometrySelectionAlpha.setValue(100);
|
549 |
|
550 |
jccDefaultHandlerColor.setColor(new Color(255, 0,0, 100)); |
551 |
jccDefaultHandlerOutLineColor.setColor(new Color(255, 0, 0, 100).darker()); |
552 |
jsDefaultHandlerAlpha.setValue(100);
|
553 |
|
554 |
} |
555 |
|
556 |
public ImageIcon getIcon() { |
557 |
return icon;
|
558 |
} |
559 |
|
560 |
public boolean isValueChanged() { |
561 |
return super.hasChanged(); |
562 |
} |
563 |
|
564 |
public void setChangesApplied() { |
565 |
setChanged(false);
|
566 |
} |
567 |
} |