Author: pyaschenko
Date: 2008-12-10 13:36:37 -0500 (Wed, 10 Dec 2008)
New Revision: 11709
Modified:
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
Log:
https://jira.jboss.org/jira/browse/RF-4474
Modified:
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
===================================================================
---
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2008-12-10
17:31:26 UTC (rev 11708)
+++
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2008-12-10
18:36:37 UTC (rev 11709)
@@ -279,10 +279,11 @@
eventsMap.put(new JSReference("delay"), new
Integer(toolTip.getShowDelay()));
eventsMap.put(new JSReference("hideDelay"), new
Integer(toolTip.getHideDelay()));
+ JSFunctionDefinition ajaxFunc = new JSFunctionDefinition("event",
"ajaxOptions");
JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context);
JSReference ref = new JSReference("ajaxOptions");
function.addParameter(ref);
- String ajaxFunc = function.toScript();
+ ajaxFunc.addToBody(function);
Map<String, Object> ajaxOptions = buildEventOptions(context, toolTip,
targetClientId);
ajaxOptions.putAll(getParamsMap(context, toolTip));
@@ -305,7 +306,7 @@
append(toolTip.isFollowMouse()).append(comma).
append(toolTip.getHorizontalOffset()).append(comma).
append(toolTip.getVerticalOffset()).append(comma).
- append("\"").append(ajaxFunc).append("\"").append(comma).append(ScriptUtils.toScript(ajaxOptions)).append(");");
+ append(ajaxFunc.toScript()).append(comma).append(ScriptUtils.toScript(ajaxOptions)).append(");");
return ret.toString();
}
Modified:
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
===================================================================
---
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2008-12-10
17:31:26 UTC (rev 11708)
+++
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2008-12-10
18:36:37 UTC (rev 11709)
@@ -29,7 +29,7 @@
this.horizontalOffset = horizontalOffset;
this.verticalOffset = verticalOffset;
- this.ajaxExecuteString = ajaxFunction;
+ if (ajaxFunction) this.ajaxExecuteFunction = (ajaxFunction) ? ajaxFunction : function()
{};
this.ajaxOptions = ajaxOptions;
this.clientAjaxParams = {};
@@ -249,12 +249,9 @@
this.toolTip.style.visibility = "hidden";
this.toolTip.style.display = 'block';
-
- this.setToolTipPosition(e);
- this.setToolTipVisible(false);
-
+ this.setToolTipPosition(e);
}
- var event = e;
+ var event = A4J.AJAX.CloneObject(e, false);
var ajaxOptions = this.ajaxOptions;
if(this.clientAjaxParams){
if(e.clientX){
@@ -268,7 +265,23 @@
Object.extend(ajaxOptions['parameters'], this.clientAjaxParams);
}
- eval(this.ajaxExecuteString);
+ if (this.delay>0)
+ {
+ this.setToolTipPosition(e);
+ this.activationTimerHandle = window.setTimeout(function()
+ {
+ if (this.toolTipDefaultContent)
+ {
+ this.setToolTipVisible(false);
+ }
+ this.ajaxExecuteFunction(event, ajaxOptions);
+ }.bind(this), this.delay);
+ }
+ else
+ {
+ this.setToolTipVisible(false);
+ this.ajaxExecuteFunction(event, ajaxOptions);
+ }
} else {
this.setToolTipPosition(e);
if (this.delay>0)
@@ -276,7 +289,7 @@
this.activationTimerHandle = window.setTimeout(function()
{
this.displayDiv();
- }.bindAsEventListener(this), this.delay);
+ }.bind(this), this.delay);
}
else this.displayDiv();
}
@@ -318,11 +331,6 @@
if (this.ffcheck(relTarg)) return;
- if (this.activationTimerHandle) {
- window.clearTimeout(this.activationTimerHandle);
- this.activationTimerHandle = undefined;
- }
-
var className;
if (relTarg)
{