Mercurial > dive4elements > river
changeset 892:63b258bf365c
Bugfix: Use name instead of description for loading new facets via Datacage.
flys-client/trunk@2735 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 14 Sep 2011 10:00:55 +0000 |
parents | f6c14ffdfd07 |
children | 89c01218172b |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java flys-client/src/main/java/de/intevation/flys/client/server/meta/Converter.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DataCageNode.java |
diffstat | 4 files changed, 40 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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 <ingo@intevation.de> + + * 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 <felix.wolfsteller@intevation.de> Committed rest for fix flys/issue311 (translation of crosssection).
--- 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) {
--- 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; }
--- 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<DataCageNode> 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; }