Hi, I'm not sure whether there is a specific reason why this method is not in the API. Maybe just because no one needed/noticed it. Maybe there is something wrong in it which I don't see at the moment. Anyway create a ticket for improvement.
Yet another way is to use IComponentInializationListener that assigns the behavior when the component is being initialized. On Thu, Feb 7, 2013 at 5:14 AM, Colin Rogers < colin.rog...@objectconsulting.com.au> wrote: > Martin and other Wicketeers, > > I have a quick, small question; why is there no 'onInitiailise()' method > on Behaviour classes? > > There is an 'bind' method, but this, unlike 'onInitialise' is call > immediately on binding to component, whether the component is in the > component tree or not. Obviously it's very easy to work around; > > * Simply ensure that bind is called after the component is added > to the component tree, even throwing an exception when 'component' > parameter has null for a parent. (This is how AbstractAjaxBehavior works). > > * Add a 'firstTime' flag in onConfigure, and set to false after > the onInitialise functionality is performed. > > While it is easy to work around, it seems odd that Behaviours lack the > common onInitialise that all Wicket components otherwise have, I'm curious > as to why that is, and hoping it wouldn't be an issue to add - it would aid > in removing boiler plate code in Behaviours. > > Cheers, > Col. > > PS. Apologies for spelling 'initialise' and 'behaviour' correctly - I > can't help it... :) > > EMAIL DISCLAIMER This email message and its attachments are confidential > and may also contain copyright or privileged material. If you are not the > intended recipient, you may not forward the email or disclose or use the > information contained in it. If you have received this email message in > error, please advise the sender immediately by replying to this email and > delete the message and any associated attachments. Any views, opinions, > conclusions, advice or statements expressed in this email message are those > of the individual sender and should not be relied upon as the considered > view, opinion, conclusions, advice or statement of this company except > where the sender expressly, and with authority, states them to be the > considered view, opinion, conclusions, advice or statement of this company. > Every care is taken but we recommend that you scan any attachments for > viruses. > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>