You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by simon <si...@chello.at> on 2008/07/20 22:37:18 UTC

Re: questions about findComponent() and tree2.HtmlTree.getPathInformation

On Thu, 2008-07-17 at 00:59 -0400, Jim the Standing Bear wrote:
> Hello,
> 
> I have two questions regarding myFaces.
> 
> 1).  In the JSF file, a Tree2 is assigned a unique ID (exploreTree),
> but the Tree2 is contained under some unnamed panelGroups and
> gridPanels.  One piece of code tried to access this Tree2 by doing the
> following:
> 
> HtmlTree tree =
> (HtmlTree)FacesContext.getCurrentInstance().getUIViewRoot().findComponent("exploreTree");
> 
> and it always gets null.  So the question is does findComponent() only
> find among its immediate children, or does it find the component with
> that ID at any depth (analogous to calling getElementById in HTML
> DOM)?  I tried to make some sense out of the Javadoc on
> findComponent() but got very confused.

Maybe the javadoc for the findComponent method here will be more useful:
http://myfaces.apache.org/core11/myfaces-api/apidocs/javax/faces/component/UIComponentBase.html


> 
> 2).  HtmlTree has a getPathInformation, which takes a parameter of
> "nodeId".  Is this nodeID the ID I assigned to a TreeNodeBase?  Or is
> this the ID that is used in the HTML source code?  My guess is the
> latter because I accidentally had some colons in the ID that I
> assigned to the TreeNodeBase, and calling getPathInformation basically
> tokenized the ID based on the ":".  But need to confirm this.

Sorry, no idea about this.

Regards,
Simon