Re: [flexcoders] File Explorer

2008-12-17 Thread Dan Vega
So I am working with the file explorer and I came across another problem.
Server side I am writing out the following xml


  









  


>
> __,_._,_
>

My 1st problem is when its an array collection I know how to get the 1st
item (getItemAt(0)) but here i have no idea how to tell the tree to expand.

private function buildTree(event:ResultEvent):void {
_treedata = new XML(event.result);
tree.expandChildrenOf(_treedata,true);
}

Also, now that I have my basic structure, i am not quite sure what the
approach is. Here i have a listener function so that when the folder is
opened we can make another trip the server.

private function onItemOpen(event:TreeEvent):void {
var path:String = event.it...@path;
//trip to the server.
}

** on that trip back to the server do I have a different function that re
writes my xml strucutre or am I just inserting the new xml block somewhere?
If I am just inserting how do I replace the block



If anyone has an example of what I am doing please let me know.


RE: [flexcoders] File Explorer

2008-12-17 Thread Tracy Spratt
"...talking about directories, I might as well go build them all out
now..." Try it.  But if the server is large, there may  still be
thousands of directories.  But maybe not.  Did I say "try it"?

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Dan Vega
Sent: Wednesday, December 17, 2008 7:00 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] File Explorer

 

Thank you so much! After screwing around with this for awhile I am
finding that to be the real problem. When you get into unlimited numbers
of sub directories the array collection becomes very hard to manage. I
think to return my list of files an arrayCollection will work just fine
but for the directory structure I am going to produce xml. Also I think
when we we are just talking about directories, I might as well go build
them all out now


__,_,_

Thank You 
Dan Vega 

 



Re: [flexcoders] File Explorer

2008-12-17 Thread Dan Vega
Thank you so much! After screwing around with this for awhile I am finding
that to be the real problem. When you get into unlimited numbers of sub
directories the array collection becomes very hard to manage. I think to
return my list of files an arrayCollection will work just fine but for the
directory structure I am going to produce xml. Also I think when we we are
just talking about directories, I might as well go build them all out now


> __,_,_
>
Thank You
Dan Vega


RE: [flexcoders] File Explorer

2008-12-17 Thread Tracy Spratt
"If I am going to be updating this collection (deleting / adding /
renaming directories) that I should be using an ArrayCollection" Don't
believe everything that you hear.  Demand an explanation "why".

 

I advise staying with XML.  Like the filesystem structure, XML is
inherently hierarchical.  The collections are not, and as Ivo shows, you
will have to do some work to make the hierarchy accessible.  XML will
just be there.

 

Plus, e4x is very powerful for manipulating hierarchies, where the
nested collections are not.

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of ivo
Sent: Wednesday, December 17, 2008 12:47 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] File Explorer

 

I worked on something similar not too long ago and my approach for #1
was to load top-level folders only and only drill inward with a server
call as the user clicks on the expand arrow on individual folders. It
made it appear more responsive for huge structures.

For #2 you can have each of your nodes be an object with a 'children'
member that is an ArrayCollection of node objects. When
inserting/removing you operate on the children ArrayCollection directly
and the Tree will reflect the change on the next screen update.

var _children:ArrayCollection = new ArrayCollection();//add your child
nodes to this

var _parent:Object = {label: 'parent', children: _children} //this would
be the parent object

var _dp:ArrayCollection = new ArrayCollection([_parent]); //data
provider for tree

- Ivo

 



From: Dan Vega 
To: flexcoders@yahoogroups.com
Sent: Wednesday, December 17, 2008 6:01:36 AM
Subject: [flexcoders] File Explorer

I am building a full featured file explorer and I am stuck on one part
of the application. On the left hand side I will have a base root
directory (root) and a listing of all directories that fall under it (no
end). When you click on a folder they will show up in the datagrid to
the right. My question is actually 2 parts.

1.) What approach should I take. Do I make one call to my server and
build the entire folder structure, then return either and
arraycollection or xmllistcollection or should I just grab the list of
directories and show an arrow next to directories with sub directories
indicating that there are sub directories. When you click on that folder
make another call to the server to grab that sub directory list and so
on.

2.) The second part of the question is i heard that If I am going to be
updating this collection (deleting / adding / renaming directories) that
I should be using an ArrayCollection. The question is when I have data
like there is below, how do I break it down into parent/child nodes?
Every example I have seen of the tree always uses xml as the data and in
those examples its clear how to break down child / parent relationships.


** Any help on this how to move forward with this would be great help **

  [0] (Object)#3
Attributes = ""
DateLastModified = Sat Nov 1 13:21:02 GMT-0400 2008
Directory = "H:\JRun4"
hasDirs = 0
Mode = ""
Name = "bin"
Path = "H:\JRun4\bin"
Size = 0
Type = "Dir"
  [1] (Object)#4
Attributes = ""
DateLastModified = Fri Aug 3 21:55:23 GMT-0400 2007
Directory = "H:\JRun4"
hasDirs = 1
Mode = ""
Name = "docs"
Path = "H:\JRun4\docs"
Size = 0
Type = "Dir"


Thank You
Dan Vega
danv...@gmail. com <mailto:danv...@gmail.com> 
http://www.danvega. org <http://www.danvega.org> 

 



Re: [flexcoders] File Explorer

2008-12-17 Thread ivo
I worked on something similar not too long ago and my approach for #1 was to 
load top-level folders only and only drill inward with a server call as the 
user clicks on the expand arrow on individual folders. It made it appear more 
responsive for huge structures.

For #2 you can have each of your nodes be an object with a 'children' member 
that is an ArrayCollection of node objects. When inserting/removing you operate 
on the children ArrayCollection directly and the Tree will reflect the change 
on the next screen update.

var _children:ArrayCollection = new ArrayCollection();//add your child nodes to 
this

var _parent:Object = {label: 'parent', children: _children} //this would be the 
parent object

var _dp:ArrayCollection = new ArrayCollection([_parent]); //data provider for 
tree

- Ivo





From: Dan Vega 
To: flexcoders@yahoogroups.com
Sent: Wednesday, December 17, 2008 6:01:36 AM
Subject: [flexcoders] File Explorer


I am building a full featured file explorer and I am stuck on one part of the 
application. On the left hand side I will have a base root directory (root) and 
a listing of all directories that fall under it (no end). When you click on a 
folder they will show up in the datagrid to the right. My question is actually 
2 parts.

1.) What approach should I take. Do I make one call to my server and build the 
entire folder structure, then return either and arraycollection or 
xmllistcollection or should I just grab the list of directories and show an 
arrow next to directories with sub directories indicating that there are sub 
directories. When you click on that folder make another call to the server to 
grab that sub directory list and so on.

2.) The second part of the question is i heard that If I am going to be 
updating this collection (deleting / adding / renaming directories) that I 
should be using an ArrayCollection. The question is when I have data like there 
is below, how do I break it down into parent/child nodes?  Every example I have 
seen of the tree always uses xml as the data and in those examples its clear 
how to break down child / parent relationships. 

** Any help on this how to move forward with this would be great help **

  [0] (Object)#3
Attributes = ""
DateLastModified = Sat Nov 1 13:21:02 GMT-0400 2008
Directory = "H:\JRun4"
hasDirs = 0
Mode = ""
Name = "bin"
Path = "H:\JRun4\bin"
Size = 0
Type = "Dir"
  [1] (Object)#4
Attributes = ""
DateLastModified = Fri Aug 3 21:55:23 GMT-0400 2007
Directory = "H:\JRun4"
hasDirs = 1
Mode = ""
Name = "docs"
Path = "H:\JRun4\docs"
Size = 0
Type = "Dir"


Thank You
Dan Vega
danv...@gmail. com
http://www.danvega. org


[flexcoders] File Explorer

2008-12-17 Thread Dan Vega
I am building a full featured file explorer and I am stuck on one part of
the application. On the left hand side I will have a base root directory
(root) and a listing of all directories that fall under it (no end). When
you click on a folder they will show up in the datagrid to the right. My
question is actually 2 parts.

1.) What approach should I take. Do I make one call to my server and build
the entire folder structure, then return either and arraycollection or
xmllistcollection or should I just grab the list of directories and show an
arrow next to directories with sub directories indicating that there are sub
directories. When you click on that folder make another call to the server
to grab that sub directory list and so on.

2.) The second part of the question is i heard that If I am going to be
updating this collection (deleting / adding / renaming directories) that I
should be using an ArrayCollection. The question is when I have data like
there is below, how do I break it down into parent/child nodes?  Every
example I have seen of the tree always uses xml as the data and in those
examples its clear how to break down child / parent relationships.

** Any help on this how to move forward with this would be great help **

  [0] (Object)#3
Attributes = ""
DateLastModified = Sat Nov 1 13:21:02 GMT-0400 2008
Directory = "H:\JRun4"
hasDirs = 0
Mode = ""
Name = "bin"
Path = "H:\JRun4\bin"
Size = 0
Type = "Dir"
  [1] (Object)#4
Attributes = ""
DateLastModified = Fri Aug 3 21:55:23 GMT-0400 2007
Directory = "H:\JRun4"
hasDirs = 1
Mode = ""
Name = "docs"
Path = "H:\JRun4\docs"
Size = 0
Type = "Dir"


Thank You
Dan Vega
danv...@gmail.com
http://www.danvega.org