If you've got the components you want somewhere else on a template, you
can always use Block/RenderBlock. That involves setting up @Block areas
for each possible content and putting a @RenderBlock in the target
area. Then you just need a method to wire up the RenderBlock's "block"
attribute. Your target blocks can even be on another page.
I think the version of DynamicBlock you're pointing to is for tap3.
I've got a bookmark to the t4 version, but the download links appear
broken. I'm not sure the author supports it any more. I'm using it on
tapestry 4.1.1 (with unrelated hacks to its source).
http://www.behindthesite.com/blog/C1931765677/E20060309215538/index.html
-Steve
Portuendo Vestado wrote:
Darn you're right, I've never even thought of that. finishLoad(), which I'm
overriding to add the new implicit component, is called only once before the
page gets cached. So basically, my dynamic component is only dynamic the
first time template loads.
The reason I chose this method is that if you do it (that is, attach a
component via addComponent()) at render time, say in pageBeginRender(), it
hits AbstractComponent.checkActiveLock() sentinel and throws a "Component
Home is active and its configuration state may not be changed", which is
quite reasonable.
I guess I'm still on the lookout for an option to delegate rendering to a
component with a template. There must be a way of instantiating those just
as simple as pages (i.e. with IRequestCycle.getPage(...)).
Btw, DynamicBlock you mentioned, is this it:
http://www.behindthesite.com/blog/C1931765677/E1630021481/? Does it work for
4.1 - seems a little old, September 2, 2004.
Thanks,
-P
----------------------------------------------
I don't know enough about tapestry internals to say if this is a good
idea, but I've played around with DynamicBlock and your solution looks a
lot simpler. At a guess, it looks like your approach is setting up your
dynamic component when tapestry is loading the page template. If it's
part of tapestry template cache, that means it would only pick the
dynamic content the first time the page is loaded and reuse the same
component on every subsequent call to the page - unless you're running
in dev mode with page caching disabled. But as I said, that's a guess.
If I'm wrong, I want to know how well does it handle things like
RenderBody and passing parameters to your component? If it handles
those concerns well, I'm tempted to wrap it up into a generic
DynamicComponent.
If I'm right, it probably jives with Howard's vision of static
structure/dynamic behavior, but may not function in the way you intended.
-Steve
_______________________________________________________
Yahoo! Mail - Sempre a melhor opção para você!
Experimente já e veja as novidades.
http://br.yahoo.com/mailbeta/tudonovo/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]