[Seaside] Generalizing WATree Update--it works..

Tim Murray tmurray at ecsorl.com
Wed Aug 18 17:47:30 UTC 2010


Hi,

 

First off, apologies to the list for using separate subjects, but if I
respond to my original thread it messes up the list formatting.

 

For the specific instance of CFileDirectoryTreeItems, I was able to
generalize the WATree component to render a display of my File system.

 

Per my previous update, the rendering of children failed because a call
to isExpanded in WATree failed because the search in the IdentitySet
'expanded'

Returned false. Even though and instance of CFileDirectoryTreeItem was
in there. I suspect this has something to do with the Tweak branch of
things.

 

I wanted to stick with this, because the Tree functionality I want is
already in place -getChildren, getLabel, etc.

 

My solution:

 

I subclassed WATree as WACFileDirectoryTree and replaced the IdentitySet
with a Dictionary so that I could use the Label of a node

As a key and store the object as a value for that key-thereby bypassing
the object/class equality voodoo.

 

I over-rode four methods:

 

initialize

            super initialize.

            expanded := Dictionary new.

            self selectBlock: [ :node | self answer: node ].

            self childrenBlock: [ :node | Array new ].

            self labelBlock: [ :node | node greaseString ]

 

expand: aNode

            expanded add: (aNode getLabel)->aNode.

 

expandAll: aCollection

            aCollection do: [:n | self expand: n].

 

isExpanded: aNode

            ^expanded includesKey:  (aNode getLabel)

 

 

 

I now can expand my tree and it renders!

 

Next up is to make sure all other WATree functionality works; however,
now that I have a handle to actual objects, It should be doable.

 

 

 

Hope it helps somebody.

 

t.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100818/8245f4aa/attachment.htm


More information about the seaside mailing list