Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/CollectionHelper.java @ 551:13c7f90917fc
Added a PanControl to pan charts.
flys-client/trunk@2064 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 07 Jun 2011 13:07:27 +0000 |
parents | 26e38b79658d |
children | a0884f486711 |
rev | line source |
---|---|
530
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.util.Map; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.w3c.dom.Document; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Element; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.common.utils.XMLUtils; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.client.shared.model.Collection; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.client.shared.model.OutputMode; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.client.shared.model.Theme; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.client.shared.model.ThemeList; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 /** |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 */ |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public class CollectionHelper { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public static Document createAttribute(Collection collection) { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 System.out.println("CollectionHelper.createAttribute"); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 Document doc = XMLUtils.newDocument(); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 ElementCreator cr = new ElementCreator( |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 doc, |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 ArtifactNamespaceContext.NAMESPACE_URI, |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 Element attr = cr.create("attribute"); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 doc.appendChild(attr); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 Map<String, OutputMode> tmpOuts = collection.getOutputModes(); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 Element outs = createOutputElements(cr, collection, tmpOuts); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 if (outs != null) { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 attr.appendChild(outs); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 return doc; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 /** |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 * Creates a whole block with art:output nodes. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 * |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 * @param cr The ElementCreator used to create new elements. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 * @param c The collection. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 * @param modes The OutputModes that should be included. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 * |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 * @return an element with output modes. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 */ |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 protected static Element createOutputElements( |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 ElementCreator cr, |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 Collection c, |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 Map<String, OutputMode> mmodes) |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 System.out.println("CollectionHelper.createOutputElements"); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 java.util.Collection<OutputMode> modes = mmodes != null |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 ? mmodes.values() |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 : null; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 if (modes == null || modes.size() == 0) { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 System.err.println("Collection has no modes: " + c.identifier()); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 return null; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 Element outs = cr.create("outputs"); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 for (OutputMode mode: modes) { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 Element out = createOutputElement(cr, c, mode); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 if (out != null) { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 outs.appendChild(out); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 return outs; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 /** |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 * Create a node art:output that further consist of art:theme nodes. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 * |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 * @param cr The ElementCreator used to create new elements. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 * @param c The collection. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 * @param mode The OutputMode. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 * |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 * @return an element that represents an output mode with its themes. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 */ |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 protected static Element createOutputElement( |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 ElementCreator cr, |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 Collection collection, |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 OutputMode mode) |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 System.out.println("CollectionHelper.createOutputElement"); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 Element out = cr.create("output"); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 cr.addAttr(out, "name", mode.getName(), false); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 ThemeList themeList = collection.getThemeList(mode.getName()); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 List<Theme> themes = themeList != null ? themeList.getThemes() : null; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 if (themes == null || themes.size() == 0) { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 System.err.println("No themes for output mode: " + mode.getName()); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 return null; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 for (Theme theme: themes) { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 Element t = createThemeElement(cr, collection, theme); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 if (t != null) { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 out.appendChild(t); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 return out; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 /** |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 * Creates a theme node art:theme that represents a curve in a chart or map. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 * |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 * @param cr The ElementCreator used to create new elements. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 * @param collection The collection. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 * @param theme The theme whose attributes should be written to an element. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 * |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 * @return an element that contains the informtion of the given theme. |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 */ |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 protected static Element createThemeElement( |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 ElementCreator cr, |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 Collection collection, |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 Theme theme) |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 if (theme == null) { |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 return null; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 Element t = cr.create("theme"); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 cr.addAttr(t, "active", theme.isActive() ? "1" : "0", true); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 cr.addAttr(t, "artifact", theme.getArtifact(), true); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 cr.addAttr(t, "facet", theme.getFacet(), true); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 cr.addAttr(t, "pos", Integer.toString(theme.getPosition()), true); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 return t; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 } |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |