tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Norris" <CNor...@widen.com>
Subject RE: Programmatically adding a binding to a component?
Date Thu, 01 Sep 2005 20:36:12 GMT
I see.  Well let me back up to the larger problem then.

With the last version of the code I had a component called
AnchoredBlock.  The component would render an anchor tag at the top and
then would add an anchor to every DirectLink contained inside of it.
This was needed so that if there were, for instance, 10 tables on a
page, and each one had sortable headers, you could click on a header on
the 10th table and not have the page refresh at the top again.  You'd
still be at the bottom due to the anchor tag and the anchors added to
the direct link.  It was really easy to use this component because you
could just wrap it around anything and it didn't require any parameters.
Without it, I'd have to pass anchor tags very, very deep in some cases,
and when I went down that route it got very ugly very quickly.  I could
easily pass an anchor 5 components deep just to get it to the
DirectLink.

With the last version of tapestry, I did that by recursively finding
every component inside of the AnchoredBlock and calling
setProperty("anchor", getAnchorName()) on the DirectLinks.  This seemed
to work pretty well.  Now I get a message that my parameter "anchor"
isn't bound and therefore I can't update it.  So what can I do here?  I
feel like I'm just going about it all wrong now.

-Chris

-----Original Message-----
From: Howard Lewis Ship [mailto:hlship@gmail.com] 
Sent: Thursday, September 01, 2005 3:26 PM
To: Tapestry users
Subject: Re: Programmatically adding a binding to a component?

It's just as well you can't; you don't want to be adding bindings
directly.  The various setter methods exist for the framework, you
should treat components as immutable. This is why its going to be good
for everyone to break the inheretance requirement ... the IComponent
that will be exposed to your peer code will be entirely immutable.

On 9/1/05, Chris Norris <CNorris@widen.com> wrote:
> Is there a way to add a binding to a component programmatically?  I
see
> that there is a setBinding() method in AbsractComponent, but I can't
> really figure out how to manually construct an IBinding instance.
> 
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


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


Mime
View raw message