Revision 38442
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolManager.java | ||
---|---|---|
275 | 275 |
*/ |
276 | 276 |
IWarningSymbol getWarningSymbol(String message, String symbolDesc, |
277 | 277 |
int symbolDrawExceptionType) throws MapContextRuntimeException; |
278 |
|
|
279 |
void setSymbolPreferences(SymbolPreferences symbolPreferences); |
|
278 | 280 |
|
279 | 281 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolManager.java | ||
---|---|---|
311 | 311 |
|
312 | 312 |
return symbol; |
313 | 313 |
} |
314 |
|
|
315 |
public void setSymbolPreferences(SymbolPreferences symbolPreferences) { |
|
316 |
this.symbolPreferences = symbolPreferences; |
|
317 |
} |
|
314 | 318 |
} |
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/gui/preferencespage/AppSymbolPreferences.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.app.gui.preferencespage; |
|
28 |
|
|
29 |
import java.awt.Color; |
|
30 |
import java.awt.Font; |
|
31 |
|
|
32 |
import org.gvsig.andami.PluginServices; |
|
33 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
34 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
|
35 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences; |
|
36 |
import org.gvsig.tools.dynobject.DynObject; |
|
37 |
|
|
38 |
/** |
|
39 |
* Default {@link SymbolPreferences} implementation based on object attributes. |
|
40 |
* |
|
41 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
42 |
*/ |
|
43 |
public class AppSymbolPreferences implements SymbolPreferences { |
|
44 |
private static final String SYMBOL_COLOR = "defaultSymbolColor"; |
|
45 |
private static final String SYMBOL_FILL_COLOR = "defaultSymbolFillColor"; |
|
46 |
private static final String SYMBOL_FILL_COLOR_ALEATORY = "defaultSymbolFillColorAleatory"; |
|
47 |
private static final String SYMBOL_FONT = "defaultSymbolFont"; |
|
48 |
private static final String SYMBOL_LIBRARY_PATH = "symbolLibraryPath"; |
|
49 |
|
|
50 |
private DynObject values = null; |
|
51 |
|
|
52 |
private String symbolFileExtension = ".gvssym"; |
|
53 |
|
|
54 |
/** |
|
55 |
* The unit that will be used when creating new symbols with Cartographic |
|
56 |
* support. |
|
57 |
*/ |
|
58 |
private int defaultCartographicSupportMeasureUnit = -1; |
|
59 |
|
|
60 |
/** |
|
61 |
* The reference system that will be used when creating new symbols with |
|
62 |
* Cartographic support. |
|
63 |
*/ |
|
64 |
private int defaultCartographicSupportReferenceSystem = CartographicSupport.WORLD; |
|
65 |
|
|
66 |
public AppSymbolPreferences() { |
|
67 |
values = PluginServices.getPluginServices(this).getPluginProperties(); |
|
68 |
initDefaults(); |
|
69 |
} |
|
70 |
|
|
71 |
private void initDefaults() { |
|
72 |
SymbolPreferences preferences = MapContextLocator.getSymbolManager().getSymbolPreferences(); |
|
73 |
if(getDefaultSymbolFont() == null) |
|
74 |
setDefaultSymbolFont(preferences.getDefaultSymbolFont()); |
|
75 |
if(getDefaultSymbolColor() == null) |
|
76 |
setDefaultSymbolColor(preferences.getDefaultSymbolColor()); |
|
77 |
if(getDefaultSymbolFillColor() == null) |
|
78 |
setDefaultSymbolFillColor(preferences.getDefaultSymbolFillColor()); |
|
79 |
if(getSymbolLibraryPath() == null) |
|
80 |
setSymbolLibraryPath(preferences.getSymbolLibraryPath()); |
|
81 |
setSymbolFileExtension(preferences.getSymbolFileExtension()); |
|
82 |
setDefaultCartographicSupportMeasureUnit(preferences.getDefaultCartographicSupportMeasureUnit()); |
|
83 |
setDefaultCartographicSupportReferenceSystem(preferences.getDefaultCartographicSupportReferenceSystem()); |
|
84 |
} |
|
85 |
|
|
86 |
public String getSymbolFileExtension() { |
|
87 |
return symbolFileExtension; |
|
88 |
} |
|
89 |
|
|
90 |
public void setSymbolFileExtension(String symbolFileExtension) { |
|
91 |
this.symbolFileExtension = symbolFileExtension; |
|
92 |
} |
|
93 |
|
|
94 |
public String getSymbolLibraryPath() { |
|
95 |
return (String)values.getDynValue(SYMBOL_LIBRARY_PATH); |
|
96 |
} |
|
97 |
|
|
98 |
public void setSymbolLibraryPath(String symbolLibraryPath) { |
|
99 |
values.setDynValue(SYMBOL_LIBRARY_PATH, symbolLibraryPath); |
|
100 |
PluginServices.getPluginServices(this).savePluginProperties(); |
|
101 |
} |
|
102 |
|
|
103 |
public Color getDefaultSymbolColor() { |
|
104 |
return (Color)values.getDynValue(SYMBOL_COLOR); |
|
105 |
} |
|
106 |
|
|
107 |
public void setDefaultSymbolColor(Color symbolColor) { |
|
108 |
values.setDynValue(SYMBOL_COLOR, symbolColor); |
|
109 |
PluginServices.getPluginServices(this).savePluginProperties(); |
|
110 |
} |
|
111 |
|
|
112 |
public Color getDefaultSymbolFillColor() { |
|
113 |
return (Color)values.getDynValue(SYMBOL_FILL_COLOR); |
|
114 |
} |
|
115 |
|
|
116 |
public void setDefaultSymbolFillColor(Color symbolFillColor) { |
|
117 |
values.setDynValue(SYMBOL_FILL_COLOR, symbolFillColor); |
|
118 |
PluginServices.getPluginServices(this).savePluginProperties(); |
|
119 |
} |
|
120 |
|
|
121 |
public boolean isDefaultSymbolFillColorAleatory() { |
|
122 |
if(values.getDynValue(SYMBOL_FILL_COLOR_ALEATORY) == null) { |
|
123 |
SymbolPreferences preferences = MapContextLocator.getSymbolManager().getSymbolPreferences(); |
|
124 |
setDefaultSymbolFillColorAleatory(preferences.isDefaultSymbolFillColorAleatory()); |
|
125 |
} |
|
126 |
return (Boolean)values.getDynValue(SYMBOL_FILL_COLOR_ALEATORY); |
|
127 |
} |
|
128 |
|
|
129 |
public void setDefaultSymbolFillColorAleatory(boolean defaultSymbolFillColorAleatory) { |
|
130 |
values.setDynValue(SYMBOL_FILL_COLOR_ALEATORY, defaultSymbolFillColorAleatory); |
|
131 |
PluginServices.getPluginServices(this).savePluginProperties(); |
|
132 |
} |
|
133 |
|
|
134 |
public Font getDefaultSymbolFont() { |
|
135 |
return (Font)values.getDynValue(SYMBOL_FONT); |
|
136 |
} |
|
137 |
|
|
138 |
public void setDefaultSymbolFont(Font defaultSymbolFont) { |
|
139 |
values.setDynValue(SYMBOL_FONT, defaultSymbolFont); |
|
140 |
PluginServices.getPluginServices(this).savePluginProperties(); |
|
141 |
} |
|
142 |
|
|
143 |
|
|
144 |
public int getDefaultCartographicSupportMeasureUnit() { |
|
145 |
return defaultCartographicSupportMeasureUnit; |
|
146 |
} |
|
147 |
|
|
148 |
public void setDefaultCartographicSupportMeasureUnit( |
|
149 |
int defaultCartographicSupportMeasureUnit) { |
|
150 |
this.defaultCartographicSupportMeasureUnit = |
|
151 |
defaultCartographicSupportMeasureUnit; |
|
152 |
} |
|
153 |
|
|
154 |
public int getDefaultCartographicSupportReferenceSystem() { |
|
155 |
return defaultCartographicSupportReferenceSystem; |
|
156 |
} |
|
157 |
|
|
158 |
public void setDefaultCartographicSupportReferenceSystem( |
|
159 |
int defaultCartographicSupportReferenceSystem) { |
|
160 |
this.defaultCartographicSupportReferenceSystem = |
|
161 |
defaultCartographicSupportReferenceSystem; |
|
162 |
} |
|
163 |
|
|
164 |
public void resetDefaultSymbolColor() { |
|
165 |
// TODO Auto-generated method stub |
|
166 |
|
|
167 |
} |
|
168 |
|
|
169 |
public void resetDefaultSymbolFillColor() { |
|
170 |
// TODO Auto-generated method stub |
|
171 |
|
|
172 |
} |
|
173 |
|
|
174 |
public void resetDefaultSymbolFillColorAleatory() { |
|
175 |
// TODO Auto-generated method stub |
|
176 |
|
|
177 |
} |
|
178 |
|
|
179 |
public void resetDefaultSymbolFont() { |
|
180 |
// TODO Auto-generated method stub |
|
181 |
|
|
182 |
} |
|
183 |
|
|
184 |
public void resetSymbolLibraryPath() { |
|
185 |
// TODO Auto-generated method stub |
|
186 |
|
|
187 |
} |
|
188 |
} |
|
0 | 189 |
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/gui/preferencespage/SymbologyPage.java | ||
---|---|---|
32 | 32 |
import org.gvsig.gui.beans.swing.JComboBoxFontSizes; |
33 | 33 |
import org.gvsig.gui.beans.swing.JComboBoxFonts; |
34 | 34 |
import org.gvsig.gui.beans.swing.JFileChooser; |
35 |
import org.gvsig.utils.StringUtilities; |
|
36 |
import org.gvsig.utils.XMLEntity; |
|
37 | 35 |
|
38 | 36 |
|
39 | 37 |
|
... | ... | |
43 | 41 |
* the path where the images that compound symbols are located. |
44 | 42 |
* |
45 | 43 |
*/ |
46 |
public class SymbologyPage extends AbstractPreferencePage{ |
|
44 |
public class SymbologyPage extends AbstractPreferencePage {
|
|
47 | 45 |
|
48 | 46 |
private static final long serialVersionUID = 1L; |
49 | 47 |
|
50 |
private final SymbolPreferences preferences = |
|
51 |
MapContextLocator.getSymbolManager().getSymbolPreferences(); |
|
48 |
private SymbolPreferences preferences = null; |
|
52 | 49 |
|
53 | 50 |
private ColorChooserPanel defaultColor = null; |
54 | 51 |
private ColorChooserPanel defaultFillColor = null; |
... | ... | |
64 | 61 |
private ImageIcon icon=null; |
65 | 62 |
private JCheckBox aleatoryFillColor; |
66 | 63 |
|
67 |
private static final String SYMBOL_FORECOLOR_PROPERTY_NAME = "ForeColor"; |
|
68 |
private static final String SYMBOL_FILLCOLOR_PROPERTY_NAME = "FillColor"; |
|
69 |
private static final String SYMBOL_FONT_TYPE_PROPERTY_NAME = "FontType"; |
|
70 |
private static final String SYMBOL_FONT_SIZE_PROPERTY_NAME = "FontSize"; |
|
71 |
private static final String SYMBOL_IMAGE_FOLDER_PROPERTY_NAME = "ImageFolder"; |
|
72 |
private static final String SYMBOL_ALEATORY_FORECOLOR = "AleatoryForeColor"; |
|
73 |
private static final String SYMBOL_ALEATORY_FILLCOLOR = "AleatoryFillColor"; |
|
74 |
|
|
75 |
|
|
76 | 64 |
public SymbologyPage(){ |
77 | 65 |
super(); |
78 | 66 |
id = this.getClass().getName(); |
79 | 67 |
} |
80 | 68 |
|
81 | 69 |
public SymbolPreferences getPreferences() { |
70 |
if(preferences == null) |
|
71 |
preferences = MapContextLocator.getSymbolManager().getSymbolPreferences(); |
|
82 | 72 |
return preferences; |
83 | 73 |
} |
84 | 74 |
|
85 |
// pending of a proposed refactor, don't erase |
|
86 |
// @Override |
|
87 |
// public void persistPreferences() throws StoreException { |
|
88 |
// File f; |
|
89 |
// String path, propertyName; |
|
90 |
// Color foreColor=defaultColor.getColor(); |
|
91 |
// Color fillColor=defaultFillColor.getColor(); |
|
92 |
// PluginServices ps = PluginServices.getPluginServices(this); |
|
93 |
// XMLEntity xml = ps.getPersistentXML(); |
|
94 |
// |
|
95 |
// xml.putProperty(SYMBOL_FORECOLOR_PROPERTY_NAME, |
|
96 |
// StringUtilities.color2String(foreColor)); |
|
97 |
// |
|
98 |
// xml.putProperty(SYMBOL_FILLCOLOR_PROPERTY_NAME, |
|
99 |
// StringUtilities.color2String(fillColor)); |
|
100 |
// |
|
101 |
// propertyName = SYMBOL_IMAGE_FOLDER_PROPERTY_NAME; |
|
102 |
// path = txtProjectsFolder.getText(); |
|
103 |
// |
|
104 |
// if (path.equals("")) { |
|
105 |
// if (xml.contains(propertyName)) { |
|
106 |
// xml.remove(propertyName); |
|
107 |
// } |
|
108 |
// } else { |
|
109 |
// f = new File(path); |
|
110 |
// if (f.exists()) { |
|
111 |
// if (xml.contains(propertyName)) { |
|
112 |
// xml.remove(propertyName); |
|
113 |
// } |
|
114 |
// xml.putProperty(propertyName, f.getAbsolutePath()); |
|
115 |
// } |
|
116 |
// } |
|
117 |
// |
|
118 |
// String nameFont=(String)fonts.getSelectedItem(); |
|
119 |
// Integer sizeFontAux =(Integer)sizes.getSelectedItem(); |
|
120 |
// int sizeFont=sizeFontAux.intValue(); |
|
121 |
// |
|
122 |
// propertyName=SYMBOL_FONT_TYPE_PROPERTY_NAME; |
|
123 |
// xml.putProperty(propertyName, nameFont); |
|
124 |
// |
|
125 |
// propertyName=SYMBOL_FONT_SIZE_PROPERTY_NAME; |
|
126 |
// xml.putProperty(propertyName, sizeFont); |
|
127 |
// |
|
128 |
// |
|
129 |
// } |
|
130 |
|
|
131 |
public void persistPreferences() throws StoreException { |
|
132 |
File f; |
|
133 |
String path, propertyName; |
|
134 |
Color foreColor=defaultColor.getColor(); |
|
135 |
Color fillColor=defaultFillColor.getColor(); |
|
136 |
PluginServices ps = PluginServices.getPluginServices(this); |
|
137 |
XMLEntity xml = ps.getPersistentXML(); |
|
138 |
|
|
139 |
xml.putProperty(SYMBOL_FORECOLOR_PROPERTY_NAME, |
|
140 |
StringUtilities.color2String(foreColor)); |
|
141 |
|
|
142 |
|
|
143 |
xml.putProperty(SYMBOL_FILLCOLOR_PROPERTY_NAME, |
|
144 |
StringUtilities.color2String(fillColor)); |
|
145 |
xml.putProperty(SYMBOL_ALEATORY_FILLCOLOR,aleatoryFillColor.isSelected()); |
|
146 |
|
|
147 |
propertyName = SYMBOL_IMAGE_FOLDER_PROPERTY_NAME; |
|
148 |
path = txtProjectsFolder.getText(); |
|
149 |
|
|
150 |
if (path.equals("")) { |
|
151 |
if (xml.contains(propertyName)) { |
|
152 |
xml.remove(propertyName); |
|
153 |
} |
|
154 |
} else { |
|
155 |
f = new File(path); |
|
156 |
if (f.exists()) { |
|
157 |
if (xml.contains(propertyName)) { |
|
158 |
xml.remove(propertyName); |
|
159 |
} |
|
160 |
xml.putProperty(propertyName, f.getAbsolutePath()); |
|
161 |
} |
|
162 |
} |
|
163 |
|
|
164 |
String nameFont=(String)fonts.getSelectedItem(); |
|
165 |
Integer sizeFontAux =(Integer)sizes.getSelectedItem(); |
|
166 |
int sizeFont=sizeFontAux.intValue(); |
|
167 |
|
|
168 |
propertyName=SYMBOL_FONT_TYPE_PROPERTY_NAME; |
|
169 |
xml.putProperty(propertyName, nameFont); |
|
170 |
|
|
171 |
propertyName=SYMBOL_FONT_SIZE_PROPERTY_NAME; |
|
172 |
xml.putProperty(propertyName, sizeFont); |
|
173 |
} |
|
174 |
|
|
175 |
|
|
176 | 75 |
@Override |
177 | 76 |
public void setChangesApplied() { |
178 | 77 |
setChanged(false); |
179 | 78 |
|
180 | 79 |
} |
181 | 80 |
|
182 |
public void applyValuesFromPersistence() throws StoreException { |
|
183 |
PluginServices ps = PluginServices.getPluginServices(this); |
|
184 |
XMLEntity xml = ps.getPersistentXML(); |
|
185 |
xml = ps.getPersistentXML(); |
|
186 |
|
|
187 |
SymbolPreferences preferences = getPreferences(); |
|
188 |
|
|
189 |
//Color |
|
190 |
if(xml.contains(SYMBOL_FORECOLOR_PROPERTY_NAME)){ |
|
191 |
Color color = StringUtilities.string2Color(xml.getStringProperty(SYMBOL_FORECOLOR_PROPERTY_NAME)); |
|
192 |
preferences.setDefaultSymbolColor(color); |
|
193 |
}else{ |
|
194 |
preferences.resetDefaultSymbolColor(); |
|
195 |
} |
|
196 |
|
|
197 |
//FillColor |
|
198 |
if(xml.contains(SYMBOL_FILLCOLOR_PROPERTY_NAME)){ |
|
199 |
Color colorFill=StringUtilities.string2Color(xml.getStringProperty(SYMBOL_FILLCOLOR_PROPERTY_NAME)); |
|
200 |
preferences.setDefaultSymbolFillColor(colorFill); |
|
201 |
}else{ |
|
202 |
preferences.resetDefaultSymbolFillColor(); |
|
203 |
} |
|
204 |
|
|
205 |
//Path |
|
206 |
if(xml.contains(SYMBOL_IMAGE_FOLDER_PROPERTY_NAME)){ |
|
207 |
preferences.setSymbolLibraryPath(xml |
|
208 |
.getStringProperty(SYMBOL_IMAGE_FOLDER_PROPERTY_NAME)); |
|
209 |
}else{ |
|
210 |
preferences.resetSymbolLibraryPath(); |
|
211 |
} |
|
212 |
|
|
213 |
//Font |
|
214 |
if(xml.contains(SYMBOL_FONT_TYPE_PROPERTY_NAME)){ |
|
215 |
int size=xml.getIntProperty(SYMBOL_FONT_SIZE_PROPERTY_NAME); |
|
216 |
String type=xml.getStringProperty(SYMBOL_FONT_TYPE_PROPERTY_NAME); |
|
217 |
Font font= new Font(type, Font.BOLD, size); |
|
218 |
preferences.setDefaultSymbolFont(font); |
|
219 |
}else{ |
|
220 |
preferences.resetDefaultSymbolFont(); |
|
221 |
} |
|
222 |
|
|
223 |
} |
|
224 |
|
|
225 | 81 |
public String getID() { |
226 | 82 |
return id; |
227 | 83 |
} |
... | ... | |
356 | 212 |
public String getTitle() { |
357 | 213 |
return PluginServices.getText(this, "symbology"); |
358 | 214 |
} |
359 |
// pending of a refactoring do not delete (swap commented lines) |
|
360 |
// public void initializeComponents() { |
|
215 |
|
|
361 | 216 |
public void initializeValues() { |
362 |
if (!panelStarted) getPanel(); |
|
217 |
if (!panelStarted) |
|
218 |
getPanel(); |
|
363 | 219 |
|
364 |
PluginServices ps = PluginServices.getPluginServices(this); |
|
365 |
XMLEntity xml = ps.getPersistentXML(); |
|
220 |
defaultColor.setColor(getPreferences().getDefaultSymbolColor()); |
|
221 |
defaultColor.setAlpha(getPreferences().getDefaultSymbolColor().getAlpha()); |
|
222 |
jsDefaultSelectionAlpha.setValue(getPreferences().getDefaultSymbolColor().getAlpha()); |
|
223 |
|
|
224 |
aleatoryFillColor.setSelected(getPreferences().isDefaultSymbolFillColorAleatory()); |
|
366 | 225 |
|
367 |
SymbolPreferences preferences = getPreferences(); |
|
226 |
defaultFillColor.setColor(getPreferences().getDefaultSymbolFillColor()); |
|
227 |
defaultFillColor.setAlpha(getPreferences().getDefaultSymbolFillColor().getAlpha()); |
|
228 |
jsFillSelelctionAlpha.setValue(getPreferences().getDefaultSymbolFillColor().getAlpha()); |
|
229 |
|
|
230 |
txtProjectsFolder.setText(getPreferences().getSymbolLibraryPath()); |
|
368 | 231 |
|
369 |
//Default Color |
|
370 |
if (xml.contains(SYMBOL_FORECOLOR_PROPERTY_NAME)) { |
|
371 |
Color color=StringUtilities.string2Color(xml.getStringProperty(SYMBOL_FORECOLOR_PROPERTY_NAME)); |
|
372 |
defaultColor.setColor(color); |
|
373 |
defaultColor.setAlpha(color.getAlpha()); |
|
374 |
jsDefaultSelectionAlpha.setValue(color.getAlpha()); |
|
375 |
preferences.setDefaultSymbolColor(color); |
|
376 |
}else{ |
|
377 |
preferences.resetDefaultSymbolColor(); |
|
378 |
Color color = preferences.getDefaultSymbolColor(); |
|
379 |
defaultColor.setColor(color); |
|
380 |
defaultColor.setAlpha(color.getAlpha()); |
|
381 |
jsDefaultSelectionAlpha.setValue(color.getAlpha()); |
|
382 |
} |
|
383 |
|
|
384 |
if(xml.contains(SYMBOL_ALEATORY_FILLCOLOR)){ |
|
385 |
aleatoryFillColor.setSelected(xml.getBooleanProperty(SYMBOL_ALEATORY_FILLCOLOR)); |
|
386 |
preferences.setDefaultSymbolFillColorAleatory(aleatoryFillColor |
|
387 |
.isSelected()); |
|
388 |
}else{ |
|
389 |
preferences.resetDefaultSymbolFillColorAleatory(); |
|
390 |
aleatoryFillColor.setSelected(preferences |
|
391 |
.isDefaultSymbolFillColorAleatory()); |
|
392 |
} |
|
393 |
|
|
394 |
//Fill Color |
|
395 |
if (xml.contains(SYMBOL_FILLCOLOR_PROPERTY_NAME)) { |
|
396 |
Color color=StringUtilities.string2Color(xml.getStringProperty(SYMBOL_FILLCOLOR_PROPERTY_NAME)); |
|
397 |
defaultFillColor.setColor(color); |
|
398 |
defaultFillColor.setAlpha(color.getAlpha()); |
|
399 |
jsFillSelelctionAlpha.setValue(color.getAlpha()); |
|
400 |
preferences.setDefaultSymbolFillColor(color); |
|
401 |
}else{ |
|
402 |
preferences.resetDefaultSymbolFillColor(); |
|
403 |
Color color = preferences.getDefaultSymbolFillColor(); |
|
404 |
defaultFillColor.setColor(color); |
|
405 |
defaultFillColor.setAlpha(color.getAlpha()); |
|
406 |
jsFillSelelctionAlpha.setValue(color.getAlpha()); |
|
407 |
} |
|
408 |
|
|
232 |
fonts.setSelectedItem(getPreferences().getDefaultSymbolFont().getFamily()); |
|
233 |
sizes.setSelectedItem(getPreferences().getDefaultSymbolFont().getSize()); |
|
234 |
|
|
409 | 235 |
defaultFillColor.setEnabled(!aleatoryFillColor.isSelected()); |
410 | 236 |
jsFillSelelctionAlpha.setEnabled(!aleatoryFillColor.isSelected()); |
411 | 237 |
|
412 |
//Path |
|
413 |
if (xml.contains(SYMBOL_IMAGE_FOLDER_PROPERTY_NAME)) { |
|
414 |
String path=xml.getStringProperty(SYMBOL_IMAGE_FOLDER_PROPERTY_NAME); |
|
415 |
txtProjectsFolder.setText(path); |
|
416 |
preferences.setSymbolLibraryPath(path); |
|
417 |
}else{ |
|
418 |
preferences.resetSymbolLibraryPath(); |
|
419 |
txtProjectsFolder.setText(preferences.getSymbolLibraryPath()); |
|
420 |
} |
|
421 |
|
|
422 |
//Font Size |
|
423 |
if(xml.contains(SYMBOL_FONT_TYPE_PROPERTY_NAME)){ |
|
424 |
String type=xml.getStringProperty(SYMBOL_FONT_TYPE_PROPERTY_NAME); |
|
425 |
fonts.setSelectedItem(type); |
|
426 |
} |
|
427 |
else{ |
|
428 |
String font = preferences.getDefaultSymbolFont().getFontName(); |
|
429 |
fonts.setSelectedItem(font); |
|
430 |
} |
|
431 |
|
|
432 |
if(xml.contains(SYMBOL_FONT_SIZE_PROPERTY_NAME)){ |
|
433 |
int size=xml.getIntProperty(SYMBOL_FONT_SIZE_PROPERTY_NAME); |
|
434 |
sizes.setSelectedItem(size); |
|
435 |
} |
|
436 |
else{ |
|
437 |
int size = preferences.getDefaultSymbolFont().getSize(); |
|
438 |
sizes.setSelectedItem(size); |
|
439 |
} |
|
440 |
preferences.setDefaultSymbolFont(new Font(fonts.getFont().getName(), |
|
441 |
fonts |
|
442 |
.getFont().getStyle(), (Integer) sizes.getSelectedItem())); |
|
443 | 238 |
} |
444 | 239 |
|
445 | 240 |
public void initializeDefaults() { |
446 |
SymbolPreferences preferences = getPreferences(); |
|
447 |
|
|
448 |
defaultColor.setColor(preferences.getDefaultSymbolColor()); |
|
449 |
jsDefaultSelectionAlpha.setValue(255); |
|
450 |
|
|
451 |
defaultFillColor.setColor(preferences.getDefaultSymbolFillColor()); |
|
452 |
jsFillSelelctionAlpha.setValue(255); |
|
453 |
|
|
454 |
fonts.setSelectedItem(preferences.getDefaultSymbolFont().getFamily()); |
|
455 |
sizes.setSelectedItem(preferences.getDefaultSymbolFont().getSize()); |
|
456 |
txtProjectsFolder.setText(preferences.getSymbolLibraryPath()); |
|
457 |
|
|
458 |
aleatoryFillColor.setSelected(preferences |
|
459 |
.isDefaultSymbolFillColorAleatory()); |
|
241 |
|
|
460 | 242 |
} |
461 |
|
|
243 |
|
|
462 | 244 |
public boolean isValueChanged() { |
463 | 245 |
return super.hasChanged(); |
464 | 246 |
} |
465 | 247 |
|
466 |
// pending of a refactoring, following method would be removed |
|
467 | 248 |
@Override |
468 | 249 |
public void storeValues() throws StoreException { |
469 |
setPropertiesFromPanel(); |
|
470 | 250 |
persistPreferences(); |
471 | 251 |
} |
472 | 252 |
|
473 |
private void setPropertiesFromPanel(){ |
|
474 |
SymbolPreferences preferences = getPreferences(); |
|
475 |
|
|
476 |
if(defaultColor.getColor()!=null){ |
|
253 |
private void persistPreferences() { |
|
254 |
if(defaultColor.getColor() != null) { |
|
477 | 255 |
Color color = defaultColor.getColor(); |
478 |
color = new Color(color.getRed(),color.getGreen(),color.getBlue(),jsDefaultSelectionAlpha.getValue()); |
|
479 |
preferences.setDefaultSymbolColor(color); |
|
256 |
color = new Color(color.getRed(), |
|
257 |
color.getGreen(), |
|
258 |
color.getBlue(), |
|
259 |
jsDefaultSelectionAlpha.getValue()); |
|
260 |
getPreferences().setDefaultSymbolColor(color); |
|
480 | 261 |
} |
481 | 262 |
|
482 |
if(aleatoryFillColor != null){ |
|
483 |
preferences.setDefaultSymbolFillColorAleatory(aleatoryFillColor |
|
484 |
.isSelected()); |
|
263 |
if(aleatoryFillColor != null) { |
|
264 |
getPreferences().setDefaultSymbolFillColorAleatory(aleatoryFillColor.isSelected()); |
|
485 | 265 |
} |
486 |
//Fill Color |
|
266 |
|
|
487 | 267 |
if (defaultFillColor.getColor() != null) { |
488 | 268 |
Color color = defaultFillColor.getColor(); |
489 | 269 |
color = new Color(color.getRed(),color.getGreen(),color.getBlue(),jsFillSelelctionAlpha.getValue()); |
490 |
preferences.setDefaultSymbolFillColor(color);
|
|
270 |
getPreferences().setDefaultSymbolFillColor(color);
|
|
491 | 271 |
} |
492 | 272 |
|
493 |
//Path |
|
494 | 273 |
if (txtProjectsFolder.getText() != null) { |
495 |
preferences.setSymbolLibraryPath(txtProjectsFolder.getText());
|
|
274 |
getPreferences().setSymbolLibraryPath(txtProjectsFolder.getText());
|
|
496 | 275 |
} |
497 | 276 |
|
498 |
//Font Size |
|
499 | 277 |
if(fonts.getFont() != null && sizes.getSelectedItem() != null){ |
500 |
Font font = fonts.getFont();
|
|
501 |
font= new Font(fonts.getFont().getFontName(), Font.BOLD, (Integer)sizes.getSelectedItem());
|
|
502 |
preferences.setDefaultSymbolFont(font);
|
|
278 |
String f = (String)fonts.getSelectedItem();
|
|
279 |
Font font = new Font(f, Font.PLAIN, (Integer)sizes.getSelectedItem());
|
|
280 |
getPreferences().setDefaultSymbolFont(font);
|
|
503 | 281 |
} |
504 | 282 |
} |
505 | 283 |
} |
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/InitializeApplicationExtension.java | ||
---|---|---|
15 | 15 |
import org.gvsig.andami.plugins.Extension; |
16 | 16 |
import org.gvsig.app.ApplicationLocator; |
17 | 17 |
import org.gvsig.app.ApplicationManager; |
18 |
import org.gvsig.app.gui.preferencespage.AppSymbolPreferences; |
|
18 | 19 |
import org.gvsig.app.project.documents.view.toolListeners.InfoListener; |
19 | 20 |
import org.gvsig.app.tools.swing.serv.field.crs.JCRSDynFieldComponentFactory; |
20 | 21 |
import org.gvsig.app.util.BaseOpenErrorHandler; |
... | ... | |
22 | 23 |
import org.gvsig.fmap.dal.OpenErrorHandler; |
23 | 24 |
import org.gvsig.fmap.dal.resource.ResourceManager; |
24 | 25 |
import org.gvsig.fmap.dal.resource.exception.DisposeResorceManagerException; |
26 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
25 | 27 |
import org.gvsig.installer.lib.api.InstallerLocator; |
26 | 28 |
import org.gvsig.installer.lib.api.InstallerManager; |
27 | 29 |
import org.gvsig.installer.lib.api.PackageInfo; |
... | ... | |
62 | 64 |
DALLocator.getResourceManager().startResourceCollector( |
63 | 65 |
3 * (60 * 1000), // minutes --> miliseconds |
64 | 66 |
null); |
67 |
|
|
68 |
MapContextLocator.getSymbolManager().setSymbolPreferences(new AppSymbolPreferences()); |
|
65 | 69 |
|
66 | 70 |
} |
67 | 71 |
|
Also available in: Unified diff