You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Warner Onstine <sw...@warneronstine.com> on 2004/03/25 23:06:39 UTC
trying out the tree component
Hi all,
I am trying out the contrib:Tree component and am having some issues
with it. I got the regular contrib:Tree component to work for my root
element, but when I click on it nothing happens. I then looked at the
FileSystemTree example and tried to emulate that one without some of
its complexities (which is probably where I'm running into issues). I
can see from the log file that Tapestry is actually connecting to the
database and looping through the sub-categories and putting them in
corresponding sub-nodes (verified through getChildCount()).
I know I'm doing something wrong, but the FileSystem example has too
many bells and whistles for me to understand what I need to implement
vs. what I can implement.
Thanks,
Warner
RE: trying out the tree component [Documentation]
Posted by tsvetelin <ts...@rushmore-digital.com>.
Hi Warner,
>If I want to contribute some documentation on this what format do I use?
I will be very useful to have more documentation about the tree so thank you
for your help :).
The first thing that can be done is updated and "upgraded" the classes java
doc comments. The second thing that can be done is to be add a section for
the tree in Contrib Component Reference document - a html format
(unfortunately there isn't anything).
If you would like to make another document for the tree I suppose that the
best format could be html.
Tsvetelin.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: trying out the tree component
Posted by Warner Onstine <wa...@warneronstine.com>.
On Mar 26, 2004, at 4:58 AM, tsvetelin wrote:
> Hi Warner,
>
> The Tree store all expanded nodes in implementation of
> ITreeStateModel, by
> default the expanded nodes are stored in a java.util.HashSet. Every
> time
> when the tree is rendered, it walks on the tree structure(from root
> node)
> and check is the current node is expanded. So if it is its children are
> showed.
>
> I suppose that in your case there is something wrong when the tree
> check is
> the current rendered node(in your case your root node) is expanded. I
> have
> seen that you extend the TreeNode class to CategoryTreeNode and you
> override
> the hashcode and equals methods. The equal method is delegated to the
> method
> from Category.equal, but the hashcode is delegated to the
> Category.Name.hashcode. I think this could be reason why the root node
> isn't
> expanded when you select it.
Ok, so I changed the hashcode() method to return category.hashcode()
and I am still getting the same problem.
Decided to test another theory out, I changed the hashcode method back
to what it was and then changed the equals method to check on the name
and it works! One question I have though is will it falsely identify
one category as another if they live in different branches?
root
branch1
test
branch2
test
Will branch1->test equal branch2->test? (this is what I was trying to
avoid by changing the equals method to check agains the object as
opposed to its name).
I initially tried to follow the SimpleTree example that is in contrib
(for which there is no corresponding .page and .html example), which is
why I switched to trying to understand the Directory example.
Thanks for your help.
If I want to contribute some documentation on this what format do I use?
-warner
>
> BTW Are you sure that when you load your tree data structure from the
> database the root node contains some children. Could you trace it after
> initializing the TreeDataModel to check is everything loaded ok?
>
> Tsvetelin.
>
> -----Original Message-----
> From: Warner Onstine [mailto:sw-list@warneronstine.com]
> Sent: Friday, March 26, 2004 12:31 AM
> To: Tapestry users
> Subject: Re: trying out the tree component
>
>
> Must be virus scanning.
> Categories.page
> -----------
> <component id="treeData" type="contrib:TreeDataView">
> <binding name="treeView" expression='components.treeView'/>
> <binding name="value" expression='category'/>
> </component>
>
> <component id="treeNodeView" type="contrib:TreeNodeView">
> <binding name="makeNodeDirect" expression="true"/>
> <binding name="treeDataView"
> expression='components.treeData'/>
> </component>
>
> <component id="treeView" type="contrib:TreeView">
> <binding name="treeModel" expression="treeModel"/>
> </component>
>
> Categories.html
> -----------
> <table cellspacing="6">
> <tr>
> <td valign="top">
> <span class="tree" jwcid="treeView">
> <span jwcid="treeData">
> <span jwcid="treeNodeView"/>
> </span>
> </span>
> </td>
> <td valign="top" height="100%"> </td>
> </tr>
> </table>
>
> -warner
>
> On Mar 25, 2004, at 3:12 PM, Warner Onstine wrote:
>
>> Grrr. for some reason my .page and .html attachments didn't come
>> through.
>>
>> -warner
>>
>> On Mar 25, 2004, at 3:06 PM, Warner Onstine wrote:
>>
>>> Hi all,
>>> I am trying out the contrib:Tree component and am having some issues
>>> with it. I got the regular contrib:Tree component to work for my root
>>> element, but when I click on it nothing happens. I then looked at the
>>> FileSystemTree example and tried to emulate that one without some of
>>> its complexities (which is probably where I'm running into issues). I
>>> can see from the log file that Tapestry is actually connecting to the
>>> database and looping through the sub-categories and putting them in
>>> corresponding sub-nodes (verified through getChildCount()).
>>>
>>> I know I'm doing something wrong, but the FileSystem example has too
>>> many bells and whistles for me to understand what I need to implement
>>> vs. what I can implement.
>>>
>>> Thanks,
>>> Warner
>>>
>>> <CategoryTreeNode.java><Categories.java>-----------------------------
>>> -
>>> ---------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:
>>> tapestry-user-help@jakarta.apache.org
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: trying out the tree component
Posted by tsvetelin <ts...@rushmore-digital.com>.
Hi Warner,
The Tree store all expanded nodes in implementation of ITreeStateModel, by
default the expanded nodes are stored in a java.util.HashSet. Every time
when the tree is rendered, it walks on the tree structure(from root node)
and check is the current node is expanded. So if it is its children are
showed.
I suppose that in your case there is something wrong when the tree check is
the current rendered node(in your case your root node) is expanded. I have
seen that you extend the TreeNode class to CategoryTreeNode and you override
the hashcode and equals methods. The equal method is delegated to the method
from Category.equal, but the hashcode is delegated to the
Category.Name.hashcode. I think this could be reason why the root node isn't
expanded when you select it.
BTW Are you sure that when you load your tree data structure from the
database the root node contains some children. Could you trace it after
initializing the TreeDataModel to check is everything loaded ok?
Tsvetelin.
-----Original Message-----
From: Warner Onstine [mailto:sw-list@warneronstine.com]
Sent: Friday, March 26, 2004 12:31 AM
To: Tapestry users
Subject: Re: trying out the tree component
Must be virus scanning.
Categories.page
-----------
<component id="treeData" type="contrib:TreeDataView">
<binding name="treeView" expression='components.treeView'/>
<binding name="value" expression='category'/>
</component>
<component id="treeNodeView" type="contrib:TreeNodeView">
<binding name="makeNodeDirect" expression="true"/>
<binding name="treeDataView" expression='components.treeData'/>
</component>
<component id="treeView" type="contrib:TreeView">
<binding name="treeModel" expression="treeModel"/>
</component>
Categories.html
-----------
<table cellspacing="6">
<tr>
<td valign="top">
<span class="tree" jwcid="treeView">
<span jwcid="treeData">
<span jwcid="treeNodeView"/>
</span>
</span>
</td>
<td valign="top" height="100%"> </td>
</tr>
</table>
-warner
On Mar 25, 2004, at 3:12 PM, Warner Onstine wrote:
> Grrr. for some reason my .page and .html attachments didn't come
> through.
>
> -warner
>
> On Mar 25, 2004, at 3:06 PM, Warner Onstine wrote:
>
>> Hi all,
>> I am trying out the contrib:Tree component and am having some issues
>> with it. I got the regular contrib:Tree component to work for my root
>> element, but when I click on it nothing happens. I then looked at the
>> FileSystemTree example and tried to emulate that one without some of
>> its complexities (which is probably where I'm running into issues). I
>> can see from the log file that Tapestry is actually connecting to the
>> database and looping through the sub-categories and putting them in
>> corresponding sub-nodes (verified through getChildCount()).
>>
>> I know I'm doing something wrong, but the FileSystem example has too
>> many bells and whistles for me to understand what I need to implement
>> vs. what I can implement.
>>
>> Thanks,
>> Warner
>>
>> <CategoryTreeNode.java><Categories.java>------------------------------
>> ---------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: trying out the tree component
Posted by Warner Onstine <sw...@warneronstine.com>.
Must be virus scanning.
Categories.page
-----------
<component id="treeData" type="contrib:TreeDataView">
<binding name="treeView" expression='components.treeView'/>
<binding name="value" expression='category'/>
</component>
<component id="treeNodeView" type="contrib:TreeNodeView">
<binding name="makeNodeDirect" expression="true"/>
<binding name="treeDataView" expression='components.treeData'/>
</component>
<component id="treeView" type="contrib:TreeView">
<binding name="treeModel" expression="treeModel"/>
</component>
Categories.html
-----------
<table cellspacing="6">
<tr>
<td valign="top">
<span class="tree" jwcid="treeView">
<span jwcid="treeData">
<span jwcid="treeNodeView"/>
</span>
</span>
</td>
<td valign="top" height="100%"> </td>
</tr>
</table>
-warner
On Mar 25, 2004, at 3:12 PM, Warner Onstine wrote:
> Grrr. for some reason my .page and .html attachments didn't come
> through.
>
> -warner
>
> On Mar 25, 2004, at 3:06 PM, Warner Onstine wrote:
>
>> Hi all,
>> I am trying out the contrib:Tree component and am having some issues
>> with it. I got the regular contrib:Tree component to work for my root
>> element, but when I click on it nothing happens. I then looked at the
>> FileSystemTree example and tried to emulate that one without some of
>> its complexities (which is probably where I'm running into issues). I
>> can see from the log file that Tapestry is actually connecting to the
>> database and looping through the sub-categories and putting them in
>> corresponding sub-nodes (verified through getChildCount()).
>>
>> I know I'm doing something wrong, but the FileSystem example has too
>> many bells and whistles for me to understand what I need to implement
>> vs. what I can implement.
>>
>> Thanks,
>> Warner
>>
>> <CategoryTreeNode.java><Categories.java>------------------------------
>> ---------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: trying out the tree component
Posted by Warner Onstine <wa...@warneronstine.com>.
Grrr. for some reason my .page and .html attachments didn't come
through.
-warner