You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2006/10/24 14:06:51 UTC
svn commit: r467318 - in
/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax:
HtmlCommandButtonAjax.java HtmlCommandButtonAjaxRenderer.java
Author: mmarinschek
Date: Tue Oct 24 05:06:50 2006
New Revision: 467318
URL: http://svn.apache.org/viewvc?view=rev&rev=467318
Log:
allow HtmlCommandButtonAjax to support onclick-attribute on buttons
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjax.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjaxRenderer.java
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjax.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjax.java?view=diff&rev=467318&r1=467317&r2=467318
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjax.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjax.java Tue Oct 24 05:06:50 2006
@@ -48,7 +48,6 @@
super();
setRendererType(DEFAULT_RENDERER_TYPE);
setType("button"); // we don't want this to submit
- setOnclick("");
}
/**
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjaxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjaxRenderer.java?view=diff&rev=467318&r1=467317&r2=467318
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjaxRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/inputAjax/HtmlCommandButtonAjaxRenderer.java Tue Oct 24 05:06:50 2006
@@ -78,18 +78,26 @@
return;
}
+ this.encodeJavascript(context, component);
+ super.encodeEnd(context, component);
+ // now write loading image
+ AjaxRendererUtils.writeLoadingImage(context, component);
+ }
-
- String clientId = component.getClientId(context);
+ protected StringBuffer buildOnClick(UIComponent uiComponent, FacesContext facesContext, ResponseWriter writer) throws IOException {
+ String clientId = uiComponent.getClientId(facesContext);
String submitFunctionStart = AjaxRendererUtils.JS_MYFACES_NAMESPACE + "ajaxSubmit3('" + clientId + "');";
- HtmlCommandButtonAjax comp = (HtmlCommandButtonAjax) component;
- comp.setOnclick(submitFunctionStart);
- this.encodeJavascript(context, component);
- super.encodeEnd(context, component);
- // now write loading image
- AjaxRendererUtils.writeLoadingImage(context, comp);
+ StringBuffer buf = super.buildOnClick(uiComponent, facesContext, writer);
+
+ if(buf.length()!=0 && !(buf.charAt(buf.length()-1)==';'))
+ {
+ buf.append(";");
+ }
+ buf.append(submitFunctionStart);
+
+ return buf;
}
public void encodeAjax(FacesContext context, UIComponent component) throws IOException