You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2016/04/02 15:12:44 UTC

[2/3] wicket git commit: moved all static factory methods to end of class

moved all static factory methods to end of class


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/8a735de3
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/8a735de3
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/8a735de3

Branch: refs/heads/master
Commit: 8a735de30aecaeda517371787fb1dd7ae62fd663
Parents: 77b4df6
Author: Sven Meier <sv...@apache.org>
Authored: Fri Apr 1 14:55:15 2016 +0200
Committer: Sven Meier <sv...@apache.org>
Committed: Sat Apr 2 09:53:57 2016 +0200

----------------------------------------------------------------------
 .../wicket/ajax/AbstractAjaxTimerBehavior.java  | 28 ++++----
 .../wicket/ajax/AjaxClientInfoBehavior.java     | 26 ++++----
 .../form/AjaxFormComponentUpdatingBehavior.java | 41 ++++++------
 .../ajax/markup/html/form/AjaxButton.java       | 40 +++++------
 .../ajax/markup/html/form/AjaxSubmitLink.java   | 70 ++++++++++----------
 .../java/org/apache/wicket/lambda/Lambdas.java  |  2 +-
 .../apache/wicket/markup/html/link/Link.java    | 30 ++++-----
 7 files changed, 118 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/8a735de3/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
index 239d047..7e99c46 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
@@ -164,20 +164,6 @@ public abstract class AbstractAjaxTimerBehavior extends AbstractDefaultAjaxBehav
 	protected abstract void onTimer(final AjaxRequestTarget target);
 
 	/**
-	 * Creates an {@link AbstractAjaxTimerBehavior} based on lambda expressions
-	 * 
-	 * @param interval
-	 *            the interval the timer
-	 * @param onTimer
-	 *            the consumer which accepts the {@link AjaxRequestTarget}
-	 * @return the {@link AbstractAjaxTimerBehavior}
-	 */
-	public static AbstractAjaxTimerBehavior onTimer(Duration interval, WicketConsumer<AjaxRequestTarget> onTimer)
-	{
-		return Lambdas.onTimer(interval, onTimer);
-	}
-
-	/**
 	 * @return {@code true} if has been stopped via {@link #stop(IPartialPageRequestHandler)}
 	 */
 	public final boolean isStopped()
@@ -263,4 +249,18 @@ public abstract class AbstractAjaxTimerBehavior extends AbstractDefaultAjaxBehav
 			clearTimeout(target.getHeaderResponse());
 		}
 	}
+
+	/**
+	 * Creates an {@link AbstractAjaxTimerBehavior} based on lambda expressions
+	 *
+	 * @param interval
+	 *            the interval the timer
+	 * @param onTimer
+	 *            the consumer which accepts the {@link AjaxRequestTarget}
+	 * @return the {@link AbstractAjaxTimerBehavior}
+	 */
+	public static AbstractAjaxTimerBehavior onTimer(Duration interval, WicketConsumer<AjaxRequestTarget> onTimer)
+	{
+		return Lambdas.onTimer(interval, onTimer);
+	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/8a735de3/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java
index a76ef7e..0bebf14 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java
@@ -122,19 +122,6 @@ public class AjaxClientInfoBehavior extends AbstractAjaxTimerBehavior
 	{
 	}
 
-	/**
-	 * Creates an {@link AjaxClientInfoBehavior} based on lambda expressions
-	 * 
-	 * @param onClientInfo
-	 *            the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the
-	 *            {@link WebClientInfo}
-	 * @return the {@link AjaxClientInfoBehavior}
-	 */
-	public static AjaxClientInfoBehavior onClientInfo(WicketBiConsumer<AjaxRequestTarget, WebClientInfo> onClientInfo)
-	{
-		return Lambdas.onClientInfo(onClientInfo);
-	}
-
 	@Override
 	protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
 	{
@@ -150,4 +137,17 @@ public class AjaxClientInfoBehavior extends AbstractAjaxTimerBehavior
 
 		response.render(JavaScriptHeaderItem.forReference(BrowserInfoForm.JS));
 	}
+
+	/**
+	 * Creates an {@link AjaxClientInfoBehavior} based on lambda expressions
+	 *
+	 * @param onClientInfo
+	 *            the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the
+	 *            {@link WebClientInfo}
+	 * @return the {@link AjaxClientInfoBehavior}
+	 */
+	public static AjaxClientInfoBehavior onClientInfo(WicketBiConsumer<AjaxRequestTarget, WebClientInfo> onClientInfo)
+	{
+		return Lambdas.onClientInfo(onClientInfo);
+	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/8a735de3/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java
index 93a4fed..c4fe486 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java
@@ -202,6 +202,25 @@ public abstract class AjaxFormComponentUpdatingBehavior extends AjaxEventBehavio
 	 */
 	protected abstract void onUpdate(AjaxRequestTarget target);
 
+	/**
+	 * Called to handle any error resulting from updating form component. Errors thrown from
+	 * {@link #onUpdate(org.apache.wicket.ajax.AjaxRequestTarget)} will not be caught here.
+	 *
+	 * The RuntimeException will be null if it was just a validation or conversion error of the
+	 * FormComponent
+	 *
+	 * @param target
+	 *            the current request handler
+	 * @param e
+	 *            the error that occurred during the update of the component
+	 */
+	protected void onError(AjaxRequestTarget target, RuntimeException e)
+	{
+		if (e != null)
+		{
+			throw e;
+		}
+	}
 
 	/**
 	 * Creates an {@link AjaxFormComponentUpdatingBehavior} based on lambda expressions
@@ -235,24 +254,4 @@ public abstract class AjaxFormComponentUpdatingBehavior extends AjaxEventBehavio
 	{
 		return Lambdas.onUpdate(eventName, onUpdate, onError);
 	}
-
-	/**
-	 * Called to handle any error resulting from updating form component. Errors thrown from
-	 * {@link #onUpdate(org.apache.wicket.ajax.AjaxRequestTarget)} will not be caught here.
-	 * 
-	 * The RuntimeException will be null if it was just a validation or conversion error of the
-	 * FormComponent
-	 * 
-	 * @param target
-	 *            the current request handler
-	 * @param e
-	 *            the error that occurred during the update of the component
-	 */
-	protected void onError(AjaxRequestTarget target, RuntimeException e)
-	{
-		if (e != null)
-		{
-			throw e;
-		}
-	}
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/8a735de3/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
index d975c80..ae61537 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
@@ -220,6 +220,26 @@ public abstract class AjaxButton extends Button
 	}
 
 	/**
+	 * Listener method invoked on form submit with no errors, after {@link Form#onSubmit()}.
+	 *
+	 * @param target
+	 * @param form
+	 */
+	protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form)
+	{
+	}
+
+	/**
+	 * Listener method invoked on form submit with errors
+	 *
+	 * @param target
+	 * @param form
+	 */
+	protected void onError(AjaxRequestTarget target, Form<?> form)
+	{
+	}
+
+	/**
 	 * Creates an {@link AjaxButton} based on lambda expressions
 	 * 
 	 * @param id
@@ -253,24 +273,4 @@ public abstract class AjaxButton extends Button
 	{
 		return Lambdas.ajaxButton(id, onSubmit, onError);
 	}
-
-	/**
-	 * Listener method invoked on form submit with no errors, after {@link Form#onSubmit()}.
-	 * 
-	 * @param target
-	 * @param form
-	 */
-	protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form)
-	{
-	}
-
-	/**
-	 * Listener method invoked on form submit with errors
-	 * 
-	 * @param target
-	 * @param form
-	 */
-	protected void onError(AjaxRequestTarget target, Form<?> form)
-	{
-	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/8a735de3/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
index 17303bc..b9333d3 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
@@ -144,41 +144,6 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink
 	{
 	}
 
-	/**
-	 * Creates an {@link AjaxSubmitLink} based on lambda expressions
-	 * 
-	 * @param id
-	 *            the id of ajax submit link
-	 * @param onSubmit
-	 *            the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the
-	 *            {@link Form}
-	 * @return the {@link AjaxSubmitLink}
-	 */
-	public static AjaxSubmitLink ajaxSubmitLink(String id, WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit)
-	{
-		return Lambdas.ajaxSubmitLink(id, onSubmit);
-	}
-
-	/**
-	 * Creates an {@link AjaxSubmitLink} based on lambda expressions
-	 * 
-	 * @param id
-	 *            the id of ajax submit link
-	 * @param onSubmit
-	 *            the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the
-	 *            {@link Form}
-	 * @param onError
-	 *            the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the
-	 *            {@link Form}
-	 * @return the {@link AjaxSubmitLink}
-	 */
-	public static AjaxSubmitLink ajaxSubmitLink(String id,
-	                                            WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit,
-	                                            WicketBiConsumer<AjaxRequestTarget, Form<?>> onError)
-	{
-		return Lambdas.ajaxSubmitLink(id, onSubmit, onError);
-	}
-
 	protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
 	{
 	}
@@ -257,4 +222,39 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink
 	{
 		logger.warn("unexpected invocation of #onAfterSubmit() on {}", this);
 	}
+
+	/**
+	 * Creates an {@link AjaxSubmitLink} based on lambda expressions
+	 *
+	 * @param id
+	 *            the id of ajax submit link
+	 * @param onSubmit
+	 *            the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the
+	 *            {@link Form}
+	 * @return the {@link AjaxSubmitLink}
+	 */
+	public static AjaxSubmitLink ajaxSubmitLink(String id, WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit)
+	{
+		return Lambdas.ajaxSubmitLink(id, onSubmit);
+	}
+
+	/**
+	 * Creates an {@link AjaxSubmitLink} based on lambda expressions
+	 *
+	 * @param id
+	 *            the id of ajax submit link
+	 * @param onSubmit
+	 *            the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the
+	 *            {@link Form}
+	 * @param onError
+	 *            the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the
+	 *            {@link Form}
+	 * @return the {@link AjaxSubmitLink}
+	 */
+	public static AjaxSubmitLink ajaxSubmitLink(String id,
+	                                            WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit,
+	                                            WicketBiConsumer<AjaxRequestTarget, Form<?>> onError)
+	{
+		return Lambdas.ajaxSubmitLink(id, onSubmit, onError);
+	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/8a735de3/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java b/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java
index 0b8f27a..d0a6f92 100644
--- a/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java
+++ b/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java
@@ -167,7 +167,7 @@ public class Lambdas
 	 *            the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget}
 	 * @return the {@link AbstractAjaxTimerBehavior}
 	 */
-	public static AbstractAjaxTimerBehavior onSelfUpdate(Duration interval,
+	public static AjaxSelfUpdatingTimerBehavior onSelfUpdate(Duration interval,
 		WicketConsumer<AjaxRequestTarget> onTimer)
 	{
 		Args.notNull(onTimer, "onTimer");

http://git-wip-us.apache.org/repos/asf/wicket/blob/8a735de3/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java
index af30cff..58e0047 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java
@@ -178,20 +178,6 @@ public abstract class Link<T> extends AbstractLink implements ILinkListener, IGe
 	public abstract void onClick();
 
 	/**
-	 * Creates a {@link Link} based on lambda expressions
-	 * 
-	 * @param id
-	 *            the id of the link
-	 * @param onClick
-	 *            the {@link WicketConsumer} which accepts the {@link Void}
-	 * @return the {@link Link}
-	 */
-	public static <T> Link<T> onClick(String id, WicketConsumer<Void> onClick)
-	{
-		return Lambdas.link(id, onClick);
-	}
-
-	/**
 	 * THIS METHOD IS NOT PART OF THE WICKET API. DO NOT ATTEMPT TO OVERRIDE OR CALL IT.
 	 * 
 	 * Called when a link is clicked. The implementation of this method is currently to simply call
@@ -433,4 +419,18 @@ public abstract class Link<T> extends AbstractLink implements ILinkListener, IGe
 			disableLink(tag);
 		}
 	}
-}
+
+	/**
+	 * Creates a {@link Link} based on lambda expressions
+	 *
+	 * @param id
+	 *            the id of the link
+	 * @param onClick
+	 *            the {@link WicketConsumer} which accepts the {@link Void}
+	 * @return the {@link Link}
+	 */
+	public static <T> Link<T> onClick(String id, WicketConsumer<Void> onClick)
+	{
+		return Lambdas.link(id, onClick);
+	}
+}
\ No newline at end of file