myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1746416 - in /myfaces/tobago/trunk: tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/20-ajax/ tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/ tobago-theme/tobago-theme...
Date Wed, 01 Jun 2016 09:23:37 GMT
Author: lofwyr
Date: Wed Jun  1 09:23:37 2016
New Revision: 1746416

URL: http://svn.apache.org/viewvc?rev=1746416&view=rev
Log:
TOBAGO-1524   
* execute render attribute submitting different values now
[developed by hnoeth]

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/20-ajax/form-ajax.xhtml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/20-ajax/form-ajax.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/20-ajax/form-ajax.xhtml?rev=1746416&r1=1746415&r2=1746416&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/20-ajax/form-ajax.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/20-ajax/form-ajax.xhtml
Wed Jun  1 09:23:37 2016
@@ -33,31 +33,32 @@
     <pre><code class="language-markup"></code></pre>
 
     <tc:box label="Outer Form">
-      <tc:form>
+      <tc:form id="outerform">
         <tc:box label="Inner Form 1">
-          <tc:form>
-            <tc:in id="innervalue1in" label="Inner Value 1" value="#{formRequiredController.innerValue1}"/>
-            <tc:out id="innervalue1out" label="Inner Value 1 in Model" value="#{formRequiredController.innerValue1}"/>
+          <tc:form id="form1">
+            <tc:in id="in" label="Inner Value 1" value="#{formRequiredController.innerValue1}"/>
+            <tc:out id="out" label="Inner Value 1 in Model" value="#{formRequiredController.innerValue1}"/>
             <tc:button label="Submit">
-              <f:ajax render="innervalue1in innervalue1out"/>
+              <f:ajax execute="in" render="out"/>
             </tc:button>
           </tc:form>
         </tc:box>
         <tc:box label="Inner Form 2">
-          <tc:form>
-            <tc:in id="innervalue2in" label="Inner Value 2" required="true"
+          <tc:form id="form2">
+            <tc:in id="in" label="Inner Value 2" required="true"
                    value="#{formRequiredController.innerValue2}"/>
-            <tc:out id="innervalue2out" label="Inner Value 2 in Model" value="#{formRequiredController.innerValue2}"/>
+            <tc:out id="out" label="Inner Value 2 in Model" value="#{formRequiredController.innerValue2}"/>
             <tc:button label="Submit">
-              <f:ajax render="innervalue2in innervalue2out"/>
+              <f:ajax execute="in" render="out"/>
             </tc:button>
           </tc:form>
         </tc:box>
         <tc:separator/>
-        <tc:in id="outervaluein" label="Outer Value" required="true" value="#{formRequiredController.outerValue}"/>
-        <tc:out id="outervalueout" label="Outer Value in Model" value="#{formRequiredController.outerValue}"/>
+        <tc:in id="in" label="Outer Value" required="true" value="#{formRequiredController.outerValue}"/>
+        <tc:out id="out" label="Outer Value in Model" value="#{formRequiredController.outerValue}"/>
         <tc:button label="Submit">
-          <f:ajax render="innervalue1in innervalue1out innervalue2in innervalue2out outervaluein
outervalueout"/>
+          <f:ajax execute=":page:outerform:form1:in :page:outerform:form2:in in"
+                  render=":page:outerform:form1:out :page:outerform:form2:out out"/>
         </tc:button>
       </tc:form>
     </tc:box>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java?rev=1746416&r1=1746415&r2=1746416&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java
Wed Jun  1 09:23:37 2016
@@ -42,6 +42,7 @@ public class AjaxClientBehaviorRenderer
 
     final AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;
     final FacesContext facesContext = behaviorContext.getFacesContext();
+    final Collection<String> execute = ajaxBehavior.getExecute();
     final Collection<String> render = ajaxBehavior.getRender();
     final UIComponent uiComponent = behaviorContext.getComponent();
 
@@ -53,6 +54,7 @@ public class AjaxClientBehaviorRenderer
           component.isTransition(),
           component.getTarget(),
           RenderUtils.generateUrl(facesContext, component),
+          ComponentUtils.evaluateClientIds(facesContext, component, execute.toArray(new String[execute.size()])),
           ComponentUtils.evaluateClientIds(facesContext, component, render.toArray(new String[render.size()])),
           null,
           null, // getConfirmation(command), // todo
@@ -70,6 +72,7 @@ public class AjaxClientBehaviorRenderer
           null,
           null,
           null,
+          ComponentUtils.evaluateClientIds(facesContext, uiComponent, execute.toArray(new
String[execute.size()])),
           ComponentUtils.evaluateClientIds(facesContext, uiComponent, render.toArray(new
String[render.size()])),
           null,
           null,

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java?rev=1746416&r1=1746415&r2=1746416&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
Wed Jun  1 09:23:37 2016
@@ -46,6 +46,8 @@ public class Command {
   private String target;
   private String url;
   private String partially;
+  private String execute;
+  private String render;
   private String focus;
   private String confirmation;
   private Integer delay;
@@ -56,6 +58,27 @@ public class Command {
   }
 
   public Command(
+      final String action, final Boolean transition, final String target, final String url,
final String execute,
+      final String render, final String focus, final String confirmation, final Integer delay,
final Popup popup,
+      final Boolean omit) {
+    this.action = action;
+    this.transition = transition;
+    this.target = target;
+    this.url = url;
+    setExecute(execute);
+    setRender(render);
+    this.focus = focus;
+    this.confirmation = confirmation;
+    this.delay = delay;
+    this.popup = popup;
+    this.omit = omit;
+  }
+
+  /**
+   * @deprecated use with "execute" and "render" instead
+   */
+  @Deprecated
+  public Command(
       final String action, final Boolean transition, final String target, final String url,
final String partially,
       final String focus, final String confirmation, final Integer delay, final Popup popup,
final Boolean omit) {
     this.action = action;
@@ -169,16 +192,44 @@ public class Command {
     this.url = url;
   }
 
+  /**
+   * @deprecated use getExecute() getRender() instead
+   */
+  @Deprecated
   public String getPartially() {
     return partially;
   }
 
+  /**
+   * @deprecated use setExecute() setRender() instead
+   */
+  @Deprecated
   public void setPartially(final String partially) {
     if (StringUtils.isNotBlank(partially)) {
       this.partially = partially;
     }
   }
 
+  public String getExecute() {
+    return execute;
+  }
+
+  public void setExecute(String execute) {
+    if (StringUtils.isNotBlank(execute)) {
+      this.execute = execute;
+    }
+  }
+
+  public String getRender() {
+    return render;
+  }
+
+  public void setRender(String render) {
+    if (StringUtils.isNotBlank(render)) {
+      this.render = render;
+    }
+  }
+
   public String getFocus() {
     return focus;
   }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java?rev=1746416&r1=1746415&r2=1746416&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java
Wed Jun  1 09:23:37 2016
@@ -153,6 +153,14 @@ public class JsonUtils {
     if (partially != null) {
       encode(builder, "partially", partially);
     }
+    final String execute = command.getExecute();
+    if (execute != null) {
+      encode(builder, "execute", execute);
+    }
+    final String render = command.getRender();
+    if (render != null) {
+      encode(builder, "render", render);
+    }
     final String focus = command.getFocus();
     if (focus != null) {
       encode(builder, "focus", focus);

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js?rev=1746416&r1=1746415&r2=1746416&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
Wed Jun  1 09:23:37 2016
@@ -78,15 +78,15 @@ Tobago.DateTime.init = function (element
         // execution of line 686 in tobago.js
         $date.parent().on('dp.change', function (event) {
           var commands = jQuery(this).find("input").data("tobago-commands");
-          if (commands.change.partially) {
+          if (commands.change.execute || commands.change.render) {
             //Tobago.reloadComponent(this, commands.change.partially, commands.change.action,
commands.change);
             jsf.ajax.request(
                 jQuery(this).find("input").attr("name"),
                 event,
                 {
                   "javax.faces.behavior.event": "change",
-                  execute: commands.change.partially,
-                  render: commands.change.partially
+                  execute: commands.change.execute,
+                  render: commands.change.render
                 });
           } else {
             Tobago.submitAction(this.firstElementChild, commands.change.action, commands.change);

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1746416&r1=1746415&r2=1746416&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Wed Jun  1 09:23:37 2016
@@ -645,16 +645,14 @@ var Tobago = {
               Tobago.Popup.close(this);
             } else {
               var action = commands.click.action ? commands.click.action : jQuery(this).attr("id");
-              if (commands.click.partially) {
-                //Tobago.reloadComponent(this, commands.click.partially, action, commands.click);
+              if (commands.click.execute || commands.click.render) {
                 jsf.ajax.request(
                     jQuery(this).attr("id"),
                     event,
                     {
-                      // TODO: check difference between f:ajax and renderPartially
                       "javax.faces.behavior.event": "click",
-                      execute: commands.click.partially,
-                      render: commands.click.partially
+                      execute: commands.click.execute,
+                      render: commands.click.render
                     });
                 event.preventDefault();
                 event.stopPropagation();
@@ -683,15 +681,14 @@ var Tobago = {
     }
     if (commands.change) {
       command.change(function(event) {
-        if (commands.change.partially) {
-          //Tobago.reloadComponent(this, commands.change.partially, commands.change.action,
commands.change);
+        if (commands.change.execute || commands.change.render) {
           jsf.ajax.request(
               jQuery(this).attr("name"),
               event,
               {
                 "javax.faces.behavior.event": "change",
-                execute: commands.change.partially,
-                render: commands.change.partially
+                execute: commands.change.execute,
+                render: commands.change.render
               });
         } else {
           Tobago.submitAction(this, commands.change.action, commands.change);
@@ -699,15 +696,14 @@ var Tobago = {
       });
     }
     if (commands.complete) {
-      if (commands.complete.partially) {
-        //Tobago.reloadComponent(this, commands.complete.partially, commands.complete.action,
commands.complete);
+      if (commands.complete.execute || commands.complete.render) {
         jsf.ajax.request(
             jQuery(this).attr("id"),
             null,
             {
               "javax.faces.behavior.event": "complete",
-              execute: commands.complete.partially,
-              render: commands.complete.partially
+              execute: commands.complete.execute,
+              render: commands.complete.render
             });
       } else {
         Tobago.submitAction(this, commands.complete.action, commands.complete);



Mime
View raw message