Author: alexsmirnov
Date: 2008-01-16 20:29:42 -0500 (Wed, 16 Jan 2008)
New Revision: 5441
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/util/LRUMap.java
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
Log:
Fix call parameters for a oncomplete function. Change jsFunction declaration for
namespace-enabled function names
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/util/LRUMap.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/util/LRUMap.java 2008-01-16 19:13:04
UTC (rev 5440)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/util/LRUMap.java 2008-01-17 01:29:42
UTC (rev 5441)
@@ -13,7 +13,7 @@
* @author asmirnov
*
*/
-public class LRUMap extends LinkedHashMap implements Serializable {
+public class LRUMap<K,V> extends LinkedHashMap<K,V> implements Serializable
{
/**
*
@@ -31,7 +31,7 @@
}
- protected boolean removeEldestEntry(Entry entry) {
+ protected boolean removeEldestEntry(Entry<K,V> entry) {
// Remove last entry if size exceeded.
return size()>capacity;
}
@@ -41,7 +41,7 @@
* @return the most Recent value
*/
public Object getMostRecent() {
- Iterator iterator = values().iterator();
+ Iterator<V> iterator = values().iterator();
Object mostRecent=null;
while (iterator.hasNext()) {
mostRecent = iterator.next();
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-01-16 19:13:04 UTC
(rev 5440)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-01-17 01:29:42 UTC
(rev 5441)
@@ -988,28 +988,20 @@
var options = request.options;
// we can set listener for complete request - for example,
// it can shedule next request for update page.
- var oncomplete = request.getElementById('org.ajax4jsf.oncomplete');
- if(oncomplete) {
+ var oncomp = request.getElementById('org.ajax4jsf.oncomplete');
+ if(oncomp) {
LOG.debug( "Call request oncomplete function after processing updates"
);
window.setTimeout(function(){
var event = request.domEvt;
var data = request.getJSON('_ajax:data');
try {
- var newscript = Sarissa.getText(oncomplete,true);
- if (!window.data) {
- window.data = data;
- } else {
- for (property in data) {
- window.data[property] = data[property];
- }
- }
+ var newscript = Sarissa.getText(oncomp,true);
+ var oncomplete = new
Function("request","event","data",newscript);
+ var target = null;
if (event) {
- var target = event.target ? event.target : event.srcElement;
- new Function(newscript).apply(target);
- } else {
- window.eval(newscript);
- }
-
+ target = event.target ? event.target : event.srcElement;
+ };
+ oncomplete.call(target,request,event,data);
} catch(e){
LOG.error('Error evaluate oncomplete function '+e.Message);
}
Modified:
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
===================================================================
---
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2008-01-16
19:13:04 UTC (rev 5440)
+++
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2008-01-17
01:29:42 UTC (rev 5441)
@@ -52,9 +52,9 @@
}
public String getFunction(FacesContext context, UIAjaxFunction component) {
- StringBuffer script = new StringBuffer();
+ StringBuffer script = new StringBuffer(component.getName()).append("=");
JSFunctionDefinition func = new JSFunctionDefinition();
- func.setName(component.getName());
+ //func.setName(component.getName());
// Create AJAX Submit function.
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
component, context,AjaxRendererUtils.AJAX_FUNCTION_NAME);
Show replies by date