You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jim the Standing Bear <st...@gmail.com> on 2006/10/17 21:37:04 UTC

question about tree2's t.nodeSelected

Hello,

Here is what I am trying to achieve:  display a tree2, when I click on
a node (a commandLink), its style changes by evaluating
#{t.nodeSelected?'selectedStyle':'notSelectedStyle'}, and it will also
invoke an actionListener at the backing bean to do more stuff

But the problem is that everytime, t.nodeSelected evaluates to false.
By looking at the sample code, it seems as if the nodeSelected must be
set manually.

In the sample code provided on the wiki, the code explicitly does
t.setNodeSelected as the actionListener of the commandLink; but i
cannot do that because as I said earlier, the actionListener is
reserved to invoke a method at the backing bean.

So my question is, is there a way to set the t.nodeSelected while also
does what I need to do?  Please help. Thanks.

-- 
--------------------------------------
Standing Bear Has Spoken
--------------------------------------

Re: question about tree2's t.nodeSelected

Posted by kewldude <pa...@yahoo.com>.
Sorry for resurrecting this old thread, but I'm in the same situation as the
thread starter. I tried the <t:updateActionListener> suggestion, but i'm
getting exceptions. Here is how my code looked like right now.


here is the tree2 component
<t:tree2 id="clientTree" value="#{treeBacker.expandedTreeData}" var="node"
varNodeToggler="t" clientSideToggle="true" binding="#{treeBacker.tree}" >

here is the a4j:commandLink

 		<a4j:commandLink id="a4jLink" styleClass="#{t.nodeSelected?
'documentSelected':'document'}" actionListener="#{treeBacker.nodeClicked}" 
reRender="a4jGroup"> 								        <t:updateActionListener
property="#{treeBacker.clickedNode}" value="#{node}" />
												           			    <t:updateActionListener
property="#{t.setNodeSelected}" value="true" />
															                   <h:outputText
value="#{node.description}"/>
															                   <f:param name="docNum"
value="#{node.identifier}"/>
															                   <f:param name="catid"
value="#{node.catId}"/>
																			</a4j:commandLink>


This is my exception:
javax.faces.el.PropertyNotFoundException: Bean:
org.apache.myfaces.custom.tree2.HtmlTree, property: setNodeSelected
	at
org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:500)
	at
org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:472)
	at
org.apache.myfaces.el.PropertyResolverImpl.getType(PropertyResolverImpl.java:325)
	at
org.apache.myfaces.custom.security.SecurityContextPropertyResolver.getType(SecurityContextPropertyResolver.java:113)
	at
org.apache.myfaces.el.ValueBindingImpl.getType(ValueBindingImpl.java:207)
	at
org.apache.myfaces.custom.updateactionlistener.UpdateActionListener.processAction(UpdateActionListener.java:136)
	at javax.faces.event.ActionEvent.processListener(ActionEvent.java:51)
	at
javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:487)
	at javax.faces.component.UICommand.broadcast(UICommand.java:78)

Basically, I need a setNodeSelected in my treeBacker class(managed bean). I
thought the setNodeSelected  was already automatic for the HtmlTree. I dont
know how to setup the setNodeSelected in the managed bean. What kind of
object to associate with the set? I just want to change how my folder looked
like when it is clicked that's why I'm tinkering with the setNodeSelected
method. I didn't use the actionListener for that because the actionListener
is doing the necessary process when a folder is clicked. I went through
every single thread about this topic in the forum, but it seems I'm missing
out on something or I'm jsut confused. I hope anyone can shed some light
into my problem.




Jim the Standing Bear-2 wrote:
> 
> I tried to do the following, but apparently tomahawk doesn't like it:
> 
>                 <h:commandLink id="id1" action="nodeClicked"
> actionListener="#{Workspace.doGetDetail}"
>                   immediate="true" value="Project:
> #{node.description}"
> styleClass="#{t.nodeSelected?'highlighted':'nodeFolder'}"
> rendered="#{!t.nodeSelected}">
>                   <f:param id="resourceId" name="resourceId"
> value="#{node.identifier}" />
>                   <t:updateActionListener
> property="#{t.setNodeSelected}" value="true"/>
>                 </h:commandLink>
> 
> I also tried property="#{t.nodeSelected}" and it made no difference...
>   is there a way to do the equivalent of   t.setNodeSelected in the
> backing bean?
> 
> 
> 
> On 10/17/06, Jeff Bischoff <jb...@klkurz.com> wrote:
>> Jim the Standing Bear wrote:
>> > In the sample code provided on the wiki, the code explicitly does
>> > t.setNodeSelected as the actionListener of the commandLink; but i
>> > cannot do that because as I said earlier, the actionListener is
>> > reserved to invoke a method at the backing bean.
>> >
>>
>> You do realize that you can have multiple t:updateActionListener tags
>> inside of a commandLink/commandButton? :)
>>
>> Regards,
>>
>> Jeff Bischoff
>> Kenneth L Kurz & Associates, Inc.
>>
>>
>>
> 
> 
> -- 
> --------------------------------------
> Standing Bear Has Spoken
> --------------------------------------
> 
> 

-- 
View this message in context: http://www.nabble.com/question-about-tree2%27s-t.nodeSelected-tf2461690.html#a11961682
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: question about tree2's t.nodeSelected

Posted by Jim the Standing Bear <st...@gmail.com>.
I tried to do the following, but apparently tomahawk doesn't like it:

                <h:commandLink id="id1" action="nodeClicked"
actionListener="#{Workspace.doGetDetail}"
                  immediate="true" value="Project:
#{node.description}"
styleClass="#{t.nodeSelected?'highlighted':'nodeFolder'}"
rendered="#{!t.nodeSelected}">
                  <f:param id="resourceId" name="resourceId"
value="#{node.identifier}" />
                  <t:updateActionListener
property="#{t.setNodeSelected}" value="true"/>
                </h:commandLink>

I also tried property="#{t.nodeSelected}" and it made no difference...
  is there a way to do the equivalent of   t.setNodeSelected in the
backing bean?



On 10/17/06, Jeff Bischoff <jb...@klkurz.com> wrote:
> Jim the Standing Bear wrote:
> > In the sample code provided on the wiki, the code explicitly does
> > t.setNodeSelected as the actionListener of the commandLink; but i
> > cannot do that because as I said earlier, the actionListener is
> > reserved to invoke a method at the backing bean.
> >
>
> You do realize that you can have multiple t:updateActionListener tags
> inside of a commandLink/commandButton? :)
>
> Regards,
>
> Jeff Bischoff
> Kenneth L Kurz & Associates, Inc.
>
>
>


-- 
--------------------------------------
Standing Bear Has Spoken
--------------------------------------

Re: question about tree2's t.nodeSelected

Posted by Jim the Standing Bear <st...@gmail.com>.
Hi Jeff,

No, I didn't know that. But by reading the documentations on this
updateActionListener, it seems this tag is used for setting values
into some properties.

Why do we have to manually perform t.setNodeSelected? I thought the
tree2 would take care of it automatically just like t.nodeExpanded...

- Jim

On 10/17/06, Jeff Bischoff <jb...@klkurz.com> wrote:
> Jim the Standing Bear wrote:
> > In the sample code provided on the wiki, the code explicitly does
> > t.setNodeSelected as the actionListener of the commandLink; but i
> > cannot do that because as I said earlier, the actionListener is
> > reserved to invoke a method at the backing bean.
> >
>
> You do realize that you can have multiple t:updateActionListener tags
> inside of a commandLink/commandButton? :)
>
> Regards,
>
> Jeff Bischoff
> Kenneth L Kurz & Associates, Inc.
>
>
>


-- 
--------------------------------------
Standing Bear Has Spoken
--------------------------------------

Re: question about tree2's t.nodeSelected

Posted by Jeff Bischoff <jb...@klkurz.com>.
Jim the Standing Bear wrote:
> In the sample code provided on the wiki, the code explicitly does
> t.setNodeSelected as the actionListener of the commandLink; but i
> cannot do that because as I said earlier, the actionListener is
> reserved to invoke a method at the backing bean.
> 

You do realize that you can have multiple t:updateActionListener tags 
inside of a commandLink/commandButton? :)

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.



How to hide a tree2 branch

Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
Hi,

I'd like to hide a branch of my tree based on some session settings, for example, user is a guest user.   I tried to use the rendered attribute of the panelGroup.  
        <f:facet name="Secure Folder">
            <h:panelGroup rendered="#{user.hasAccess}">
                ...
            </h:panelGroup>
        </f:facet> 

It does hide the node, but the little + sign and the line still shows up.  Is there a better way to hide a branch completely?  

Thanks a lot for your help,

Jane