You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sb...@apache.org on 2017/09/23 22:18:02 UTC

wicket git commit: WICKET-6308 Add an extra constructor to EmailTextField with a custom validator but without model

Repository: wicket
Updated Branches:
  refs/heads/wicket-6.x 98fbb6853 -> 846eae602


WICKET-6308 Add an extra constructor to EmailTextField with a custom validator but without model


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

Branch: refs/heads/wicket-6.x
Commit: 846eae602e45f78c7fb47fd83a3111f8680fd13d
Parents: 98fbb68
Author: sbriquet <sb...@apache.org>
Authored: Sun Sep 24 00:15:14 2017 +0200
Committer: sbriquet <sb...@apache.org>
Committed: Sun Sep 24 00:15:14 2017 +0200

----------------------------------------------------------------------
 .../wicket/markup/html/form/EmailTextField.java | 21 ++++++++++++++++++--
 .../wicket/markup/html/form/UrlTextField.java   |  2 +-
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/846eae60/wicket-core/src/main/java/org/apache/wicket/markup/html/form/EmailTextField.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/EmailTextField.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/EmailTextField.java
index 60bf307..8dcbb80 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/EmailTextField.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/EmailTextField.java
@@ -46,7 +46,7 @@ public class EmailTextField extends TextField<String>
 	 */
 	public EmailTextField(String id, final String emailAddress)
 	{
-		this(id, new Model<String>(emailAddress));
+		this(id, Model.of(emailAddress));
 	}
 
 	/**
@@ -64,7 +64,9 @@ public class EmailTextField extends TextField<String>
 
 	/**
 	 * Construct.
-	 * 
+	 *
+	 * <p>Use this constructor when the model will be provided by a parent component.</p>
+	 *
 	 * @param id
 	 *            see Component
 	 */
@@ -75,6 +77,21 @@ public class EmailTextField extends TextField<String>
 
 	/**
 	 * Construct.
+	 *
+	 * <p>Use this constructor when the model will be provided by a parent component.</p>
+	 *
+	 * @param id
+	 *            the component id
+	 * @param emailValidator
+	 *            the validator that will check the correctness of the input value
+	 */
+	public EmailTextField(String id, IValidator<String> emailValidator)
+	{
+		this(id, null, emailValidator);
+	}
+
+	/**
+	 * Construct.
 	 * 
 	 * @param id
 	 *            the component id

http://git-wip-us.apache.org/repos/asf/wicket/blob/846eae60/wicket-core/src/main/java/org/apache/wicket/markup/html/form/UrlTextField.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/UrlTextField.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/UrlTextField.java
index be4e016..929cf99 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/UrlTextField.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/UrlTextField.java
@@ -40,7 +40,7 @@ public class UrlTextField extends TextField<String>
 	 */
 	public UrlTextField(String id, final String url)
 	{
-		this(id, new Model<String>(url));
+		this(id, Model.of(url));
 	}
 
 	/**