Versions Compared

Key

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

...

Code Block
java
java
    if (RequestCycle.get().find(AjaxRequestTarget.class) == null) {
        // executed for non-ajax-request in Wicket 7
        // never executed in Wicket 8
        ...
    }

See WICKET-6189 for more details

  • Before Wicket 8 users used to create a custom implementation of IHeaderResponseDecorator to place JavaScript items inside page body:

...

This code doesn't work anymore. See WICKET-6498 for more details

Environment

...

Replace it with standard Java 8 java.util.function.Supplier<T> which is virtually identical.

Deprecate org.apache.wicket.util.IContextProvider 
Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyWICKET-6118

Replace IContextProvider<T, C> with standard Java 8 java.util.function.Function<C, T> which is virtually identical.

As a consequence IPageManagerProvider, IPageRendererProvider and IRequestCycleProvider now override #apply() method instead of #get().

Deprecate org.apache.wicket.protocol.http.documentvalidation.HtmlDocumentValidator 
Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyWICKET-6119

Tests based on HtmlDocumentValidator are very fragile. They start to fail as soon as there is a single character change somewhere in the page markup.

We believe that there are very few users of this API. It is recommended to use TagTester and WicketTestCase#executeTest() instead.

Deprecate org.apache.wicket.model.AbstractReadOnlyModel

Use an anonymous instance of IModel instead. Since Wicket 8.0 IModel doesn't require providing implementation of #setObject(Object) method.

IGenericComponent's setter methods now return the current instance for method chaining

All specialization classes return their type.

AjaxButton, AjaxLink and AjaxFallbackButton event callback methods no longer get form as second argument 
Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyWICKET-6184

 

For consistency with other components and the new lambda support, the submitted form is no longer passed as argument to callback methods (e.g. #onSubmit(), #onClick()) of AjaxButton, AjaxLink and AjaxFallbackButton. You can call #getForm() instead.

 

RequestCycle#find(Class<T>) returns java.util.Optional 
Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyWICKET-6189
Anchor
WICKET-6189
WICKET-6189
WICKET-6189

 

Code calling RequestCycle#find(Class<T>) has to check whether  a matching IRequestHandler is found. This is now enforced by returning an Optional<T>:

...

All AjaxFallback** components and the containers which use internally AjaxFallback** components, like AjaxTabbedPanel, RatingPanel and TableTree, have been reworked to pass Optional<AjaxRequestTarget> instead of just AjaxRequestTarget to their onXyz() callback methods. This way the application developer should not forget to check that the AjaxRequestTarget is not null. 

AbstractChoice#getChoices() is 'final' now  
Jira
serverASF JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyWICKET-6132

AbstractChoice#getChoices() has been made final. If the application needs to provide different choices for each render then it should override AbstractChoice#getChoicesModel() instead. The application code would be almost the same as before, it will just need to wrap the final List result in an IModel, most probably ListModel.

ListenerInterfaceRequestHandler simplification
Jira
serverASF JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyWICKET-6137

RequestListenerInterface was removed:

  • IResourceListener, IBehaviorListener, IOnChangeListener, ILinkListener are replaced by the generic method IRequestListener#onRequest()
  • ListenerInterfaceRequestHandler was renamed to ListenerRequestHandler
  • Component's and Behavior's #canCallListenerInterface() were renamed to #canCallListener()
  • PageSettings#getCallListenerInterfaceAfterExpiry() was renamed to #getCallListenerAfterExpiry.

A Component or Behavior can now implement IRequestListener once only, thus removing the need to include an identifier (e.g. "ILinkListener") in the URL.

If you implemented IResourceListener previously, you have to override IRequestListener#rendersPage() now to return false.

wantOnSelectionChangedNotifications moved to FormComponentUpdatingBehavior 
Jira
serverASF JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyWICKET-6348

Change notification was moved from CheckBox, DropDownChoice, RadioChoice, CheckGroup/Check and RadioGroup/Radio into a new behavior FormComponentUpdatingBehavior.

Instead of subclasses the component, this behavior can now be added to the component:

Code Block
languagejava
titleFormComponentUpdatingBehavior
// Wicket 7.x
new CheckBox("id", model) {
	protected boolean wantOnSelectionChangedNotifications() {
		return true;
        }

	protected void onSelectionChanged(Boolean newSelection) {
		// do something, page will be rerendered;
	}
};


// Wicket 8.x
new CheckBox("id", model)
.add(new FormComponentUpdatingBehavior() {
	protected void onUpdate() {
		// do something, page will be rerendered;
	}

    protected void onError(RuntimeException ex) {
        super.onError(ex);
    }
});

As with AjaxFormComponentUpdatingBehavior any error during processing of the form component can now be handled in #onError().

Renderers are IDetachable now 
Jira
serverASF JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyWICKET-6347

Renderers (IChoiceRendere, IOptionRenderer and IAutoCompleteRenderer now take part in detachment as other Wicket concepts like components and models. The owning component is responsible to detach it.

Behavior changesWICKET-6498

Application's IHeaderResponseDecorator
Jira
serverASF JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyWICKET-6498
Anchor
WICKET-6498
WICKET-6498

Before WICKET-6498 users used to create a custom implementation of IHeaderResponseDecorator to place JavaScript items inside page body:

...