You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Carl Crowder <ca...@taptu.com> on 2008/09/01 18:00:21 UTC

Context and Multiple Components

Hi all,

I'm writing a stats system where graphs have various abilities to be
filtered, changed and so on. To control the date range, I've got a date
range component, and to change the filtering, I have a filter control
component and so on. Some graphs don't use all of these components,
which is why I don't just bundle them all together.

I'm trying to avoid persisting any data in the session and instead
setting it all in the URL, so that all graph configurations can be
shared using the URL.

My problem is that I'm not sure how to handle setting the context for
forms or links within these optional components. In order for the, eg,
filter-control state to be set in the URL, the date-range control must
be aware of the filter-control settings. This is awkward to code, and
it's also bad practice, the two should really be completely independent.

So my question is: does anyone know a way to easily keep the context of
other elements when inside another one?

I tried writing a URL persistence strategy, which sort of worked, but I
ended up having URLs like "page?page_id.component_type.component_id="
and it got horribly messy...

Carl

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


Re: Context and Multiple Components

Posted by Carl Crowder <ca...@taptu.com>.
Sorry, I should have mentioned that the date-control and filter-control
things etc all submit their changes via forms.

It's just occurred to me that I could get the parent page using
ComponentResources during the onSuccess method, and pass in the new
values relevant to the control and get the parent page to handle
redirecting, as it is aware of its child components. I'll give that a try.

Any other ideas though?

Carl

PS It would be the case that, after thinking about this for a few days,
I finally get an idea just after sending an email!

Carl Crowder wrote:
> Hi all,
> 
> I'm writing a stats system where graphs have various abilities to be
> filtered, changed and so on. To control the date range, I've got a date
> range component, and to change the filtering, I have a filter control
> component and so on. Some graphs don't use all of these components,
> which is why I don't just bundle them all together.
> 
> I'm trying to avoid persisting any data in the session and instead
> setting it all in the URL, so that all graph configurations can be
> shared using the URL.
> 
> My problem is that I'm not sure how to handle setting the context for
> forms or links within these optional components. In order for the, eg,
> filter-control state to be set in the URL, the date-range control must
> be aware of the filter-control settings. This is awkward to code, and
> it's also bad practice, the two should really be completely independent.
> 
> So my question is: does anyone know a way to easily keep the context of
> other elements when inside another one?
> 
> I tried writing a URL persistence strategy, which sort of worked, but I
> ended up having URLs like "page?page_id.component_type.component_id="
> and it got horribly messy...
> 
> Carl
> 
> ---------------------------------------------------------------------
> 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