You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2010/01/03 19:10:18 UTC

svn commit: r895456 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/taglib/decl/ example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/ example/demo/src/main/java/org/apache/myfaces/tobago/example/reference...

Author: weber
Date: Sun Jan  3 18:10:15 2010
New Revision: 895456

URL: http://svn.apache.org/viewvc?rev=895456&view=rev
Log:
(TOBAGO-842) Multi field update from tc:in autoSuggest
<https://issues.apache.org/jira/browse/TOBAGO-842>

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java
    myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
    myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/InputSuggestController.java
    myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/SuggestMethodRule.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java?rev=895456&r1=895455&r2=895456&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java Sun Jan  3 18:10:15 2010
@@ -27,16 +27,17 @@
 public interface HasSuggestMethod {
 
   /**
-   * MethodBinding which generates a list of suggested input values based on a
-   * passed prefix -- the currently entered text.
-   * The expression has to evaluate to a public method which has a String parameter
-   * and a List&lt;String> as return type.
+   * MethodBinding which generates a list of suggested input values based on
+   * the currently entered text, which could be retrieved via getSubmittedValue() on the UIInput.
+   * The expression has to evaluate to a public method which has a javax.faces.component.UIInput parameter
+   * and returns a List&lt;String>(deprecated), a List&lt;org.apache.myfaces.tobago.model.AutoSuggestItem>
+   * or a org.apache.myfaces.tobago.model.AutoSuggestItems.
    */
   @TagAttribute
   @UIComponentTagAttribute(type = {},
       expression = DynamicExpression.METHOD_BINDING_REQUIRED,
-      methodSignature = "java.lang.String",
-      methodReturnType = "java.util.List<java.lang.String>")
+      methodSignature = "javax.faces.component.UIInput",
+      methodReturnType = "java.lang.Object")
   void setSuggestMethod(String suggestMethod);
 
 }

Modified: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java?rev=895456&r1=895455&r2=895456&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java (original)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java Sun Jan  3 18:10:15 2010
@@ -31,6 +31,7 @@
 
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
 import javax.faces.context.FacesContext;
 import javax.faces.event.ActionEvent;
 import javax.faces.validator.ValidatorException;
@@ -391,7 +392,8 @@
         this.toolbarTextItems = toolbarTextItems;
     }
 
-    public List<String> getInputSuggestItems(String prefix) {
+  public List<String> getInputSuggestItems(UIInput component) {
+    String prefix = (String) component.getSubmittedValue();
     LOG.info("createing items for prefix :\"" + prefix + "\"");
     List<String> li = new ArrayList<String>();
     li.add(prefix+1);

Modified: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/InputSuggestController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/InputSuggestController.java?rev=895456&r1=895455&r2=895456&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/InputSuggestController.java (original)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/InputSuggestController.java Sun Jan  3 18:10:15 2010
@@ -4,6 +4,7 @@
 import org.apache.myfaces.tobago.model.AutoSuggestItem;
 import org.apache.myfaces.tobago.model.AutoSuggestItems;
 
+import javax.faces.component.UIInput;
 import javax.faces.model.SelectItem;
 import java.util.ArrayList;
 import java.util.List;
@@ -93,7 +94,8 @@
     this.region = region;
   }
 
-  public List<String> getSimpleSuggestItems(String prefix) {
+  public List<String> getSimpleSuggestItems(UIInput component) {
+    String prefix = (String) component.getSubmittedValue();
     LOG.info("createing items for prefix :\"" + prefix + "\"");
     List<String> li = new ArrayList<String>();
     li.add(prefix+1);
@@ -105,7 +107,8 @@
     return li;
   }
 
-  public AutoSuggestItems getZipSuggestItems(String prefix) {
+  public AutoSuggestItems getZipSuggestItems(UIInput component) {
+    String prefix = (String) component.getSubmittedValue();
     AutoSuggestItems item = new AutoSuggestItems();
     item.setItems(getSuggestItems(prefix, true));
     item.setNextFocusId("page:txarea");
@@ -114,7 +117,8 @@
 
 
 
-  public AutoSuggestItems getCitySuggestItems(String prefix) {
+  public AutoSuggestItems getCitySuggestItems(UIInput component) {
+    String prefix = (String) component.getSubmittedValue();
     AutoSuggestItems item = new AutoSuggestItems();
     item.setItems(getSuggestItems(prefix, false));
     item.setNextFocusId("page:txarea");

Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/SuggestMethodRule.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/SuggestMethodRule.java?rev=895456&r1=895455&r2=895456&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/SuggestMethodRule.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/SuggestMethodRule.java Sun Jan  3 18:10:15 2010
@@ -31,7 +31,7 @@
  * Time: 8:59:29 PM
  */
 public class SuggestMethodRule extends MetaRule {
-  static final Class[] SUGGEST_METHOD = new Class[]{String.class};
+  static final Class[] SUGGEST_METHOD = new Class[]{javax.faces.component.UIInput.class};
   public static final SuggestMethodRule INSTANCE = new SuggestMethodRule();
 
   public Metadata applyRule(String name, TagAttribute attribute,

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java?rev=895456&r1=895455&r2=895456&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java Sun Jan  3 18:10:15 2010
@@ -212,7 +212,7 @@
 //        ? input.getMaxSuggestedItems().intValue()
 //        : DEFAULT_MAX_SUGGESTED_ITEMS;
 
-    Object object = mb.invoke(context, new Object[]{(String) input.getSubmittedValue()});
+    Object object = mb.invoke(context, new Object[]{(UIInput) input});
 
     AutoSuggestItems items = null;
     if (object instanceof AutoSuggestItems) {