Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/StyleHelper.java @ 4205:0dd8963cec9c
Set also the width of the GaugeTree when resizing the GaugePanel
GWT is no longer able to calculate and set the correct width of the GaugeTree since
the GaugeTree is added via a Canvas wrapper. Therefore set the width manually
when resizing the GaugeTree.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 22 Oct 2012 15:33:16 +0200 |
parents | a6b7f0585761 |
children | f53e2e877aa4 |
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); |
6d4a80b668a4
Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 String hidden = e.getAttribute("hidden"); |
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"), |
6d4a80b668a4
Added missing StyleHelper class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 (hidden != null ? Boolean.valueOf(hidden) : false) |
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 : |