You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Epstein, Ezra" <ep...@amazon.com> on 2006/10/06 23:53:46 UTC

How to observe property binding events

I've got a component which accepts a parameter.  I want to listen (receive a callback) when the parameter is set (bound).  Does Tapestry provide such a facility?

Thanks, 

Ezra Epstein 



Re: How to observe property binding events

Posted by Jesse Kuhnert <jk...@gmail.com>.
Yes, but the usefulness of my answer largely depends on how clever/efficient
you are trying to be doing it.

Now, there is IBinding. The one object to bind them all ;)

If you work your way down the type hierarchy you'll find AbstractBinding,
which holds the method you care about most - "setObject". This will be
called by tapestry when managing all of the page properties "automagically"
for you.

Some of the magic happens in (for your exact case at least)
org.apache.tapestry.enhance.ParameterPropertyWorker.

The other half of the work happens in each specific binding implementation
that will handle these set/get object calls..(Like ognl bindings, etc..)

I'm not sure where you are going with this but I guess you could use the
hivemind chain of command service sort of configuration (like I did for
org.apache.tapestry.services.ComponentRenderWorker ) to generically call a
single interface method for a hivemind configuration point...Then you can
contribute as many workers into the chain you like if you decide that you
have more than one use for it.

Again...Not knowing what you are doing - and taking the exact parameters
given I'd probably extend and override the default ParameterPropertyWorker
(a hivemind service, so replacing it inline with what Tapestry does already
should be easy )  and just  override whatever section of code I needed to in
that implementation to inject + call my service reference.

It may look a little complicated in there at first, but the whole
org.apache.tapestry.enhance package is filled with lots of different
enhancement works - and most of them inject a service into the object they
work on...So finding an easier to follow worker to reference before
modifying ParameterPropertyWorker might be easier.

Hope that helps.

On 10/6/06, Epstein, Ezra <ep...@amazon.com> wrote:
>
> I've got a component which accepts a parameter.  I want to listen (receive
> a callback) when the parameter is set (bound).  Does Tapestry provide such a
> facility?
>
> Thanks,
>
> Ezra Epstein
>
>
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com