annotate flys-client/src/main/java/de/intevation/flys/client/server/StyleHelper.java @ 5291:66d9389c80cb

added tables for jetties in spatial schema
author Tom Gottfried <tom@intevation.de>
date Thu, 14 Mar 2013 12:16:58 +0100
parents f53e2e877aa4
children
rev   line source
2909
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.server;
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 2909
diff changeset
3 import de.intevation.flys.client.shared.model.Style;
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 2909
diff changeset
4 import de.intevation.flys.client.shared.model.StyleSetting;
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 2909
diff changeset
5
2909
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import org.w3c.dom.Element;
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import org.w3c.dom.NodeList;
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 public class StyleHelper {
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 public static Style getStyle (Element element) {
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 if (!element.getTagName().equals("theme")) {
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 return null;
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 }
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 NodeList list = element.getElementsByTagName("field");
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 Style style = new Style();
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 style.setName (element.getAttribute("name"));
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 style.setFacet (element.getAttribute("facet"));
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 try {
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 int ndx = Integer.parseInt(element.getAttribute("index"));
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 style.setIndex (ndx);
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 }
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 catch(NumberFormatException nfe) {
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 return null;
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 }
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 for(int i = 0; i < list.getLength(); i++) {
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 Element e = (Element) list.item(i);
4665
f53e2e877aa4 Read and use the hidden hint correctly.
Raimund Renkert <rrenkert@intevation.de>
parents: 3384
diff changeset
33 String hints = e.getAttribute("hints");
2909
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 StyleSetting set = new StyleSetting (
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 e.getAttribute("name"),
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 e.getAttribute("default"),
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 e.getAttribute("display"),
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 e.getAttribute("hints"),
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 e.getAttribute("type"),
4665
f53e2e877aa4 Read and use the hidden hint correctly.
Raimund Renkert <rrenkert@intevation.de>
parents: 3384
diff changeset
41 (hints != null && hints.contains("hidden") ? true : false)
2909
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 );
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 style.appendStyleSetting(set);
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 }
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 return style;
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 }
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 }
6d4a80b668a4 Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org