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 2007/07/09 15:13:33 UTC

svn commit: r554633 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java

Author: weber
Date: Mon Jul  9 06:13:32 2007
New Revision: 554633

URL: http://svn.apache.org/viewvc?view=rev&rev=554633
Log:
TOBAGO-272 :  onchange has no effect in tc:in

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java?view=diff&rev=554633&r1=554632&r2=554633
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java Mon Jul  9 06:13:32 2007
@@ -17,6 +17,7 @@
  * limitations under the License.
  */
 
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ONCLICK;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
 import static org.apache.myfaces.tobago.TobagoConstants.FACET_MENUBAR;
@@ -177,12 +178,16 @@
               + "}";
       writer.writeJavascript(script);
     } else {
+      UIComponent facetComponent = facetEntry.getValue();
+      String facetAction = (String) facetComponent.getAttributes().get(ATTR_ONCLICK);
+      if (facetAction == null) {
+        facetAction = "Tobago.submitAction('" + facetComponent.getClientId(facesContext) + "')";
+      }
       String script =
           "var element = Tobago.element(\"" + clientId  + "\");\n"
               + "if (element) {\n"
-              + "   Tobago.addEventListener(element, \"" + facetEntry.getKey() + "\", function(){Tobago.submitAction('"
-              + facetEntry.getValue().getClientId(facesContext) + "')});\n"
-              + "}";
+              + "   Tobago.addEventListener(element, \"" + facetEntry.getKey() + "\", function(){"
+              + facetAction + "});\n}";
       writer.writeJavascript(script);
     }
   }