You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2012/11/21 15:06:44 UTC

svn commit: r1412110 - in /myfaces/tobago/branches/tobago-1.5.x: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/ tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/ tobago-theme/tobago-theme-scarborough...

Author: lofwyr
Date: Wed Nov 21 14:06:43 2012
New Revision: 1412110

URL: http://svn.apache.org/viewvc?rev=1412110&view=rev
Log:
TOBAGO-1217: Input-suggest: Make the number of characters to open the list configurable

Modified:
    myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSuggestMethod.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml
    myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSuggestMethod.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSuggestMethod.java?rev=1412110&r1=1412109&r2=1412110&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSuggestMethod.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSuggestMethod.java Wed Nov 21 14:06:43 2012
@@ -23,9 +23,6 @@ import org.apache.myfaces.tobago.apt.ann
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
 
-/**
- * $Id$
- */
 public interface HasSuggestMethod {
 
   /**
@@ -36,10 +33,28 @@ public interface HasSuggestMethod {
    * or a org.apache.myfaces.tobago.model.AutoSuggestItems.
    */
   @TagAttribute
-  @UIComponentTagAttribute(type = {},
+  @UIComponentTagAttribute(
       expression = DynamicExpression.METHOD_BINDING_REQUIRED,
       methodSignature = "javax.faces.component.UIInput",
       methodReturnType = "java.lang.Object")
   void setSuggestMethod(String suggestMethod);
 
+  /**
+   * Minimum number of chars to type before the list will be requested.
+   *
+   * @since 1.5.9
+   */
+  @TagAttribute
+  @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "2")
+  void setSuggestMinChars(String suggestMinChars);
+
+  /**
+   * Time in milli seconds before the list will be requested.
+   *
+   * @since 1.5.9
+   */
+  @TagAttribute
+  @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "500")
+  void setSuggestDelay(String suggestDelay);
+
 }

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml?rev=1412110&r1=1412109&r2=1412110&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml Wed Nov 21 14:06:43 2012
@@ -50,7 +50,7 @@
                label="#{overviewBundle.basic_textboxLabel}" tip="#{overviewBundle.basic_textboxTip}"/>
         <tx:in value="#{overviewController.suggestInput}" tabIndex="3"
                label="#{overviewBundle.basic_suggestLabel}" tip="#{overviewBundle.basic_suggestTip}"
-               suggestMethod="#{overviewController.getInputSuggestItems}"/>
+               suggestMethod="#{overviewController.getInputSuggestItems}" suggestDelay="300" suggestMinChars="1"/>
         <tx:date value="#{overviewController.basicDate}" tabIndex="4"
                  label="#{overviewBundle.basic_dateLabel}" required="true">
           <f:convertDateTime pattern="dd/MM/yyyy"/>

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java?rev=1412110&r1=1412109&r2=1412110&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java Wed Nov 21 14:06:43 2012
@@ -156,12 +156,16 @@ public class InRenderer extends InputRen
       // input suggest
       if (renderAjaxSuggest) {
 
+        UIIn in = (UIIn) input;
+        int suggestMinChars = in.getSuggestMinChars();
+        int suggestDelay = in.getSuggestDelay();
+
         final String[] cmds = {
             "new Tobago.AutocompleterAjax(",
             "    '" + id + "',",
             "    " + required + ",",
             "    '" + requiredClass + "',",
-            "    { });"
+            "    {minPrefixLength:" + suggestMinChars + ",eventDelay:" + suggestDelay + "});"
         };
 
         HtmlRendererUtils.writeScriptLoader(facesContext, null, cmds);