the idea was to make it more obvious/easier to access since you are likely to need the component in that method. reusing ajax behavior instances doesnt make sense because they hold state. im not really attached to this enhancement, just seemed like it would make the code cleaner when i was doing the migration.
-igor On Sat, Apr 27, 2013 at 6:54 AM, Martin Grigorov <[email protected]> wrote: > On Fri, Apr 26, 2013 at 8:44 PM, Martin Grigorov <[email protected]>wrote: > >> Hi Igor, >> >> I saw your entry in the roadmap: >> ================================== >> h4. ajaxbehavior#updateAjaxAttributes() should get component passed in >> >> otherwise referencing the component as needed in throttle settings is >> annoying >> >> {code} >> queryField.add(new AjaxFormComponentUpdatingBehavior("onkeydown") { >> protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { >> attributes.setThrottlingSettings(new >> ThrottlingSettings(queryField.getMarkupId(), Duration.seconds(1))); >> >> ----------------------------------------------------------------------------^ >> {code} >> ================================== >> >> Few comments >> 1) the throttling id is not used for DOM selector so it could be anything. >> Just make sure it is unique for all throttlers >> 2) the component is easily available via #getComponent() >> (AbstractDefaultAjaxBehavior#getComponent()) >> >> I think we can spare this API break for the users >> > > The extreme alternative is to add Component as parameter to every other > method in Ajax behaviors (including #getCallbackUrl(), #onRespond(), > #onClick(), etc.) and this way a behavior can be reused in several > components. > I'm not sure how big gain this will be. > But the API break will be huge. > > >> >> -- >> Martin Grigorov >> jWeekend >> Training, Consulting, Development >> http://jWeekend.com <http://jweekend.com/> >> > > > > -- > Martin Grigorov > Wicket Training & Consulting > http://jWeekend.com <http://jweekend.com/>
