Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 128:206312c2aa76
I18N of strings for the DESCRIBE document.
flys-artifacts/trunk@1468 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 14 Mar 2011 16:32:42 +0000 |
parents | 21d791e21aca |
children | f3dfa188d8b2 |
comparison
equal
deleted
inserted
replaced
127:21d791e21aca | 128:206312c2aa76 |
---|---|
21 import de.intevation.artifactdatabase.transition.TransitionEngine; | 21 import de.intevation.artifactdatabase.transition.TransitionEngine; |
22 | 22 |
23 import de.intevation.artifacts.common.utils.XMLUtils; | 23 import de.intevation.artifacts.common.utils.XMLUtils; |
24 | 24 |
25 import de.intevation.flys.artifacts.context.FLYSContext; | 25 import de.intevation.flys.artifacts.context.FLYSContext; |
26 import de.intevation.flys.artifacts.resources.Resources; | |
26 | 27 |
27 | 28 |
28 /** | 29 /** |
29 * The default WINFO artifact. | 30 * The default WINFO artifact. |
30 * | 31 * |
52 | 53 |
53 /** | 54 /** |
54 * This method returns a description of this artifact. | 55 * This method returns a description of this artifact. |
55 * | 56 * |
56 * @param data Some data. | 57 * @param data Some data. |
57 * @param CallContext The CallContext. | 58 * @param context The CallContext. |
58 * | 59 * |
59 * @return the description of this artifact. | 60 * @return the description of this artifact. |
60 */ | 61 */ |
61 public Document describe(Document data, CallContext context) { | 62 public Document describe(Document data, CallContext context) { |
62 logger.debug("Describe: the current state is: " + getCurrentStateId()); | 63 logger.debug("Describe: the current state is: " + getCurrentStateId()); |
97 creator, "ui", null, null); | 98 creator, "ui", null, null); |
98 | 99 |
99 Element staticUI = ProtocolUtils.createArtNode( | 100 Element staticUI = ProtocolUtils.createArtNode( |
100 creator, "static", null, null); | 101 creator, "static", null, null); |
101 | 102 |
103 appendStaticUI(creator, staticUI, context); | |
104 | |
102 Element dynamic = current.describe( | 105 Element dynamic = current.describe( |
103 description, | 106 description, |
104 root, | 107 root, |
105 context, | 108 context, |
106 identifier()); | 109 identifier()); |
107 | 110 |
108 ui.appendChild(dynamic); | 111 ui.appendChild(dynamic); |
112 ui.appendChild(staticUI); | |
109 root.appendChild(ui); | 113 root.appendChild(ui); |
110 | |
111 appendStaticUI(creator, ui); | |
112 | 114 |
113 return description; | 115 return description; |
114 } | 116 } |
115 | 117 |
116 | 118 |
129 * the user - to the static node of the DESCRIBE document. | 131 * the user - to the static node of the DESCRIBE document. |
130 * | 132 * |
131 * @param cr The ElementCreator that is used to create new elements. | 133 * @param cr The ElementCreator that is used to create new elements. |
132 * @param ui The static ui node. | 134 * @param ui The static ui node. |
133 */ | 135 */ |
134 protected void appendStaticUI(XMLUtils.ElementCreator cr, Node ui) { | 136 protected void appendStaticUI( |
137 XMLUtils.ElementCreator cr, | |
138 Node ui, | |
139 CallContext context) | |
140 { | |
135 Set<String> keys = data.keySet(); | 141 Set<String> keys = data.keySet(); |
136 | 142 |
137 // XXX This just handles single selection string values. If we need more | 143 // XXX This just handles single selection string values. If we need more |
138 // complex (maybe multiselect) objects we should introduce a data | 144 // complex (maybe multiselect) objects we should introduce a data |
139 // structure for this - this structure should have a method that returns | 145 // structure for this - this structure should have a method that returns |
140 // a <data> node that contains its items. | 146 // a <data> node that contains its items. |
141 for (String k: keys) { | 147 for (String k: keys) { |
142 logger.debug("The key = " + k); | 148 logger.debug("The key = " + k); |
143 StateData d = getData(k); | 149 StateData d = getData(k); |
150 String name = Resources.getMsg( | |
151 context.getMeta(), | |
152 d.getName(), | |
153 d.getName()); | |
144 | 154 |
145 Element dataElement = cr.create("data"); | 155 Element dataElement = cr.create("data"); |
146 cr.addAttr(dataElement, "name", (String) d.getName(), true); | 156 cr.addAttr(dataElement, "name", name, true); |
147 cr.addAttr(dataElement, "type", d.getType(), true); | 157 cr.addAttr(dataElement, "type", d.getType(), true); |
148 | 158 |
149 Element itemElement = cr.create("item"); | 159 Element itemElement = cr.create("item"); |
150 cr.addAttr(itemElement, "value", (String) d.getValue(), true); | 160 cr.addAttr(itemElement, "value", (String) d.getValue(), true); |
151 // TODO Description (human readable) is missing | 161 // TODO Description (human readable) is missing |