From renggli@iam.unibe.ch Mon Aug 11 08:46:47 2008 From: Lukas Renggli To: smallwiki@list.inf.unibe.ch Subject: Re: Sample code using MACssRenderer, MADivsRenderer or Magritte-ComponentDecoration? Date: Mon, 11 Aug 2008 08:46:37 +0200 Message-ID: In-Reply-To: <64EABF9E-6B20-46C1-96F4-C67E26AC0FCB@ca-flower.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7697679325468059144==" --===============7697679325468059144== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > 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: ...
[Group]
[Label] [Component]
This is what traditional web applications mostly had. It looks ok even without applying any style-sheets. * MACssRenderer creates something along:
[Group]
[Label]
[Component]
...
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 , and
,
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 --===============7697679325468059144==--