Rendering descendant of PRCase

Lukas Renggli renggli at gmail.com
Fri Feb 13 22:02:11 MET 2009


On Fri, Feb 13, 2009 at 4:52 PM, Dennis Schetinin <chaetal at gmail.com> wrote:
>
> Is there any "correct'" way to render classes inhereted from PRCase? Here
> are the details:
>
> I want to represent an object, say Clinic with fullDescription, address,
> etc. attributes. Currently I do such things the way I saw in Pier-Blog. I.e.
> I overloaded Person>>viewComponentClass to return PersonView. And there I do
> something like:
>
> renderContentOn: html
>     super renderContentOn: html.
>     self renderFullDescriptionOn: html.
>     self renderAddressOn: html.
>     self renderDoctorsOn: html
>
> It works ofcourse, but I feel there should be another way to explain Pier
> (or Magritte?) how to render Clinics as far as I described them.

That's basically the right way.

In the custom render method you can use Magritte to generate a
read-only view of the fields, try something along:

html table: [
	aStructure description do: [ :each |
		(each isEditable and: [ each componentClass notNil ]) ifTrue: [
			html tableRow: [
				html tableHeading: each label.
				html tableData: [
					(each componentClass memento: aStructure description: each)
						renderViewerOn: html ] ] ] ] ]

Unfortunately you have to add that yourself, because PRCase overrides
this default view of structures by just displaying the document.

> And one more thing: I saw people mentioned "Tutorial" but I don't know where
> to get it. Perhaps it's where all answers are already given? :)

See here <http://www.lukas-renggli.ch/smalltalk/magritte> and keep
asking questions.

Lukas

>
> --
> Dennis Schetinin
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the smallwiki mailing list