Author: akushunin
Date: 2008-01-14 09:39:19 -0500 (Mon, 14 Jan 2008)
New Revision: 5351
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
Log:
http://jira.jboss.com/jira/browse/RF-1897
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-01-14
14:23:32 UTC (rev 5350)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-01-14
14:39:19 UTC (rev 5351)
@@ -42,6 +42,9 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptString;
+import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.compiler.TemplateContext;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.Java2Dresource;
@@ -908,4 +911,25 @@
writer.writeText(eventName + ": ''", null);
}
}
+
+ public JSFunctionDefinition getAsEventHandler(FacesContext context, UIComponent
component, String attributeName, String append) {
+ String event = (String) component.getAttributes().get(attributeName);
+
+ if (event != null) {
+ event = event.trim();
+
+ if (event.length() != 0) {
+ JSFunctionDefinition function = new JSFunctionDefinition();
+ function.addParameter("event");
+ if(null!=append && append.length()>0){
+ function.addToBody(event+append);
+ }else{
+ function.addToBody(event);
+ }
+ return function;
+ }
+ }
+
+ return null;
+ }
}