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/08/17 07:58:03 UTC

svn commit: r1756589 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ tobago-theme/tobago-theme-standard/src/main/java/org/apache/m...

Author: lofwyr
Date: Wed Aug 17 07:58:03 2016
New Revision: 1756589

URL: http://svn.apache.org/viewvc?rev=1756589&view=rev
Log:
TOBAGO-1574: AJAX not working from change-facet-command
* differ client event facets and others

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.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=1756589&r1=1756588&r2=1756589&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 Aug 17 07:58:03 2016
@@ -25,15 +25,18 @@ public enum Facets {
   action,
   bar,
   before,
+  blur(true),
   brand,
-  change,
+  change(true),
   checkbox,
-  click,
+  click(true),
   complete,
   confirmation,
   constraints,
   contextMenu,
   dropDownMenu,
+  focus(true),
+  hover(true),
   label,
   /**
    * @deprecated since 3.0.0. The layout manager tag should surround the content instead.
@@ -55,15 +58,25 @@ public enum Facets {
   @Deprecated
   popup,
   radio,
-  reload,
+  reload(true),
   resize,
   sorter,
   toolBar;
 
+  private boolean event;
+
+  Facets() {
+  }
+
+  Facets(boolean event) {
+    this.event = event;
+  }
+
   public static final String AFTER = "after";
   public static final String ACTION = "action";
   public static final String BAR = "bar";
   public static final String BEFORE = "before";
+  public static final String BLUR = "blur";
   public static final String BRAND = "brand";
   public static final String CHANGE = "change";
   public static final String CHECKBOX = "checkbox";
@@ -73,6 +86,8 @@ public enum Facets {
   public static final String CONSTRAINTS = "constraints";
   public static final String CONTEXT_MENU = "contextMenu";
   public static final String DROP_DOWN_MENU = "dropDownMenu";
+  public static final String FOCUS = "focus";
+  public static final String HOVER = "hover";
   public static final String LABEL = "label";
   /**
    * @deprecated since 3.0.0. The layout manager tag should surround the content instead.
@@ -94,4 +109,13 @@ public enum Facets {
   public static final String RESIZE = "resize";
   public static final String SORTER = "sorter";
   public static final String TOOL_BAR = "toolBar";
+
+  public static boolean isEvent(final String string) {
+    try {
+      return valueOf(string).event;
+    } catch (IllegalArgumentException e) {
+      // ignore
+      return false;
+    }
+  }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java?rev=1756589&r1=1756588&r2=1756589&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java Wed Aug 17 07:58:03 2016
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.intern
 
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasAction;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasActionListener;
@@ -44,7 +45,9 @@ import org.apache.myfaces.tobago.interna
 import javax.faces.component.UICommand;
 
 /**
- * A general command.
+ * Use this tag only as a facet for the client events "click", "change"
+ * in selectOneRadio, selectBooleanCheckbox, selectManyCheckbox, selectOneChoice, etc.
+ * TODO: may add some events and components. See {@link Facets#isEvent(String)}
  */
 @Tag(name = "command")
 @UIComponentTag(uiComponent = "org.apache.myfaces.tobago.component.UICommand",

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java?rev=1756589&r1=1756588&r2=1756589&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java Wed Aug 17 07:58:03 2016
@@ -271,9 +271,7 @@ public final class RenderUtils {
       behaviors = new HashMap<String, List<ClientBehavior>>();
       for (Map.Entry<String, UIComponent> facetEntry : ((UIComponent) holder).getFacets().entrySet()) {
 
-        // XXX hack to make after and before facets runable with AJAX buttons
-        if (!facetEntry.getKey().equals(Facets.click.name())
-            && !facetEntry.getKey().equals(Facets.change.name())) {
+        if (!Facets.isEvent(facetEntry.getKey())) {
           break;
         }