You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Erik van Oosten <e....@grons.nl> on 2009/12/23 16:34:23 UTC

please help find an 'onBeforeRender' for behaviors attached to ComponentTag (wicket:for attribute)

Hi,

I just added a patch to http://issues.apache.org/jira/browse/WICKET-1469 
(support for wicket:for attribute).

The implementation is based on that of the wicket:message attribute and 
works fine.

However, I can't reliably convince the referred component to render its 
markup id. The problem is that the referred component might already have 
been rendered. I can't find a hook that is called /before/ the render 
phase starts for a behavior that is attached to a ComponentTag.

ComponentTag#onBeforeRender is actually called /during/ rendering from 
Component#render (line 2426 in branch 1.4.x) and not before. This makes 
sense as the markup stream is only known until the rendering of a 
component is started. Anyway, I wouldn't know how to override this 
method as the instance is created elsewhere.

So my questions are:
Is there an appropriate hook?
Can one be added easily?
Is there another way to manipulate the component hierarchy from the 
markup stream?

If no such hook is/will be available I propose to just drop this feature 
altogether.

Regards,
    Erik.

-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



Re: please help find an 'onBeforeRender' for behaviors attached to ComponentTag (wicket:for attribute)

Posted by Juergen Donnerstag <ju...@gmail.com>.
Hi Erik,

two options come in my mind:

1) IMarkupLoader is used to merge inheritanted markup. You could
enhance the default implementation or create your own (they get
chained), analyse the markup and add a tag to the appropriate tag.

2)
>> Can one be added easily?
another option: currently Markup contains a list of MarkupElements
(incl. ComponentTag and WicketTag). But also the info about the markup
resource (file, xml declaration, etc). We could add a Map<String,
IBehavior) to Markup where MarkupFilter's may add a behavior to and
Component.renderComponentTag() takes care of it.

-Juergen