# HG changeset patch # User Sascha L. Teichmann # Date 1312820340 0 # Node ID 6db4839e0ba135cff027fc49e79b732e72bc46b7 # Parent 57ea5af8a967a33054133f414403b58cf63b0a46 Datacage: Added a subclass of TreeNode to carry the informations needed by the loading listeners. flys-client/trunk@2470 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 57ea5af8a967 -r 6db4839e0ba1 flys-client/ChangeLog --- a/flys-client/ChangeLog Mon Aug 08 15:54:59 2011 +0000 +++ b/flys-client/ChangeLog Mon Aug 08 16:19:00 2011 +0000 @@ -1,3 +1,14 @@ +2011-08-08 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/client/client/widgets/tree/AttributedTreeNode.java: + New. Subclassed TreeNode to carry the attribute data from + the meta data service. + + * src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java: + Create AttributedTreeNodes instead of TreeNodes to have the + relevant information at hand if a listener wants to access + the data. + 2011-08-08 Sascha L. Teichmann * src/main/java/de/intevation/flys/client/shared/model/AttrList.java: diff -r 57ea5af8a967 -r 6db4839e0ba1 flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java Mon Aug 08 15:54:59 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java Mon Aug 08 16:19:00 2011 +0000 @@ -33,6 +33,8 @@ import de.intevation.flys.client.shared.model.DataCageTree; import de.intevation.flys.client.shared.model.DataCageNode; +import de.intevation.flys.client.client.widgets.tree.AttributedTreeNode; + public class DatacageWindow extends Window { @@ -112,23 +114,24 @@ treeGrid.setData(convertTree(tree)); } - protected static TreeNode convert(DataCageNode node) { + protected static AttributedTreeNode convert(DataCageNode node) { List children = node.getChildren(); - TreeNode [] cs; + AttributedTreeNode [] cs; if (children != null) { - cs = new TreeNode[children.size()]; + cs = new AttributedTreeNode[children.size()]; for (int i = 0, N = children.size(); i < N; ++i) { cs[i] = convert(children.get(i)); } } else { - cs = new TreeNode[0]; + cs = new AttributedTreeNode[0]; } - return new TreeNode(node.getName(), cs); + return new AttributedTreeNode( + node.getName(), node.getAttributes(), cs); } protected static Tree convertTree(DataCageTree tree) { @@ -136,20 +139,21 @@ List children = root.getChildren(); - TreeNode [] cs; + AttributedTreeNode [] cs; if (children != null) { - cs = new TreeNode[children.size()]; + cs = new AttributedTreeNode[children.size()]; for (int i = 0, N = children.size(); i < N; ++i) { cs[i] = convert(children.get(i)); } } else { - cs = new TreeNode[0]; + cs = new AttributedTreeNode[0]; } - TreeNode rn = new TreeNode(root.getName(), cs); + AttributedTreeNode rn = new AttributedTreeNode( + root.getName(), root.getAttributes(), cs); Tree r = new Tree(); r.setRoot(rn); diff -r 57ea5af8a967 -r 6db4839e0ba1 flys-client/src/main/java/de/intevation/flys/client/client/widgets/tree/AttributedTreeNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/widgets/tree/AttributedTreeNode.java Mon Aug 08 16:19:00 2011 +0000 @@ -0,0 +1,43 @@ +package de.intevation.flys.client.client.widgets.tree; + +import com.smartgwt.client.widgets.tree.TreeNode; + +import com.google.gwt.core.client.JavaScriptObject; + +import de.intevation.flys.client.shared.model.AttrList; + +public class AttributedTreeNode +extends TreeNode +{ + protected AttrList attrs; + + public AttributedTreeNode() { + } + + public AttributedTreeNode(JavaScriptObject jsObj) { + super(jsObj); + } + + public AttributedTreeNode(String name) { + super(name); + } + + public AttributedTreeNode(String name, TreeNode ... children) { + super(name, children); + } + + public AttributedTreeNode(String name, AttrList attrs) { + super(name); + this.attrs = attrs; + } + + public AttributedTreeNode(String name, AttrList attrs, TreeNode ... children) { + super(name, children); + this.attrs = attrs; + } + + public AttrList getSpecialAttributes() { + return attrs; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :