PRSearchView

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

PRSearchView

Nick
Hi,

PRSearchView raises an exception once the form is submitted. The problem is that in the #refresh method the call to "self context" returns nil, so the following fails:
searcher := self context root fullTextSearch.

Investigating the problem I noticed that it's immediate super class PRViewComponent implements  #setContext: and context and the more distant superclass WAPresenter implements #context: context.

I fixed the problem locally by adding "self setContext: PRCurrentContext value.", before the call to "self context" and I see search results, but it feels more like a hack than a fix. Some thoughts:

* Does PRViewComponent store context for performance, if I removed these methods (setContext: & #context) the search would function without my change.
* There seems to be a naming inconsistency with #setContext: & #context:

Any thoughts? 

Nick

PS Thanks again for the all the help - I *really* appreciate it. 

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRSearchView

Lukas Renggli
> PRSearchView raises an exception once the form is submitted. The problem is
> that in the #refresh method the call to "self context" returns nil, so the
> following fails:
> searcher := self context root fullTextSearch.
> Investigating the problem I noticed that it's immediate super class
> PRViewComponent implements  #setContext: and context and the more distant
> superclass WAPresenter implements #context: context.
> I fixed the problem locally by adding "self setContext: PRCurrentContext
> value.", before the call to "self context" and I see search results, but it
> feels more like a hack than a fix. Some thoughts:
> * Does PRViewComponent store context for performance, if I removed these
> methods (setContext: & #context) the search would function without my
> change.
> * There seems to be a naming inconsistency with #setContext: & #context:
> Any thoughts?

Strange. I cannot reproduce that problem in the latest builds of the
Seaside 3.0/Pier image.

Lukas

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

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRSearchView

Nick
Strange. I cannot reproduce that problem in the latest builds of the
Seaside 3.0/Pier image.

Sorry I should have included this the first mail. My steps to reproduce:

* Download latest build from Hudson server, I used 21st Jan build at:  http://hudson.lukas-renggli.ch/job/Seaside%203.0/lastSuccessfulBuild/artifact/pier2/pier2.image +  changes
* Copy PharoV10.sources into download directory, start image and web server
* Register a new Pier app as:
PRPierFrame registerAsApplication: 'piersearch' kernel: (PRKernel new root: ((PRComponent named: 'search') componentClass: PRSearchView); name: 'testKernel').
* browse to localhost:8080/piersearch
* type anything into the search box and press "search"
* MessageNotUnderstood: receiver of "root" is nil

Hope this makes sense

Nick

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRSearchView

Reza Razavi
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


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRSearchView

Lukas Renggli
In reply to this post by Nick
Ok, but the views are not supposed to be instantiated like this.

You can display the views anywhere in Pier by clicking onto the Search
menu item or by typing an URL like this:

   http://localhost:8080/pier?view=Search

The views need to cache the context because they can be instantiated
and used in a different context than the currently active one.

Lukas




2010/1/21 Nick Ager <[hidden email]>:

>> Strange. I cannot reproduce that problem in the latest builds of the
>> Seaside 3.0/Pier image.
>
> Sorry I should have included this the first mail. My steps to reproduce:
> * Download latest build from Hudson server, I used 21st Jan build at:
>  http://hudson.lukas-renggli.ch/job/Seaside%203.0/lastSuccessfulBuild/artifact/pier2/pier2.image
> +  changes
> * Copy PharoV10.sources into download directory, start image and web server
> * Register a new Pier app as:
> PRPierFrame registerAsApplication: 'piersearch' kernel: (PRKernel new root:
> ((PRComponent named: 'search') componentClass: PRSearchView); name:
> 'testKernel').
> * browse to localhost:8080/piersearch
> * type anything into the search box and press "search"
> * MessageNotUnderstood: receiver of "root" is nil
> Hope this makes sense
> Nick
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



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

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRSearchView

Lukas Renggli
Also note that the views should not be displayed in the edit dialog of
the component from the web, unless you script it by hand and thus
avoid the validation of Magritte.

Lukas

2010/1/22 Lukas Renggli <[hidden email]>:

> Ok, but the views are not supposed to be instantiated like this.
>
> You can display the views anywhere in Pier by clicking onto the Search
> menu item or by typing an URL like this:
>
>   http://localhost:8080/pier?view=Search
>
> The views need to cache the context because they can be instantiated
> and used in a different context than the currently active one.
>
> Lukas
>
>
>
>
> 2010/1/21 Nick Ager <[hidden email]>:
>>> Strange. I cannot reproduce that problem in the latest builds of the
>>> Seaside 3.0/Pier image.
>>
>> Sorry I should have included this the first mail. My steps to reproduce:
>> * Download latest build from Hudson server, I used 21st Jan build at:
>>  http://hudson.lukas-renggli.ch/job/Seaside%203.0/lastSuccessfulBuild/artifact/pier2/pier2.image
>> +  changes
>> * Copy PharoV10.sources into download directory, start image and web server
>> * Register a new Pier app as:
>> PRPierFrame registerAsApplication: 'piersearch' kernel: (PRKernel new root:
>> ((PRComponent named: 'search') componentClass: PRSearchView); name:
>> 'testKernel').
>> * browse to localhost:8080/piersearch
>> * type anything into the search box and press "search"
>> * MessageNotUnderstood: receiver of "root" is nil
>> Hope this makes sense
>> Nick
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>
>
>
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
>



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

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRSearchView

Nick
Hi Lukas and Reza,

Thanks for the explanations, it helps a lot to understand the intent of the code.

Cheers

Nick

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki