annotate artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java @ 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.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 23 Aug 2013 11:07:11 +0200
parents 7a9cbb3a3d5a
children 835e07ee769d
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
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
76 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
77
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 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
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_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
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_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
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_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
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 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
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 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
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_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
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 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
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 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
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 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
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 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
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_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
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 WSPLGEN_FIELDS = "/theme[@name='WSPLGEN']/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
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>();
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
137 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
138 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
139 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
140 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
141 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
142 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
143 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
144 }
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 }
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 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
147 }
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
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
149 /** 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
150 private static boolean parseBoolean(String value, boolean defaultsTo) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
151 if (value == null || value.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
152 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
153 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
154 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
155 return false;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
156 }
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
157 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
158 return true;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
159 }
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
160 return defaultsTo;
6906
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
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
163
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
164 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
165 * 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
166 * return \param defaultsTo.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
167 * @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
168 * @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
169 * @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
170 */
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
171 private static int parseInteger(String value, int defaultsTo) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
172 if (value == null || value.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
173 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
174 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
175
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
176 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
177 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
178 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
179 catch (NumberFormatException nfe) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
180 // do nothing
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
181 }
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 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
184 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
185
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 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
188 * 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
189 * return \param defaultsTo.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
190 * @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
191 * @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
192 * @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
193 */
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
194 private static double parseDouble(String value, double defaultsTo) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
195 if (value == null || value.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
196 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
197 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
198
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
199 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
200 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
201 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
202 catch (NumberFormatException nfe) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
203 // do nothing
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
204 }
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 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
207 }
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
208
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
209 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
210 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
211 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
212 }
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
213
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
214 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
215 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
216 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
217 }
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
218
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
219 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
220 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
221 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
222 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
223
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
224 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
225 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
226
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
227 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
228 ? "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
229 : "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
230 }
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
231
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
232 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
233 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
234 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
235 }
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
236
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
237 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
238 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
239 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
240 }
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
241
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
242 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
243 String font = getValue(LABEL_FONT_FACE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
244 if (font == null || font.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
245 return null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
246 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
247
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
248 int size = parseTextSize();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
249 int style = parseTextStyle();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
250 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
251 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
252 }
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
253
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
254 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
255 return parseRGB(getTextColorString());
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
256 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
257
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
258 public String getTextColorString() {
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
259 String textColor = getValue(LABEL_FONT_COLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
260 return textColor;
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
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
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
263 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
264 String color = getLabelBackgroundColorString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
265 if (color == null || color.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
266 return Color.WHITE;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
267 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
268 return parseRGB(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
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
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
271 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
272 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
273 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
274
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
275
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
276 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
277 String size = getValue(LINE_SIZE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
278 if (size == null || size.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
279 return 0;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
280 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
281
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
282 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
283 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
284 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
285 catch (NumberFormatException nfe) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
286 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
287 }
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
288 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
289 }
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
290
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
291 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
292 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
293
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
294 float[] def = {10};
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
295 if (dash == null || dash.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
296 return def;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
297 }
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 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
300 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
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 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
305 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
306 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
307 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
308 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
309 return dashes;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
310 }
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
311 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
312 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
313 return def;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
314 }
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
315 }
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
316
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
317 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
318 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
319 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
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 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
323 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
324 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
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 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
328 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
329 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
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 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
333 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
334 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
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
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
337 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
338 String style = getValue(LABEL_FONT_STYLE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
339 if (style == null || style.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
340 return Font.PLAIN;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
341 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
342
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
343 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
344 return Font.ITALIC;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
345 }
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
346 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
347 return Font.BOLD;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
348 }
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
349 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
350 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
351
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
352 public TextStyle parseComplexTextStyle() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
353 return new TextStyle(
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
354 parseTextColor(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
355 parseTextFont(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
356 parseTextBackground(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
357 parseLabelShowBackground(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
358 !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
359 }
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
360
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
361 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
362 return new LineStyle(
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
363 parseLineColorField(),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
364 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
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
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
367 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
368 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
369 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
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 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
373 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
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 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
378 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
379 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
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
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
382 public static Color parseColor(String colorString) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
383 if (colorString == null || colorString.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
384 return null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
385 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
386 else if (colorString.indexOf("#") == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
387 return parseHexColor(colorString);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
388 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
389 else if (colorString.indexOf(",") >= 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
390 return parseRGB(colorString);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
391 }
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
392
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
393 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
394 }
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
395
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
396
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
397 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
398 * 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
399 *
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
400 * @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
401 *
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
402 * @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
403 */
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
404 public static Color parseHexColor(String hex) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
405 if (hex == null) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
406 return null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
407 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
408
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
409 return Color.decode(hex);
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
410 }
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
411
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
412
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 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
414 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
415 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
416 }
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
417
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
418 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
419 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
420 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
421 }
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
422
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
423 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
424 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
425 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
426 }
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
427
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
428 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
429 String size = getValue(LABEL_FONT_SIZE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
430 if (size == null || size.length() == 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
431 return 10;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
432 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
433
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
434 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
435 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
436 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
437 catch (NumberFormatException nfe) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
438 }
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 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
443 * 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
444 * @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
445 * @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
446 */
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
447 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
448 if (rgbtext == null) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
449 return null;
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 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
452 Color c = null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
453 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
454 c = new Color(
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
455 Integer.parseInt(rgb[0].trim()),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
456 Integer.parseInt(rgb[1].trim()),
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
457 Integer.parseInt(rgb[2].trim()));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
458 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
459 catch (NumberFormatException nfe) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
460 c = null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
461 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
462 return c;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
463 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
464
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
465 public 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
466 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
467 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
468
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
469
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
470 /** Get show border as string. */
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
471 public 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
472 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
473 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
474
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 /** 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
477 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
478 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
479 }
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
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
481 public String getSymbol() {
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
482 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
483 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
484
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
485
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
486 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
487 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
488 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
489
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
490
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
491 public 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
492 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
493 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
494
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 public 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
497 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
498 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
499
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 public 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
502 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
503 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
504
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 * 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
508 * @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
509 * @return color.
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 public Color parseFillColorField() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
512 return parseRGB(getFillColorString());
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
513 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
514
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
515
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
516 public boolean parseShowBorder() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
517 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
518 }
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 int parseTransparency() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
522 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
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
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
526 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
527 * 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
528 * @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
529 * @return color.
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 public Color parseLineColorField() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
532 String lineColorStr = getLineColorString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
533 logger.debug("parseLineColorField: lineColorStr = " +
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
534 (lineColorStr == null ? "null" : lineColorStr));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
535 return parseColor(lineColorStr);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
536 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
537
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
538
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
539 public Color parseAreaLineColorField() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
540 String lineColorStr = getAreaLineColorString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
541 logger.debug("parseLineColorField: lineColorStr = " +
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
542 (lineColorStr == null ? "null" : lineColorStr));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
543 return parseColor(lineColorStr);
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
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
547 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
548 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
549 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
550
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
551
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
552 public boolean parseShowMinimum() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
553 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
554 }
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 public boolean parseShowMaximum() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
558 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
559 }
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 * 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
564 * 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
565 * 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
566 * @param theme
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
567 * @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
568 */
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
569 public String createDynamicMapserverStyle(
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
570 float from, float to, float step, CallMeta meta)
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 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
573
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
574 String strStartColor = getValue(WSPLGEN_STARTCOLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
575 Color startColor = strStartColor != null ? parseColor(strStartColor) : 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
576 String strEndColor = getValue(WSPLGEN_ENDCOLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
577 Color endColor = strEndColor != null? parseColor(strEndColor) : new Color(2, 27, 42);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
578
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
579 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
580 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
581
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
582 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
583
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
584 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
585 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
586 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
587
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
588 if (numClasses > 1) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
589 // 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
590 numClasses += 1;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
591 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
592
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
593 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
594 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
595 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
596 newColor.append(' ');
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
597 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
598 newColor.append(' ');
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
599 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
600
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
601 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
602 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
603
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
604 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
605 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
606 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
607 s.setSize(5);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
608
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
609 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
610 c.addItem(s);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
611
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
612 ms.addClazz(c);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
613 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
614
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
615 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
616 }
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
617
6906
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 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
620 if (idx < maxIdx) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
621 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
622 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
623 else {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
624 return "[DIFF] >= " + val;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
625 }
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
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
628 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
629 * 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
630 * 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
631 *
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
632 * @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
633 * @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
634 * @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
635 * @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
636 * @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
637 * @return
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
638 */
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
639 protected static String createWSPLGENClassName(float val, float step, int idx, int maxIdx, CallMeta meta) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
640 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
641
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
642 if (idx < maxIdx) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
643 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
644 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
645 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
646 else {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
647 return Resources.getMsg(meta, MSG_ISOBATH_LASTCLASS,
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
648 new Object[] {val});
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 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
651
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
652
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
653 public String createMapserverStyle() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
654 String symbol = getSymbol();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
655 String backcolor = getLabelBackgroundColorString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
656 String linecolor = getLineColorString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
657 if (linecolor == null || "".equals(linecolor)) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
658 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
659 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
660 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
661
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
662 int linewidth = parseLineWidth();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
663
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
664 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
665
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
666 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
667
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
668 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
669 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
670
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
671 if (backcolor != null && backcolor.length() > 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
672 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
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 s.setSize(linewidth);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
676 s.setSymbol(symbol);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
677 c.addItem(s);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
678
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
679 String textcolor = getTextColorString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
680 int textsize = parseTextSize();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
681
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
682 if (textcolor != null && textcolor.length() > 0 && textsize > 0) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
683 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
684 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
685 l.setSize(textsize);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
686 c.addItem(l);
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
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
689 ms.addClazz(c);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
690
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
691 return ms.toString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
692 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
693
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
694
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
695 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
696 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
697 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
698
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
699
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
700 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
701 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
702 }
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
703
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
704
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
705 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
706 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
707 }
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
708
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
709 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
710 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
711 }
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
712
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
713
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
714 public boolean parseAreaShowBorder() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
715 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
716 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
717
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
718
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
719 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
720 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
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 }
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
723 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org