You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Blower, Andy" <An...@proquest.co.uk> on 2009/02/06 13:05:42 UTC

Problem wiring up two components on a page

I've just run across a problem and I'm stumped, so I really hope someone can shed some light on this for me.

I have a page with a paged list component on it, elsewhere on the page I have another component which contains a select box and a 'go' button to change the number of things displayed on the page. The paged list component is passed into this per page selector component as a parameter so it can simply update using a setter method since the parameters are all bound together. The components are shared across multiple pages and this is working fine.

Now, the per page selector component is going in an area along with another component, and this should become a new component. Unfortunately when I try to nest my per page selector component in another component like this I get this error:

Failure writing parameter 'value' of component Results:displayoptionsbar.selectperpageresults.itemsperpage: Failure reading parameter 'for' of component Results:displayoptionsbar.selectperpageresults: Component Results:displayoptionsbar does not contain an embedded component with id 'pagedList'. Available components: selectperpageresults.


Now I can see that I could bubble up an event to the page and have the logic in there to set the value into the paged list component explicitly instead of relying on the setting of the per page parameter and that being bound back up to the page and down to the paged list component, but this would break the encapsulation of my per page selector component and duplicate the code on every page so I don't want to do that. The problem seems to be passing the paged list component reference down two levels so I have access to it... the middle level doesn't have the component in the template or in the Java class so it throws and error. How should I be doing this?

The parameters of the middle component holding the per page selector component look like this:

@Parameter(required=true, defaultPrefix=BindingConstants.COMPONENT)
@Property @SuppressWarnings("unused")
private PagedBase pagedList;

@Parameter
@Property @SuppressWarnings("unused")
private int itemsPerPage;


Hope someone can help me before I go on holiday in five hours? Asking a lot I know. ;-)

Thanks,

Andy.

Re: Problem wiring up two components on a page

Posted by Howard Lewis Ship <hl...@gmail.com>.
I'm having a little trouble picturing this ... and I doubt I'll make
your holiday deadline!  What you want should work but I'd need to see
at list snippets of the page and component templates I think.

On Fri, Feb 6, 2009 at 4:05 AM, Blower, Andy
<An...@proquest.co.uk> wrote:
> I've just run across a problem and I'm stumped, so I really hope someone can shed some light on this for me.
>
> I have a page with a paged list component on it, elsewhere on the page I have another component which contains a select box and a 'go' button to change the number of things displayed on the page. The paged list component is passed into this per page selector component as a parameter so it can simply update using a setter method since the parameters are all bound together. The components are shared across multiple pages and this is working fine.
>
> Now, the per page selector component is going in an area along with another component, and this should become a new component. Unfortunately when I try to nest my per page selector component in another component like this I get this error:
>
> Failure writing parameter 'value' of component Results:displayoptionsbar.selectperpageresults.itemsperpage: Failure reading parameter 'for' of component Results:displayoptionsbar.selectperpageresults: Component Results:displayoptionsbar does not contain an embedded component with id 'pagedList'. Available components: selectperpageresults.
>
>
> Now I can see that I could bubble up an event to the page and have the logic in there to set the value into the paged list component explicitly instead of relying on the setting of the per page parameter and that being bound back up to the page and down to the paged list component, but this would break the encapsulation of my per page selector component and duplicate the code on every page so I don't want to do that. The problem seems to be passing the paged list component reference down two levels so I have access to it... the middle level doesn't have the component in the template or in the Java class so it throws and error. How should I be doing this?
>
> The parameters of the middle component holding the per page selector component look like this:
>
> @Parameter(required=true, defaultPrefix=BindingConstants.COMPONENT)
> @Property @SuppressWarnings("unused")
> private PagedBase pagedList;
>
> @Parameter
> @Property @SuppressWarnings("unused")
> private int itemsPerPage;
>
>
> Hope someone can help me before I go on holiday in five hours? Asking a lot I know. ;-)
>
> Thanks,
>
> Andy.
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: Problem wiring up two components on a page

Posted by "Blower, Andy" <An...@proquest.co.uk>.
Thanks for the suggestion Thiago, but it doesn't help unfortunately.

> -----Original Message-----
> From: Thiago H. de Paula Figueiredo [mailto:thiagohp@gmail.com]
> Sent: 06 February 2009 12:42
> To: Tapestry users
> Subject: Re: Problem wiring up two components on a page
> 
> On Fri, Feb 6, 2009 at 10:05 AM, Blower, Andy
> <An...@proquest.co.uk> wrote:
> > @Parameter(required=true, defaultPrefix=BindingConstants.COMPONENT)
> 
> Try the principal attribute of @Parameter. Maybe it is the solution
> for your problem:
> @Parameter(required=true, principal = true,
> defaultPrefix=BindingConstants.COMPONENT)
> 
> --
> Thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Problem wiring up two components on a page

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, Feb 6, 2009 at 10:05 AM, Blower, Andy
<An...@proquest.co.uk> wrote:
> @Parameter(required=true, defaultPrefix=BindingConstants.COMPONENT)

Try the principal attribute of @Parameter. Maybe it is the solution
for your problem:
@Parameter(required=true, principal = true,
defaultPrefix=BindingConstants.COMPONENT)

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org