Hi

I'm looking to develop a Tree component that will allow users to set where a 
document starts and begins based on pages.  

Some background on the data.  A folder (root) contains at least one document 
(child).  A document is comprised of pages (the pages are the children of the 
document).  When a user doubleClicks on a page, that page should become the 
start of the next document.  If a document does not have any pages (children) 
it is a one page document (i.e. so every document has at least one page and the 
document also represents the first page of itself).

I'm still trying to work out whether to use XML or ArrayCollection. I've played 
with both a little and am unable to work out which is best. Please let me know 
if you think one is more appropriate than another and why.

This is the structure in XML:

<node type='folder' data='' label='Folder: ABC'>
        <node type='document' data='123' label='ABC01'/>
        <node type='document' data='124' label='ABC02'>
                <node type='page' data='125' label='ABC03'/>
                <node type='page' data='126' label='ABC04'/>
                <node type='page' data='127' label='ABC05'/>
        </node>
        <node type='document' data='128' label='ABC06'/>
        <node type='document' data='129' label='ABC07'/>
</node>

So ABC0010001 is a one page document and ABC02 is a four page document.

If someone doubeClicked on ABC04 I would want to set ABC04 to be a document and 
make ABC05 a page of ABC04.  How would I do this programmatically?  I figure I 
need to:
- add a new document node to the root between ABC02 and ABC06
- set its values to be that of the ABC04 page
- move ABC05 page to be a page of the new document (move = create new then 
delete existing?)

So the data should end up looking like:

<node type='folder' data='' label='Folder: ABC'>
        <node type='document' data='123' label='ABC01'/>
        <node type='document' data='124' label='ABC02'>
                <node type='page' data='125' label='ABC03'/>
        </node>
        <node type='document' data='126' label='ABC04'>
                <node type='page' data='127' label='ABC05'/>
        </node>
        <node type='document' data='128' label='ABC06'/>
        <node type='document' data='129' label='ABC07'/>
</node>

Can anyone tell me how I could do this?  I'm a bit overwhelmed by all the 
classes that make up Tree, data descriptors, collections and item renderers at 
the moment and haven't been able to link all the pieces together to work out 
how to do this (I'm a bit of a noob). 

Thanks in advance.

Nathan

Reply via email to