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