Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java @ 1747:d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
flys-artifacts/trunk@3047 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 20 Oct 2011 13:45:45 +0000 |
parents | ee105e5d5ead |
children | 6ed439ff61bf |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java Thu Oct 20 13:29:54 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java Thu Oct 20 13:45:45 2011 +0000 @@ -30,6 +30,7 @@ import de.intevation.flys.artifacts.transitions.TransitionFactory; import de.intevation.flys.themes.Theme; import de.intevation.flys.themes.ThemeFactory; +import de.intevation.flys.themes.ThemeMapping; /** @@ -344,7 +345,8 @@ return; } - Map<String, String> mapping = new HashMap<String, String>(); + Map<String, List<ThemeMapping>> mapping = + new HashMap<String, List<ThemeMapping>>(); for (int i = 0; i < num; i++) { Node node = mappings.item(i); @@ -355,12 +357,22 @@ String to = (String) XMLUtils.xpath( node, "@to", XPathConstants.STRING); + String pattern = (String) XMLUtils.xpath( + node, "@pattern", XPathConstants.STRING); + if (from != null && to != null) { - mapping.put(from, to); + List<ThemeMapping> tm = mapping.get(from); + + if (tm == null) { + tm = new ArrayList<ThemeMapping>(); + mapping.put(from, tm); + } + + tm.add(new ThemeMapping(from, to, pattern)); } } - logger.debug("Found " + mapping.size() + " theme/facet mappings."); + logger.debug("Found " + mapping.size() + " theme mappings."); context.put(FLYSContext.THEME_MAPPING, mapping); }