Thanks for Sean & Matthias for their patience and help.
 
Now have my tree2 working as I want. You can click on the Document node of the tree2 component and it forwards to the next page with the "Loan Name" stored;
 
As suggest I have both an ActionListener & Action in the same component;
 
<f:facet name="loan">
    <h:panelGroup>
        <x:commandLink styleClass="document" actionListener="#{loanSelectionTreeActionListener.processAction}" action="" >
            <h:graphicImage value="images/document.png" border="0"/>
            <h:outputText value="#{node.description}"/>
            <f:param name="docNum" value="#{node.identifier}"/>
        </x:commandLink>
     </h:panelGroup>
</f:facet>
 
The backing class stores the selected Node and sets "success" for the forward as defined in the faces.config;
 
public class LoanSelectionTreeActionListener implements ActionListener {
 
    public String nodeDescription = null;
 
    public LoanSelectionTreeActionListener() {
    }
 
    public void processAction(ActionEvent actionEvent) throws AbortProcessingException {
        System.out.println(">>>>> LoanSelectionTreeActionListener selectLoan");
 
        UIComponent component = actionEvent.getComponent();
 
        UIComponent parent = component.getParent().getParent();
 
        HtmlTree tree = (HtmlTree) parent;
        TreeNode node = tree.getNode();
        nodeDescription = node.getDescription();
 
        System.out.println(">>>>> LoanSelectionTreeActionListener selectLoan node.getDescription = " + node.getDescription());
    }
 
    public String getNodeDescription() {
        return (nodeDescription);
    }
 
    public String isTreeNodeSelected() {
 
        if (nodeDescription != null) {
            System.out.println(">>>>> LoanSelectionTreeActionListener isTreeNodeSelected = " + FortyTwoObjectsConstants.SUCCESS_OUTCOME);
            return FortyTwoObjectsConstants.SUCCESS_OUTCOME;
        }
        else {
            System.out.println(">>>>> LoanSelectionTreeActionListener isTreeNodeSelected = " + FortyTwoObjectsConstants.ERROR_OUTCOME);
            return FortyTwoObjectsConstants.ERROR_OUTCOME;
        }
    }
}
 
 
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]>; "Roger Lee, NOTiFY" <[EMAIL PROTECTED]>
Sent: Tuesday, March 29, 2005 6:10 PM
Subject: Re: navigating from tree2

If you want to have the tree keep track of whether or not the node is
selected you need:

actionListener="#{t.setNodeSelected}"

That is the only way you can do this (for now.)  Of course, you could
always extend HtmlTree to do it differently.  Also, we could consider
modifying tree2 if there is a compelling argument to do so.

As for navigation, you need an action *method* as Matthias has shown.
AFAIK its perfectly acceptable to have both an actionListener and
action (method) attribute for the same component.  If you need to have
your own actionListener in addition to the one required for
maintaining node selection, then you should use the <f:actionListener>
tag to do so.

sean


On Tue, 29 Mar 2005 17:46:12 +0100, Roger Lee, NOTiFY
<
[EMAIL PROTECTED]> wrote:
> Matthias,
>
> Yes but on the example you give you do not have an ActionListener. I have;
>
>  <f:facet name="loan">
>                           <h:panelGroup>
>                                 <x:commandLink styleClass="document"
> actionListener="#{loanSelectionTreeActionListener.selectLoan}" >
>                                     <h:graphicImage
> value="images/document.png" border="0"/>
>                                     <h:outputText
> value="#{node.description}"/>
>                                     <f:param name="docNum"
> value="#{node.identifier}"/>
>                                 </x:commandLink>
>                             </h:panelGroup>
> </f:facet>
>
> So where do I add the;
>
>  <x:commandLink
> action="" >
>   </x:commandLink>
>
> to also execute the method (isTreeNodeSelected) after the ActionListener has
> been executed, to return the "success" so my <navigation-rule> works?
>
> Thanks for your patience.
>
> Regards,
>
> Roger Lee
>
> 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: "Matthias Wessendorf" <
[EMAIL PROTECTED]>
> To: "MyFaces Discussion" <
[email protected]>
> Sent: Tuesday, March 29, 2005 5:31 PM
> Subject: Re: navigating from tree2
>
> > Roger Lee,
> >
> > I guess you are mixing some issues ;)
> >
> > see comments inline.
> >
> >
> >> The ActionListener method is being executed and the value returned is
> >> "success" but it doesn't cause my <navigation-rule> to execute!
> >
> > the *return value* for a actionListener method must be void
> >
> > like:
> > public void nameOfMyMethod(ActionEvent event);
> >
> >> I have tried added a <commandLink action="" ...> on the
> >> Document node as well, after the <ActionListener>, but this doesn't get
> >> executed.
> >>
> >> Are you saying that I cannot use the <navigation-rule>  from a tree2
> >> component?
> >
> > No! I use it this way:
> >
> > ...
> > <f:facet name="holzmichls">
> >   <h:panelGroup>
> >     <h:commandLink styleClass="document" action="">
> >       <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>
> > ...
> >
> >> Regards,
> >>
> >> Roger Lee
> >>
> >> 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: "Matthias Wessendorf"
> >> <
[EMAIL PROTECTED]>
> >> To: "MyFaces Discussion" <
[email protected]>
> >> Sent: Tuesday, March 29, 2005 3:48 PM
> >> Subject: Re: navigating from tree2
> >>
> >>
> >>> Roger Lee,
> >>>
> >>> if you use <commandLink action="" ...>
> >>> and you have a
> >>> <snip>
> >>> public String method(){
> >>>   return ("foo");
> >>> }
> >>> </snip>
> >>> that will help to navigate (be carefull with immediate="true";
> >>> my tree.jsp has no immediate for commandLinks that use faces-config.xml
> >>> for navigation)
> >>>
> >>> I use actionListener for other things.
> >>>
> >>> Imagine a form that has lot's of opional fields
> >>> but only some mandatory fields.
> >>>
> >>> By standard you could show only the mandatory fields
> >>> and provide a link "Show complete form". There a actionListener
> >>> fits fine in (IMHO).
> >>>
> >>> Below there is a simple example on that.
> >>> (a <h:form/> and two actionListener-methods)
> >>>
> >>> HTH,
> >>> Matthias
> >>>
> >>> --------------------------form.jsp--------------------------
> >>> <h:form>
> >>> <h:panelGrid columns="2">
> >>>
> >>>   <h:outputText value="Vorname"/>
> >>>   <h:inputText value="#{person.vorname}"/>
> >>>
> >>>   <h:outputText value="Nachname"/>
> >>>   <h:inputText value="#{person.nachname}"/>
> >>>
> >>>   <h:outputText value="Strasse" rendered="#{person.komplett}"/>
> >>>   <h:inputText value="#{person.strasse}" rendered="#{person.komplett}"/>
> >>>
> >>>   <h:outputText value="Hausnummer" rendered="#{person.komplett}"/>
> >>>   <h:inputText value="#{person.hausnummer}"
> >>> rendered="#{person.komplett}"/>
> >>>
> >>>   <h:outputText value="Postleitzahl" rendered="#{person.komplett}"/>
> >>>   <h:inputText value="#{person.postleitzahl}"
> >>> rendered="#{person.komplett}"/>
> >>>
> >>>   <h:outputText value="Ort" rendered="#{person.komplett}"/>
> >>>   <h:inputText value="#{person.ort}" rendered="#{person.komplett}"/>
> >>>
> >>>   <h:outputText value="Telefonnummer" rendered="#{person.komplett}"/>
> >>>   <h:inputText value="#{person.telefonnummer}"
> >>> rendered="#{person.komplett}"/>
> >>>
> >>>   <h:outputText value="Handynummer" rendered="#{person.komplett}"/>
> >>>   <h:inputText value="#{person.handynummer}"
> >>> rendered="#{person.komplett}"/>
> >>>
> >>>   <h:commandButton
> >>>     id="kompaktId"
> >>>     value="small formular"
> >>>     style="color:red"
> >>>     immediate="true"
> >>>     rendered="#{person.komplett}"
> >>>     actionListener="#{person.kompaktAnsicht}"/>
> >>>
> >>>   <h:commandButton
> >>>     id="vollansichtId"
> >>>     value="complete formular"
> >>>     style="color:red"
> >>>     immediate="true"
> >>>     rendered="#{! person.komplett}"
> >>>     actionListener="#{person.komplettAnsicht}"/>
> >>>
> >>>   <h:commandButton value="absenden" action=""/>
> >>> </h:panelGrid>
> >>> </h:form>
> >>> --------------------------actionListener--------------------------
> >>>
> >>> private boolean komplett;
> >>>
> >>>   public void kompaktAnsicht(ActionEvent event){
> >>>     this.komplett = false;
> >>>   }
> >>>
> >>>   public void komplettAnsicht(ActionEvent event){
> >>>     this.komplett = true;
> >>>   }
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> Roger Lee, NOTiFY wrote:
> >>>
> >>>> Michael,
> >>>>
> >>>> The return value was declared outside as;
> >>>>
> >>>> public class LoanSelectionTreeActionListener {
> >>>>
> >>>>     public String nodeDescription = null;
> >>>>
> >>>>     public LoanSelectionTreeActionListener() {
> >>>>     }
> >>>>
> >>>>     public String selectLoan(ActionEvent actionEvent) throws
> >>>> AbortProcessingException {
> >>>>
> >>>>     etc etc.
> >>>>
> >>>>
> >>>> Changed it as suggested, but still fails to forward to
> >>>> LoanEnquirySummary.jsp
> >>>>
> >>>> I had this working in WebGalileo using similar technique.
> >>>>
> >>>> Thanks for your suggestions.
> >>>>
> >>>>
> >>>>
> >>>> 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: "Flesch, Michael RD-AS2"
> >>>> <
[EMAIL PROTECTED]>
> >>>> To: "MyFaces Discussion" <
[email protected]>; "Roger
> >>>> Lee, NOTiFY" <
[EMAIL PROTECTED]>
> >>>> Sent: Tuesday, March 29, 2005 2:11 PM
> >>>> Subject: AW: navigating from tree2
> >>>>
> >>>>
> >>>> I thing you lost the return value.
> >>>> Use:
> >>>> public String selectLoan(ActionEvent actionEvent) throws
> >>>> AbortProcessingException {
> >>>>       ...
> >>>>        return isTreeNodeSelected();
> >>>>     }
> >>>> Michael -----Urspr�ngliche Nachricht-----
> >>>> Von: Roger Lee, NOTiFY [mailto:[EMAIL PROTECTED] Gesendet:
> >>>> Dienstag, 29. M�rz 2005 14:44
> >>>> An: MyFaces Discussion
> >>>> Betreff: navigating from tree2
> >>>>
> >>>>
> >>>> My ActionListener in a tree2 component calls a backing class and gets
> >>>> the Description from the Tree Node.
> >>>>
> >>>> LoanSelectionTree.jsp
> >>>>
> >>>> <x:commandLink immediate="true" styleClass="document"
> >>>> actionListener="#{loanSelectionTreeActionListener.selectLoan}" >
> >>>>
> >>>>
> >>>> I then call a method in this Backing Class which returns "success".
> >>>>
> >>>>  public void selectLoan(ActionEvent actionEvent) throws
> >>>> AbortProcessingException {
> >>>>         //System.out.println("**********
> >>>> LoanSelectionTreeActionListener selectLoan");
> >>>>
> >>>>         UIComponent component = actionEvent.getComponent();
> >>>>
> >>>>         UIComponent parent = component.getParent().getParent();
> >>>>
> >>>>         HtmlTree tree = (HtmlTree) parent;
> >>>>         TreeNode node = tree.getNode();
> >>>>         nodeDescription = node.getDescription();
> >>>>
> >>>>         System.out.println(">>>>> LoanSelectionTreeActionListener
> >>>> selectLoan node.getDescription = " + node.getDescription());
> >>>>
> >>>>         // To force return of "Success"
> >>>>         isTreeNodeSelected();
> >>>>     }
> >>>>
> >>>>     public String getNodeDescription() {
> >>>>         return (nodeDescription);
> >>>>     }
> >>>>
> >>>>     public String isTreeNodeSelected() {
> >>>>
> >>>>         if (nodeDescription != null) {
> >>>>             System.out.println(">>>>> LoanSelectionTreeActionListener
> >>>> isTreeNodeSelected = " + FortyTwoObjectsConstants.SUCCESS_OUTCOME);
> >>>>             return FortyTwoObjectsConstants.SUCCESS_OUTCOME;
> >>>>         }
> >>>>         else {
> >>>>             System.out.println(">>>>> LoanSelectionTreeActionListener
> >>>> isTreeNodeSelected = " + FortyTwoObjectsConstants.ERROR_OUTCOME);
> >>>>             return FortyTwoObjectsConstants.ERROR_OUTCOME;
> >>>>         }
> >>>>     }
> >>>>
> >>>> in my Faces-Config I have;
> >>>>
> >>>> <navigation-rule>
> >>>>         <from-view-id>/LoanSelectionTree.jsp</from-view-id>
> >>>>         <navigation-case>
> >>>>
> >>>> <from-action>#{loanSelectionTreeActionListener.selectLoan}</from-action>
> >>>>             <from-outcome>success</from-outcome>
> >>>>             <to-view-id>/LoanEnquirySummary.jsp</to-view-id>
> >>>>         </navigation-case>
> >>>>     </navigation-rule>
> >>>>
> >>>> I have also tried it with;
> >>>>
> >>>>
> >>>> <from-action>#{loanSelectionTreeActionListener.isTreeNodeSelected}</from-action>
> >>>>
> >>>> Either way it does not navigate to my "LoanEnquirySummary.jsp"
> >>>>
> >>>> No errors thrown. Any suggestions?
> >>>>
> >>>> Many thanks.
> >>>>
> >>>> Roger Lee
> >>>>
> >>>> 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.
> >
>
>

Reply via email to