comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java @ 118:5ebc059064a6

Adding Languagetransfer to the ArtifactDatabase to the GNV-Client gnv-artifacts/trunk@181 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 05 Oct 2009 07:52:13 +0000
parents ef157bd2fa92
children 7fb9441dd8af
comparison
equal deleted inserted replaced
117:ef157bd2fa92 118:5ebc059064a6
7 import java.io.OutputStream; 7 import java.io.OutputStream;
8 import java.util.ArrayList; 8 import java.util.ArrayList;
9 import java.util.Collection; 9 import java.util.Collection;
10 import java.util.HashMap; 10 import java.util.HashMap;
11 import java.util.Iterator; 11 import java.util.Iterator;
12 import java.util.Locale;
13 import java.util.Map; 12 import java.util.Map;
14 13
15 import org.apache.log4j.Logger; 14 import org.apache.log4j.Logger;
16 import org.w3c.dom.Document; 15 import org.w3c.dom.Document;
17 import org.w3c.dom.Element; 16 import org.w3c.dom.Element;
357 * @param document 356 * @param document
358 * @param xmlUtilities 357 * @param xmlUtilities
359 * @return 358 * @return
360 */ 359 */
361 private Element createSelectBox(Document document, CallMeta callMeta) { 360 private Element createSelectBox(Document document, CallMeta callMeta) {
362 Locale locale = callMeta.getPreferredLocale(RessourceFactory.getInstance().getSupportedLocales()); 361
363 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); 362 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
364 String selectboxName = "product"; 363 String selectboxName = "product";
365 Iterator<Product> it = this.products.values().iterator(); 364 Iterator<Product> it = this.products.values().iterator();
366 Element selectNode = xmlUtilities.createXFormElement(document,"select1"); 365 Element selectNode = xmlUtilities.createXFormElement(document,"select1");
367 selectNode.setAttribute("ref", selectboxName); 366 selectNode.setAttribute("ref", selectboxName);
368 367
369 368
370 Element lableNode = xmlUtilities.createXFormElement(document, "label"); 369 Element lableNode = xmlUtilities.createXFormElement(document, "label");
371 lableNode.setTextContent(RessourceFactory.getInstance().getRessource(locale, selectboxName, selectboxName)); 370 lableNode.setTextContent(RessourceFactory.getInstance().getRessource(callMeta.getLanguages(), selectboxName, selectboxName));
372 selectNode.appendChild(lableNode); 371 selectNode.appendChild(lableNode);
373 Element choiceNode = xmlUtilities.createXFormElement(document, "choices"); 372 Element choiceNode = xmlUtilities.createXFormElement(document, "choices");
374 selectNode.appendChild(choiceNode); 373 selectNode.appendChild(choiceNode);
375 while (it.hasNext()){ 374 while (it.hasNext()){
376 Product p = it.next(); 375 Product p = it.next();
379 if (this.current != null && this.current.getName().equals(p.getName())){ 378 if (this.current != null && this.current.getName().equals(p.getName())){
380 itemNode.setAttribute("selected", "true"); 379 itemNode.setAttribute("selected", "true");
381 } 380 }
382 381
383 Element choiceLableNode = xmlUtilities.createXFormElement(document, "label"); 382 Element choiceLableNode = xmlUtilities.createXFormElement(document, "label");
384 choiceLableNode.setTextContent(RessourceFactory.getInstance().getRessource(locale, p.getName(), p.getName())); 383 choiceLableNode.setTextContent(RessourceFactory.getInstance().getRessource(callMeta.getLanguages(), p.getName(), p.getName()));
385 itemNode.appendChild(choiceLableNode); 384 itemNode.appendChild(choiceLableNode);
386 385
387 Element choicValueNode = xmlUtilities.createXFormElement(document, "value"); 386 Element choicValueNode = xmlUtilities.createXFormElement(document, "value");
388 choicValueNode.setTextContent(p.getName()); 387 choicValueNode.setTextContent(p.getName());
389 itemNode.appendChild(choicValueNode); 388 itemNode.appendChild(choicValueNode);

http://dive4elements.wald.intevation.org