#ideModel - the correct solution?

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

#ideModel - the correct solution?

Schwab,Wilhelm K
Andy,

Please note that the code below is not heavily tested, and might cause
problems that I have not yet recognized.

This revisits my idea of having a default model that is used only for
the IDE's Show command.  I care about it because I have a few very
complex models, and lots of presenters that need them in order to work.

It's great to have a complex network of objects created (including parts
deserialized from byte arrays) on the fly for testing, but end users
should not suffer that overhead for each of several subpresenters, only
to have them all pointed at an extant model.

I came up with a partial solution before, but it required that I
override #show: and it didn't work with dialogs.  I **think** the
methods below fix it.  The default #ideModel delegates to #defaultModel,
but can be changed to create something more expensive, and w/o affecting
other paths for creating shells.

The one caveat I see is that #show won't necessarily work if
#defaultModel answers nil but #ideModel does not, but in that case, I
don't think one would care to send #show - a model would be required, as
that is the entire point of doing this.

What do you think?

Have a good one,

Bill




!ClassSelector methodsFor!

showPresenter: viewName
        "Show the selected presenter class in an existing view resource, of the
<readableString> name,
        viewName, belonging to the selected class."

        #wksDangerous.
        "self selection show: viewName"
        self selection show:viewName on:self selection ideModel.
        ! !
!ClassSelector categoriesFor: #showPresenter:!commands!public! !


!Presenter class methodsFor!

ideModel
        "Answer a default model to be assigned to the receiver when it
        is initialized by the IDE Show... command; defaults to #defaultModel,
        which in turn defaults to nil."

        #wksSafe.
        ^self defaultModel! !
!Presenter class categoriesFor: #defaultModel!models!public! !


--
Wilhelm K. Schwab, Ph.D.
[hidden email]