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 2016/10/05 11:40:34 UTC

svn commit: r1763432 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/ tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ tobago-example/tobago-example-demo/src/main/webapp/...

Author: lofwyr
Date: Wed Oct  5 11:40:34 2016
New Revision: 1763432

URL: http://svn.apache.org/viewvc?rev=1763432&view=rev
Log:
cleanup code: this is related to: TOBAGO-1574: AJAX not working from change-facet-command (differ client event facets and others)

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ResizeController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/75-resize/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/75-resize/resize.xhtml
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java?rev=1763432&r1=1763431&r2=1763432&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java Wed Oct  5 11:40:34 2016
@@ -63,7 +63,7 @@ public enum Facets {
   popup,
   radio,
   reload(true),
-  resize,
+  resize(true),
   sorter,
   toolBar;
 

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ResizeController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ResizeController.java?rev=1763432&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ResizeController.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ResizeController.java Wed Oct  5 11:40:34 2016
@@ -0,0 +1,17 @@
+package org.apache.myfaces.tobago.example.demo;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.enterprise.inject.Model;
+
+@Model
+public class ResizeController {
+
+  private static final Logger LOG = LoggerFactory.getLogger(ResizeController.class);
+
+  public String resize() {
+    LOG.info("Method resize() was called!");
+    return null;
+  }
+}

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/75-resize/resize.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/75-resize/resize.xhtml?rev=1763432&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/75-resize/resize.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/75-resize/resize.xhtml Wed Oct  5 11:40:34 2016
@@ -0,0 +1,35 @@
+<?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="/plain.xhtml"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets"
+                xmlns:f="http://java.sun.com/jsf/core">
+  <ui:param name="title" value="Resize Event"/>
+
+  <f:facet name="resize">
+    <tc:command id="resize" action="#{resizeController.resize}"/>
+  </f:facet>
+
+  Todo: make nicer example
+  <br/>
+
+  Resizing demo. Resizing the window will call a command (from the resize facet).
+
+</ui:composition>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java?rev=1763432&r1=1763431&r2=1763432&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java Wed Oct  5 11:40:34 2016
@@ -20,6 +20,7 @@
 package org.apache.myfaces.tobago.renderkit.html.util;
 
 import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UIForm;
 import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.context.Markup;
@@ -299,12 +300,13 @@ public final class HtmlRendererUtils {
     final Map<String, UIComponent> facets = component.getFacets();
     for (final Map.Entry<String, UIComponent> entry : facets.entrySet()) {
       final UIComponent facetComponent = entry.getValue();
+      final String key = entry.getKey();
       if (facetComponent.isRendered()
-          && (facetComponent instanceof AbstractUICommand || facetComponent instanceof UIForm)) {
+          && (facetComponent instanceof AbstractUICommand || facetComponent instanceof UIForm)
+          && Facets.isEvent(key)) {
         if (commandMap == null) {
           commandMap = new CommandMap();
         }
-        final String key = entry.getKey();
         commandMap.addCommand(key, new Command(facesContext, entry.getValue(), id));
       }
     }