0

Tree Render Bug?

asked 2008-09-16 10:22:08 +0800

mk gravatar image mk
30

updated 2008-09-16 10:22:41 +0800

Hi

I think I have found a bug in the tree component.

If I declare the component within a zul file like this:
<tree model="${treemodel}" treeitemRenderer="${treeRenderer}">

"treemodel" and "treeRenderer" are declared ahead of the tree component within a <zscript> tag

The tree should be renderer on loading of the zul file with my "treeRenderer", but it is renderer with the default TreeitemRenderer.
As soon as I open the Treeitem, all following Treeitems are renderer correctly with my "treeRenderer".
If necessary I can provide a small example.



<zscript><![CDATA[
TestTreeitemRenderer treeRenderer = new TestTreeitemRenderer();

... (some data filling for demonstration purpose)...

SimpleTreeNode first = new SimpleTreeNode(ls.get(1), ls2);
SimpleTreeNode second = new SimpleTreeNode(ls.get(2), ls3);
ls1.add(first);
ls1.add(second);
SimpleTreeNode root = new SimpleTreeNode(ls.get(0), ls1);

SimpleTreeModel treemodel = new SimpleTreeModel(root);
]]></zscript>
<tree model="${treemodel}" treeitemRenderer="${treeRenderer}">
</tree>


I am using zk 3.50

mfg Michael

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2008-09-17 08:21:45 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

updated 2008-09-17 08:22:11 +0800

I cannot figure out your problem.
Do you mean, the first level nodes are rendered by default renderer, and other level nodes are rendered by your custom renderer?

link publish delete flag offensive edit

answered 2008-09-17 08:45:06 +0800

mk gravatar image mk
30

Yes.
The first level node is not renderer with my custom renderer. As soon as I open the tree my custom renderer is used. Also if I asign the same model through clicking a button, my custom renderer is used.

There is only a problem, if the page is loaded and the tree is initalized, and the first level nodes are rendered. It seems to ignore the assigned renderer and uses the default one.

mfg Michael

link publish delete flag offensive edit

answered 2008-09-17 14:15:44 +0800

mk gravatar image mk
30

I have found a solution to this problem.

<tree id="testt" model="${treemodel}" treeitemRenderer="${treeRenderer}"/>


with this code, the first treenodes are renderer with the default treeitemRenderer and looks like: [email protected]

But if you, assign the model, after the tree, within a zscript, it works fine and the nodes look like: "test1 3" "test2 3"
<tree id="testt" treeitemRenderer="${treeRenderer}">
</tree>
<zscript><![CDATA[
  testt.setModel(treemodel);
]]></zscript>


mfg Michael

link publish delete flag offensive edit

answered 2008-09-18 01:36:30 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

updated 2008-09-18 01:37:52 +0800

mm...
Use ZUL tag did have sequence issue when assigning attribute in some components.
I did not have sample to run your code.
However, could you help us with following code to see if this work or not.

<tree id="testt"  treeitemRenderer="${treeRenderer}" model="${treemodel}"/>

remove the zscript to set model and move the model attribute later than treeitemRenderer , thanks.

link publish delete flag offensive edit

answered 2008-09-22 09:41:34 +0800

mk gravatar image mk
30

Hi dennis

I was not aware that the ZUL tags had a special sequence order for attributes.
If I rearrange the attribute as you suggested, it works fine.

mfg Michael

link publish delete flag offensive edit

answered 2008-09-23 11:14:02 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

updated 2008-09-23 11:15:15 +0800

Hmm, Maybe we should post it to been a bug ,
check here, http://sourceforge.net/tracker/index.php?func=detail&aid=2124391&group_id=152762&atid=785191

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-09-16 10:22:08 +0800

Seen: 349 times

Last updated: Sep 23 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More