view flys-client/src/main/java/de/intevation/flys/client/server/StyleHelper.java @ 3497:88feb3347aa5

Implement a ProxyServlet Implement a ProxyServlet to be able to restrict the access to the mapserver too. All queries to the provided map services should go throught this new ProxyServlet. Currently the ProxyServlet can only handle HTTP GET requests. flys-client/trunk@5221 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Thu, 16 Aug 2012 14:42:36 +0000
parents a6b7f0585761
children f53e2e877aa4
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 hidden = e.getAttribute("hidden");

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

http://dive4elements.wald.intevation.org