I'm trying to wrap my brain around the above
classes and what they
offer over the default rendering that Magritte offers
(MATableRenderer)... To that end, I've seen a few little snippets
using a little of the above but still can't seem to figure out the
typical usage scenario.. I've got existing css that I would like to
use to dress up various pieces of one or more objects -- similar to
what Keith has submitted in photo form here on this mailing list
earlier this year (enclosing various fields in boxes,etc).. Anyway, if
someone can post a little code that can do something akin to that,
that would get me past my current hurdle.. MANY thanks in advance!
MATableRenderer (default) and MACssRenderer are complementary. These
classes define how the different input fields are laid out in the
XHTML. You can choose a different renderer by overriding the container
description:
descriptionContainer
^ super descriptionContainer componentRenderer: MACssRenderer
* MATableRenderer creates something along:
<table>
<tr class="group">
<th colspan="2">[Group]</th>
</tr>
<tr>
<th>[Label]</th>
<td>[Component]</th>
</tr>
...
</table>
This is what traditional web applications mostly had. It looks ok even
without applying any style-sheets.
* MACssRenderer creates something along:
<dl>
<dt class="group">[Group]</dt>
<dt>[Label]</dt>
<dd>[Component]</dd>
...
</dl>
This is is a more modern approach (semantically meaningful) and
requires some CSS tweaking.
In both cases you don't have many possibilities to tweak the XHTML
generation. You might set a CSS class to the descriptions though, that
gets added to <th>, <td> and <dt>, <dd> respectively:
descriptionFirstName
^ MAStringDescription new
accesssor: #firstName;
cssClass: 'firstname';
yourself
In your case you probably need to provide your own implementation of a
renderer.
* The components (subclasses of MADescriptionComponent) provide the
view of the description. Every description has a default component,
but some have addition views. You can choose the different view like
this:
descriptionVegetarian
^ MABooleanDescription new
accessor: #vegetarian;
componentClass: MACheckboxComponent;
"or MASelectListComponent or MARadioGroupComponent" ;
yourself
* The decorations (subclasses of MAComponentDecoration) are solely
used to attach the form around the components, to display the error
messages and to add form buttons.
Hope this helps? I might turn this answer into a blog post someday ;-)
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch