Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java @ 6931:2c8e5bad8699
Fix NPE in case the artifact does not even have the master attribute
Started happening with the new other.wqkms.w attribute condition
and official lines in waterlevel calculations
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 27 Aug 2013 18:35:51 +0200 |
parents | 058b8dc4e8b6 |
children | 234b1a3b527d |
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_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
|
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_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
|
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_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
|
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 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
|
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 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
|
111 |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
112 |
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
|
113 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
|
114 |
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
|
115 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
|
116 |
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
|
117 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
|
118 } |
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 |
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 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
|
121 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
|
122 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
|
123 } |
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
|
124 |
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 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
|
126 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
|
127 } |
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 |
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
|
129 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
|
130 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
|
131 } |
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time 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 |
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time 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 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
|
134 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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 } |
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time 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 } |
6912
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
144 if (logger.isDebugEnabled()) { |
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
145 logger.debug("Theme values: " + values); |
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
146 } |
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
|
147 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
|
148 } |
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
149 |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
150 /** 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
|
151 private static boolean parseBoolean(String value, boolean defaultsTo) { |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
152 if (value == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
153 return defaultsTo; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
154 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
155 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
|
156 return false; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
157 } |
6908
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
158 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
|
159 return true; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
160 } |
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
|
161 return defaultsTo; |
6906
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 /** |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
166 * 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
|
167 * return \param defaultsTo. |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
168 * @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
|
169 * @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
|
170 * @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
|
171 */ |
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
|
172 private static int parseInteger(String value, int defaultsTo) { |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
173 if (value == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
174 return defaultsTo; |
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 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
177 try { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
178 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
|
179 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
180 catch (NumberFormatException nfe) { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
181 // do nothing |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
182 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
183 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
184 return defaultsTo; |
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 /** |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
189 * 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
|
190 * return \param defaultsTo. |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
191 * @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
|
192 * @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
|
193 * @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
|
194 */ |
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
|
195 private static double parseDouble(String value, double defaultsTo) { |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
196 if (value == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
197 return defaultsTo; |
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 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
200 try { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
201 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
|
202 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
203 catch (NumberFormatException nfe) { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
204 // do nothing |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
205 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
206 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
207 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
|
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 |
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
|
210 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
|
211 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
|
212 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
|
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 |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
215 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
|
216 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
|
217 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
|
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 |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
220 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
|
221 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
|
222 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
|
223 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
224 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
225 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
|
226 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
|
227 |
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time 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 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
|
229 ? "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
|
230 : "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
|
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 |
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
|
233 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
|
234 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
|
235 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
|
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 |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
238 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
|
239 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
|
240 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
|
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 |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
243 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
|
244 String font = getValue(LABEL_FONT_FACE); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
245 if (font == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
246 return null; |
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 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
249 int size = parseTextSize(); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
250 int style = parseTextStyle(); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
251 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
|
252 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
|
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 |
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
|
255 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
|
256 return parseRGB(getTextColorString()); |
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 |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
259 private String getTextColorString() { |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
260 return getValue(LABEL_FONT_COLOR); |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
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(); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
265 return color != null |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
266 ? parseRGB(color) |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
267 : Color.WHITE; |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
268 } |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
269 |
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
|
270 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
|
271 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
|
272 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
273 |
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
|
274 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
|
275 String size = getValue(LINE_SIZE); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
276 if (size == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
277 return 0; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
278 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
279 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
280 try { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
281 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
|
282 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
283 catch (NumberFormatException nfe) { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
284 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
|
285 } |
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
|
286 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
|
287 } |
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 |
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 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
|
290 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
|
291 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
292 float[] def = {10}; |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
293 if (dash == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
294 return def; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
295 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
296 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
297 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
|
298 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
|
299 return def; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
300 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
301 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
302 try { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
303 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
|
304 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
|
305 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
|
306 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
307 return dashes; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
308 } |
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
|
309 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
|
310 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
|
311 return def; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
312 } |
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
|
313 } |
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
|
314 |
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 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
|
316 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
|
317 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
|
318 } |
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
|
319 |
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 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
|
321 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
|
322 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
|
323 } |
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
|
324 |
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 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
|
326 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
|
327 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
|
328 } |
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
|
329 |
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 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
|
331 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
|
332 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
|
333 } |
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
|
334 |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
335 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
|
336 String style = getValue(LABEL_FONT_STYLE); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
337 if (style == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
338 return Font.PLAIN; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
339 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
340 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
341 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
|
342 return Font.ITALIC; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
343 } |
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
|
344 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
|
345 return Font.BOLD; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
346 } |
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
|
347 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
|
348 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
349 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
350 public TextStyle parseComplexTextStyle() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
351 return new TextStyle( |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
352 parseTextColor(), |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
353 parseTextFont(), |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
354 parseTextBackground(), |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
355 parseLabelShowBackground(), |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
356 !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
|
357 } |
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
|
358 |
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 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
|
360 return new LineStyle( |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
361 parseLineColorField(), |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
362 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
|
363 } |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
364 |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
365 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
|
366 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
|
367 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
|
368 } |
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
|
369 |
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 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
|
371 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
|
372 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
|
373 } |
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
|
374 |
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 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
|
376 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
|
377 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
|
378 } |
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
|
379 |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
380 private static Color parseColor(String colorString) { |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
381 if (colorString == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
382 return null; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
383 } |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
384 if (colorString.indexOf("#") == 0) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
385 return parseHexColor(colorString); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
386 } |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
387 if (colorString.indexOf(",") >= 0) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
388 return parseRGB(colorString); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
389 } |
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
|
390 |
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
|
391 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
|
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 |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
394 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
395 /** |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
396 * 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
|
397 * |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
398 * @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
|
399 * |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
400 * @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
|
401 */ |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
402 private static Color parseHexColor(String hex) { |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
403 return hex != null |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
404 ? Color.decode(hex) |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
405 : null; |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
406 } |
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
|
407 |
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
|
408 |
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
|
409 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
|
410 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
|
411 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
|
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 |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
414 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
|
415 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
|
416 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
|
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 |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
419 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
|
420 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
|
421 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
|
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 |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
424 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
|
425 String size = getValue(LABEL_FONT_SIZE); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
426 if (size == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
427 return 10; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
428 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
429 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
430 try { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
431 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
|
432 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
433 catch (NumberFormatException nfe) { |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
434 // Do nothing |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
435 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
436 return 10; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
437 } |
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 /** |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
440 * 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
|
441 * @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
|
442 * @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
|
443 */ |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
444 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
|
445 if (rgbtext == null) { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
446 return null; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
447 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
448 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
|
449 try { |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
450 return new Color( |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
451 Integer.parseInt(rgb[0].trim()), |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
452 Integer.parseInt(rgb[1].trim()), |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
453 Integer.parseInt(rgb[2].trim())); |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
454 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
455 catch (NumberFormatException nfe) { |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
456 // Do nothing |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
457 } |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
458 return null; |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
459 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
460 |
6912
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
461 private String getLineColorString() { |
6908
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
462 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
|
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 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
466 /** Get show border as string. */ |
6912
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
467 private String getShowBorderString() { |
6908
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
468 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
|
469 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
470 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
471 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
472 /** 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
|
473 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
|
474 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
|
475 } |
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
476 |
6912
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
477 private String getSymbol() { |
6908
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
478 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
|
479 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
480 |
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
|
481 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
|
482 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
|
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 |
6912
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
486 private String getAreaTransparencyString() { |
6908
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
487 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
|
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 |
6912
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
491 private String getShowMinimum() { |
6908
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
492 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
|
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 |
6912
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
496 private String getShowMaximum() { |
6908
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
497 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
|
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 * 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
|
502 * @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
|
503 * @return color. |
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 public Color parseFillColorField() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
506 return parseRGB(getFillColorString()); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
507 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
508 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
509 public boolean parseShowBorder() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
510 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
|
511 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
512 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
513 public int parseTransparency() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
514 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
|
515 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
516 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
517 |
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 * 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
|
520 * @return color. |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
521 */ |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
522 public Color parseLineColorField() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
523 String lineColorStr = getLineColorString(); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
524 if (logger.isDebugEnabled()) { |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
525 logger.debug("parseLineColorField: lineColorStr = " + |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
526 (lineColorStr == null |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
527 ? "null" |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
528 : lineColorStr)); |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
529 } |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
530 return parseColor(lineColorStr); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
531 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
532 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
533 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
534 public Color parseAreaLineColorField() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
535 String lineColorStr = getAreaLineColorString(); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
536 if (logger.isDebugEnabled()) { |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
537 logger.debug("parseLineColorField: lineColorStr = " + |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
538 (lineColorStr == null |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
539 ? "null" |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
540 : lineColorStr)); |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
541 } |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
542 return parseColor(lineColorStr); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
543 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
544 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
545 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
546 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
|
547 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
|
548 } |
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 public boolean parseShowMinimum() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
552 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
|
553 } |
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 public boolean parseShowMaximum() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
557 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
|
558 } |
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 * 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
|
563 * 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
|
564 * 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
|
565 * @param theme |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
566 * @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
|
567 */ |
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
|
568 public String createDynamicMapserverStyle( |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
569 float from, |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
570 float to, |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
571 float step, |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
572 CallMeta meta |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
573 ) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
574 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
|
575 |
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 strStartColor = getValue(WSPLGEN_STARTCOLOR); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
577 Color startColor = strStartColor != null |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
578 ? parseColor(strStartColor) |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
579 : 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
|
580 String strEndColor = getValue(WSPLGEN_ENDCOLOR); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
581 Color endColor = strEndColor != null |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
582 ? parseColor(strEndColor) |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
583 : new Color(2, 27, 42); |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
584 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
585 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
|
586 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
|
587 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
588 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
|
589 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
590 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
|
591 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
|
592 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
|
593 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
594 if (numClasses > 1) { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
595 // 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
|
596 numClasses += 1; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
597 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
598 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
599 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
|
600 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
|
601 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
|
602 newColor.append(' '); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
603 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
|
604 newColor.append(' '); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
605 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
|
606 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
607 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
|
608 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
|
609 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
610 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
|
611 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
|
612 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
|
613 s.setSize(5); |
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 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
|
616 c.addItem(s); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
617 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
618 ms.addClazz(c); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
619 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
620 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
621 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
|
622 } |
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
|
623 |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
624 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
625 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
|
626 if (idx < maxIdx) { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
627 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
|
628 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
629 else { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
630 return "[DIFF] >= " + val; |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
631 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
632 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
633 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
634 /** |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
635 * 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
|
636 * 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
|
637 * |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
638 * @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
|
639 * @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
|
640 * @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
|
641 * @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
|
642 * @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
|
643 * @return |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
644 */ |
6912
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
645 protected static String createWSPLGENClassName( |
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
646 float val, |
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
647 float step, |
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
648 int idx, |
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
649 int maxIdx, |
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
650 CallMeta meta |
058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6909
diff
changeset
|
651 ) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
652 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
|
653 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
654 if (idx < maxIdx) { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
655 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
|
656 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
|
657 } |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
658 return Resources.getMsg(meta, MSG_ISOBATH_LASTCLASS, |
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
659 new Object[] {val}); |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
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 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
663 public String createMapserverStyle() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
664 String symbol = getSymbol(); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
665 String backcolor = getLabelBackgroundColorString(); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
666 String linecolor = getLineColorString(); |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
667 if (linecolor == null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
668 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
|
669 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
|
670 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
671 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
672 int linewidth = parseLineWidth(); |
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 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
|
675 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
676 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
|
677 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
678 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
|
679 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
|
680 |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
681 if (backcolor != null) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
682 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
|
683 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
684 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
685 s.setSize(linewidth); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
686 s.setSymbol(symbol); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
687 c.addItem(s); |
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 String textcolor = getTextColorString(); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
690 int textsize = parseTextSize(); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
691 |
6909
835e07ee769d
Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6908
diff
changeset
|
692 if (textcolor != null && textsize > 0) { |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
693 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
|
694 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
|
695 l.setSize(textsize); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
696 c.addItem(l); |
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 ms.addClazz(c); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
700 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
701 return ms.toString(); |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
702 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
703 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
704 |
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
|
705 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
|
706 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
|
707 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
708 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
709 |
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
|
710 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
|
711 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
|
712 } |
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
|
713 |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
714 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
715 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
|
716 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
|
717 } |
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
718 |
819481cc9195
Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6906
diff
changeset
|
719 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
|
720 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
|
721 } |
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 |
6906
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
723 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
724 public boolean parseAreaShowBorder() { |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
725 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
|
726 } |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
727 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
728 |
7a9cbb3a3d5a
Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
729 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
|
730 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
|
731 } |
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
|
732 } |
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
733 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |