18.5.6 Mondrian presentation
The MondrianPresentation offers the means to integrate a Mondrian view inside a browser.
The presentation can simply be customized through a painting:
block that takes a view
variable as a first parameter and the entity variables as the following parameters. Let’s see an example of building a simple browser with two panes showing a System Complexity to the left and for each selected class displaying a Class Blueprint to the right:
| browser |
browser := GLMTabulator new.
browser title: 'Complexity Previewer'.
browser column: #complexity span: 3; column: #blueprint.
browser transmit to: #complexity; andShow: [:a |
a mondrian
painting: [ :view :model |
(model allModelClasses reject: #isInterface) viewSystemComplexityOn: view ]].
browser transmit from: #complexity; to: #blueprint; andShow: [:a |
a mondrian
painting: [ :view :class |
class viewBlueprintOn: view ];
whenKindOf: FAMIXClass ].
In the above code, we made use of the already provided Mondrian scripts found in FAMIXClassGroup>>viewSystemComplexityOn:
and FAMIXClass>>viewBlueprintOn:
. Both of these accept an instance of a ViewRenderer
as a parameter, so we can simply pass them the view
variable received in the block (see Section 15.3.7 for more details about Mondrian scripts).
The MondrianPresentation populates the #selection
port with the object behind the selected element. Furthemore, populating the #selection
port from outside leads to selecting the element with the corresponding object behind.