Hi all, I want to visualise three nested levels of a model. I am not sure if I am doing it right, since I had to add a reference to the view to the nested elements manually to make it work. The problem I face now is that elements in the deepest level do not react to interactions. In the example below, popup is only shown for the elements in the first two levels. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= v := RTView new. es := (RTBox new color: Color white; borderColor: Color lightGray) elementsOn: (Array with: RTLayout with: RTShape with: RTBuilder). v addAll: es. es @ RTPopup. RTNest new for: es add: [ :group :model | elements := (RTBox new color: (Color red alpha: 0.1)) elementsOn: model withAllSubclasses. group addAll: elements. elements @ RTPopup. elements do: [ :e | e view: v ]. RTNest new for: elements add: [ :group2 :model2 | els := (RTBox new color: Color blue) elementsOn: model2 methods. group2 addAll: els. els @ RTPopup. RTTreeLayout on: els edges: edges ]. RTGridLayout on: elements ]. RTGridLayout on: es. v -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Any hint would be much appreciated. Best regards, Leonel
|
Hi Leonel,
Currently, a roassal element is not composed. So, this means you need to all the elements to the view, and then define the nesting. From your script, you do not gain much by directly talking to Roassal. You should better use a builder, such as Mondrian. I think your script can be: -=-=-=-=-=-=-=-= packages := { 'Roassal2GT' . 'Trachel' } collect: [ :name | RPackageOrganizer default packageNamed: name ]. b := RTMondrian new. b nodes: packages forEach: [ :pak | b nodes: pak classes forEach: [ :cls | b nodes: cls methods. b layout grid ]. b layout grid ]. b -=-=-=-=-=-=-=-= Here is a version of what you try to do using plain Roassal: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "Packages to visualize" packages := { 'Roassal2GT' . 'Trachel' } collect: [ :name | RPackageOrganizer default packageNamed: name ]. palette := RTPalette c10. v := RTView new. packagesElements := (RTBox new color: palette first) elementsOn: packages. v addAll: packagesElements. packagesElements @ RTPopup. packagesElements do: [ :pakEl | clsElements := (RTBox new color: palette second) elementsOn: pakEl model classes. v addAll: clsElements. clsElements do: [ :clsEl | mtdElements := (RTBox new color: palette third) elementsOn: clsEl model methods. v addAll: mtdElements. mtdElements @ RTPopup. RTGridLayout on: mtdElements. RTNest new on: clsEl nest: mtdElements. ]. RTGridLayout on: clsElements. RTNest new on: pakEl nest: clsElements. clsElements @ RTPopup. ]. RTGridLayout on: packagesElements. v -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= With the colors: Cheers, Alexandre On Dec 8, 2015, at 1:35 PM, Leonel Merino <[hidden email]> wrote: -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. |
Nice, that worked perfect. Thanks Alex ! Sure, the example fits better for Mondrian, however my code is more complex. Best regards, Leonel On Tue, Dec 8, 2015 at 10:20 PM, Alexandre Bergel <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |