Dolphin (All Versions) Mutate View Issue (and maybe a fix)

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

Dolphin (All Versions) Mutate View Issue (and maybe a fix)

Christopher J. Demers
I have a problem with the way the View Composer Mutate feature works in
Dolphin 4.0 (and previous versions).  When you mutate a view it looses the
names of all sub-views.  It took me a little while to realize what was
happening.  I had created a new view MVP group as if it were a Window, then
I realized that I wanted to use it as a sub-view in another window instead.
So I attempted to mutate it to the right kind of view, and move the
presenter.  However my code did not work because all the sub-view names were
lost as a result of the mutate.

Since mutate did not do what I wanted I decided to make it do what I wanted
(try that in Java;)).  I found that I could save the sub-view names before
they were reparented, and then reset the names after.  This worked well and
let me do what I wanted to do with my views.

Is there any reason why Mutate should loose sub-view names by default, or is
this a bug?  I am enclosing the method I changed bellow.  Is there a
downside to what I have done, that I may have missed?

====Dolphin 4.0 Code======
=====Begin Method========
ViewComposer<<mutateTo: aViewClass
 "Mutate the primary selection to an instance of aViewClass.
 CJD 12-2-2000 Modified to retain the name of the subviews after a mutate."

 | x y tmpName |
     x := self primarySelection.
     y := x parentView addSubView: aViewClass new.
     self copyAspectsFrom: x to: y.
     x subViews reverse copy do: [ :each |
          tmpName := each name.
          each parentView: y; recreate.
          each name: tmpName ].
     self pastedView: y context: y parentView.
     self removeView: x.
=====End Method========

I have not spent a great deal of time in Dolphin 4 yet, but so far I like
what I see.  Great job OA!

Chris