Talking Meta

Meta talk about Smalltalk, Seaside, Magritte, Pier and related things.

Test Coverage of Pier and Magritte

I submitted a simple extension of the SUnit Test Runner to the Pharo Inbox. It accurately determines the test coverage of a selected package. For the latest versions of Magritte and Pier I get the following results:

Package Number of Tests Test Coverage
Magritte-Model 1,637 71%
Pier-Model 1,409 81%
Posted by Lukas Renggli at 30 March 2009, 8:57 pm with tags magritte, pier, testing 1 comment link

Video of Magritte Presentation

There were complaints that the slides of my Magritte presentation are puzzling. That’s true, but the idea is to get people listen to the talk instead of reading the slides. Luckily you can do that now even if you were not at ESUG 2008 in Amsterdam. Have a look at the video James Robertson posted on his blog.

Posted by Lukas Renggli at 3 December 2008, 9:13 am with tags magritte, presentation, video, esug comment link

110th birthday of René Magritte

Several people have pointed out that Google is displaying a montage of the work of René Magritte in honor of his 110th birthday:

Google-magritte.jpeg

Above the screenshot of the search engine as seen in Belgium, the home country of the famous surrealist artist. The paintings of René Magritte have always fascinated me and provided the necessary inspiration to the Magritte meta-modelling framework.

Posted by Lukas Renggli at 21 November 2008, 8:43 pm with tags magritte, google 1 comment link

Magritte Presentation ESUG 2008

On Tuesday I gave a 15 minutes presentation on Magritte to give a quick overview and prepare people for the following panel discussion. The slides are available to download here. James Robertson blogged about my presentation as well as the following panel discussion.

Posted by Lukas Renggli at 29 August 2008, 10:43 am with tags esug, magritte 2 comments link

Magritte Rendering in Seaside

Magritte for Seaside allows one to automatically build Seaside components from descriptive objects. There are several possibilities to customize this 3 step process:

  1. a renderer defines the markup surrounding the form elements,
  2. a view component defines the visual appearance of every form element, and
  3. decorations surround the generated form to add additional functionality.

The Renderer

MATableRenderer (default) and MACssRenderer are complementary. These classes define how the different Magritte components are laid out in the generated XHTML. You can choose a different renderer by overriding the container description of your domain object:

descriptionContainer
^ super descriptionContainer
componentRenderer: MACssRenderer;
yourself

To customize the way CSS classes are assigned to the individual items of the form, add the class names to the respective descriptions.

descriptionFirstName
^ MAStringDescription new
accesssor: #firstName;
cssClass: 'firstname';
yourself

If a completely different markup is needed, a custom subclass of MAComponentRenderer should be created. Below a short description of the two renderer that come with Magritte.

The table renderer

MATableRenderer puts the form elements into a table, this is what traditional web applications mostly do. This looks good without applying any style-sheet.

<table>
    <tr class="group">
        <th colspan="2"><i>Group Label</i></th>
    </tr>
    <tr>
        <th><i>Description Label</i></th>
        <td><i>Description Component</i></th>
    </tr>
    ...
</table>

The CSS renderer

The other renderer, MACssRenderer, uses semantically meaningful XHML markup and requires some CSS tweaking to look fine:

<dl>
    <dt class="group"><i>Group Label</i></dt>
    <dt><i>Description Label</i></dt>
    <dd><i>Description Component</i></dd>
    ...
</dl>

The components

The components (subclasses of MADescriptionComponent) provide the view of the description. Every description has a default component, and some have addition views. In the example below, the boolean value can either be displayed using a checkbox (default), a drop-down box, or a group of radio buttons.

descriptionVegetarian
^ MABooleanDescription new
accessor: #vegetarian;
componentClass: MACheckboxComponent;
"or MASelectListComponent or MARadioGroupComponent" ;
yourself

The list of views that are known to work with a particular description can be found in the class-side method called defaultComponentClasses of the respective description. For MABooleanDescription this method looks like:

defaultComponentClasses
^ Array
with: MACheckboxComponent
with: MASelectListComponent
with: MARadioGroupComponent

To build your own view, simply customize one of the existing views or implement your own Seaside component as a subclass of MADescriptionComponent.

The decorations

The decorations (subclasses of MAComponentDecoration) enable one to customize the form around the components build by Magritte. This is not done automatically from the renderer, because one might want to manually compose multiple components to one big screen. The following decorations are available:

Decoration Class Add Selector Description
MAFormDecoration addForm and addForm: Surrounds the component with a &lt;form&gt; tag and adds save and cancel buttons. Other button actions and labels can be specified with the decoration.
MASwitchDecoration addSwitch Turns the component read-only, but adds an edit button that allows one to switch between view and edit-mode.
MAValidationDecoration addValidation Normally invisible, but in case of validation errors show a list of problems.

Since addForm and addValidation are commonly used together, there are the conveniance methods addValidatedForm and addValidatedForm:. To decorate your Magritte components differently, simply create your own decoration class or refine an existing one.

Posted by Lukas Renggli at 12 August 2008, 9:44 am with tags magritte, seaside, tutorial 2 comments link
<< 1 2 >>