annotate artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java @ 7119:988dde49ae65

Fix area label rendering. Previously the showarealabel setting was neither parsed nor used to decide if the arealabel should be drawn. It is mostly off but enabled for Cross Sections. It is now also shown in the style editors in case someone got used to it ;)
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 24 Sep 2013 18:13:51 +0200
parents 234b1a3b527d
children 4dbbdf0c8b2c
rev   line source
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
3 *
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
6 * documentation coming with Dive4Elements River for details.
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
7 */
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
8
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
9 package org.dive4elements.river.themes;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
10
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
11 import java.awt.Color;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
12 import java.awt.Font;
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
13 import java.util.HashMap;
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
14 import java.util.Map;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
15
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
16 import org.apache.log4j.Logger;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
17 import org.dive4elements.artifacts.CallMeta;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
18 import org.dive4elements.river.artifacts.model.MapserverStyle;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
19 import org.dive4elements.river.artifacts.model.MapserverStyle.Clazz;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
20 import org.dive4elements.river.artifacts.model.MapserverStyle.Expression;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
21 import org.dive4elements.river.artifacts.model.MapserverStyle.Label;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
22 import org.dive4elements.river.artifacts.model.MapserverStyle.Style;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
23 import org.dive4elements.river.artifacts.resources.Resources;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
24 import org.w3c.dom.Document;
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
25 import org.w3c.dom.Element;
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
26 import org.w3c.dom.NodeList;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
27
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
28 public class ThemeDocument
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
29 {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
30 private static Logger logger = Logger.getLogger(ThemeDocument.class);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
31
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
32 private static final String MSG_ISOBATH_CLASS = "floodmap.isobath.class";
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
33
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
34 private static final String MSG_ISOBATH_LASTCLASS = "floodmap.isobath.lastclass";
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
35
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
36 public final static String FILL_COLOR = "fillcolor";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
37
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
38 public final static String LINE_COLOR = "linecolor";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
39
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
40 public final static String AREA_LINE_COLOR = "areabordercolor";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
41
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
42 public static final String LINE_SIZE = "linesize";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
43
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
44 public static final String LINE_STYLE = "linetype";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
45
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
46 public static final String POINT_SIZE = "pointsize";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
47
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
48 public static final String POINT_COLOR = "pointcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
49
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
50 public final static String SHOW_BORDER = "showborder";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
51
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
52 public final static String AREA_SHOW_BORDER = "showborder";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
53
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
54 public final static String SHOW_POINTS = "showpoints";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
55
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
56 public final static String SHOW_LINE = "showlines";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
57
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
58 public final static String SHOW_VERTICAL_LINE = "showverticalline";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
59
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
60 public final static String SHOW_HORIZONTAL_LINE = "showhorizontalline";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
61
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
62 public final static String SHOW_LINE_LABEL = "showlinelabel";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
63
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
64 public final static String SHOW_POINT_LABEL = "showpointlabel";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
65
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
66 public final static String SHOW_WIDTH = "showwidth";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
67
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
68 public final static String SHOW_LEVEL = "showlevel";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
69
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
70 public final static String TRANSPARENCY = "transparency";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
71
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
72 public final static String AREA_TRANSPARENCY = "areatransparency";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
73
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
74 public final static String SHOW_AREA = "showarea";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
75
7119
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
76 public final static String SHOW_AREA_LABEL = "showarealabel";
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
77
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
78 public final static String SHOW_MIDDLE_HEIGHT = "showmiddleheight";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
79
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
80 public final static String LABEL_FONT_COLOR = "labelfontcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
81
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
82 public final static String LABEL_FONT_SIZE = "labelfontsize";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
83
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
84 public final static String LABEL_FONT_FACE = "labelfontface";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
85
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
86 public final static String LABEL_FONT_STYLE = "labelfontstyle";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
87
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
88 public final static String TEXT_ORIENTATION = "textorientation";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
89
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
90 public final static String LABEL_BGCOLOR = "labelbgcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
91
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
92 public final static String LABEL_SHOW_BACKGROUND = "labelshowbg";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
93
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
94 public final static String BACKGROUND_COLOR = "backgroundcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
95
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
96 public final static String AREA_BACKGROUND_COLOR = "areabgcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
97
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
98 public final static String SYMBOL = "symbol";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
99
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
100 public final static String SHOW_MINIMUM = "showminimum";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
101
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
102 public final static String SHOW_MAXIMUM = "showmaximum";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
103
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
104 public final static String WSPLGEN_STARTCOLOR = "startcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
105
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
106 public final static String WSPLGEN_ENDCOLOR = "endcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
107
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
108 public final static String WSPLGEN_NUMCLASSES = "numclasses";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
109
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
110 public final static String BANDWIDTH = "bandwidth";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
111
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
112 public final static String SHOWEXTRAMARK = "showextramark";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
113
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
114
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
115 private Document document;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
116
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
117 private Map<String, String> values;
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
118
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
119 public ThemeDocument() {
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
120 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
121
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
122 public ThemeDocument(Document document) {
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
123 this.document = document;
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
124 values = extractValues(document);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
125 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
126
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
127 public Document getDocument() {
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
128 return document;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
129 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
130
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
131 private String getValue(String key) {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
132 return values.get(key);
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
133 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
134
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
135 private static Map<String, String> extractValues(Document document) {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
136 Map<String, String> values = new HashMap<String, String>();
6962
234b1a3b527d Workaround for flys/issue14070. TODO: Find the reason why a null document is given to the ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6912
diff changeset
137 if (document == null) {
234b1a3b527d Workaround for flys/issue14070. TODO: Find the reason why a null document is given to the ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6912
diff changeset
138 logger.error("Invalid null document given.");
234b1a3b527d Workaround for flys/issue14070. TODO: Find the reason why a null document is given to the ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6912
diff changeset
139 return values;
234b1a3b527d Workaround for flys/issue14070. TODO: Find the reason why a null document is given to the ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6912
diff changeset
140 }
234b1a3b527d Workaround for flys/issue14070. TODO: Find the reason why a null document is given to the ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6912
diff changeset
141
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
142 NodeList fields = document.getElementsByTagName("field");
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
143 for (int i = 0, N = fields.getLength(); i < N; ++i) {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
144 Element field = (Element)fields.item(i);
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
145 String name = field.getAttribute("name");
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
146 String value = field.getAttribute("default");
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
147 if (!name.isEmpty() && !value.isEmpty()) {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
148 values.put(name, value);
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
149 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
150 }
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
151 if (logger.isDebugEnabled()) {
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
152 logger.debug("Theme values: " + values);
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
153 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
154 return values;
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
155 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
156
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
157 /** Parse string to be boolean with default if empty or unrecognized. */
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
158 private static boolean parseBoolean(String value, boolean defaultsTo) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
159 if (value == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
160 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
161 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
162 if (value.equals("false")) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
163 return false;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
164 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
165 if (value.equals("true")) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
166 return true;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
167 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
168 return defaultsTo;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
169 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
170
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
171
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
172 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
173 * Attempt converting \param value to an integer, in failing cases,
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
174 * return \param defaultsTo.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
175 * @param value String to be converted to integer.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
176 * @param defaultsTo Default to return if conversion failed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
177 * @return \param value as integer or defaultsto if conversion failed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
178 */
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
179 private static int parseInteger(String value, int defaultsTo) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
180 if (value == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
181 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
182 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
183
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
184 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
185 return Integer.parseInt(value);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
186 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
187 catch (NumberFormatException nfe) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
188 // do nothing
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
189 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
190
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
191 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
192 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
193
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
194
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
195 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
196 * Attempt converting \param value to a double, in failing cases,
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
197 * return \param defaultsTo.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
198 * @param value String to be converted to double.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
199 * @param defaultsTo Default to return if conversion failed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
200 * @return \param value as integer or defaultsto if conversion failed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
201 */
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
202 private static double parseDouble(String value, double defaultsTo) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
203 if (value == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
204 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
205 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
206
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
207 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
208 return Double.parseDouble(value);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
209 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
210 catch (NumberFormatException nfe) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
211 // do nothing
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
212 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
213
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
214 return defaultsTo;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
215 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
216
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
217 public boolean parseShowLineLabel() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
218 String show = getValue(SHOW_LINE_LABEL);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
219 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
220 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
221
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
222 public boolean parseShowWidth() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
223 String show = getValue(SHOW_WIDTH);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
224 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
225 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
226
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
227 public boolean parseShowLevel() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
228 String show = getValue(SHOW_LEVEL);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
229 return parseBoolean(show, false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
230 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
231
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
232 public String parseTextOrientation() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
233 String o = getValue(TEXT_ORIENTATION);
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
234
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
235 return o != null && "true".equals(o)
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
236 ? "horizontal"
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
237 : "vertical";
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
238 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
239
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
240 public boolean parseShowMiddleHeight() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
241 String show = getValue(SHOW_MIDDLE_HEIGHT);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
242 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
243 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
244
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
245 public boolean parseLabelShowBackground() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
246 String show = getValue(LABEL_SHOW_BACKGROUND);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
247 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
248 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
249
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
250 public Font parseTextFont() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
251 String font = getValue(LABEL_FONT_FACE);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
252 if (font == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
253 return null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
254 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
255
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
256 int size = parseTextSize();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
257 int style = parseTextStyle();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
258 Font f = new Font(font, style, size);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
259 return f;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
260 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
261
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
262 public Color parseTextColor() {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
263 return parseRGB(getTextColorString());
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
264 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
265
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
266 private String getTextColorString() {
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
267 return getValue(LABEL_FONT_COLOR);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
268 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
269
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
270 public Color parseTextBackground() {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
271 String color = getLabelBackgroundColorString();
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
272 return color != null
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
273 ? parseRGB(color)
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
274 : Color.WHITE;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
275 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
276
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
277 private String getLabelBackgroundColorString() {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
278 return getValue(LABEL_BGCOLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
279 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
280
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
281 public int parseLineWidth() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
282 String size = getValue(LINE_SIZE);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
283 if (size == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
284 return 0;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
285 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
286
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
287 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
288 return Integer.parseInt(size);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
289 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
290 catch (NumberFormatException nfe) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
291 logger.warn("Unable to set line size from string: '" + size + "'");
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
292 }
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
293 return 0;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
294 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
295
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
296 public float [] parseLineStyle() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
297 String dash = getValue(LINE_STYLE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
298
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
299 float[] def = {10};
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
300 if (dash == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
301 return def;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
302 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
303
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
304 String[] pattern = dash.split(",");
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
305 if(pattern.length == 1) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
306 return def;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
307 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
308
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
309 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
310 float[] dashes = new float[pattern.length];
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
311 for (int i = 0; i < pattern.length; i++) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
312 dashes[i] = Float.parseFloat(pattern[i]);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
313 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
314 return dashes;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
315 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
316 catch (NumberFormatException nfe) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
317 logger.warn("Unable to set dash from string: '" + dash + "'");
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
318 return def;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
319 }
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
320 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
321
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
322 public int parsePointWidth() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
323 String width = getValue(POINT_SIZE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
324 return parseInteger(width, 3);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
325 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
326
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
327 public Color parsePointColor() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
328 String color = getValue(POINT_COLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
329 return parseColor(color);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
330 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
331
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
332 public boolean parseShowPoints() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
333 String show = getValue(SHOW_POINTS);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
334 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
335 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
336
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
337 public boolean parseShowLine() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
338 String show = getValue(SHOW_LINE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
339 return parseBoolean(show, true);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
340 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
341
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
342 public int parseTextStyle() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
343 String style = getValue(LABEL_FONT_STYLE);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
344 if (style == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
345 return Font.PLAIN;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
346 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
347
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
348 if (style.equals("italic")) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
349 return Font.ITALIC;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
350 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
351 if (style.equals("bold")) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
352 return Font.BOLD;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
353 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
354 return Font.PLAIN;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
355 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
356
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
357 public TextStyle parseComplexTextStyle() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
358 return new TextStyle(
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
359 parseTextColor(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
360 parseTextFont(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
361 parseTextBackground(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
362 parseLabelShowBackground(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
363 !parseTextOrientation().equals("horizontal"));
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
364 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
365
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
366 public LineStyle parseComplexLineStyle() {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
367 return new LineStyle(
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
368 parseLineColorField(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
369 Integer.valueOf(parseLineWidth()));
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
370 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
371
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
372 public boolean parseShowVerticalLine() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
373 String show = getValue(SHOW_VERTICAL_LINE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
374 return parseBoolean(show, true);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
375 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
376
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
377 public boolean parseShowHorizontalLine() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
378 String show = getValue(SHOW_HORIZONTAL_LINE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
379 return parseBoolean(show, true);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
380 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
381
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
382 public double parseBandWidth() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
383 String bandWidth = getValue(BANDWIDTH);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
384 return parseDouble(bandWidth, 0);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
385 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
386
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
387 private static Color parseColor(String colorString) {
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
388 if (colorString == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
389 return null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
390 }
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
391 if (colorString.indexOf("#") == 0) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
392 return parseHexColor(colorString);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
393 }
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
394 if (colorString.indexOf(",") >= 0) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
395 return parseRGB(colorString);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
396 }
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
397
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
398 return null;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
399 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
400
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
401
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
402 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
403 * Parse a string like "#00CC22" and return the corresponding color.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
404 *
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
405 * @param hex The hex color value.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
406 *
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
407 * @return a Color or null, if <i>hex</i> is empty.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
408 */
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
409 private static Color parseHexColor(String hex) {
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
410 return hex != null
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
411 ? Color.decode(hex)
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
412 : null;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
413 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
414
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
415
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
416 public boolean parseShowArea() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
417 String show = getValue(SHOW_AREA);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
418 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
419 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
420
7119
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
421 public boolean parseShowAreaLabel() {
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
422 String show = getValue(SHOW_AREA_LABEL);
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
423 return parseBoolean(show, false);
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
424 }
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
425
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
426 public boolean parseShowPointLabel() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
427 String show = getValue(SHOW_POINT_LABEL);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
428 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
429 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
430
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
431 public boolean parseShowExtraMark() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
432 String show = getValue(SHOWEXTRAMARK);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
433 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
434 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
435
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
436 public int parseTextSize() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
437 String size = getValue(LABEL_FONT_SIZE);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
438 if (size == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
439 return 10;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
440 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
441
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
442 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
443 return Integer.parseInt(size);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
444 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
445 catch (NumberFormatException nfe) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
446 // Do nothing
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
447 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
448 return 10;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
449 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
450
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
451 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
452 * Parse a string like "103, 100, 0" and return a corresping color.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
453 * @param rgbtext Color as string representation, e.g. "255,0,20".
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
454 * @return Color, null in case of issues.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
455 */
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
456 public static Color parseRGB(String rgbtext) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
457 if (rgbtext == null) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
458 return null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
459 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
460 String rgb[] = rgbtext.split(",");
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
461 try {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
462 return new Color(
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
463 Integer.parseInt(rgb[0].trim()),
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
464 Integer.parseInt(rgb[1].trim()),
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
465 Integer.parseInt(rgb[2].trim()));
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
466 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
467 catch (NumberFormatException nfe) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
468 // Do nothing
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
469 }
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
470 return null;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
471 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
472
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
473 private String getLineColorString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
474 return getValue(LINE_COLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
475 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
476
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
477
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
478 /** Get show border as string. */
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
479 private String getShowBorderString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
480 return getValue(SHOW_BORDER);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
481 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
482
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
483
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
484 /** Get fill color as string. */
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
485 private String getFillColorString() {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
486 return getValue(FILL_COLOR);
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
487 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
488
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
489 private String getSymbol() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
490 return getValue(SYMBOL);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
491 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
492
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
493 private String getTransparencyString() {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
494 return getValue(TRANSPARENCY);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
495 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
496
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
497
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
498 private String getAreaTransparencyString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
499 return getValue(AREA_TRANSPARENCY);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
500 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
501
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
502
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
503 private String getShowMinimum() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
504 return getValue(SHOW_MINIMUM);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
505 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
506
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
507
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
508 private String getShowMaximum() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
509 return getValue(SHOW_MAXIMUM);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
510 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
511
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
512 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
513 * Gets color from color field.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
514 * @param theme the theme document.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
515 * @return color.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
516 */
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
517 public Color parseFillColorField() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
518 return parseRGB(getFillColorString());
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
519 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
520
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
521 public boolean parseShowBorder() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
522 return parseBoolean(getShowBorderString(), false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
523 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
524
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
525 public int parseTransparency() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
526 return parseInteger(getTransparencyString(), 50);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
527 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
528
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
529
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
530 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
531 * Gets color from color field.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
532 * @return color.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
533 */
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
534 public Color parseLineColorField() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
535 String lineColorStr = getLineColorString();
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
536 if (logger.isDebugEnabled()) {
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
537 logger.debug("parseLineColorField: lineColorStr = " +
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
538 (lineColorStr == null
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
539 ? "null"
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
540 : lineColorStr));
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
541 }
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
542 return parseColor(lineColorStr);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
543 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
544
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
545
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
546 public Color parseAreaLineColorField() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
547 String lineColorStr = getAreaLineColorString();
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
548 if (logger.isDebugEnabled()) {
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
549 logger.debug("parseLineColorField: lineColorStr = " +
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
550 (lineColorStr == null
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
551 ? "null"
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
552 : lineColorStr));
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
553 }
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
554 return parseColor(lineColorStr);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
555 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
556
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
557
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
558 private String getAreaLineColorString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
559 return getValue(AREA_LINE_COLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
560 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
561
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
562
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
563 public boolean parseShowMinimum() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
564 return parseBoolean(getShowMinimum(), false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
565 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
566
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
567
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
568 public boolean parseShowMaximum() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
569 return parseBoolean(getShowMaximum(), false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
570 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
571
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
572
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
573 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
574 * Creates a MapserverStyle from the given XML theme.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
575 * This method uses a start- and endcolor to interpolate a
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
576 * given number of color classes for the MapserverStyle.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
577 * @param theme
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
578 * @return String representation of the MapserverStyle
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
579 */
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
580 public String createDynamicMapserverStyle(
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
581 float from,
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
582 float to,
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
583 float step,
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
584 CallMeta meta
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
585 ) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
586 MapserverStyle ms = new MapserverStyle();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
587
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
588 String strStartColor = getValue(WSPLGEN_STARTCOLOR);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
589 Color startColor = strStartColor != null
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
590 ? parseColor(strStartColor)
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
591 : new Color(178, 201, 215);
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
592 String strEndColor = getValue(WSPLGEN_ENDCOLOR);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
593 Color endColor = strEndColor != null
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
594 ? parseColor(strEndColor)
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
595 : new Color(2, 27, 42);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
596
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
597 to = to != 0 ? to : 9999;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
598 step = step != 0 ? step : to;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
599
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
600 int numClasses = (int)((to - from) / step);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
601
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
602 float rd = (endColor.getRed() - startColor.getRed()) / (float)numClasses;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
603 float gd = (endColor.getGreen() - startColor.getGreen()) / (float)numClasses;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
604 float bd = (endColor.getBlue() - startColor.getBlue()) / (float)numClasses;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
605
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
606 if (numClasses > 1) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
607 // Desktop Flys always added a last "and larger class"
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
608 numClasses += 1;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
609 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
610
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
611 for (int n = 0; n < numClasses; n++) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
612 StringBuilder newColor = new StringBuilder();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
613 newColor.append(startColor.getRed() + Math.round(n * rd));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
614 newColor.append(' ');
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
615 newColor.append(startColor.getGreen() + Math.round(n * gd));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
616 newColor.append(' ');
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
617 newColor.append(startColor.getBlue() + Math.round(n * bd));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
618
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
619 String expr = createWSPLGENClassExpression(from + n * step, step, n + 1, numClasses);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
620 String name = createWSPLGENClassName(from + n * step, step, n + 1, numClasses, meta);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
621
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
622 Clazz c = new Clazz(name);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
623 Style s = new Style();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
624 s.setColor(newColor.toString());
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
625 s.setSize(5);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
626
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
627 c.addItem(new Expression("(" + expr + ")"));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
628 c.addItem(s);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
629
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
630 ms.addClazz(c);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
631 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
632
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
633 return ms.toString();
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
634 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
635
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
636
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
637 protected static String createWSPLGENClassExpression(float val, float step, int idx, int maxIdx) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
638 if (idx < maxIdx) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
639 return "[DIFF] >= " + val + " AND [DIFF] < " + (val + step);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
640 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
641 else {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
642 return "[DIFF] >= " + val;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
643 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
644 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
645
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
646 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
647 * Creates a class name for the mapfile style that visualizes a floodmap.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
648 * The class names are used in the map's legend.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
649 *
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
650 * @param val Current isobath value.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
651 * @param step Difference between to class values.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
652 * @param idx Current class index that is being processed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
653 * @param maxIdx Highest class index.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
654 * @param meta Caller meta object used to determine locale.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
655 * @return
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
656 */
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
657 protected static String createWSPLGENClassName(
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
658 float val,
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
659 float step,
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
660 int idx,
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
661 int maxIdx,
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
662 CallMeta meta
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
663 ) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
664 assert meta != null : "CallMeta instance is null";
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
665
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
666 if (idx < maxIdx) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
667 return Resources.getMsg(meta, MSG_ISOBATH_CLASS,
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
668 new Object[] {val, val + step});
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
669 }
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
670 return Resources.getMsg(meta, MSG_ISOBATH_LASTCLASS,
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
671 new Object[] {val});
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
672 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
673
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
674
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
675 public String createMapserverStyle() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
676 String symbol = getSymbol();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
677 String backcolor = getLabelBackgroundColorString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
678 String linecolor = getLineColorString();
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
679 if (linecolor == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
680 logger.warn("createMapserverStyle: linecolor String is empty");
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
681 linecolor = "0,128,255";
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
682 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
683
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
684 int linewidth = parseLineWidth();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
685
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
686 MapserverStyle ms = new MapserverStyle();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
687
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
688 Clazz c = new Clazz(" ");
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
689
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
690 Style s = new Style();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
691 s.setOutlineColor(linecolor.replace(",", " "));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
692
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
693 if (backcolor != null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
694 s.setColor(backcolor.replace(",", " "));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
695 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
696
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
697 s.setSize(linewidth);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
698 s.setSymbol(symbol);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
699 c.addItem(s);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
700
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
701 String textcolor = getTextColorString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
702 int textsize = parseTextSize();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
703
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
704 if (textcolor != null && textsize > 0) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
705 Label l = new Label();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
706 l.setColor(textcolor.replace(",", " "));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
707 l.setSize(textsize);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
708 c.addItem(l);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
709 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
710
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
711 ms.addClazz(c);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
712
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
713 return ms.toString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
714 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
715
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
716
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
717 private String getAreaBackgroundColorString() {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
718 return getValue(AREA_BACKGROUND_COLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
719 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
720
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
721
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
722 public Color parseAreaBackgroundColor() {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
723 return parseColor(getAreaBackgroundColorString());
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
724 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
725
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
726
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
727 public int parseAreaTransparency() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
728 return parseAreaTransparency(50);
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
729 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
730
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
731 public int parseAreaTransparency(int alpha) {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
732 return parseInteger(getAreaTransparencyString(), alpha);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
733 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
734
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
735
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
736 public boolean parseAreaShowBorder() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
737 return parseBoolean(getAreaShowBorderString(), false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
738 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
739
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
740
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
741 private String getAreaShowBorderString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
742 return getValue(AREA_SHOW_BORDER);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
743 }
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
744 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
745 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org