Andy,
I've been giving a face lift to one of my old apps that displays a large
number of composite presenters, all of the same type and inserted as
reference views. They differ only by a couple of strings that identify each
presenter (and its subset of the common model).
Previously, it used a dictionary to map view names to the strings. In the
revision, I chose $_ as a separator, and have the composite presenter parse
its view name to get the two strings. The advantage is that the strings are
now part of the view resource, so no coding is required to make changes -
that's **if** I can load the view resource and attach presenters as needed.
Eventually, I'd like to allow (skilled) end users to pony up for a copy of
Dolphin, load a small package, and create view layouts that the deployed app
can load. Short term, I'll be glad when the revised system works. Toward
that end, I've tried to get a composite presenter to load a view resource,
select reference views of the charmed type, and then attach presenters to
them. The following _seems_ to work:
onViewOpened
| referenceViews |
super onViewOpened.
referenceViews := self view allSubViews select:[ :each |
( each isKindOf:ReferenceView )
and:[
each resourceIdentifier owningClass = GizmoPresenter
].
].
referenceViews do:[ :ref | | aPresenter |
aPresenter := self add:GizmoPresenter new name:ref name.
aPresenter model:self model.
ref presenter:aPresenter.
aPresenter
view:ref;
onViewOpened.
].
What do you think?
Have a good one,
Bill
--
Wilhelm K. Schwab, Ph.D.
[hidden email]