myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r1782451 - in /myfaces/tobago/trunk: tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/50-filter/ tobago-example/tobago...
Date Fri, 10 Feb 2017 10:53:31 GMT
Author: deki
Date: Fri Feb 10 10:53:31 2017
New Revision: 1782451

URL: http://svn.apache.org/viewvc?rev=1782451&view=rev
Log:
TOBAGO-1689 change event is not executed for <tc:suggest>
When using <tc:suggest/> the <tc:event> as well as <f:ajax> are now supported.
[developed by sub_ft1, hnoeth]

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/4500-suggest/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/4500-suggest/suggest.xhtml
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SuggestController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/50-filter/sheet-filter.xhtml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/script/tobago-suggest.js

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SuggestController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SuggestController.java?rev=1782451&r1=1782450&r2=1782451&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SuggestController.java
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SuggestController.java
Fri Feb 10 10:53:31 2017
@@ -37,6 +37,8 @@ public class SuggestController implement
 
   private static final Logger LOG = LoggerFactory.getLogger(SuggestController.class);
   private String query;
+  private String selection1;
+  private String selection2;
 
   public String getQuery() {
     return query;
@@ -83,4 +85,21 @@ public class SuggestController implement
     }
     return result;
   }
+
+  public String getSelection1() {
+    return selection1;
+  }
+
+  public void setSelection1(String selection1) {
+    LOG.info("setSelection1 ->" + selection1);
+    this.selection1 = selection1;
+  }
+
+  public String getSelection2() {
+    return selection2;
+  }
+
+  public void setSelection2(String selection2) {
+    this.selection2 = selection2;
+  }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/50-filter/sheet-filter.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/50-filter/sheet-filter.xhtml?rev=1782451&r1=1782450&r2=1782451&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/50-filter/sheet-filter.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/50-filter/sheet-filter.xhtml
Fri Feb 10 10:53:31 2017
@@ -47,7 +47,7 @@
                 <tc:selectItems value="#{sheetFilterController.suggestionSolarList}" var="name"
itemValue="#{name}"/>
               </tc:suggest>
               <!-- XXX using blur instead of change for event, because of TOBAGO-1689
-->
-              <f:ajax event="blur" execute=":::sheet" render=":::sheet" listener="#{sheetFilterController.filter}"/>
+              <f:ajax execute=":::sheet" render=":::sheet" listener="#{sheetFilterController.filter}"/>
             </tc:in>
           </tc:panel>
           <tc:panel>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/4500-suggest/suggest.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/4500-suggest/suggest.xhtml?rev=1782451&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/4500-suggest/suggest.xhtml
(added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/4500-suggest/suggest.xhtml
Fri Feb 10 10:53:31 2017
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets">
+  <ui:param name="title" value="#{demoBundle.suggest} &lt;tc:suggest&gt;"/>
+
+  <tc:section label="Suggest Input - AJAX">
+    <p>The out component will show the selected value choosen from the suggest input
field. Ajax case is covered and component is reloaded after valid selection.</p>
+    <tc:out id="outBasic" label="Selection" value="#{suggestController.selection1}"/>
+    <tc:in id="inBasic" value="#{suggestController.selection1}">
+      <tc:suggest totalCount="10" query="#{suggestController.query}">
+        <tc:selectItems value="#{suggestController.languages}" var="language" itemValue="#{language}"/>
+      </tc:suggest>
+      <f:ajax render="outBasic"/>
+    </tc:in>
+  </tc:section>
+
+  <tc:section label="Suggest Input - No AJAX">
+    <p>The out component will show the selected value choosen from the suggest input
field. Page is reloaded after selection.</p>
+    <tc:out id="outTwo" label="Selection" value="#{suggestController.selection2}"/>
+    <tc:in id="inTwo" value="#{suggestController.selection2}">
+      <f:ajax render="outTwo"/>
+    </tc:in>
+  </tc:section>
+  <tc:button label="Submit"/>
+</ui:composition>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/script/tobago-suggest.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/script/tobago-suggest.js?rev=1782451&r1=1782450&r2=1782451&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/script/tobago-suggest.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/script/tobago-suggest.js
Fri Feb 10 10:53:31 2017
@@ -116,6 +116,20 @@ Tobago.Suggest.init = function(elements)
         //name: 'test',// todo
         limit: maxItems,
         source: source
+      }).on('typeahead:selected', function(event) {
+        var commands = input.data("tobago-commands");
+        if (commands.change.execute || commands.change.render) {
+          jsf.ajax.request(
+            suggest,
+            event,
+            {
+              "javax.faces.behavior.event": "change",
+              execute: commands.change.execute,
+              render: commands.change.render
+            });
+        } else {
+          Tobago.submitAction(this, commands.change.action, null);
+        }
       });
 
       input.bind('typeahead:open', function() {



Mime
View raw message