You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Roger Lee, NOTiFY" <ro...@notify.co.uk> on 2005/03/29 10:50:33 UTC

Re: Getting Description from tree Node - Code Snippet

Just in case anyone is interested;

import javax.faces.component.UIComponent;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;

public class LoanSelectionTreeActionListener {

    public LoanSelectionTreeActionListener() {
    }

    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();

        System.out.println("********** LoanSelectionTreeActionListener 
selectLoan node = " + node.getDescription());
    }
}


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: "Rob Decker" <ro...@objectsource.org>
To: "MyFaces Discussion" <my...@incubator.apache.org>; "Roger Lee, 
NOTiFY" <ro...@notify.co.uk>
Sent: Tuesday, March 29, 2005 12:38 AM
Subject: Re: Getting Description from tree Node


> UIComponent parent = null;
> while (!(parent instanceof HTMLTree))
>    parent = component.getParent();
>
> HtmlTree tree = (HtmlTree)parent;
>
>
> ----- Original Message ----- 
> From: "Roger Lee, NOTiFY" <ro...@notify.co.uk>
> To: "MyFaces Discussion" <my...@incubator.apache.org>
> Sent: Monday, March 28, 2005 5:07 PM
> Subject: Getting Description from tree Node
>
>
>>
>> I have an ActionListener on a x:commandLink on a Document in a tree2. In
> the
>> backing class I have;
>>
>>   public void selectLoan(ActionEvent actionEvent) throws
>> AbortProcessingException {
>>         UIComponent component = actionEvent.getComponent();
>>
>>         HtmlTree tree = (HtmlTree) component.getParent().getParent;
>>  }
>>
>> But I get a ClassCastException.
>>
>> What is the correct way to get the description from the Tree2 node.
>>
>> 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.
>>
>>
>
>