# HG changeset patch # User Ingo Weinzierl # Date 1315994455 0 # Node ID 63b258bf365c342198f5d35c4630a754c335d008 # Parent f6c14ffdfd07d18fad8190eacbcd02526c30a75f Bugfix: Use name instead of description for loading new facets via Datacage. flys-client/trunk@2735 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r f6c14ffdfd07 -r 63b258bf365c flys-client/ChangeLog --- a/flys-client/ChangeLog Wed Sep 14 09:45:37 2011 +0000 +++ b/flys-client/ChangeLog Wed Sep 14 10:00:55 2011 +0000 @@ -1,3 +1,21 @@ +2011-09-14 Ingo Weinzierl + + * src/main/java/de/intevation/flys/client/server/meta/Converter.java: + Extract the name AND the description from dom Element. Use both + attributes to create a new DataCageNode with 'name' and 'description'. + The 'description' depends on the Element: if it has an attribute + 'description', this one is used otherwise the 'description' is + "${'name'}". + + * src/main/java/de/intevation/flys/client/shared/model/DataCageNode.java: + Added a new attribute 'description' with getter method and new + constructor. + + * src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java: + Display the 'description' of DataCageNodes in the Datacage tree, but use + the 'name' for in the ToLoad object which is created after pressing the + "+" button. + 2011-09-14 Felix Wolfsteller Committed rest for fix flys/issue311 (translation of crosssection). diff -r f6c14ffdfd07 -r 63b258bf365c flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Wed Sep 14 09:45:37 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Wed Sep 14 10:00:55 2011 +0000 @@ -179,7 +179,7 @@ if (factory != null) { // we need at least a factory String artifact = node.getAttribute("artifact-id"); String out = node.getAttribute("out"); - String name = node.getName(); + String name = node.getAttribute("facet"); String ids = node.getAttribute("ids"); toLoad.add(artifact, factory, out, name, ids); @@ -247,7 +247,8 @@ tn.setAttribute("parent-id", parentId); tn.setAttribute("id", id); // TODO: i18n - tn.setAttribute("name", node.getName()); + tn.setAttribute("name", node.getDescription()); + tn.setAttribute("facet", node.getName()); nodes.add(tn); AttrList attrs = node.getAttributes(); if (attrs != null) { diff -r f6c14ffdfd07 -r 63b258bf365c flys-client/src/main/java/de/intevation/flys/client/server/meta/Converter.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/meta/Converter.java Wed Sep 14 09:45:37 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/meta/Converter.java Wed Sep 14 10:00:55 2011 +0000 @@ -40,11 +40,15 @@ public static class I18NConverter implements NodeConverter { public DataCageNode convert(Element node, Converter converter) { //System.err.println("I18NConverter called"); - String name = node.hasAttribute("description") + + String name = node.getLocalName(); + String desc = node.hasAttribute("description") ? node.getAttribute("description") - : "${" + node.getLocalName() + "}"; + : "${" + name + "}"; + DataCageNode out = - new DataCageNode(name, toAttrList(node.getAttributes())); + new DataCageNode(name, desc, toAttrList(node.getAttributes())); + converter.convertChildren(out, node); return out; } diff -r f6c14ffdfd07 -r 63b258bf365c flys-client/src/main/java/de/intevation/flys/client/shared/model/DataCageNode.java --- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DataCageNode.java Wed Sep 14 09:45:37 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DataCageNode.java Wed Sep 14 10:00:55 2011 +0000 @@ -8,6 +8,7 @@ public class DataCageNode implements Serializable { protected String name; + protected String description; protected List children; protected AttrList attrs; @@ -19,14 +20,23 @@ } public DataCageNode(String name, AttrList attrs) { - this.name = name; - this.attrs = attrs; + this(name, name, attrs); + } + + public DataCageNode(String name, String description, AttrList attrs) { + this.name = name; + this.description = description; + this.attrs = attrs; } public String getName() { return name; } + public String getDescription() { + return description; + } + public void setName(String name) { this.name = name; }