Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java @ 657:af3f56758f59
merged gnv-artifacts/0.5
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:13:53 +0200 |
parents | cbb6b592bc6f |
children | dde7f51dbe1e |
comparison
equal
deleted
inserted
replaced
590:5f5f273c8566 | 657:af3f56758f59 |
---|---|
1 package de.intevation.gnv.artifacts; | |
2 | |
3 import de.intevation.artifactdatabase.DefaultArtifact; | |
4 import de.intevation.artifactdatabase.XMLUtils; | |
5 | |
6 import de.intevation.artifacts.ArtifactNamespaceContext; | |
7 import de.intevation.artifacts.CallContext; | |
8 import de.intevation.artifacts.CallMeta; | |
9 | |
10 import de.intevation.gnv.artifacts.ressource.RessourceFactory; | |
11 | |
12 import org.apache.log4j.Logger; | |
13 | |
14 import org.w3c.dom.Document; | |
15 import org.w3c.dom.Element; | |
16 | |
17 /** | |
18 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> | |
19 */ | |
20 public class GNVDefaultArtifact extends DefaultArtifact { | |
21 | |
22 private static Logger logger = Logger.getLogger(GNVDefaultArtifact.class); | |
23 | |
24 | |
25 public GNVDefaultArtifact() { | |
26 super(); | |
27 } | |
28 | |
29 | |
30 protected void appendFis( | |
31 Document document, | |
32 Element staticNode, | |
33 CallContext context, | |
34 String fisName | |
35 ) { | |
36 RessourceFactory resource = RessourceFactory.getInstance(); | |
37 CallMeta callMeta = (CallMeta) context.getMeta(); | |
38 | |
39 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( | |
40 document, | |
41 XMLUtils.XFORM_URL, | |
42 XMLUtils.XFORM_PREFIX | |
43 ); | |
44 | |
45 XMLUtils.ElementCreator artCreator = new XMLUtils.ElementCreator( | |
46 document, | |
47 ArtifactNamespaceContext.NAMESPACE_URI, | |
48 ArtifactNamespaceContext.NAMESPACE_PREFIX | |
49 ); | |
50 | |
51 Element selectNode = creator.create("select1"); | |
52 artCreator.addAttr(selectNode, "fis", "true", true); | |
53 | |
54 Element labelNode = creator.create("label"); | |
55 labelNode.setTextContent( | |
56 resource.getRessource(callMeta.getLanguages(), "fis", "fis") | |
57 ); | |
58 | |
59 Element choicesNode = creator.create("choices"); | |
60 | |
61 Element itemNode = creator.create("item"); | |
62 creator.addAttr(itemNode, "selected", "true"); | |
63 | |
64 Element choiceLabel = creator.create("label"); | |
65 choiceLabel.setTextContent(resource.getRessource( | |
66 callMeta.getLanguages(), | |
67 fisName, | |
68 fisName | |
69 )); | |
70 | |
71 Element choiceValue = creator.create("value"); | |
72 choiceValue.setTextContent(fisName); | |
73 | |
74 itemNode.appendChild(choiceLabel); | |
75 itemNode.appendChild(choiceValue); | |
76 choicesNode.appendChild(itemNode); | |
77 | |
78 selectNode.appendChild(labelNode); | |
79 selectNode.appendChild(choicesNode); | |
80 | |
81 staticNode.appendChild(selectNode); | |
82 } | |
83 } |