On Sat, Mar 12, 2016 at 10:46 PM, Sven Meier <[email protected]> wrote:

> Hi,
>
> > org.apache.wicket.lambdas
>
> IMHO org.apache.wicket.lambda (not the singular) would be better: it
> aligns with org.apache.wicket.model.lambda and follows other package
> namings.
>

Done!


>
> > Lambdas
>
> What's the purpose of this class - is it supposed to ease static imports
> in an IDE?
>

Yes, static imports.
One can statically import Lambdas.ajaxLink or Lambdas.* and then use it
like:

add(ajaxLink("someId", this::onSomething));

The static method in AjaxLink is named "onClick" though.
The idea here is:
add(AjaxLink.onEvent("someId", this::onSomething))


> I'd rather keep all those implementations in the relevant classes, instead
> of this single location. If you see the need for such a 'collector', we
> could reverse the delegation:
>

I've moved them in one place because all those methods share the same
purpose.
I don't mind to move them back though.


> public class Lambdas {
>
>     public static AjaxSelfUpdatingTimerBehavior onSelfUpdate(Duration
> interval, WicketConsumer<AjaxRequestTarget> onTimer)
>     {
>         return AjaxSelfUpdatingTimerBehavior.onSelfUpdate(interval,
> onTimer);
>     }
>
> }
>
> In this case I think a plural makes sense though.
>
> Regards
> Sven
>

I also want to check out Martijn's Lambdas class that he proposed a while
back but didn't commit it due to some problems in javac vs. Eclipse
compiler.

Thanks!


>
>
> On 12.03.2016 21:51, [email protected] wrote:
>
>> Repository: wicket
>> Updated Branches:
>>    refs/heads/static-factories-for-lambdas 229fee822 -> d3bee7507
>>
>>
>> Introduce Lambdas class - a class with factory methods for creating
>> components and behaviors by using lambdas for their callback methods
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d3bee750
>> Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d3bee750
>> Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d3bee750
>>
>> Branch: refs/heads/static-factories-for-lambdas
>> Commit: d3bee7507e14e7a1dc8ba9e9a0c77e02bffacda6
>> Parents: 229fee8
>> Author: Martin Tzvetanov Grigorov <[email protected]>
>> Authored: Sat Mar 12 21:50:13 2016 +0100
>> Committer: Martin Tzvetanov Grigorov <[email protected]>
>> Committed: Sat Mar 12 21:50:13 2016 +0100
>>
>> ----------------------------------------------------------------------
>>   .../wicket/ajax/AbstractAjaxTimerBehavior.java  |  15 +-
>>   .../wicket/ajax/AjaxClientInfoBehavior.java     |  15 +-
>>   .../apache/wicket/ajax/AjaxEventBehavior.java   |  14 +-
>>   .../ajax/AjaxNewWindowNotifyingBehavior.java    |  24 +-
>>   .../ajax/AjaxSelfUpdatingTimerBehavior.java     |  15 +-
>>   ...AjaxFormChoiceComponentUpdatingBehavior.java |  34 +-
>>   .../form/AjaxFormComponentUpdatingBehavior.java |  35 +-
>>   .../ajax/form/AjaxFormSubmitBehavior.java       |  33 +-
>>   .../wicket/ajax/form/OnChangeAjaxBehavior.java  |  35 +-
>>   .../ajax/markup/html/AjaxFallbackLink.java      |   2 -
>>   .../wicket/ajax/markup/html/AjaxLink.java       |  17 +-
>>   .../ajax/markup/html/form/AjaxButton.java       |  40 +-
>>   .../ajax/markup/html/form/AjaxCheckBox.java     |  17 +-
>>   .../ajax/markup/html/form/AjaxSubmitLink.java   |  33 +-
>>   .../java/org/apache/wicket/lambdas/Lambdas.java | 366
>> +++++++++++++++++++
>>   .../apache/wicket/lambdas/WicketBiConsumer.java |  32 ++
>>   .../apache/wicket/lambdas/WicketConsumer.java   |  30 ++
>>   .../apache/wicket/lambdas/WicketFunction.java   |  32 ++
>>   .../apache/wicket/lambdas/WicketSupplier.java   |  30 ++
>>   .../apache/wicket/markup/html/link/Link.java    |  17 +-
>>   .../java/org/apache/wicket/model/Model.java     |  41 +++
>>   .../apache/wicket/model/lambda/LambdaModel.java |   7 +-
>>   .../model/lambda/SupplierCachingModel.java      |   1 +
>>   .../wicket/model/lambda/SupplierModel.java      |   1 +
>>   .../wicket/model/lambda/WicketBiConsumer.java   |  32 --
>>   .../wicket/model/lambda/WicketConsumer.java     |  30 --
>>   .../wicket/model/lambda/WicketFunction.java     |  32 --
>>   .../wicket/model/lambda/WicketSupplier.java     |  30 --
>>   .../wicket/model/lambda/LambdaModelTest.java    |   2 +
>>   .../model/lambda/SupplierCachingModelTest.java  |   1 +
>>   .../wicket/model/lambda/SupplierModelTest.java  |   1 +
>>   .../ajax/markup/html/IndicatingAjaxButton.java  |   9 +-
>>   .../ajax/markup/html/IndicatingAjaxLink.java    |   2 +-
>>   33 files changed, 603 insertions(+), 422 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/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 aef5591..4a3609c 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
>> @@ -19,10 +19,10 @@ package org.apache.wicket.ajax;
>>   import org.apache.wicket.Component;
>>   import org.apache.wicket.Page;
>>   import
>> org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.markup.head.IHeaderResponse;
>>   import org.apache.wicket.markup.head.OnLoadHeaderItem;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>   import org.apache.wicket.util.time.Duration;
>>     /**
>> @@ -165,16 +165,7 @@ public abstract class AbstractAjaxTimerBehavior
>> extends AbstractDefaultAjaxBehav
>>         public static AbstractAjaxTimerBehavior onTimer(Duration
>> interval, WicketConsumer<AjaxRequestTarget> onTimer)
>>         {
>> -               Args.notNull(onTimer, "onTimer");
>> -
>> -               return new AbstractAjaxTimerBehavior(interval)
>> -               {
>> -                       @Override
>> -                       protected void onTimer(AjaxRequestTarget target)
>> -                       {
>> -                               onTimer.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.onTimer(interval, onTimer);
>>         }
>>         /**
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/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 22c9316..bd7c954 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
>> @@ -19,15 +19,15 @@ package org.apache.wicket.ajax;
>>   import org.apache.wicket.Component;
>>   import org.apache.wicket.Session;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketBiConsumer;
>>   import org.apache.wicket.markup.head.IHeaderResponse;
>>   import org.apache.wicket.markup.head.JavaScriptHeaderItem;
>>   import org.apache.wicket.markup.html.pages.BrowserInfoForm;
>> -import org.apache.wicket.model.lambda.WicketBiConsumer;
>>   import org.apache.wicket.protocol.http.ClientProperties;
>>   import org.apache.wicket.protocol.http.request.WebClientInfo;
>>   import org.apache.wicket.request.IRequestParameters;
>>   import org.apache.wicket.request.cycle.RequestCycle;
>> -import org.apache.wicket.util.lang.Args;
>>   import org.apache.wicket.util.time.Duration;
>>     /**
>> @@ -122,16 +122,7 @@ public class AjaxClientInfoBehavior extends
>> AbstractAjaxTimerBehavior
>>         public static AjaxClientInfoBehavior
>> onClientInfo(WicketBiConsumer<AjaxRequestTarget, WebClientInfo>
>> onClientInfo)
>>         {
>> -               Args.notNull(onClientInfo, "onClientInfo");
>> -
>> -               return new AjaxClientInfoBehavior()
>> -               {
>> -                       @Override
>> -                       protected void onClientInfo(AjaxRequestTarget
>> target, WebClientInfo clientInfo)
>> -                       {
>> -                               onClientInfo.accept(target, clientInfo);
>> -                       }
>> -               };
>> +               return Lambdas.onClientInfo(onClientInfo);
>>         }
>>         @Override
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java
>> index 7a11b2d..fa49035 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java
>> @@ -21,9 +21,10 @@ import java.util.List;
>>     import org.apache.wicket.Component;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.markup.head.IHeaderResponse;
>>   import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>>   import org.apache.wicket.util.lang.Args;
>>   import org.apache.wicket.util.lang.Checks;
>>   import org.apache.wicket.util.string.Strings;
>> @@ -166,15 +167,6 @@ public abstract class AjaxEventBehavior extends
>> AbstractDefaultAjaxBehavior
>>         public static AjaxEventBehavior onEvent(String eventName,
>> WicketConsumer<AjaxRequestTarget> onEvent)
>>         {
>> -               Args.notNull(onEvent, "onEvent");
>> -
>> -               return new AjaxEventBehavior(eventName)
>> -               {
>> -                       @Override
>> -                       protected void onEvent(AjaxRequestTarget target)
>> -                       {
>> -                               onEvent.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.onEvent(eventName, onEvent);
>>         }
>>   }
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java
>> index 932d54e..130666b 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java
>> @@ -21,16 +21,13 @@ import java.util.UUID;
>>   import org.apache.wicket.Component;
>>   import org.apache.wicket.WicketRuntimeException;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.markup.head.IHeaderResponse;
>>   import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
>>   import org.apache.wicket.markup.head.OnLoadHeaderItem;
>>   import org.apache.wicket.markup.html.WebPage;
>> -import org.apache.wicket.model.lambda.WicketBiConsumer;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.protocol.http.request.WebClientInfo;
>> -import org.apache.wicket.util.lang.Args;
>>   import org.apache.wicket.util.string.StringValue;
>> -import org.apache.wicket.util.string.Strings;
>>     /**
>>    * An Ajax behavior that notifies when a new browser window/tab is
>> opened with
>> @@ -133,21 +130,6 @@ public abstract class AjaxNewWindowNotifyingBehavior
>> extends AbstractDefaultAjax
>>         public static AjaxNewWindowNotifyingBehavior onNewWindow(String
>> windowName, WicketConsumer<AjaxRequestTarget> onNewWindow)
>>         {
>> -               Args.notNull(onNewWindow, "onNewWindow");
>> -
>> -               if (Strings.isEmpty(windowName))
>> -               {
>> -                       windowName = UUID.randomUUID().toString();
>> -               }
>> -
>> -               return new AjaxNewWindowNotifyingBehavior(windowName)
>> -               {
>> -                       @Override
>> -                       protected void onNewWindow(AjaxRequestTarget
>> target)
>> -                       {
>> -                               onNewWindow.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.onNewWindow(windowName, onNewWindow);
>>         }
>> -
>>   }
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java
>> index 479a6b9..d615ae5 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java
>> @@ -16,8 +16,8 @@
>>    */
>>   package org.apache.wicket.ajax;
>>   -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.util.lang.Args;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.util.time.Duration;
>>     /**
>> @@ -67,15 +67,6 @@ public class AjaxSelfUpdatingTimerBehavior extends
>> AbstractAjaxTimerBehavior
>>         public static AbstractAjaxTimerBehavior onSelfUpdate(Duration
>> interval, WicketConsumer<AjaxRequestTarget> onTimer)
>>         {
>> -               Args.notNull(onTimer, "onTimer");
>> -
>> -               return new AjaxSelfUpdatingTimerBehavior(interval)
>> -               {
>> -                       @Override
>> -                       protected void
>> onPostProcessTarget(AjaxRequestTarget target)
>> -                       {
>> -                               onTimer.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.onSelfUpdate(interval, onTimer);
>>         }
>>   }
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java
>> index e5bc69a..19915d6 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java
>> @@ -21,14 +21,14 @@ import org.apache.wicket.WicketRuntimeException;
>>   import org.apache.wicket.ajax.AjaxRequestTarget;
>>   import org.apache.wicket.ajax.attributes.AjaxCallListener;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketBiConsumer;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.markup.html.form.CheckBoxMultipleChoice;
>>   import org.apache.wicket.markup.html.form.CheckGroup;
>>   import org.apache.wicket.markup.html.form.FormComponent;
>>   import org.apache.wicket.markup.html.form.RadioChoice;
>>   import org.apache.wicket.markup.html.form.RadioGroup;
>> -import org.apache.wicket.model.lambda.WicketBiConsumer;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>     /**
>>    * This is a Ajax Component Update Behavior that is meant for
>> choices/groups that are not one
>> @@ -114,36 +114,12 @@ public abstract class
>> AjaxFormChoiceComponentUpdatingBehavior extends
>>                         (component instanceof CheckGroup);
>>         }
>>   -
>>         public static AjaxFormChoiceComponentUpdatingBehavior
>> onUpdateChoice(WicketConsumer<AjaxRequestTarget> onUpdateChoice) {
>> -               Args.notNull(onUpdateChoice, "onUpdateChoice");
>> -               return new AjaxFormChoiceComponentUpdatingBehavior()
>> -               {
>> -                       @Override
>> -                       protected void onUpdate(AjaxRequestTarget target)
>> -                       {
>> -                               onUpdateChoice.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.onUpdateChoice(onUpdateChoice);
>>         }
>>         public static AjaxFormChoiceComponentUpdatingBehavior
>> onUpdateChoice(WicketConsumer<AjaxRequestTarget> onUpdateChoice,
>>
>>  WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError) {
>> -               Args.notNull(onUpdateChoice, "onUpdateChoice");
>> -               Args.notNull(onError, "onError");
>> -               return new AjaxFormChoiceComponentUpdatingBehavior()
>> -               {
>> -                       @Override
>> -                       protected void onUpdate(AjaxRequestTarget target)
>> -                       {
>> -                               onUpdateChoice.accept(target);
>> -                       }
>> -
>> -                       @Override
>> -                       protected void onError(AjaxRequestTarget target,
>> RuntimeException e)
>> -                       {
>> -                               onError.accept(target, e);
>> -                       }
>> -               };
>> +               return Lambdas.onUpdateChoice(onUpdateChoice, onError);
>>         }
>>   }
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/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 97b31a3..490afd6 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
>> @@ -23,11 +23,11 @@ import org.apache.wicket.ajax.AjaxEventBehavior;
>>   import org.apache.wicket.ajax.AjaxRequestTarget;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketBiConsumer;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.markup.html.form.FormComponent;
>>   import org.apache.wicket.markup.html.form.validation.IFormValidator;
>> -import org.apache.wicket.model.lambda.WicketBiConsumer;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>   import org.slf4j.Logger;
>>   import org.slf4j.LoggerFactory;
>>   @@ -205,39 +205,14 @@ public abstract class
>> AjaxFormComponentUpdatingBehavior extends AjaxEventBehavio
>>         public static AjaxFormComponentUpdatingBehavior onUpdate(String
>> eventName, WicketConsumer<AjaxRequestTarget> onUpdate)
>>         {
>> -               Args.notNull(onUpdate, "onUpdate");
>> -
>> -               return new AjaxFormComponentUpdatingBehavior(eventName)
>> -               {
>> -                       @Override
>> -                       protected void onUpdate(AjaxRequestTarget target)
>> -                       {
>> -                               onUpdate.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.onUpdate(eventName, onUpdate);
>>         }
>>         public static AjaxFormComponentUpdatingBehavior onUpdate(String
>> eventName,
>>
>>  WicketConsumer<AjaxRequestTarget> onUpdate,
>>
>>  WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError)
>>         {
>> -               Args.notNull(onUpdate, "onUpdate");
>> -               Args.notNull(onError, "onError");
>> -
>> -               return new AjaxFormComponentUpdatingBehavior(eventName)
>> -               {
>> -                       @Override
>> -                       protected void onUpdate(AjaxRequestTarget target)
>> -                       {
>> -                               onUpdate.accept(target);
>> -                       }
>> -
>> -                       @Override
>> -                       protected void onError(AjaxRequestTarget target,
>> RuntimeException e)
>> -                       {
>> -                               onError.accept(target, e);
>> -                       }
>> -               };
>> +               return onUpdate(eventName, onUpdate, onError);
>>         }
>>         /**
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
>> index 7b7c4a0..7011481 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
>> @@ -21,12 +21,12 @@ import org.apache.wicket.ajax.AjaxEventBehavior;
>>   import org.apache.wicket.ajax.AjaxRequestTarget;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.markup.html.form.Button;
>>   import org.apache.wicket.markup.html.form.Form;
>>   import org.apache.wicket.markup.html.form.IFormSubmitter;
>>   import org.apache.wicket.markup.html.form.IFormSubmittingComponent;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>     /**
>>    * Ajax event behavior that submits a form via ajax when the event it
>> is attached to, is invoked.
>> @@ -272,37 +272,12 @@ public abstract class AjaxFormSubmitBehavior
>> extends AjaxEventBehavior
>>         public static AjaxFormSubmitBehavior onSubmit(String eventName,
>> WicketConsumer<AjaxRequestTarget> onSubmit)
>>         {
>> -               Args.notNull(onSubmit, "onSubmit");
>> -
>> -               return new AjaxFormSubmitBehavior(eventName)
>> -               {
>> -                       @Override
>> -                       protected void onSubmit(AjaxRequestTarget target)
>> -                       {
>> -                               onSubmit.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.onSubmit(eventName, onSubmit);
>>         }
>>         public static AjaxFormSubmitBehavior onSubmit(String eventName,
>>
>> WicketConsumer<AjaxRequestTarget> onSubmit,
>>
>> WicketConsumer<AjaxRequestTarget> onError) {
>> -               Args.notNull(onSubmit, "onSubmit");
>> -               Args.notNull(onError, "onError");
>> -
>> -               return new AjaxFormSubmitBehavior(eventName)
>> -               {
>> -                       @Override
>> -                       protected void onSubmit(AjaxRequestTarget target)
>> -                       {
>> -                               onSubmit.accept(target);
>> -                       }
>> -
>> -                       @Override
>> -                       protected void onError(AjaxRequestTarget target)
>> -                       {
>> -                               onError.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.onSubmit(eventName, onSubmit, onError);
>>         }
>>   }
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java
>> index e1f2d9b..01c07a8 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java
>> @@ -19,12 +19,12 @@ package org.apache.wicket.ajax.form;
>>   import org.apache.wicket.Component;
>>   import org.apache.wicket.ajax.AjaxRequestTarget;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketBiConsumer;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.markup.html.form.FormComponent;
>>   import org.apache.wicket.markup.html.form.TextArea;
>>   import org.apache.wicket.markup.html.form.TextField;
>> -import org.apache.wicket.model.lambda.WicketBiConsumer;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>     /**
>>    * A behavior that updates the hosting {@link FormComponent} via Ajax
>> when value of the component is
>> @@ -80,38 +80,13 @@ public abstract class OnChangeAjaxBehavior extends
>> AjaxFormComponentUpdatingBeha
>>         public static OnChangeAjaxBehavior
>> onChange(WicketConsumer<AjaxRequestTarget> onChange)
>>         {
>> -               Args.notNull(onChange, "onChange");
>> -
>> -               return new OnChangeAjaxBehavior()
>> -               {
>> -                       @Override
>> -                       protected void onUpdate(AjaxRequestTarget target)
>> -                       {
>> -                               onChange.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.onChange(onChange);
>>         }
>>         public static OnChangeAjaxBehavior
>> onChange(WicketConsumer<AjaxRequestTarget> onChange,
>>
>> WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError)
>>         {
>> -               Args.notNull(onChange, "onChange");
>> -               Args.notNull(onError, "onError");
>> -
>> -               return new OnChangeAjaxBehavior()
>> -               {
>> -                       @Override
>> -                       protected void onUpdate(AjaxRequestTarget target)
>> -                       {
>> -                               onChange.accept(target);
>> -                       }
>> -
>> -                       @Override
>> -                       protected void onError(AjaxRequestTarget target,
>> RuntimeException e)
>> -                       {
>> -                               onError.accept(target, e);
>> -                       }
>> -               };
>> +               return Lambdas.onChange(onChange, onError);
>>         }
>>     }
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
>> index 29ccb99..d4f95a3 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
>> @@ -24,8 +24,6 @@ import
>> org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>>   import org.apache.wicket.markup.ComponentTag;
>>   import org.apache.wicket.markup.html.link.Link;
>>   import org.apache.wicket.model.IModel;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>     /**
>>    * An ajax link that will degrade to a normal request if ajax is not
>> available or javascript is
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java
>> index bf3d4d5..1907f58 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java
>> @@ -20,11 +20,11 @@ import org.apache.wicket.IGenericComponent;
>>   import org.apache.wicket.ajax.AjaxEventBehavior;
>>   import org.apache.wicket.ajax.AjaxRequestTarget;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.markup.ComponentTag;
>>   import org.apache.wicket.markup.html.link.AbstractLink;
>>   import org.apache.wicket.model.IModel;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>     /**
>>    * A component that allows a trigger request to be triggered via html
>> anchor tag
>> @@ -135,17 +135,8 @@ public abstract class AjaxLink<T> extends
>> AbstractLink implements IAjaxLink, IGe
>>         @Override
>>         public abstract void onClick(final AjaxRequestTarget target);
>>   -     public static <T> AjaxLink<T> ajaxLink(String id,
>> WicketConsumer<AjaxRequestTarget> onClick)
>> +       public static <T> AjaxLink<T> onClick(String id,
>> WicketConsumer<AjaxRequestTarget> onClick)
>>         {
>> -               Args.notNull(onClick, "onClick");
>> -
>> -               return new AjaxLink<T>(id)
>> -               {
>> -                       @Override
>> -                       public void onClick(AjaxRequestTarget target)
>> -                       {
>> -                               onClick.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.ajaxLink(id, onClick);
>>         }
>>   }
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/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 ce2fcf7..9d3732f 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
>> @@ -19,12 +19,12 @@ package org.apache.wicket.ajax.markup.html.form;
>>   import org.apache.wicket.ajax.AjaxRequestTarget;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>>   import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketBiConsumer;
>>   import org.apache.wicket.markup.ComponentTag;
>>   import org.apache.wicket.markup.html.form.Button;
>>   import org.apache.wicket.markup.html.form.Form;
>>   import org.apache.wicket.model.IModel;
>> -import org.apache.wicket.model.lambda.WicketBiConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>   import org.slf4j.Logger;
>>   import org.slf4j.LoggerFactory;
>>   @@ -219,40 +219,16 @@ public abstract class AjaxButton extends Button
>>         {
>>         }
>>   -     public static AjaxButton ajaxButton(String id,
>> WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit)
>> +       public static AjaxButton onSubmit(String id,
>> WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit)
>>         {
>> -               Args.notNull(onSubmit, "onSubmit");
>> -
>> -               return new AjaxButton(id)
>> -               {
>> -                       @Override
>> -                       public void onSubmit(AjaxRequestTarget target,
>> Form<?> form)
>> -                       {
>> -                               onSubmit.accept(target, form);
>> -                       }
>> -               };
>> +               return Lambdas.ajaxButton(id, onSubmit);
>>         }
>>   -     public static AjaxButton ajaxButton(String id,
>> WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit,
>> -
>>  WicketBiConsumer<AjaxRequestTarget, Form<?>> onError)
>> +       public static AjaxButton onSubmit(String id,
>> +
>>  WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit,
>> +
>>  WicketBiConsumer<AjaxRequestTarget, Form<?>> onError)
>>         {
>> -               Args.notNull(onSubmit, "onSubmit");
>> -               Args.notNull(onError, "onError");
>> -
>> -               return new AjaxButton(id)
>> -               {
>> -                       @Override
>> -                       public void onSubmit(AjaxRequestTarget target,
>> Form<?> form)
>> -                       {
>> -                               onSubmit.accept(target, form);
>> -                       }
>> -
>> -                       @Override
>> -                       protected void onError(AjaxRequestTarget target,
>> Form<?> form)
>> -                       {
>> -                               onError.accept(target, form);
>> -                       }
>> -               };
>> +               return Lambdas.ajaxButton(id, onSubmit, onError);
>>         }
>>         /**
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java
>> index 54e8b3d..5dba68e 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java
>> @@ -19,10 +19,10 @@ package org.apache.wicket.ajax.markup.html.form;
>>   import org.apache.wicket.ajax.AjaxRequestTarget;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>>   import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketConsumer;
>>   import org.apache.wicket.markup.html.form.CheckBox;
>>   import org.apache.wicket.model.IModel;
>> -import org.apache.wicket.model.lambda.WicketConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>     /**
>>    * A CheckBox which is updated via ajax when the user changes its value
>> @@ -92,17 +92,8 @@ public abstract class AjaxCheckBox extends CheckBox
>>          */
>>         protected abstract void onUpdate(AjaxRequestTarget target);
>>   -     public static AjaxCheckBox ajaxCheckBox(String id,
>> WicketConsumer<AjaxRequestTarget> onUpdate)
>> +       public static AjaxCheckBox onUpdate(String id,
>> WicketConsumer<AjaxRequestTarget> onUpdate)
>>         {
>> -               Args.notNull(onUpdate, "onUpdate");
>> -
>> -               return new AjaxCheckBox(id)
>> -               {
>> -                       @Override
>> -                       public void onUpdate(AjaxRequestTarget target)
>> -                       {
>> -                               onUpdate.accept(target);
>> -                       }
>> -               };
>> +               return Lambdas.ajaxCheckBox(id, onUpdate);
>>         }
>>   }
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/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 f369bf6..552f64c 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
>> @@ -19,11 +19,11 @@ package org.apache.wicket.ajax.markup.html.form;
>>   import org.apache.wicket.ajax.AjaxRequestTarget;
>>   import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
>>   import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
>> +import org.apache.wicket.lambdas.Lambdas;
>> +import org.apache.wicket.lambdas.WicketBiConsumer;
>>   import org.apache.wicket.markup.ComponentTag;
>>   import org.apache.wicket.markup.html.form.AbstractSubmitLink;
>>   import org.apache.wicket.markup.html.form.Form;
>> -import org.apache.wicket.model.lambda.WicketBiConsumer;
>> -import org.apache.wicket.util.lang.Args;
>>   import org.slf4j.Logger;
>>   import org.slf4j.LoggerFactory;
>>   @@ -138,39 +138,14 @@ public abstract class AjaxSubmitLink extends
>> AbstractSubmitLink
>>         public static AjaxSubmitLink ajaxSubmitLink(String id,
>> WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit)
>>         {
>> -               Args.notNull(onSubmit, "onSubmit");
>> -
>> -               return new AjaxSubmitLink(id)
>> -               {
>> -                       @Override
>> -                       public void onSubmit(AjaxRequestTarget target,
>> Form<?> form)
>> -                       {
>> -                               onSubmit.accept(target, form);
>> -                       }
>> -               };
>> +               return Lambdas.ajaxSubmitLink(id, onSubmit);
>>         }
>>         public static AjaxSubmitLink ajaxSubmitLink(String id,
>>
>> WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit,
>>
>> WicketBiConsumer<AjaxRequestTarget, Form<?>> onError)
>>         {
>> -               Args.notNull(onSubmit, "onSubmit");
>> -               Args.notNull(onError, "onError");
>> -
>> -               return new AjaxSubmitLink(id)
>> -               {
>> -                       @Override
>> -                       public void onSubmit(AjaxRequestTarget target,
>> Form<?> form)
>> -                       {
>> -                               onSubmit.accept(target, form);
>> -                       }
>> -
>> -                       @Override
>> -                       protected void onError(AjaxRequestTarget target,
>> Form<?> form)
>> -                       {
>> -                               onError.accept(target, form);
>> -                       }
>> -               };
>> +               return Lambdas.ajaxSubmitLink(id, onSubmit, onError);
>>         }
>>         protected void updateAjaxAttributes(AjaxRequestAttributes
>> attributes)
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/lambdas/Lambdas.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/lambdas/Lambdas.java
>> b/wicket-core/src/main/java/org/apache/wicket/lambdas/Lambdas.java
>> new file mode 100644
>> index 0000000..0397706
>> --- /dev/null
>> +++ b/wicket-core/src/main/java/org/apache/wicket/lambdas/Lambdas.java
>> @@ -0,0 +1,366 @@
>> +package org.apache.wicket.lambdas;
>> +
>> +import java.util.UUID;
>> +
>> +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
>> +import org.apache.wicket.ajax.AjaxClientInfoBehavior;
>> +import org.apache.wicket.ajax.AjaxEventBehavior;
>> +import org.apache.wicket.ajax.AjaxNewWindowNotifyingBehavior;
>> +import org.apache.wicket.ajax.AjaxRequestTarget;
>> +import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
>> +import
>> org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
>> +import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
>> +import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
>> +import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
>> +import org.apache.wicket.ajax.markup.html.AjaxLink;
>> +import org.apache.wicket.ajax.markup.html.form.AjaxButton;
>> +import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
>> +import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
>> +import org.apache.wicket.markup.html.form.Form;
>> +import org.apache.wicket.markup.html.link.Link;
>> +import org.apache.wicket.protocol.http.request.WebClientInfo;
>> +import org.apache.wicket.util.lang.Args;
>> +import org.apache.wicket.util.string.Strings;
>> +import org.apache.wicket.util.time.Duration;
>> +
>> +/**
>> + *
>> + */
>> +public class Lambdas
>> +{
>> +       public static AbstractAjaxTimerBehavior onTimer(Duration
>> interval, WicketConsumer<AjaxRequestTarget> onTimer)
>> +       {
>> +               Args.notNull(onTimer, "onTimer");
>> +
>> +               return new AbstractAjaxTimerBehavior(interval)
>> +               {
>> +                       @Override
>> +                       protected void onTimer(AjaxRequestTarget target)
>> +                       {
>> +                               onTimer.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxClientInfoBehavior
>> onClientInfo(WicketBiConsumer<AjaxRequestTarget, WebClientInfo>
>> onClientInfo)
>> +       {
>> +               Args.notNull(onClientInfo, "onClientInfo");
>> +
>> +               return new AjaxClientInfoBehavior()
>> +               {
>> +                       @Override
>> +                       protected void onClientInfo(AjaxRequestTarget
>> target, WebClientInfo clientInfo)
>> +                       {
>> +                               onClientInfo.accept(target, clientInfo);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxEventBehavior onEvent(String eventName,
>> WicketConsumer<AjaxRequestTarget> onEvent)
>> +       {
>> +               Args.notNull(onEvent, "onEvent");
>> +
>> +               return new AjaxEventBehavior(eventName)
>> +               {
>> +                       @Override
>> +                       protected void onEvent(AjaxRequestTarget target)
>> +                       {
>> +                               onEvent.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxNewWindowNotifyingBehavior onNewWindow(String
>> windowName, WicketConsumer<AjaxRequestTarget> onNewWindow)
>> +       {
>> +               Args.notNull(onNewWindow, "onNewWindow");
>> +
>> +               if (Strings.isEmpty(windowName))
>> +               {
>> +                       windowName = UUID.randomUUID().toString();
>> +               }
>> +
>> +               return new AjaxNewWindowNotifyingBehavior(windowName)
>> +               {
>> +                       @Override
>> +                       protected void onNewWindow(AjaxRequestTarget
>> target)
>> +                       {
>> +                               onNewWindow.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AbstractAjaxTimerBehavior onSelfUpdate(Duration
>> interval, WicketConsumer<AjaxRequestTarget> onTimer)
>> +       {
>> +               Args.notNull(onTimer, "onTimer");
>> +
>> +               return new AjaxSelfUpdatingTimerBehavior(interval)
>> +               {
>> +                       @Override
>> +                       protected void
>> onPostProcessTarget(AjaxRequestTarget target)
>> +                       {
>> +                               onTimer.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +
>> +       public static AjaxFormChoiceComponentUpdatingBehavior
>> onUpdateChoice(WicketConsumer<AjaxRequestTarget> onUpdateChoice) {
>> +               Args.notNull(onUpdateChoice, "onUpdateChoice");
>> +               return new AjaxFormChoiceComponentUpdatingBehavior()
>> +               {
>> +                       @Override
>> +                       protected void onUpdate(AjaxRequestTarget target)
>> +                       {
>> +                               onUpdateChoice.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxFormChoiceComponentUpdatingBehavior
>> onUpdateChoice(WicketConsumer<AjaxRequestTarget> onUpdateChoice,
>> +
>>     WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError) {
>> +               Args.notNull(onUpdateChoice, "onUpdateChoice");
>> +               Args.notNull(onError, "onError");
>> +               return new AjaxFormChoiceComponentUpdatingBehavior()
>> +               {
>> +                       @Override
>> +                       protected void onUpdate(AjaxRequestTarget target)
>> +                       {
>> +                               onUpdateChoice.accept(target);
>> +                       }
>> +
>> +                       @Override
>> +                       protected void onError(AjaxRequestTarget target,
>> RuntimeException e)
>> +                       {
>> +                               onError.accept(target, e);
>> +                       }
>> +               };
>> +       }
>> +
>> +
>> +       public static AjaxFormComponentUpdatingBehavior onUpdate(String
>> eventName, WicketConsumer<AjaxRequestTarget> onUpdate)
>> +       {
>> +               Args.notNull(onUpdate, "onUpdate");
>> +
>> +               return new AjaxFormComponentUpdatingBehavior(eventName)
>> +               {
>> +                       @Override
>> +                       protected void onUpdate(AjaxRequestTarget target)
>> +                       {
>> +                               onUpdate.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxFormComponentUpdatingBehavior onUpdate(String
>> eventName,
>> +
>> WicketConsumer<AjaxRequestTarget> onUpdate,
>> +
>> WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError)
>> +       {
>> +               Args.notNull(onUpdate, "onUpdate");
>> +               Args.notNull(onError, "onError");
>> +
>> +               return new AjaxFormComponentUpdatingBehavior(eventName)
>> +               {
>> +                       @Override
>> +                       protected void onUpdate(AjaxRequestTarget target)
>> +                       {
>> +                               onUpdate.accept(target);
>> +                       }
>> +
>> +                       @Override
>> +                       protected void onError(AjaxRequestTarget target,
>> RuntimeException e)
>> +                       {
>> +                               onError.accept(target, e);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxFormSubmitBehavior onSubmit(String eventName,
>> WicketConsumer<AjaxRequestTarget> onSubmit)
>> +       {
>> +               Args.notNull(onSubmit, "onSubmit");
>> +
>> +               return new AjaxFormSubmitBehavior(eventName)
>> +               {
>> +                       @Override
>> +                       protected void onSubmit(AjaxRequestTarget target)
>> +                       {
>> +                               onSubmit.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxFormSubmitBehavior onSubmit(String eventName,
>> +
>>  WicketConsumer<AjaxRequestTarget> onSubmit,
>> +
>>  WicketConsumer<AjaxRequestTarget> onError) {
>> +               Args.notNull(onSubmit, "onSubmit");
>> +               Args.notNull(onError, "onError");
>> +
>> +               return new AjaxFormSubmitBehavior(eventName)
>> +               {
>> +                       @Override
>> +                       protected void onSubmit(AjaxRequestTarget target)
>> +                       {
>> +                               onSubmit.accept(target);
>> +                       }
>> +
>> +                       @Override
>> +                       protected void onError(AjaxRequestTarget target)
>> +                       {
>> +                               onError.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +
>> +       public static OnChangeAjaxBehavior
>> onChange(WicketConsumer<AjaxRequestTarget> onChange)
>> +       {
>> +               Args.notNull(onChange, "onChange");
>> +
>> +               return new OnChangeAjaxBehavior()
>> +               {
>> +                       @Override
>> +                       protected void onUpdate(AjaxRequestTarget target)
>> +                       {
>> +                               onChange.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static OnChangeAjaxBehavior
>> onChange(WicketConsumer<AjaxRequestTarget> onChange,
>> +
>>  WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError)
>> +       {
>> +               Args.notNull(onChange, "onChange");
>> +               Args.notNull(onError, "onError");
>> +
>> +               return new OnChangeAjaxBehavior()
>> +               {
>> +                       @Override
>> +                       protected void onUpdate(AjaxRequestTarget target)
>> +                       {
>> +                               onChange.accept(target);
>> +                       }
>> +
>> +                       @Override
>> +                       protected void onError(AjaxRequestTarget target,
>> RuntimeException e)
>> +                       {
>> +                               onError.accept(target, e);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static <T> AjaxLink<T> ajaxLink(String id,
>> WicketConsumer<AjaxRequestTarget> onClick)
>> +       {
>> +               Args.notNull(onClick, "onClick");
>> +
>> +               return new AjaxLink<T>(id)
>> +               {
>> +                       @Override
>> +                       public void onClick(AjaxRequestTarget target)
>> +                       {
>> +                               onClick.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +
>> +       public static AjaxButton ajaxButton(String id,
>> WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit)
>> +       {
>> +               Args.notNull(onSubmit, "onSubmit");
>> +
>> +               return new AjaxButton(id)
>> +               {
>> +                       @Override
>> +                       public void onSubmit(AjaxRequestTarget target,
>> Form<?> form)
>> +                       {
>> +                               onSubmit.accept(target, form);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxButton ajaxButton(String id,
>> WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit,
>> +
>>  WicketBiConsumer<AjaxRequestTarget, Form<?>> onError)
>> +       {
>> +               Args.notNull(onSubmit, "onSubmit");
>> +               Args.notNull(onError, "onError");
>> +
>> +               return new AjaxButton(id)
>> +               {
>> +                       @Override
>> +                       public void onSubmit(AjaxRequestTarget target,
>> Form<?> form)
>> +                       {
>> +                               onSubmit.accept(target, form);
>> +                       }
>> +
>> +                       @Override
>> +                       protected void onError(AjaxRequestTarget target,
>> Form<?> form)
>> +                       {
>> +                               onError.accept(target, form);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxCheckBox ajaxCheckBox(String id,
>> WicketConsumer<AjaxRequestTarget> onUpdate)
>> +       {
>> +               Args.notNull(onUpdate, "onUpdate");
>> +
>> +               return new AjaxCheckBox(id)
>> +               {
>> +                       @Override
>> +                       public void onUpdate(AjaxRequestTarget target)
>> +                       {
>> +                               onUpdate.accept(target);
>> +                       }
>> +               };
>> +       }
>> +
>> +
>> +       public static AjaxSubmitLink ajaxSubmitLink(String id,
>> WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit)
>> +       {
>> +               Args.notNull(onSubmit, "onSubmit");
>> +
>> +               return new AjaxSubmitLink(id)
>> +               {
>> +                       @Override
>> +                       public void onSubmit(AjaxRequestTarget target,
>> Form<?> form)
>> +                       {
>> +                               onSubmit.accept(target, form);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static AjaxSubmitLink ajaxSubmitLink(String id,
>> +
>>  WicketBiConsumer<AjaxRequestTarget, Form<?>> onSubmit,
>> +
>>  WicketBiConsumer<AjaxRequestTarget, Form<?>> onError)
>> +       {
>> +               Args.notNull(onSubmit, "onSubmit");
>> +               Args.notNull(onError, "onError");
>> +
>> +               return new AjaxSubmitLink(id)
>> +               {
>> +                       @Override
>> +                       public void onSubmit(AjaxRequestTarget target,
>> Form<?> form)
>> +                       {
>> +                               onSubmit.accept(target, form);
>> +                       }
>> +
>> +                       @Override
>> +                       protected void onError(AjaxRequestTarget target,
>> Form<?> form)
>> +                       {
>> +                               onError.accept(target, form);
>> +                       }
>> +               };
>> +       }
>> +
>> +       public static <T> Link<T> link(String id, WicketConsumer<Void>
>> onClick)
>> +       {
>> +               Args.notNull(onClick, "onClick");
>> +
>> +               return new Link<T>(id)
>> +               {
>> +                       @Override
>> +                       public void onClick()
>> +                       {
>> +                               onClick.accept((Void)null);
>> +                       }
>> +               };
>> +       }
>> +}
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketBiConsumer.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketBiConsumer.java
>> b/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketBiConsumer.java
>> new file mode 100644
>> index 0000000..509a6c5
>> --- /dev/null
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketBiConsumer.java
>> @@ -0,0 +1,32 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one or more
>> + * contributor license agreements.  See the NOTICE file distributed with
>> + * this work for additional information regarding copyright ownership.
>> + * The ASF licenses this file to You under the Apache License, Version
>> 2.0
>> + * (the "License"); you may not use this file except in compliance with
>> + * the License.  You may obtain a copy of the License at
>> + *
>> + *      http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing, software
>> + * distributed under the License is distributed on an "AS IS" BASIS,
>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> + * See the License for the specific language governing permissions and
>> + * limitations under the License.
>> + */
>> +package org.apache.wicket.lambdas;
>> +
>> +import java.io.Serializable;
>> +import java.util.function.BiConsumer;
>> +
>> +/**
>> + * A {@link Serializable} {@link BiConsumer}.
>> + *
>> + * @param <T>
>> + *            - the type of the first input to consume
>> + * @param <T>
>> + *            - the type of the second input to consume
>> + */
>> +public interface WicketBiConsumer<T, U> extends BiConsumer<T, U>,
>> Serializable
>> +{
>> +}
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketConsumer.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketConsumer.java
>> b/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketConsumer.java
>> new file mode 100644
>> index 0000000..36404f2
>> --- /dev/null
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketConsumer.java
>> @@ -0,0 +1,30 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one or more
>> + * contributor license agreements.  See the NOTICE file distributed with
>> + * this work for additional information regarding copyright ownership.
>> + * The ASF licenses this file to You under the Apache License, Version
>> 2.0
>> + * (the "License"); you may not use this file except in compliance with
>> + * the License.  You may obtain a copy of the License at
>> + *
>> + *      http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing, software
>> + * distributed under the License is distributed on an "AS IS" BASIS,
>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> + * See the License for the specific language governing permissions and
>> + * limitations under the License.
>> + */
>> +package org.apache.wicket.lambdas;
>> +
>> +import java.io.Serializable;
>> +import java.util.function.Consumer;
>> +
>> +/**
>> + * A {@link Serializable} {@link Consumer}.
>> + *
>> + * @param <T>
>> + *            - the type of the input to consume
>> + */
>> +public interface WicketConsumer<T> extends Consumer<T>, Serializable
>> +{
>> +}
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/d3bee750/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketFunction.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketFunction.java
>> b/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketFunction.java
>> new file mode 100644
>> index 0000000..7c6b9ae
>> --- /dev/null
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/lambdas/WicketFunction.java
>> @@ -0,0 +1,32 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one or more
>> + * contributor license agreements.  See the NOTICE file distributed with
>> + * this work for additional information regarding copyright ownership.
>> + * The ASF licenses this file to You under the Apache License, Version
>> 2.0
>> + * (the "License"); you may not use this file except in compliance with
>> + * the License.  You may obtain a copy of the License at
>> + *
>> + *      http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing, software
>> + * distributed under the License is distributed on an "AS IS" BASIS,
>
>

Reply via email to