Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Before the constructor change, you would call Component#replace to replace a component with another one. This method does not exist anymore. Instead, you either create a new component with the same parent and id (so the hierarchy will match; the new component is then the current), or you call Component#reAttach to set it as the current one.

If you look at

Code Block

wicket.examples.template.TemplatePage

, in 1.2, the code to replace a banner looked like this:

...

Form component level validation has been decoupled from FormComponent so that validators can be reused outside wicket. The new API can be found in wicket.validation package, with the validator implementations in wicket.validation.validator. From the point of view of validator development not much has changed if you extended the AbstractValidator; if you however implemented the IValidator interface directly you will need to use the new API, namely error reporting via ValidationError instead of FormComponent.error(List,Map). Errors with messages fully constructed inside the validator can still be reported using FormComponent.error(String).

Annotations

Wicket has replaced the need to override certain callback methods with annotation-driven approach.

For an outline of advantages see here https://issues.apache.org/jira/browse/WICKET-23

See

  • @OnAttach
  • @OnDetach
  • @OnBeforeRender
  • @OnAfterRender
    Code example:
    Code Block
    
    class MyComponent extends WebMarkupContainer {    public void onAttach() {        super.onAttach();        // handle attach event        createRepeaterItems();        createHeaderItems();     }     private void createRepeaterItems() {        ...    }     private void createHeaderItems() {       ...    }
     }
    
     becomes
    Code Block
    
     class MyComponent extends WebMarkupContainer {    @OnAttach    private void createRepeaterItems() {        ...    }    @OnAttach    private void createHeaderItems() {       ...    } }Â