Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3082

Introduce IComponentOnInitializeListener for cross-cutting concerns

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.12
    • 1.4.13, 1.5-M3
    • wicket
    • None

    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.

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            sludwig Sven Ludwig
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: