You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2017/06/01 07:59:10 UTC

svn commit: r1797153 - in /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago: internal/renderkit/renderer/InRenderer.java internal/renderkit/renderer/TextareaRenderer.java renderkit/html/HtmlAttributes.java

Author: bommel
Date: Thu Jun  1 07:59:10 2017
New Revision: 1797153

URL: http://svn.apache.org/viewvc?rev=1797153&view=rev
Log: (empty)

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java?rev=1797153&r1=1797152&r2=1797153&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java Thu Jun  1 07:59:10 2017
@@ -45,6 +45,7 @@ import javax.faces.component.UIComponent
 import javax.faces.component.UIPanel;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.LengthValidator;
+import javax.faces.validator.RegexValidator;
 import javax.faces.validator.Validator;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -107,22 +108,26 @@ public class InRenderer extends MessageL
       writer.writeAttribute(HtmlAttributes.TITLE, title, true);
     }
     int maxLength = 0;
-    final String pattern = null;
+    int minLength = 0;
+    String pattern = null;
     for (final Validator validator : input.getValidators()) {
       if (validator instanceof LengthValidator) {
         final LengthValidator lengthValidator = (LengthValidator) validator;
         maxLength = lengthValidator.getMaximum();
-      }
-        /*if (validator instanceof RegexValidator) {
+        minLength = lengthValidator.getMinimum();
+      } else if (validator instanceof RegexValidator) {
           RegexValidator regexValidator = (RegexValidator) validator;
           pattern = regexValidator.getPattern();
-        }*/
+      }
     }
     if (maxLength > 0) {
       writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
     }
+    if (minLength > 0) {
+      writer.writeAttribute(HtmlAttributes.MINLENGTH, minLength);
+    }
     if (pattern != null) {
-      writer.writeAttribute(HtmlAttributes.PATTERN, pattern, false);
+      writer.writeAttribute(HtmlAttributes.PATTERN, pattern, true);
     }
     writer.writeAttribute(HtmlAttributes.READONLY, readonly);
     writer.writeAttribute(HtmlAttributes.DISABLED, disabled);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java?rev=1797153&r1=1797152&r2=1797153&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java Thu Jun  1 07:59:10 2017
@@ -33,6 +33,7 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.sanitizer.SanitizeMode;
 import org.apache.myfaces.tobago.sanitizer.Sanitizer;
 import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.validator.SubmittedValueLengthValidator;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,6 +41,7 @@ import org.slf4j.LoggerFactory;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.LengthValidator;
+import javax.faces.validator.RegexValidator;
 import javax.faces.validator.Validator;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -89,23 +91,27 @@ public class TextareaRenderer extends Me
     classAttributes.add(input.getCustomClass());
     writer.writeClassAttribute(null, null, classAttributes.toArray(new CssItem[classAttributes.size()]));
     writer.writeStyleAttribute(input.getStyle());
-    int maxLength = -1;
-    final String pattern = null;
+    int maxLength = 0;
+    int minLength = 0;
+    String pattern = null;
     for (final Validator validator : input.getValidators()) {
       if (validator instanceof LengthValidator) {
         final LengthValidator lengthValidator = (LengthValidator) validator;
         maxLength = lengthValidator.getMaximum();
-      }
-      /*if (validator instanceof RegexValidator) {
+        minLength = lengthValidator.getMinimum();
+      } else if (validator instanceof RegexValidator) {
         RegexValidator regexValidator = (RegexValidator) validator;
         pattern = regexValidator.getPattern();
-      }*/
+      }
     }
     if (maxLength > 0) {
       writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
     }
+    if (minLength > 0) {
+      writer.writeAttribute(HtmlAttributes.MINLENGTH, minLength);
+    }
     if (pattern != null) {
-      writer.writeAttribute(HtmlAttributes.PATTERN, pattern, false);
+      writer.writeAttribute(HtmlAttributes.PATTERN, pattern, true);
     }
 
     writer.writeCommandMapAttribute(JsonUtils.encode(RenderUtils.getBehaviorCommands(facesContext, input)));

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java?rev=1797153&r1=1797152&r2=1797153&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java Thu Jun  1 07:59:10 2017
@@ -53,6 +53,7 @@ public enum HtmlAttributes implements Ma
   METHOD("method"),
   MULTIPLE("multiple"),
   NAME("name"),
+  MINLENGTH("minlength"),
   /** @deprecated Since 2.0.0. This attribute work not with SCP */
   @Deprecated
   ONBLUR("onblur"),