view flys-client/src/main/java/de/intevation/flys/client/server/StyleHelper.java @ 5622:b28a6d05e969

Add a new mechanism in mapfish print call to add arbitary data maps Data properties are identified by starting with mapfish-data and they are then split in info value pairs where info can be the description of the information and value the value of the information to be transported in the data map.
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 09 Apr 2013 19:04:32 +0200
parents f53e2e877aa4
children
line wrap: on
line source
package de.intevation.flys.client.server;

import de.intevation.flys.client.shared.model.Style;
import de.intevation.flys.client.shared.model.StyleSetting;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;


public class StyleHelper {

    public static Style getStyle (Element element) {
        if (!element.getTagName().equals("theme")) {
            return null;
        }

        NodeList list = element.getElementsByTagName("field");
        Style style = new Style();

        style.setName (element.getAttribute("name"));
        style.setFacet (element.getAttribute("facet"));

        try {
            int ndx = Integer.parseInt(element.getAttribute("index"));
            style.setIndex (ndx);
        }
        catch(NumberFormatException nfe) {
            return null;
        }

        for(int i = 0; i < list.getLength(); i++) {
            Element     e = (Element) list.item(i);
            String hints = e.getAttribute("hints");

            StyleSetting set = new StyleSetting (
                e.getAttribute("name"),
                e.getAttribute("default"),
                e.getAttribute("display"),
                e.getAttribute("hints"),
                e.getAttribute("type"),
                (hints != null && hints.contains("hidden") ? true : false)
            );
            style.appendStyleSetting(set);
        }
        return style;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org