myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Schofield" <sean.schofi...@gmail.com>
Subject Re: Tomahawk Tree2 / Expanding nodes programmatically via events
Date Wed, 01 Mar 2006 18:09:50 GMT
Please post these kinds of questions to the user list.

Sean



On 3/1/06, Hendrik Beck (camunda) <hendrik.beck@camunda.com> wrote:
> Hi all!
>
> In our current project we are using the Tomahawkt tree2 component. Due to
> some special requirements I have to control the state of expanded nodes
> programmatically. Therefore I have implemented a map which contains the
> nodeIds ("0", "1:2:0" and so on) of the tree nodes and my own Ids. So I can
> expand one single node by calling my own method "expandNode( String myNodeId
> )" which translates my own IDs into tree IDs and then talks to the tree
> component directly.
>
> This method then fires a ToggleExpandEvent on the tree just as the
> HtmlTreeRenderer class does in its "decode()" method (This mechanism is
> executed when the "+" and "-" symbols are executed). In this event the real
> tree node ID is used (e.g. "0:1").
>
> This works fine except for the first toggle of any node. It fails when I try
> to expand a node before at least one node was expanded by clicking on any
> "+" symbol. Because it works fine all the other times I think I must
> basically be a right way. But why does it fail the first time?
>
> Despite of debugging the classes and looking at sources I couldn't find out
> wether the tree does something special when the first node is being
> expanded, maybe some kind of initializing or something.
>
>
> This is my tree:
>
> <t:tree2
>           id="shopCategoryTree" value="#{Tree.tree}"
>           binding="#{NavigationBean.shopCategoryHtmlTree}"
>           var="node" varNodeToggler="t" showRootNode="false"
> clientSideToggle="false" showNav="true">
>
>     <f:facet name="category">
>         <h:outputLink value="navigation.jsf">
>             <h:outputText value="#{node.description}"/>
>             <f:param id="categoryId" name="categoryId"
> value="#{node.identifier}"/>
>         </h:outputLink>
>     </f:facet>
>
>
> </t:tree2>
>
>
> And this is the line of code that manages the state of the tree. This is
> part of the backing bean "NavigationBean" which is used for component
> binding in the tree above.
>
>      shopCategoryHtmlTree.broadcast( new ToggleExpandedEvent(
> this.shopCategoryHtmlTree, "0:1" );
>
> Of course the Id parameter depends on the node that should be expanded but I
> thought it makes the example clearer :-))
>
>
> Can anyone help me answering the questions
> - wether this i a adequate approach for toggling nodes programmatically
> - why it only works after at least one node is expanded via the component
> itself
>
> ?
>
>
> Thanks a lot in advance. Greetz
> Hendrik
>
>

Mime
View raw message