It seems to be basics of Pier, but I still don't understand them. If I have my own PRCase child with custom viewComponentClass, can I embed (using ++) it in another page, rendered the same way as at it's original position?
For instance, I have a Questionnaire and QuestionnaireView, which renders (it's children) Polls using Vote command. How can I show this at the main page of my site? Or how to do this some other (proper) way? -- Dennis Schetinin _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Hi Dennis,
On Tue, Jul 7, 2009 at 7:25 PM, Dennis Schetinin<[hidden email]> wrote: > It seems to be basics of Pier, but I still don't understand them. If I have > my own PRCase child with custom viewComponentClass, can I embed (using ++) > it in another page, rendered the same way as at it's original position? > > For instance, I have a Questionnaire and QuestionnaireView, which renders > (it's children) Polls using Vote command. How can I show this at the main > page of my site? Or how to do this some other (proper) way? I'm not sure but I would try: 1) Implement a method #accept: in Questionnaire Questionnaire>>accept: aVisitor aVisitor visitQuestionnaire: self 2) Implement PRVisitor>>visitQuestionnaire: PRVisitor>>visitQuestionnaire: aQuestionnaire self visitCase: aQuestionnaire 3) Implement PREmbeddedRender>>visitQuestionnaire: PREmbeddedRender>>visitQuestionnaire: aQuestionnaire "do whatever you want with the 'html' instance variable and 'aQuestionnaire' questionnaire" ... -- Damien Cassou http://damiencassou.seasidehosting.st "Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Nice instructions, thank you. I'll try it this way -- Dennis Schetinin _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
In reply to this post by Damien Cassou-3
Wouldn't it be a hack to implement it this way? PREmbeddedRenderer >> visitQuestionnaire: aStructure (aStructure viewComponentClass on: self context) structure: aStructure; renderContentOn: html Specifically I'm not sure about #structure: setter for QuestionnaireView... I had to do the following there: QuestionnaireView >> renderContentOn: html self components do: [:each | html render: each] components | pollStructure pollCommand pollComponent | ^ self polls collect: [:each | pollStructure := self context structure: each command: POVoteCommand new. pollCommand := pollStructure command. pollComponent := pollCommand description asComponentOn: pollCommand. "..." pollComponent] polls ^ self structure childrenDecoration children structure ^ structure ifNil: [self context structure] It works so far but I doubt it's a correct away... Though I can't explain/understand why... -- Dennis Schetinin _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Wouldn't it be a hack to implement it this way? One (not the only?) problem is "WAComponentsNotFoundError" while posting the form. It's because #children method of QuestionnaireView is not invoked at all... Any suggestions? Shouldn't I create a special PRWidget for this case? Or go some other way? -- Dennis Schetinin _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |