Revision 39501
branches/v2_0_0_prep/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/resources/plugin-persistence.def | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
Definitions of plugin persistence org.gvsig.annotation.app.extension. |
|
4 |
--> |
|
5 |
<definitions> |
|
6 |
<version>1.0.0</version> |
|
7 |
<classes> |
|
8 |
<class name="org.gvsig.annotation.app.extension"> |
|
9 |
<description>Persistence for the annotation plugin</description> |
|
10 |
<fields> |
|
11 |
<field name="def_font_color" type="integer" mandatory="true" /> |
|
12 |
<field name="def_text_value" type="string" mandatory="true"/> |
|
13 |
<field name="def_font_type" type="string" mandatory="true"/> |
|
14 |
<field name="def_font_style" type="string" mandatory="true"/> |
|
15 |
<field name="def_font_height" type="double" mandatory="true"/> |
|
16 |
<field name="def_font_rotation" type="double" mandatory="true"/> |
|
17 |
</fields> |
|
18 |
</class> |
|
19 |
</classes> |
|
20 |
</definitions> |
branches/v2_0_0_prep/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationExtension.java | ||
---|---|---|
55 | 55 |
* @version $Id$ |
56 | 56 |
*/ |
57 | 57 |
public class AnnotationExtension extends Extension { |
58 |
|
|
59 |
public static final String PERSIST_DEF_FONT_COLOR_KEY = "def_font_color"; |
|
60 |
public static final String PERSIST_DEF_TEXT_VALUE_KEY = "def_text_value"; |
|
61 |
public static final String PERSIST_DEF_FONT_TYPE_KEY = "def_font_type"; |
|
62 |
public static final String PERSIST_DEF_FONT_STYLE_KEY = "def_font_style"; |
|
63 |
public static final String PERSIST_DEF_FONT_HEIGHT_KEY = "def_font_height"; |
|
64 |
public static final String PERSIST_DEF_FONT_ROTATION_KEY = "def_font_rotation"; |
|
65 |
|
|
58 | 66 |
private AnnotationManager manager; |
59 | 67 |
private AnnotationSwingManager swingManager; |
60 | 68 |
|
branches/v2_0_0_prep/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationPreferencesPage.java | ||
---|---|---|
57 | 57 |
import org.gvsig.annotation.AnnotationManager; |
58 | 58 |
import org.gvsig.annotation.swing.AnnotationSwingLocator; |
59 | 59 |
import org.gvsig.annotation.swing.JAnnotationPreferencesPanel; |
60 |
import org.gvsig.tools.dynobject.DynObject; |
|
60 | 61 |
/** |
61 | 62 |
* Default configuration page. |
62 | 63 |
* <b><b> |
... | ... | |
95 | 96 |
|
96 | 97 |
public void initializeValues() { |
97 | 98 |
getPanel(); // init UI |
99 |
|
|
100 |
PluginServices ps = PluginServices.getPluginServices(this); |
|
101 |
DynObject props = ps.getPluginProperties(); |
|
102 |
|
|
103 |
// first defaults, then stored if not null |
|
104 |
initializeDefaults(); |
|
105 |
|
|
106 |
String str = null; |
|
107 |
Double dou = null; |
|
108 |
Integer col = null; |
|
109 |
|
|
110 |
str = (String) props.getDynValue(AnnotationExtension.PERSIST_DEF_TEXT_VALUE_KEY); |
|
111 |
if (str != null) { |
|
112 |
txtDefaultText.setText(str); |
|
113 |
} |
|
114 |
str = (String) props.getDynValue(AnnotationExtension.PERSIST_DEF_FONT_TYPE_KEY); |
|
115 |
if (str != null) { |
|
116 |
panel.setDefaultFontType(str); |
|
117 |
} |
|
118 |
str = (String) props.getDynValue(AnnotationExtension.PERSIST_DEF_FONT_STYLE_KEY); |
|
119 |
if (str != null) { |
|
120 |
panel.setDefaultFontStyle(str); |
|
121 |
} |
|
122 |
dou = (Double) props.getDynValue(AnnotationExtension.PERSIST_DEF_FONT_HEIGHT_KEY); |
|
123 |
if (dou != null) { |
|
124 |
panel.setDefaultFontHeight(dou); |
|
125 |
} |
|
126 |
dou = (Double) props.getDynValue(AnnotationExtension.PERSIST_DEF_FONT_ROTATION_KEY); |
|
127 |
if (str != null) { |
|
128 |
panel.setDefaultFontRotation(dou); |
|
129 |
} |
|
130 |
|
|
131 |
col = (Integer) props.getDynValue(AnnotationExtension.PERSIST_DEF_FONT_COLOR_KEY); |
|
132 |
if (str != null) { |
|
133 |
panel.setDefaultFontColor(col); |
|
134 |
} |
|
98 | 135 |
} |
99 | 136 |
|
100 | 137 |
public String getID() { |
... | ... | |
116 | 153 |
} |
117 | 154 |
|
118 | 155 |
public void storeValues() throws StoreException { |
119 |
annotationManager.setDefaultFontColor(panel.getDefaultFontColor()); |
|
120 |
annotationManager.setDefaultTextValue(txtDefaultText.getText()); |
|
121 |
annotationManager.setDefaultFontType(panel.getDefaultFontType()); |
|
122 |
annotationManager.setDefaultFontStyle(panel.getDefaultFontStyle()); |
|
123 |
annotationManager.setDefaultFontHeight(panel.getDefaultFontHeight()); |
|
124 |
annotationManager.setDefaultFontRotation(panel.getDefaultFontRotation()); |
|
156 |
|
|
157 |
PluginServices ps = PluginServices.getPluginServices(this); |
|
158 |
DynObject props = ps.getPluginProperties(); |
|
159 |
|
|
160 |
props.setDynValue(AnnotationExtension.PERSIST_DEF_FONT_COLOR_KEY, |
|
161 |
panel.getDefaultFontColor()); |
|
162 |
props.setDynValue(AnnotationExtension.PERSIST_DEF_TEXT_VALUE_KEY, |
|
163 |
txtDefaultText.getText()); |
|
164 |
props.setDynValue(AnnotationExtension.PERSIST_DEF_FONT_TYPE_KEY, |
|
165 |
panel.getDefaultFontType()); |
|
166 |
props.setDynValue(AnnotationExtension.PERSIST_DEF_FONT_STYLE_KEY, |
|
167 |
panel.getDefaultFontStyle()); |
|
168 |
props.setDynValue(AnnotationExtension.PERSIST_DEF_FONT_HEIGHT_KEY, |
|
169 |
panel.getDefaultFontHeight()); |
|
170 |
props.setDynValue(AnnotationExtension.PERSIST_DEF_FONT_ROTATION_KEY, |
|
171 |
panel.getDefaultFontRotation()); |
|
172 |
|
|
173 |
ps.savePluginProperties(); |
|
125 | 174 |
} |
126 | 175 |
|
127 | 176 |
|
branches/v2_0_0_prep/libraries/org.gvsig.annotation/org.gvsig.annotation.swing/org.gvsig.annotation.swing.impl/src/main/java/org/gvsig/annotation/swing/impl/DefaultJAnnotationPreferencesPanel.java | ||
---|---|---|
273 | 273 |
} |
274 | 274 |
|
275 | 275 |
public int getDefaultFontColor() { |
276 |
return getColorChooser().getColor().getRGB(); |
|
276 |
Color col = getColorChooser().getColor(); |
|
277 |
int resp = (col.getAlpha() << 24) | col.getRGB(); |
|
278 |
// resp = resp + ; |
|
279 |
return resp; |
|
277 | 280 |
} |
278 | 281 |
|
279 | 282 |
public void setDefaultFontColor(int color) { |
280 |
getColorChooser().setColor(new Color(color)); |
|
283 |
getColorChooser().setColor(new Color(color, true));
|
|
281 | 284 |
} |
282 | 285 |
|
283 | 286 |
public double getDefaultFontRotation() { |
Also available in: Unified diff