An Outline Code Editor First Steps
Bob Arning
arning at charm.net
Thu Aug 19 20:18:44 UTC 1999
On Thu, 19 Aug 1999 10:19:57 -0700 Laurence Rozier <lrozier at thepattern.com> wrote:
>My first, quick and dirty approach was to
>subclass ListItemWrapper, overriding the contents method in the same way
>ObjectExplorerWrapper does. Not surprisingly that's not a very flexible approach.
>It expects that all nodes displayed will be homogeneous.
Well, not exactly. ObjectExplorer is a very simple example and does not illustrate some of the possibilities. What I had in mind when I wrote the ListItemWrapper was two-fold:
1. To keep view-specific code out of the model classes where possible for esthetic and practical reasons.
2. To allow for multiple types of views for the same model object. The difficuly with #getChildNodes is that it limits a given class to only one representation. Creating subclasses (as many as you want) of ListItemWrapper will allow you retain the current view as a "standard" explore and yet have other views that look at items differently.
For more examples, including different representations of the same object, see
http://www.charm.net/~arning/BobsBrowser.14Apr1206pm.cs.txt
Note: while this can be filed into 2.5 and work reasonably well, it was written for a slightly older squeak and I would advise saving the image with this loaded. But you can run it and see some different implementations of ListItemWrapper subclasses.
[snip]
>1. Get rid of the curly braces!
They are generated in ParseNode>>printOn:. You could write a similar method that did not include them.
[snip]
>Comments, suggestions?
One thing you will want to do is to insure that #hasContents answers truthfully about the state of #contents. Otherwise, you will walkbacks and inconsistent behavior.
Cheers,
Bob
More information about the Squeak-dev
mailing list
|