Seaside WATree

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

Seaside WATree

Gaston Charkiewicz
Hello everyone!
My name is Gastón Charkiewicz, I'm from Argentina, and I study IT Programming in de Quilmes National University (UNQ). I'm developing a certain domain in Seaside, and I want to model a folder hierarchy using a WATree (I'm just starting to use it).
I have a "Folder" class, who haves a instance variable, "folders", a SortedCollection (sortBlock given) with more Folder s. So, I prepared a component called WAFolderTree, extending from WATree. It haves an instance variable, "folders", with the folder hierarchy it's going to show. I have this initialize mehod:

initialize
super initialize.
folders := Folder new.
folders folderName: 'root'.
folders subFolders add: (Folder new folderName: 'var').
folders subFolders add: (Folder new folderName: 'usr').

    self
    root: folders;
    labelBlock: [:f | f folderName];
    childrenBlock: [:f | f subFolders];
    yourself.

(I'm just testing the class' vehaviour, I'm going to make it a Singleton class after testings, and make it beautier also :) ).

The problem: when I render the containing window, I also render the tree using
html render: WAFolderTree new.
...but I just get in screen "WAFolderTree". No +, even no selecting points. Could you help me?

Thank you all!
Best regards,

--
Gastón N. Charkiewicz
"El éxito parece estar relacionado con la acción. Las personas de éxito son activas. Cometen errores pero no se rinden." Conrad Hilton

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

Re: Seaside WATree

Philippe Marschall
2011/6/5 Gaston Charkiewicz <[hidden email]>:

> Hello everyone!
> My name is Gastón Charkiewicz, I'm from Argentina, and I study IT
> Programming in de Quilmes National University (UNQ). I'm developing a
> certain domain in Seaside, and I want to model a folder hierarchy using a
> WATree (I'm just starting to use it).
> I have a "Folder" class, who haves a instance variable, "folders", a
> SortedCollection (sortBlock given) with more Folder s. So, I prepared a
> component called WAFolderTree, extending from WATree. It haves an instance
> variable, "folders", with the folder hierarchy it's going to show. I have
> this initialize mehod:

You shouldn't subclass WATree for this. Just create an instance and
configure it in your component.

> initialize
> super initialize.
> folders := Folder new.
> folders folderName: 'root'.
> folders subFolders add: (Folder new folderName: 'var').
> folders subFolders add: (Folder new folderName: 'usr').
>
>     self
>     root: folders;
>     labelBlock: [:f | f folderName];
>     childrenBlock: [:f | f subFolders];
>     yourself.
>
> (I'm just testing the class' vehaviour, I'm going to make it a Singleton
> class after testings, and make it beautier also :) ).
>
> The problem: when I render the containing window, I also render the tree
> using
> html render: WAFolderTree new.
> ...but I just get in screen "WAFolderTree". No +, even no selecting points.
> Could you help me?

That creates a new WAFolderTree every time the page is rendered. You
want to store it in an instance variable. Assign it in #initialize and
answer it in #children. Also check out the embedding section [1] in
the book.

 [1] http://book.seaside.st/book/components/embedding

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