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/07/16 08:46:36 UTC
[1/5] wicket git commit: WICKET-6203 rework IModel#mapWith
Repository: wicket
Updated Branches:
refs/heads/master 3729285d0 -> 019b002da
WICKET-6203 rework IModel#mapWith
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a0c43bb9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a0c43bb9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a0c43bb9
Branch: refs/heads/master
Commit: a0c43bb9808c5e6b916e6461b357c3eaa4fa84fc
Parents: 0006d35
Author: Matthias Metzger <no...@yahoo.de>
Authored: Fri Jul 15 20:01:45 2016 +0200
Committer: Matthias Metzger <no...@yahoo.de>
Committed: Fri Jul 15 20:26:08 2016 +0200
----------------------------------------------------------------------
.../main/java/org/apache/wicket/model/IModel.java | 11 ++++++-----
.../java/org/apache/wicket/model/IModelTest.java | 16 ++++++++--------
2 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/a0c43bb9/wicket-core/src/main/java/org/apache/wicket/model/IModel.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/model/IModel.java b/wicket-core/src/main/java/org/apache/wicket/model/IModel.java
index 9fdac84..99c13ca 100644
--- a/wicket-core/src/main/java/org/apache/wicket/model/IModel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/model/IModel.java
@@ -113,7 +113,8 @@ public interface IModel<T> extends IDetachable
}
/**
- * Returns a IModel applying the given mapper to the contained object, if it is not {@code null}.
+ * Returns a IModel applying the given mapper to the contained object, if it is not {@code null}
+ * .
*
* @param <R>
* the new type of the contained object
@@ -145,14 +146,14 @@ public interface IModel<T> extends IDetachable
* the resulting type
* @param <U>
* the other models type
- * @param combiner
- * a function combining this and the others object to a result.
* @param other
* another model to be combined with this one
+ * @param combiner
+ * a function combining this and the others object to a result.
* @return a new IModel
*/
- default <R, U> IModel<R> mapWith(WicketBiFunction<? super T, ? super U, R> combiner,
- IModel<U> other)
+ default <R, U> IModel<R> combineWith(IModel<U> other,
+ WicketBiFunction<? super T, ? super U, R> combiner)
{
Args.notNull(combiner, "combiner");
Args.notNull(other, "other");
http://git-wip-us.apache.org/repos/asf/wicket/blob/a0c43bb9/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java b/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java
index acf10bd..965eac5 100644
--- a/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java
@@ -93,41 +93,41 @@ public class IModelTest extends Assert
}
@Test
- public void withMap()
+ public void combineWith()
{
IModel<String> janeModel = Model.of("Jane");
WicketBiFunction<Person, String, String> function =
(WicketBiFunction<Person, String, String>) (person1, other) ->
person1.getName() + " is in relationship with " + other;
- IModel<String> relationShipModel = Model.of(person).mapWith(function, janeModel);
+ IModel<String> relationShipModel = Model.of(person).combineWith(janeModel, function);
assertThat(relationShipModel.getObject(), is(equalTo("John is in relationship with Jane")));
}
@Test
- public void withMapWithNullObject()
+ public void combineWithNullObject()
{
IModel<String> janeModel = Model.of((String)null);
WicketBiFunction<Person, String, String> function =
(WicketBiFunction<Person, String, String>) (person1, other) ->
person1.getName() + " is in relationship with " + other;
- IModel<String> relationShipModel = Model.of(person).mapWith(function, janeModel);
+ IModel<String> relationShipModel = Model.of(person).combineWith(janeModel, function);
assertThat(relationShipModel.getObject(), is(nullValue()));
}
@Test(expected = IllegalArgumentException.class)
- public void withMapWithNullModel()
+ public void combineWithNullModel()
{
IModel<String> janeModel = null;
WicketBiFunction<Person, String, String> function =
(WicketBiFunction<Person, String, String>) (person1, other) ->
person1.getName() + " is in relationship with " + other;
- Model.of(person).mapWith(function, janeModel);
+ Model.of(person).combineWith(janeModel, function);
}
@Test(expected = IllegalArgumentException.class)
- public void withMapWithNullCombiner()
+ public void combineWithNullCombiner()
{
- Model.of(person).mapWith(null, Model.of("Jane"));
+ Model.of(person).combineWith(Model.of("Jane"), null);
}
@Test
[4/5] wicket git commit: Small improvements in wording for
IModal+lambda docs
Posted by mg...@apache.org.
Small improvements in wording for IModal+lambda docs
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/9b27b0a6
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/9b27b0a6
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/9b27b0a6
Branch: refs/heads/master
Commit: 9b27b0a6343d347ce02b32c36bc4cf301389ac48
Parents: a361d2f
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sat Jul 16 10:40:44 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sat Jul 16 10:43:01 2016 +0200
----------------------------------------------------------------------
.../src/docs/guide/modelsforms/modelsforms_2.gdoc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/9b27b0a6/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_2.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_2.gdoc b/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_2.gdoc
index d092350..4fd15ce 100644
--- a/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_2.gdoc
+++ b/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_2.gdoc
@@ -1,10 +1,10 @@
With Wicket 8 @IModel@ has been extended with new methods to fully leverage lambdas. The most interesting thing of the new version of @IModel@ is that it provides a default implementation for all of its methods (included @setObject()@), with the only exception of @getObject()@.
-In this way @IModel@ is eligible as functional interface and this greatly simplify the creation of cutom models. As long as we need to display a static test it doesn't make much sense building a custom model, but if we need to display a dynamic value (like the input provided by a user or a value read from a database), defining a model with a lambda expression comes quite in handy.
+In this way @IModel@ is eligible as functional interface and this greatly simplify the creation of custom models. As long as we need to display a static text it doesn't make much sense building a custom model, but if we need to display a dynamic value (like the input provided by a user or a value read from a database), defining a model with a lambda expression comes quite in handy.
Let's say we need a label to display the current time stamp each time a page is rendered. This could be a possible solution:
{code}
-add(new Label("timeStamp", () -> new Date().toString()));
+add(new Label("timeStamp", () -> java.time.LocalDate.now()));
{code}
As mentioned above, method @setObject()@ comes with a default implementation. The code is the following:
@@ -23,7 +23,7 @@ h3. Lambda Goodies
Most of the default methods we find in @IModel@ are meant to leverage Lambda expressions to transform model object. The following is a short reference for such methods:
-* *filter(predicateFilter)*: Returns a @IModel@ checking whether the predicate holds for the contained object, if it is not null. If the predicate doesn't evaluate to true, the contained object will be null. Example:
+* *filter(predicate)*: Returns a @IModel@ checking whether the predicate holds for the contained object, if it is not null. If the predicate doesn't evaluate to true, the contained object will be null. Example:
{divcontainer:li-nested-content}
{code:java}
//the filtered model will have a null model object if person's name
@@ -40,4 +40,4 @@ Most of the default methods we find in @IModel@ are meant to leverage Lambda exp
{code}
{divcontainer}
- TODO:add other methods
\ No newline at end of file
+ TODO:add other methods
[5/5] wicket git commit: Merge branch 'pr-174-rework-model-mapWith'
Posted by mg...@apache.org.
Merge branch 'pr-174-rework-model-mapWith'
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/019b002d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/019b002d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/019b002d
Branch: refs/heads/master
Commit: 019b002da1ed5d259d2bc04b636dc6b0539667ba
Parents: 3729285 9b27b0a
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sat Jul 16 10:46:27 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sat Jul 16 10:46:27 2016 +0200
----------------------------------------------------------------------
.../main/java/org/apache/wicket/model/IModel.java | 11 ++++++-----
.../java/org/apache/wicket/model/IModelTest.java | 16 ++++++++--------
2 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
[2/5] wicket git commit: WICKET-6202 Guide: 26.1 Page storing,
section HttpSessionDataStore - example code is not correct
Posted by mg...@apache.org.
WICKET-6202 Guide: 26.1 Page storing, section HttpSessionDataStore - example code is not correct
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a361d2f4
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a361d2f4
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a361d2f4
Branch: refs/heads/master
Commit: a361d2f406fce748afc81ce109894f42310f2b2c
Parents: e3a1abb
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Jul 15 19:36:23 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sat Jul 16 10:43:01 2016 +0200
----------------------------------------------------------------------
wicket-user-guide/src/docs/guide/internals/pagestoring.gdoc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/a361d2f4/wicket-user-guide/src/docs/guide/internals/pagestoring.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/internals/pagestoring.gdoc b/wicket-user-guide/src/docs/guide/internals/pagestoring.gdoc
index 2bdc268..dd26b75 100644
--- a/wicket-user-guide/src/docs/guide/internals/pagestoring.gdoc
+++ b/wicket-user-guide/src/docs/guide/internals/pagestoring.gdoc
@@ -65,11 +65,11 @@ MyApp#init()
{
super.init();
- setPageManagerProvider(new DefaultPageManagerProvider()
+ setPageManagerProvider(new DefaultPageManagerProvider(this)
{
protected IDataStore newDataStore()
{
- return new HttpSessionDataStore(pageManagerContext, new PageNumberEvictionStrategy(20));
+ return new HttpSessionDataStore(getPageManagerContext(), new PageNumberEvictionStrategy(20));
}
}
}
[3/5] wicket git commit: HTTP2 docu improvements
Posted by mg...@apache.org.
HTTP2 docu improvements
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e3a1abb5
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e3a1abb5
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e3a1abb5
Branch: refs/heads/master
Commit: e3a1abb5b1b165c2127beaaeb567879ee06335f0
Parents: a0c43bb
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Jul 15 19:34:05 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sat Jul 16 10:43:01 2016 +0200
----------------------------------------------------------------------
.../src/docs/guide/http2push/http2push_1.gdoc | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/e3a1abb5/wicket-user-guide/src/docs/guide/http2push/http2push_1.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/http2push/http2push_1.gdoc b/wicket-user-guide/src/docs/guide/http2push/http2push_1.gdoc
index e03477d..d6888fd 100644
--- a/wicket-user-guide/src/docs/guide/http2push/http2push_1.gdoc
+++ b/wicket-user-guide/src/docs/guide/http2push/http2push_1.gdoc
@@ -1,27 +1,22 @@
Currently there are different implementations for each server to be used until the Servlet 4.0 (JSR 369) specification reaches the final state.
Current supported servers are:
-* Eclipse Jetty
-* Apache Tomcat
-* redhat undertow
+* Eclipse Jetty 9.3+
+* Apache Tomcat 8.5+
+* RedHat Undertow 2+
For the setup you need to follow those steps:
1. Setup your server to use HTTP/2 and follow the instructions provided by the vendor specific documentation
-2. Add two dependencies to provide the push functionality - one core dependency and one for the custom server implementation.
+2. Add the respective dependency for your web server to provide the push functionality.
{code}
<dependency>
<groupId>org.apache.wicket.experimental.wicket8</groupId>
- <artifactId>wicket-http2-core</artifactId>
- <version>0.X-SNAPSHOT</version>
-</dependency>
-<dependency>
- <groupId>org.apache.wicket.experimental.wicket8</groupId>
<artifactId>wicket-http2-jetty</artifactId>
- <!--<artifactId>wicket-http2-tomcat</artifactId>
- <artifactId>wicket-http2-undertow</artifactId>-->
+ <!--<artifactId>wicket-http2-tomcat</artifactId>-->
+ <!--<artifactId>wicket-http2-undertow</artifactId>-->
<version>0.X-SNAPSHOT</version>
</dependency>
{code}