WATree

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

WATree

William Harford
I am having a little trouble with WATree. I feel like I am doing  
something obviously wrong but I can not figure it out.

I am trying to get WATree to give me a directory listing with the  
ability to download the files. I have been able to get it to work on  
the first level of the tree but none of the subdirectories will  
expand.  I click the "+" and the page reloades but the "+" stays a  
"+" and the tree does not expand.

I am using WATree like so ....


tree _ WATree new.
tree labelBlock: [ :dir | dir localName ].
tree root: (FileDirectory on: (self extraFilesPath));
        childrenBlock: [ :dir | |d |
                       
                        ( dir isKindOf:FileStream ) ifTrue:[
                                #()
                        ]ifFalse:[
                        ((FileDirectory on:(dir fullName)) entries) collect:[:de |
                                ( de at: 4 ) ifTrue:[
                                        d _ dir directoryNamed:  ( de at: 1 ).
                                ] ifFalse:[
                                        d _ dir fileNamed:  ( de at: 1 ).
                                       
                                ].
                                d.
                ]]
                ];
                selectBlock: [:file |
                        self session download: (file file contents)
                        mimeType: ('application/octet-stream')
                        filename: (file name). ];
                canSelectBlock: [ :file | file isKindOf:FileStream].


Why do subdirectories not expand ?

Thanks
Will
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WATree

Lukas Renggli
> I am trying to get WATree to give me a directory listing with the
> ability to download the files. I have been able to get it to work on
> the first level of the tree but none of the subdirectories will
> expand.  I click the "+" and the page reloades but the "+" stays a
> "+" and the tree does not expand.

Reason that the expanded nodes are not remembered could be:

- the WATree is instantiated on every rendering pass in
#renderContentOn:, this should be only done one in #initalize.

- the nodes do not properly implement #=, in my image file-directory
uses #== for comparison which does not work with WATree.

Hope this helps,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WATree

William Harford

On Jun 13, 2006, at 10:22 AM, Lukas Renggli wrote:
>
> - the nodes do not properly implement #=, in my image file-directory
> uses #== for comparison which does not work with WATree.
>

Thats it.

I am not sure what the behavior of FileDirectory should be when it  
comes to comparisons but implementing #= for FileDirectory and  
comparing pathNames works.

...


= anObject
        (anObject isKindOf: FileDirectory) ifTrue:[
                ^(anObject pathName = self pathName)
        ]ifFalse:[
                ^false.
        ].


Is this the "right" thing to do. I can't foresee any problems that  
might be caused by doing this; are there any or would the Squeak list  
be a better place to ask this.

Thanks
Will

> Hope this helps,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside