Author: dbiatenia
Date: 2007-07-16 15:41:21 -0400 (Mon, 16 Jul 2007)
New Revision: 1638
Modified:
branches/3.0.2/sandbox/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
branches/3.0.2/sandbox/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
Log:
Modified:
branches/3.0.2/sandbox/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
===================================================================
---
branches/3.0.2/sandbox/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-07-16
19:40:06 UTC (rev 1637)
+++
branches/3.0.2/sandbox/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-07-16
19:41:21 UTC (rev 1638)
@@ -49,20 +49,20 @@
Map eventOptions = AjaxRendererUtils.buildEventOptions(context, component);
- String refreshTooltipPointerExp = ";" + getJsVarName(context,
component) + ".toolTip = $('" + component.getClientId(context) +
"');";
+ String refreshTooltipInDOM = ";" + getJsVarName(context, component) +
".toolTip = $('" + component.getClientId(context) + "');";
+ String showNewToolTip = ";" + getJsVarName(context, component) +
".displayDiv();";
if(eventOptions.containsKey("oncomplete")){
JSFunctionDefinition onComplete =
(JSFunctionDefinition)eventOptions.get("oncomplete");
- onComplete.addToBody(refreshTooltipPointerExp);
+ onComplete.addToBody(refreshTooltipInDOM + showNewToolTip);
eventOptions.put("oncomplete", onComplete);
} else {
JSFunctionDefinition onComplete = new JSFunctionDefinition();
onComplete.addParameter("request");
onComplete.addParameter("event");
onComplete.addParameter("data");
- onComplete.addToBody(refreshTooltipPointerExp);
+ onComplete.addToBody(refreshTooltipInDOM + showNewToolTip);
eventOptions.put("oncomplete", onComplete);
-
}
function.addParameter(eventOptions);
Modified:
branches/3.0.2/sandbox/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
===================================================================
---
branches/3.0.2/sandbox/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2007-07-16
19:40:06 UTC (rev 1637)
+++
branches/3.0.2/sandbox/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2007-07-16
19:41:21 UTC (rev 1638)
@@ -37,6 +37,11 @@
this.toolTip.style.display = "none";
this.parentAttached = false;
this.hintParentElement = null;
+
+ // mouse could be overed while ajax request is still in process,
+ // so, after DOM-element replaced, we should not display it
+ this.isMouseOvered = false;
+
if(IE){
var toolTipZindex = parseInt(this.toolTip.style.zIndex);
new Insertion.Before(this.toolTip,
@@ -86,33 +91,29 @@
hintNotLeft = this.detectAncestorNode(e.toElement,this.hintParentElement);
hintNotLeft = hintNotLeft ||
this.detectAncestorNode(e.relatedTarget,this.hintParentElement);
- if (!hintNotLeft)
+ if (!hintNotLeft){
this.doHide(e);
+ this.isMouseOvered = false;
+ }
},
doShow: function(e){
-
+ this.isMouseOvered = true;
if (e.target)
this.hintParentElement = e.target;
if (e.srcElement)
this.hintParentElement = e.srcElement;
+ this.setToolTipPosition(e);
if(this.mode == 'ajax'){
var event = e;
eval(this.ajaxExecuteString);
}
- this.setToolTipPosition(e);
-
- this.toolTip.style.display = "block";
- if(this.iframe){
- this.iframe.style.top = parseInt(this.toolTip.style.top) - this.toolTipBorderHeight;
- this.iframe.style.left = parseInt(this.toolTip.style.left) - this.toolTipBorderWidth;
- this.iframe.style.display = "block";
- }
+ this.displayDiv(e);
},
doHide: function(e){
@@ -122,11 +123,13 @@
if (!fakeEvent) {
+ this.isMouseOvered = false;
this.toolTip.style.display = "none";
if(this.iframe){
this.iframe.style.display = "none";
}
this.hintParentElement = null;
+ this.isMouseOvered = false;
}
},
@@ -213,5 +216,16 @@
wHeight = document.body.clientHeight;
}
return [wWidth,wHeight];
+ },
+
+ displayDiv: function(e){
+ if(this.isMouseOvered){
+ this.toolTip.style.display = "block";
+ if(this.iframe){
+ this.iframe.style.top = parseInt(this.toolTip.style.top) - this.toolTipBorderHeight;
+ this.iframe.style.left = parseInt(this.toolTip.style.left) -
this.toolTipBorderWidth;
+ this.iframe.style.display = "block";
+ }
+ }
}
}
\ No newline at end of file
Show replies by date