Yes I am getting action events from h:commandLinks.

Could you please give me rough idea how I can sub class the tree2 component
and put an action listener for "+" and "-" images also?

Mihir

-----Original Message-----
From: Rob Decker [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 11, 2005 5:58 PM
To: MyFaces Discussion
Subject: Re: selectionlistener for tree2

You are getting action events from h:commandLinks. The tree2 component
doesn't support the actionListener attribute. You can subclass the tree2
component add the functionality.

----- Original Message ----- 
From: "Mihir Solanki" <[EMAIL PROTECTED]>
To: "'MyFaces Discussion'" <[email protected]>; "'Sean
Schofield'" <[EMAIL PROTECTED]>
Sent: Monday, April 11, 2005 5:42 AM
Subject: RE: selectionlistener for tree2


Sean,

I have created tree2 and as per this email thread, I am getting action
events in my bean whenever I click on either "images" or "description text".

But the only problem is when I click on "+" or "-" images I and not getting
the action events as these images are (I guess) put bye the tree2
component...

So how do I get action events on "+" and"-" images for the consistence
behavior...

Thanks
Mihir Solanki

-----Original Message-----
From: Sean Schofield [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 29, 2005 9:01 PM
To: MyFaces Discussion; Roger Lee, NOTiFY
Subject: Re: selectionlistener for tree2

It looks like your problem is that you have the method name as
processEvent in your actionListener attribute but you've defined the
method name as processAction.

If you want the tree to keep track of your selected nodes for you then
you *must* use:

actionListener="#{t.setNodeSelected}"

But if you want to handle things yourself, then there is nothing wrong
with what you are trying to do.

sean


On Mon, 28 Mar 2005 18:50:35 +0100, Roger Lee, NOTiFY
<[EMAIL PROTECTED]> wrote:
> Sean,
>
> Could you clarify which Listener I should use for tree2. I want to get the
> description of the Document node/leaf of the Tree(2).
>
> I have in my JSP;
>
> <h:commandLink immediate="true" styleClass="document"
> actionListener="#{loanSelectionTreeActionListener.processEvent}" >
>
> and backing class;
>
> public class LoanSelectionTreeActionListener implements ActionListener {
>
>     public LoanSelectionTreeActionListener() {
>
>     }
>
>     public void processAction(ActionEvent event) throws
> AbortProcessingException {
>         System.out.println(">>>>> selectedLoan");
>
>         //UIComponent comp = actionEvent.getComponent();
>         //HtmlTree tree = (HtmlTree) comp.getParent().getParent();
>         //System.out.println(">>>>> tree = " + tree);
>         //TreeNodeBase node = tree.getNode();
>     }
> }
>
> However this throws an exception;
>
> 17:28:53,221 INFO  [STDOUT] >>>>> LoanServiceBean getHierarchy
> 17:28:53,251 ERROR [MethodBindingImpl] Exception while invoking expression
> #{loa
> nSelectionTreeActionListener.processEvent}
> java.lang.NoSuchMethodException:
> com.fortytwoobjects.mangroup.jsf.LoanSelectionT
> reeActionListener.processEvent(javax.faces.event.ActionEvent)
>         at java.lang.Class.getMethod(Class.java:986)
>         at
> org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java
> :127)
>         at javax.faces.component.UICommand.broadcast(UICommand.java:86)
>         at
> org.apache.myfaces.custom.tree2.UITreeData.broadcast(UITreeData.java:
> 116)
>         at
> javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:1
> 10)
>         at
> javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:152)
>         at
> org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(Lifecyc
> leImpl.java:177)
>         at
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java
> :87)
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:109)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:237)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:157)
>
> Thanks,
>
> Roger
>
>
> Internet communications are not secure and therefore NOTiFY
> does not accept legal responsibility for the contents of this message.
> Although NOTiFY operates anti-virus programmes, it does not
> accept responsibility for any damage whatsoever that is caused by
> viruses being passed.  Any views or opinions presented are solely those
> of the author and do not necessarily represent those of NOTiFY.
> Replies to this email may be monitored by NOTiFY for operational or
> business reasons.
>
> ----- Original Message -----
> From: "Sean Schofield" <[EMAIL PROTECTED]>
> To: "MyFaces Discussion" <[email protected]>
> Sent: Thursday, March 24, 2005 3:10 PM
> Subject: Re: selectionlistener for tree2
>
> Jon,
>
> Here is a portion of a previous email I sent on the subject.  Let me
> know if there is still any confusion.
>
> sean
>
> [snip]
>
> I've added a isNodeSelected() method to the tree so that it can be
> accessed via a
> value binding expression.
>
> All that is required (if you want to use this functionality) is to set
> the action listener of the commandLink as in this JSP.
>
>    <f:facet name="document">
>      <h:panelGroup>
>        <h:commandLink immediate="true" styleClass="document"
> actionListener="#{t.setNodeSelected}" rendered="#{!t.nodeSelected}">
>          <h:graphicImage value="/images/document.png" border="0"/>
>          <h:outputText value="#{node.description}"/>
>          <f:param name="docNum" value="#{node.identifier}"/>
>        </h:commandLink>
>        <h:commandLink immediate="true" styleClass="documentSelected"
> actionListener="#{t.setNodeSelected}" rendered="#{t.nodeSelected}">
>          <h:graphicImage value="/images/document.png" border="0"/>
>          <h:outputText value="#{node.description}"/>
>          <f:param name="docNum" value="#{node.identifier}"/>
>        </h:commandLink>
>      </h:panelGroup>
>    </f:facet>
>
> In fact the new tree is now even more powerful than the current tree
> in this regard because you can control what constitutes node
> selection.  So if you didn't want the selection of a branch node to be
> counted as a node selection you now have that option.  Of course you
> can always configure it to behave exactly the same as the current tree
> if that is your wish (or ignore node selection entirely.)
>
> [snip]
>
> On Wed, 23 Mar 2005 16:47:43 -0800, Jon Travis <[EMAIL PROTECTED]> wrote:
> > I know there was some discussion on the -dev list about
> > tree2 selection differences between tree1.
> >
> > One of the things that I'm liking about Tree1 is the
> > ability to easily show which nodes are selected (they
> > are bolded, hilighted, etc.)
> >
> > Does this feature exist in tree2?  I basically need
> > the ability to set the selected tree nodes from the
> > model & have them visually cued.
> >
> > -- Jon
> >
> >
> > On Mar 18, 2005, at 10:34 AM, Borja Mart�n wrote:
> >
> > > Yes, I could get the selected node without problem. I paste the code
> > > snippet in case it could help anyone else:
> > > <x:tree2 id="secciones"
> > >    value="#{sections.data}"
> > >    var="section"
> > >    varNodeToggler="t">
> > >                          <f:facet name="section">
> > >        <h:panelGroup>
> > >            <f:facet name="expand">
> > >                <h:graphicImage value="images/yellow-folder-open.png"
> > > rendered="#{t.nodeExpanded}" border="0"/>
> > >            </f:facet>
> > >            <f:facet name="collapse">
> > >                <h:graphicImage value="images/yellow-folder-closed.png"
> > > rendered="#{!t.nodeExpanded}" border="0"/>
> > >            </f:facet>
> > >                      <h:commandLink
> > > actionListener="#{sections.select}">
> > >                <h:outputText value="#{section.description}" />
> > >            </h:commandLink>
> > >        </h:panelGroup>
> > >    </f:facet>
> > > </x:tree2>
> > >
> > > public void select(ActionEvent ae)
> > > {
> > >    UIComponent comp = ae.getComponent();
> > >    HtmlTree tree = (HtmlTree) comp.getParent().getParent();
> > >    TreeNodeBase node = tree.getNode();
> > > }
> > >
> > > bye!
> > >
> > > Sean Schofield wrote:
> > >
> > >> x:treeselectionlistener is for tree.  Tree2 does not use that (as you
> > >> have probably figured out already.)  Tree2 can use an action listener
> > >> to indicate which node was selected (similar to what you were
trying.)
> > >>
> > >> Do you have it working now?  It sounded like from your last message
> > >> that you are ok with tree2 and node selection now.
> > >>
> > >> sean
> > >>
> > >> On Fri, 18 Mar 2005 19:13:47 +0100, Borja Mart�n <[EMAIL PROTECTED]>
> > >> wrote:
> > >>
> > >>> sorry, but the problem was that I had some html without the
> > >>> f:verbatim
> > >>> tags and that's why the actions weren't called
> > >>>
> > >>> Borja Mart�n wrote:
> > >>>
> > >>>
> > >>>> hi,
> > >>>> I was trying to get the tree2 working and have found that the
> > >>>> TreeSelectionListener tag (x:treeselectionlistener) doesnt work, it
> > >>>> says the component isnt a component tree. I tried to insert an
> > >>>> actionListener like this #{sections.select} and created the method
> > >>>> public void select(ActionEvent ae){..} in the sections bean, but it
> > >>>> isnt called
> > >>>> which should be the way to get the selected node using the tree2
> > >>>> component?
> > >>>>
> > >>>> thanks in
> > >
> > >
> > >
> >
> >
>
>



http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at [EMAIL PROTECTED] and delete this mail.
_____________________________________________________________________




http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at [EMAIL PROTECTED] and delete this mail. 
_____________________________________________________________________

Reply via email to