Reflecting on a view resource

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

Reflecting on a view resource

Bill Schwab
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]


Reply | Threaded
Open this post in threaded view
|

Re: Reflecting on a view resource

Andy Bower
Bill,

[snip]

> What do you think?

Well it seems like it should work. However, since there's an #isKindOf: the
code I couldn't possibly reveal my true feelings in a public forum :-)

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: Reflecting on a view resource

Bill Schwab-2
Andy,

> > What do you think?
>
> Well it seems like it should work.

Thanks for reviewing it.  Experience also seems to suggest that it's ok for
what little that's worth.


> However, since there's an #isKindOf: the
> code I couldn't possibly reveal my true feelings in a public forum :-)

Perhaps Timo can suggest an alternative ;)

Have a good one,

Bill

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