Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java @ 1823:7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
flys-artifacts/trunk@3152 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 03 Nov 2011 10:32:17 +0000 |
parents | 6ed439ff61bf |
children | 9562ca537143 |
rev | line source |
---|---|
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.themes; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
3 import org.apache.log4j.Logger; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
4 |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.io.Serializable; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.util.regex.Matcher; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import java.util.regex.Pattern; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
9 import de.intevation.flys.artifacts.FLYSArtifact; |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
11 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
12 * Represents mapping to a theme (including conditions). |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
13 */ |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 public class ThemeMapping implements Serializable { |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
16 /** The logger that is used in this class */ |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
17 private static Logger logger = Logger.getLogger(ThemeMapping.class); |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
18 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
19 /** Name from which to map. */ |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 protected String from; |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
21 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
22 /** Name to which to map. */ |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 protected String to; |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
24 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
25 /** Given pattern (held against facet description). */ |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 protected String patternStr; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
28 /** Given masterAttr pattern (held against masterartifacts attributes). */ |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
29 protected String masterAttr; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
30 |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 protected Pattern pattern; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 public ThemeMapping(String from, String to) { |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
35 this(from, to, null, null); |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 } |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
39 public ThemeMapping( |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
40 String from, |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
41 String to, |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
42 String patternStr, |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
43 String masterAttr) |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
44 { |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 this.from = from; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 this.to = to; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 this.patternStr = patternStr; |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
48 this.masterAttr = masterAttr; |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 this.pattern = Pattern.compile(patternStr); |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 } |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 public String getFrom() { |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 return from; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 } |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
59 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
60 * Get name of theme that is mapped to. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
61 */ |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 public String getTo() { |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 return to; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
67 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
68 * Get pattern. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
69 */ |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 public String getPatternStr() { |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 return patternStr; |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 } |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
75 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
76 * Match regular expression against text. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
77 * |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
78 * @param text string to be matched against. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
79 * @return true if pattern matches text or pattern is empty. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
80 */ |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 public boolean applyPattern(String text) { |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
82 if (patternStr == null || patternStr.equals("")) { |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
83 return true; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
84 } |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 Matcher m = pattern.matcher(text); |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 return m.matches(); |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 } |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
88 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
89 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
90 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
91 * Inspects Artifacts data given the masterAttr-condition. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
92 * |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
93 * The only condition implemented so far is 'key==value', for which |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
94 * the Artifacts data with name "key" has to be of value "value" in order |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
95 * for true to be returned. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
96 * |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
97 * @param artifact Artifact of which to inspect data. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
98 * @return true if no condition is specified or condition is met. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
99 */ |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
100 public boolean masterAttrMatches(FLYSArtifact artifact) { |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
101 if (masterAttr == null || masterAttr.equals("")) { |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
102 return true; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
103 } |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
104 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
105 // Operator split. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
106 String[] parts = masterAttr.split("=="); |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
107 if (parts.length != 2) { |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
108 logger.error("ThemeMapping could not parse masterAttr.-condition:_" |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
109 + masterAttr + "_"); |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
110 return false; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
111 } |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
112 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
113 // Test. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
114 return artifact.getDataAsString(parts[0]).equals(parts[1]); |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
115 } |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 } |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |