At 23:46 21/01/2010, Nick Ager wrote:
* Register a new Pier app as:
PRPierFrame registerAsApplication: 'piersearch' kernel: (PRKernel
new root: ((PRComponent named: 'search') componentClass:
PRSearchView); name: 'testKernel').
Nick,
PRSearchView is a subclass of PRViewComponent, which expects to be
instantiated with #on:, instead of #new. The argument to #on: is
supposed to be aContext, which is then cached for later use by
methods like #refresh. There is an example of such call in
PRViewCommand >> viewComponent.
The issue is related to the fact that in your case, PRSearchView is
instantiated by #new. Here is the call sequence:
PRPierFrame >> children
PRPierFrame >> buildChildren
PRPierFrame >> componentsOf:
(PRComponent) PRStructure >> componentsIn:
PRContext >> componentFor:
PRContext >> buildComponent:for:
PRComponent >> componentFor:
PRSearchView class (WAComponent)>> owner:link:
#owner:link: calls #new, instead of #on:
Now, there are PRWidgets that don't cash the context, and can be
instantiated by #new. Consequently, the above call sequence works
just fine in their case. And, Pier standard distributions use
PRAjaxSearchWidget instead of PRSearchView,, which is a kind of
PRWidget. So, the following app should work:
PRPierFrame registerAsApplication: 'piersearch' kernel: (PRKernel new
root: ((PRComponent named: 'search') componentClass:
PRAjaxSearchWidget); name: 'testKernel').
Hoping this helps,
Regards,
Reza