Any thougts?  The leaves also display the disclosure icon. Some
testing shows that for each of these haschildren is true but
children.size is 0.

On 3/14/07, Douglas Knudsen <[EMAIL PROTECTED]> wrote:
> Wow, way old thread here....but I'm on this topic currently.  I implemented
> the above for a Tree.  Problem is all my leaves display with folder icon in
> the tree even though they have no children.  Any ideas?
>
> DK
>
> On 11/7/06, Matias Nicolas Sommi <[EMAIL PROTECTED]> wrote:
> >
> > Is too late, but I read this in a personal search in the history messages.
> > The error of NullPointerException maybe is for:
> > for(int i = 0; i < listFiles.length; i++){
> > treeNode.getChildren().add(listFiles[i]);
> > }
> > In this sentece, you add childrens to the ArrayList, but the ArrayList
> > never has been initialized.
> > You must to initialize this, for example, in the constructor of the
> javaclass, or in the getter if is null.
> >
> > Regards.
> > --
> > Matías Nicolás Sommi
> >
> >
> > 2006/10/9, frederic_dematos <[EMAIL PROTECTED]>:
> > >
> > >   OK I created my java class TreeNode like that
> > >
> > > public class TreeNode {
> > >
> > > private String label;
> > > private String data;
> > > private ArrayList children;
> > >
> > > public ArrayList getChildren() {
> > > return children;
> > > }
> > > public void setChildren(ArrayList children) {
> > > this.children = children;
> > > }
> > > public String getData() {
> > > return data;
> > > }
> > > public void setData(String data) {
> > > this.data = data;
> > > }
> > > public String getLabel() {
> > > return label;
> > > }
> > > public void setLabel(String label) {
> > > this.label = label;
> > > }
> > >
> > > }
> > >
> > > I don't know if it is needed, but i did the same in ActionScript
> > >
> > > package src.beans
> > > {
> > > import mx.collections.ArrayCollection;
> > > [Managed]
> > > [RemoteClass(alias="beans.TreeNode")]
> > > public class TreeNode
> > > {
> > > private var label:String;
> > > private var data:String;
> > > private var children:ArrayCollection;
> > >
> > > public function getChildren():ArrayCollection {
> > > return children;
> > > }
> > > public function setChildren( children:ArrayCollection):void {
> > > this.children = children;
> > > }
> > > public function getData():String {
> > > return data;
> > > }
> > > public function setData( data:String ):void {
> > > this.data = data;
> > > }
> > > public function getLabel():String {
> > > return label;
> > > }
> > > public function setLabel( label:String):void {
> > > this.label = label;
> > > }
> > >
> > >
> > > }
> > >
> > > }
> > >
> > > In my remoting-config in got
> > >
> > > <destination id="treeNode">
> > > <properties>
> > > <source>beans.TreeNode</source>
> > > <scope>application</scope>
> > > </properties>
> > > </destination>
> > >
> > > So then I call a java class webDav method getFiles which do :
> > >
> > > IN JAVA
> > > public TreeNode getFiles(){
> > >
> > > TreeNode treeNode = new TreeNode();
> > >
> > > treeNode.setLabel("Root");
> > >
> > > String[]listFiles = this.wdr.list();
> > >
> > > for(int i = 0; i < listFiles.length; i++){
> > > treeNode.getChildren().add(listFiles[i]);
> > > }
> > >
> > > return treeNode;
> > > }
> > >
> > > IN AS
> > >
> > > <mx:RemoteObject id="webdav" destination="webdav" >
> > > <mx:method name="getFiles" result='getFilesResult(event)' />
> > > </mx:RemoteObject>
> > >
> > > public function getFilesResult(event:ResultEvent):void{
> > > myProjectTree.dataProvider = event.result as TreeNode;
> > > }
> > >
> > > and I get the folloing error message :
> > >
> > > [RPC Fault faultString="java.lang.NullPointerException : null"
> > > faultCode="Server.Processing" faultDetail="null"]
> > > at
> > > mx.rpc::AbstractInvoker/
> > > http://www.adobe.com/2006/flex/mx/internal::faultHandler ()
> > > at mx.rpc::Responder/fault()
> > > at mx.rpc::AsyncRequest/fault()
> > > at
> > >
> > >
> ::NetConnectionMessageResponder/NetConnectionChannel.as$37:NetConnectionMessageResponder::statusHandler()
> > > at mx.messaging::MessageResponder/status()
> > >
> > > Did somebody had an idea ?
> > >
> > > The linkage between the Webdav java class and Flex is working, but i
> > > dont know how to make flex understand the TreeNode Class.
> > >
> > > Thanks
> > >
> > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
> > > "Dustin Mercer" <[EMAIL PROTECTED]>
> > > wrote:
> > > >
> > > > Yeah, this is a fun one. I have done this, but it's not as elegant
> > > as I was hoping, but it works. What I had to do was create a TreeNode
> > > class. Looks like this:
> > > >
> > > >
> > > >
> > > > Public class TreeNode {
> > > >
> > > >
> > > >
> > > > Private String label;
> > > >
> > > > Private String data;
> > > >
> > > > Private ArrayList children;
> > > >
> > > >
> > > >
> > > > Getters and setters....
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > > The key here is the children property. The property to hold the
> > > nodes must be named children or the tree won't have any childNodes.
> > > There is probably better ways to do this, I.E. implementing the
> > > ITreeDataProvider interface on the AS class, but I couldn't get it to
> > > work properly, and haven't had a chance to revisit it. Does your tree
> > > need to load dynamically (I.E. populate the children with another call
> > > to the database on the nodeOpen event) or will you be loading the
> > > whole tree at once? If you load dynamically, you will need to make
> > > sure you initialize the children property or that node won't be a
> > > folder.
> > > >
> > > >
> > > >
> > > > Dustin Mercer
> > > >
> > > >
> > > >
> > > > ________________________________
> > > >
> > > > From: flexcoders@yahoogroups.com
> <flexcoders%40yahoogroups.com>[mailto:flexcoders@yahoogroups.com<flexcoders%40yahoogroups.com>
> > > ]
> > > On Behalf Of frederic_dematos
> > > > Sent: Wednesday, October 04, 2006 7:15 AM
> > > > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > > > Subject: [flexcoders] Fill a Tree From a JAVA Class
> > > >
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I want to fill an mx:Tree from a Java class talking with webDav.
> > > >
> > > > I am calling my Java class using the Remoting Object.
> > > >
> > > > On the actionScript I want to call the method getFiles of my Java
> > > > class and give the result to the mx.Tree. The problem is I don't know
> > > > which kind of data and which king of structure to pass to the data
> > > > provider of the tree.
> > > >
> > > > If somebody had already meet that kind of problem , thanks for your
> > > help.
> > > >
> > > > Fr�d�ric DE MATOS
> > > >
> > >
> > >    
> >
>
>
>
> --
> Douglas Knudsen
> http://www.cubicleman.com
> this is my signature, like it?
>


-- 
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?

Reply via email to