Description
I suggest the introduction of org.apache.wicket.application.IComponentOnInitializeListener for onInitialize-cross-cutting-concerns on Components. Such a listener should be called for a Component right after the onInitialize Method of the Component has been executed. I hope this has not been discussed already. I have not found any such issues.
A use case: For implementing cross-cutting concerns in Wicket, there are several Listeners that are called at various points during the life-cycle of a Component. Such listeners as in Wicket 1.4.12 are IComponentInstantiationListener, IComponentOnBeforeRenderListener, IComponentOnAfterRenderListener. However, for adding a Validator to all IValidateable Components of a certain type, non of the existing Listeners is really a good option. IComponentInstantiationListener cannot successfully add a Validator in general, because such a listener is executed before the member variable validators in the FormComponent class is actually set to null during instantiation. IComponentOnAfterRenderListener will obviously be to late. And with IComponentOnBeforeRenderListener, the validator itself would (without extra coding) be instantiated and added in each request, which would be an unnecessary overhead.