You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2016/11/18 21:52:28 UTC
[2/6] wicket git commit: WICKET-6281 Listener interfaces' methods
should use empty default methods for friendlier extension
WICKET-6281 Listener interfaces' methods should use empty default methods for friendlier extension
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/ab1f3c73
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/ab1f3c73
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/ab1f3c73
Branch: refs/heads/master
Commit: ab1f3c734051694841a9336a14659613a15a5e2b
Parents: 92369a8
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Nov 18 22:41:10 2016 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri Nov 18 22:41:10 2016 +0100
----------------------------------------------------------------------
.../cdi/ICdiAwareRequestCycleListener.java | 6 ++-
.../cdi/ICdiAwareRequestCycleListener.java | 6 ++-
.../org/apache/wicket/IApplicationListener.java | 6 ++-
.../java/org/apache/wicket/IDetachListener.java | 6 ++-
.../org/apache/wicket/ISessionListener.java | 6 ++-
.../apache/wicket/ajax/AjaxRequestTarget.java | 26 ++++-------
.../ajax/attributes/IAjaxCallListener.java | 45 ++++++++++++++++----
.../cycle/AbstractRequestCycleListener.java | 3 ++
.../request/cycle/IRequestCycleListener.java | 31 +++++++++-----
.../breadcrumb/IBreadCrumbModelListener.java | 11 +++--
.../extensions/wizard/IWizardModelListener.java | 13 +++---
11 files changed, 104 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
----------------------------------------------------------------------
diff --git a/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java b/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
index d3ded47..a577954 100644
--- a/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
+++ b/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
@@ -27,7 +27,8 @@ public interface ICdiAwareRequestCycleListener extends IRequestCycleListener
* @param cycle
* request cycle
*/
- void onAfterConversationActivated(RequestCycle cycle);
+ default void onAfterConversationActivated(RequestCycle cycle)
+ {}
/**
* Called right before the current conversation context is deactivated
@@ -35,5 +36,6 @@ public interface ICdiAwareRequestCycleListener extends IRequestCycleListener
* @param cycle
* request cycle
*/
- void onBeforeConversationDeactivated(RequestCycle cycle);
+ default void onBeforeConversationDeactivated(RequestCycle cycle)
+ {}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-cdi/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
----------------------------------------------------------------------
diff --git a/wicket-cdi/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java b/wicket-cdi/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
index d3ded47..a577954 100644
--- a/wicket-cdi/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
+++ b/wicket-cdi/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
@@ -27,7 +27,8 @@ public interface ICdiAwareRequestCycleListener extends IRequestCycleListener
* @param cycle
* request cycle
*/
- void onAfterConversationActivated(RequestCycle cycle);
+ default void onAfterConversationActivated(RequestCycle cycle)
+ {}
/**
* Called right before the current conversation context is deactivated
@@ -35,5 +36,6 @@ public interface ICdiAwareRequestCycleListener extends IRequestCycleListener
* @param cycle
* request cycle
*/
- void onBeforeConversationDeactivated(RequestCycle cycle);
+ default void onBeforeConversationDeactivated(RequestCycle cycle)
+ {}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-core/src/main/java/org/apache/wicket/IApplicationListener.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/IApplicationListener.java b/wicket-core/src/main/java/org/apache/wicket/IApplicationListener.java
index c6a0ab1..58fa4fc 100644
--- a/wicket-core/src/main/java/org/apache/wicket/IApplicationListener.java
+++ b/wicket-core/src/main/java/org/apache/wicket/IApplicationListener.java
@@ -28,12 +28,14 @@ public interface IApplicationListener
*
* @param application
*/
- void onAfterInitialized(Application application);
+ default void onAfterInitialized(Application application)
+ {}
/**
* Called before application instance is destroyed
*
* @param application
*/
- void onBeforeDestroyed(Application application);
+ default void onBeforeDestroyed(Application application)
+ {}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-core/src/main/java/org/apache/wicket/IDetachListener.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/IDetachListener.java b/wicket-core/src/main/java/org/apache/wicket/IDetachListener.java
index 8582287..6678931 100644
--- a/wicket-core/src/main/java/org/apache/wicket/IDetachListener.java
+++ b/wicket-core/src/main/java/org/apache/wicket/IDetachListener.java
@@ -39,10 +39,12 @@ public interface IDetachListener
* @param component
* component being detached
*/
- void onDetach(Component component);
+ default void onDetach(Component component)
+ {}
/**
* Called when the application is being destroyed. Useful for cleaning up listener caches, etc.
*/
- void onDestroyListener();
+ default void onDestroyListener()
+ {}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-core/src/main/java/org/apache/wicket/ISessionListener.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ISessionListener.java b/wicket-core/src/main/java/org/apache/wicket/ISessionListener.java
index b731f52..8876c93 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ISessionListener.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ISessionListener.java
@@ -28,7 +28,8 @@ public interface ISessionListener
*
* @param session
*/
- void onCreated(Session session);
+ default void onCreated(Session session)
+ {}
/**
* Informs the listener that session with specific id has been unbound.
@@ -36,5 +37,6 @@ public interface ISessionListener
* @param sessionId
* the id of the unbound session
*/
- void onUnbound(String sessionId);
+ default void onUnbound(String sessionId)
+ {}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
index 1bc4861..0d98dba 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
@@ -47,7 +47,8 @@ public interface AjaxRequestTarget extends IPartialPageRequestHandler, ILoggable
* javascript
*
*/
- void onBeforeRespond(Map<String, Component> map, AjaxRequestTarget target);
+ default void onBeforeRespond(Map<String, Component> map, AjaxRequestTarget target)
+ {}
/**
* Triggered after ajax request target is done with its response cycle. At this point only
@@ -62,7 +63,8 @@ public interface AjaxRequestTarget extends IPartialPageRequestHandler, ILoggable
* @param response
* response object that can be used to output javascript
*/
- void onAfterRespond(Map<String, Component> map, AjaxRequestTarget.IJavaScriptResponse response);
+ default void onAfterRespond(Map<String, Component> map, AjaxRequestTarget.IJavaScriptResponse response)
+ {}
/**
* Triggered for every Ajax behavior. Can be used to configure common settings.
@@ -73,29 +75,19 @@ public interface AjaxRequestTarget extends IPartialPageRequestHandler, ILoggable
* The attributes for the Ajax behavior
* @since 7.0.0
*/
- void updateAjaxAttributes(AbstractDefaultAjaxBehavior behavior, AjaxRequestAttributes attributes);
+ default void updateAjaxAttributes(AbstractDefaultAjaxBehavior behavior, AjaxRequestAttributes attributes)
+ {}
}
/**
* Empty implementation of an {@link IListener} useful as a starting point for your own
* custom listener.
+ *
+ * @deprecated This class will be removed in Wicket 9.0.0. Use {@link IListener} instead
*/
+ @Deprecated
class AbstractListener implements IListener
{
- @Override
- public void updateAjaxAttributes(AbstractDefaultAjaxBehavior behavior, AjaxRequestAttributes attributes)
- {
- }
-
- @Override
- public void onBeforeRespond(Map<String, Component> map, AjaxRequestTarget target)
- {
- }
-
- @Override
- public void onAfterRespond(Map<String, Component> map, IJavaScriptResponse response)
- {
- }
}
/**
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java
index e671c0a..f790f77 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java
@@ -48,7 +48,10 @@ public interface IAjaxCallListener
* the Component with the Ajax behavior
* @return the JavaScript that will be executed on initialization of the Ajax call.
*/
- CharSequence getInitHandler(Component component);
+ default CharSequence getInitHandler(Component component)
+ {
+ return null;
+ }
/**
* The JavaScript that will be executed before the Ajax call, as early as possible. Even before
@@ -62,7 +65,10 @@ public interface IAjaxCallListener
* the Component with the Ajax behavior
* @return the JavaScript that will be executed before the Ajax call.
*/
- CharSequence getBeforeHandler(Component component);
+ default CharSequence getBeforeHandler(Component component)
+ {
+ return null;
+ }
/**
* A JavaScript function that is invoked before the request is being executed. If it returns
@@ -77,7 +83,10 @@ public interface IAjaxCallListener
* @return the JavaScript that should be used to decide whether the Ajax call should be made at
* all.
*/
- CharSequence getPrecondition(Component component);
+ default CharSequence getPrecondition(Component component)
+ {
+ return null;
+ }
/**
* The JavaScript that will be executed right before the execution of the the Ajax call, only if all
@@ -93,7 +102,10 @@ public interface IAjaxCallListener
* the Component with the Ajax behavior
* @return the JavaScript that will be executed before the Ajax call.
*/
- CharSequence getBeforeSendHandler(Component component);
+ default CharSequence getBeforeSendHandler(Component component)
+ {
+ return null;
+ }
/**
* The JavaScript that will be executed after the Ajax call. The script will be executed in a
@@ -111,7 +123,10 @@ public interface IAjaxCallListener
* @return the JavaScript that will be executed after the start of the Ajax call but before its
* response is returned.
*/
- CharSequence getAfterHandler(Component component);
+ default CharSequence getAfterHandler(Component component)
+ {
+ return null;
+ }
/**
* The JavaScript that will be executed after successful return of the Ajax call. The script
@@ -127,7 +142,10 @@ public interface IAjaxCallListener
* the Component with the Ajax behavior
* @return the JavaScript that will be executed after a successful return of the Ajax call.
*/
- CharSequence getSuccessHandler(Component component);
+ default CharSequence getSuccessHandler(Component component)
+ {
+ return null;
+ }
/**
* The JavaScript that will be executed after unsuccessful return of the Ajax call. The script
@@ -143,7 +161,10 @@ public interface IAjaxCallListener
* the Component with the Ajax behavior
* @return the JavaScript that will be executed after a unsuccessful return of the Ajax call.
*/
- CharSequence getFailureHandler(Component component);
+ default CharSequence getFailureHandler(Component component)
+ {
+ return null;
+ }
/**
* The JavaScript that will be executed after both successful and unsuccessful return of the
@@ -159,7 +180,10 @@ public interface IAjaxCallListener
* @return the JavaScript that will be executed after both successful and unsuccessful return of
* the Ajax call.
*/
- CharSequence getCompleteHandler(Component component);
+ default CharSequence getCompleteHandler(Component component)
+ {
+ return null;
+ }
/**
* The JavaScript that will be executed after the Ajax call is done, regardless whether it was
@@ -173,5 +197,8 @@ public interface IAjaxCallListener
* the Component with the Ajax behavior
* @return the JavaScript that will be executed after the Ajax call is done.
*/
- CharSequence getDoneHandler(Component component);
+ default CharSequence getDoneHandler(Component component)
+ {
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-core/src/main/java/org/apache/wicket/request/cycle/AbstractRequestCycleListener.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/cycle/AbstractRequestCycleListener.java b/wicket-core/src/main/java/org/apache/wicket/request/cycle/AbstractRequestCycleListener.java
index 9e8964c..89ebc9c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/cycle/AbstractRequestCycleListener.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/cycle/AbstractRequestCycleListener.java
@@ -22,7 +22,10 @@ import org.apache.wicket.request.Url;
/**
* Empty implementation of an {@link IRequestCycleListener} useful as a starting point for your own
* custom listener.
+ *
+ * @deprecated This class will be removed in Wicket 9.0.0. Use {@link IRequestCycleListener} instead.
*/
+@Deprecated
public abstract class AbstractRequestCycleListener implements IRequestCycleListener
{
@Override
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-core/src/main/java/org/apache/wicket/request/cycle/IRequestCycleListener.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/cycle/IRequestCycleListener.java b/wicket-core/src/main/java/org/apache/wicket/request/cycle/IRequestCycleListener.java
index 74574ec..43ee75d 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/cycle/IRequestCycleListener.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/cycle/IRequestCycleListener.java
@@ -103,21 +103,24 @@ public interface IRequestCycleListener
*
* @param cycle
*/
- void onBeginRequest(RequestCycle cycle);
+ default void onBeginRequest(RequestCycle cycle)
+ {}
/**
* Called when the request cycle object has finished its response
*
* @param cycle
*/
- void onEndRequest(RequestCycle cycle);
+ default void onEndRequest(RequestCycle cycle)
+ {}
/**
* Called after the request cycle has been detached
*
* @param cycle
*/
- void onDetach(RequestCycle cycle);
+ default void onDetach(RequestCycle cycle)
+ {}
/**
* Called when an {@link IRequestHandler} is resolved and will be executed.
@@ -126,7 +129,8 @@ public interface IRequestCycleListener
*
* @param handler
*/
- void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler);
+ default void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
+ {}
/**
* Called when a {@link IRequestHandler} has been scheduled. Can be called multiple times during
@@ -136,7 +140,8 @@ public interface IRequestCycleListener
* @param handler
* @see RequestCycle#scheduleRequestHandlerAfterCurrent(IRequestHandler)
*/
- void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler);
+ default void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler)
+ {}
/**
* Called when there is an exception in the request cycle that would normally be handled by
@@ -158,7 +163,10 @@ public interface IRequestCycleListener
* is returned, it will override any configured
* {@link Application#getExceptionMapperProvider() exception mapper}.
*/
- IRequestHandler onException(RequestCycle cycle, Exception ex);
+ default IRequestHandler onException(RequestCycle cycle, Exception ex)
+ {
+ return null;
+ }
/**
* Called when an {@link IRequestHandler} is resolved for an exception and will be executed.
@@ -167,8 +175,9 @@ public interface IRequestCycleListener
* @param handler
* @param exception
*/
- void onExceptionRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler,
- Exception exception);
+ default void onExceptionRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler,
+ Exception exception)
+ {}
/**
* Called after an {@link IRequestHandler} has been executed. If the execution resulted in an
@@ -177,7 +186,8 @@ public interface IRequestCycleListener
* @param cycle
* @param handler
*/
- void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler);
+ default void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
+ {}
/**
* Called after a Url is generated for a {@link IRequestHandler}. This method can be used to
@@ -187,5 +197,6 @@ public interface IRequestCycleListener
* @param handler
* @param url
*/
- void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url);
+ default void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
+ {}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/IBreadCrumbModelListener.java
----------------------------------------------------------------------
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/IBreadCrumbModelListener.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/IBreadCrumbModelListener.java
index 8d5b8d8..68d567d 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/IBreadCrumbModelListener.java
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/IBreadCrumbModelListener.java
@@ -39,8 +39,9 @@ public interface IBreadCrumbModelListener extends EventListener, IClusterable
* @param breadCrumbParticipant
* The bread crumb that was activated.
*/
- void breadCrumbActivated(IBreadCrumbParticipant previousParticipant,
- IBreadCrumbParticipant breadCrumbParticipant);
+ default void breadCrumbActivated(IBreadCrumbParticipant previousParticipant,
+ IBreadCrumbParticipant breadCrumbParticipant)
+ {}
/**
* Called when a bread crumb was added to the model.
@@ -48,7 +49,8 @@ public interface IBreadCrumbModelListener extends EventListener, IClusterable
* @param breadCrumbParticipant
* The new bread crumb
*/
- void breadCrumbAdded(IBreadCrumbParticipant breadCrumbParticipant);
+ default void breadCrumbAdded(IBreadCrumbParticipant breadCrumbParticipant)
+ {}
/**
* Called when a bread crumb was removed from the model.
@@ -56,5 +58,6 @@ public interface IBreadCrumbModelListener extends EventListener, IClusterable
* @param breadCrumbParticipant
* The bread crumb that was removed
*/
- void breadCrumbRemoved(IBreadCrumbParticipant breadCrumbParticipant);
+ default void breadCrumbRemoved(IBreadCrumbParticipant breadCrumbParticipant)
+ {}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/ab1f3c73/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModelListener.java
----------------------------------------------------------------------
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModelListener.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModelListener.java
index b0638f8..c8d676f 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModelListener.java
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModelListener.java
@@ -31,15 +31,18 @@ public interface IWizardModelListener extends IClusterable
* @param newStep
* The new step
*/
- void onActiveStepChanged(IWizardStep newStep);
+ default void onActiveStepChanged(IWizardStep newStep)
+ {}
/**
* Called when the wizard was cancelled.
*/
- void onCancel();
+ default void onCancel()
+ {}
/**
- * Called when the wizard finished succesfully.
+ * Called when the wizard finished successfully.
*/
- void onFinish();
-}
\ No newline at end of file
+ default void onFinish()
+ {}
+}