org.apache.wicket.behavior.AbstractAjaxBehavior#bind() protects you from using the behavior twice. I see no reason why #onComponentTag and #afterRender do this delegation. They just introduce new methods in the API and the benefit is zero (or at least I don't see it).
I'm trying to follow up your idea of having Ajax strategy (webApp.getAjaxSettings().getStrategy().xyz()). This way we can have strategies for Wicket6 and Wicket7 (this uses data-w-eventName) as defaults, and the users can use their own if they want. I can extract and pass the component to the strategy. I just find the API weird and I see no problems with the normal API of Behavior#onComponentTag(Component, ComponentTag). Wicket will pass the correct 'component'. No need of this protection. On Thu, Aug 1, 2013 at 1:26 PM, Sven Meier <[email protected]> wrote: > It's that way to emphasize that an AbstractAjaxBehavior can be bound to a > single component only. Why change it? > > Sven > > > > On 08/01/2013 12:25 PM, Martin Grigorov wrote: > >> Hi, >> >> Is there any reason why AbstractAjaxBehavior#**onComponentTag(Component, >> ComponentTag) is final and delegates to "#onComponentTag(ComponentTag)**" >> (note the missing 'component' parameter) ? >> >> The idea is to use #getComponent() if access to the bound Component is >> needed inside #onComponentTag(ComponentTag). But I don't see why we hide >> the component this way from the user. >> >> Any objections to make the first non-final and deprecate the second in >> Wicket 7.x ? >> >> >
