Hi Evan,

You are indeed on the edge of what Roassal can do. This is a situation that I 
have tried to fix. Please play with the solution I propose and complain if this 
is not what you expect.

Try this:
-=-=-=-=-=-=-=-=-=-=-=-=
v := RTView new.

es := RTShape withAllSubclasses collect: [ :cls |
        b := RTPieBuilder new.
        b interaction popupText.
        b objects: cls withAllSuperclasses.
        b slice: #numberOfMethods.
        b normalizer distinctColor.
        b build; asElement.
].

v addAll: es.
RTCellLayout new lineItemsCount: 8; on: es.
v
-=-=-=-=-=-=-=-=-=-=-=-=
It produces the following 


Now, you can send the message #asElement to a builder or a view. This message 
returns a "compound element” (something new I have recently introduced) which 
can freely be added to a view.

Is this what you expect? 
It is likely that this mechanism will be a foundation of Roassal3 as nesting is 
a recurrent need. 

Cheers,
Alexandre


> On Mar 17, 2016, at 9:59 PM, Evan Donahue <emdon...@gmail.com> wrote:
> 
> Hello,
> 
> I am working with Roassal and trying to write a cell-layout builder that uses 
> RTPieBuilders internally as its nested objects. The nesting docs cover 
> nesting RT elements, but not builders. The composition docs cover composing 
> builders, but not nesting them. I have a partial solution, but it is getting 
> increasingly hacky, to the point where it may be easier to just duplicate the 
> piebuilder code in my builder. Before I go down that road, I wanted to check 
> if there was a more natural way to nest builders. 
> 
> Below is a mashup of the Roassal Examples Nesting and Pie Chart builders that 
> gives the basic flavor of what I am trying to accomplish. Notice that I am 
> creating new PieBuilders every time, running them, and extracting their 
> createdElements for my layout. This works well enough, but if I then want to 
> normalize global properties so that all pie slices with the same property get 
> the same color, I have no way to coordinate the newly generated PieBuilders, 
> as each possesses its own normalizer. Likewise, if I have a global 
> PieBuilder, its internal state gets trampled with each iteration. I figured 
> there was likely an easy way to compose builders that I didn't know about, so 
> I thought I would ask.
> 
> | v es b |
> v := RTView new.
> es := RTEllipse elementsOn: RTShape withAllSubclasses.
> v addAll: es.
> 
> RTNest new
>     for: es
>     add: [ :group :model |
>         b := RTPieBuilder new.
>         b objects: RTShape withAllSubclasses.
>         b slice: #numberOfMethods.
>         b normalizer distinctColor.    
>         b view: v.
>         b build.
>         group addAll: b createdElements. ].
>     
> RTCellLayout new lineItemsCount: 8; on: es.
> v
> 
> 
> Thanks,
> Evan

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



Reply via email to