Author: sergeyhalipov
Date: 2007-10-16 12:44:24 -0400 (Tue, 16 Oct 2007)
New Revision: 3402
Modified:
trunk/ui/tooltip/src/main/config/component/toolTip.xml
trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
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:
http://jira.jboss.com/jira/browse/RF-1124
Modified: trunk/ui/tooltip/src/main/config/component/toolTip.xml
===================================================================
--- trunk/ui/tooltip/src/main/config/component/toolTip.xml 2007-10-16 16:19:49 UTC (rev
3401)
+++ trunk/ui/tooltip/src/main/config/component/toolTip.xml 2007-10-16 16:44:24 UTC (rev
3402)
@@ -42,11 +42,17 @@
<defaultvalue><![CDATA["inline"]]></defaultvalue>
</property>
<property>
- <name>delay</name>
+ <name>showDelay</name>
<classname>int</classname>
<description>Delay in milliseconds before tooltip will be
displayed.</description>
<defaultvalue><![CDATA[0]]></defaultvalue>
- </property>
+ </property>
+ <property>
+ <name>hideDelay</name>
+ <classname>int</classname>
+ <description>Delay in milliseconds before tooltip will be
hidden.</description>
+ <defaultvalue><![CDATA[0]]></defaultvalue>
+ </property>
<property>
<name>zorder</name>
<classname>int</classname>
Modified: trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
===================================================================
--- trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2007-10-16
16:19:49 UTC (rev 3401)
+++ trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2007-10-16
16:44:24 UTC (rev 3402)
@@ -93,10 +93,14 @@
public abstract void setOnmouseover(String onmouseover);
- public abstract int getDelay();
+ public abstract int getShowDelay();
- public abstract void setDelay(int delay);
+ public abstract void setShowDelay(int delay);
+
+ public abstract int getHideDelay();
+ public abstract void setHideDelay(int delay);
+
public abstract int getZorder();
public abstract void setZorder(int delay);
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 2007-10-16
16:19:49 UTC (rev 3401)
+++
trunk/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-10-16
16:44:24 UTC (rev 3402)
@@ -221,7 +221,8 @@
eventsMap.put(new JSReference("onshow"), toolTip.getOnshow());
eventsMap.put(new JSReference("oncomplete"), toolTip.getOncomplete());
eventsMap.put(new JSReference("onhide"), toolTip.getOnhide());
- eventsMap.put(new JSReference("delay"), new Integer(toolTip.getDelay()));
+ eventsMap.put(new JSReference("delay"), new
Integer(toolTip.getShowDelay()));
+ eventsMap.put(new JSReference("hideDelay"), new
Integer(toolTip.getHideDelay()));
JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context);
JSReference ref = new JSReference("ajaxOptions");
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 2007-10-16
16:19:49 UTC (rev 3401)
+++
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2007-10-16
16:44:24 UTC (rev 3402)
@@ -11,6 +11,7 @@
this.oncomplete = new Function('event', events.oncomplete + ';return
true;');
this.onhide = new Function('event', events.onhide + ';return true;');
this.delay = events.delay;
+ this.hideDelay = events.hideDelay;
this.id = id;
this.parentId = parentId;
@@ -61,7 +62,13 @@
this.attachOnLoadEventsListner = this.attachOnLoadEvents.bindAsEventListener(this);
this.setToolTipPositionListner = this.setToolTipPosition.bindAsEventListener(this);
- this.doHideListner = this.doHide.bindAsEventListener(this);
+
+ if (this.hideDelay > 0) {
+ this.doHideListner = this.customHideHandler.bindAsEventListener(this);
+ } else {
+ this.doHideListner = this.doHide.bindAsEventListener(this);
+ }
+
this.leaveToolTipListner = this.leaveToolTip.bindAsEventListener(this);
if (Richfaces.tooltips[parentId])
@@ -113,11 +120,23 @@
this.eventCopy = A4J.AJAX.CloneObject(event, false);
- this.activationTimerHandle = setTimeout(function() {
+ this.activationTimerHandle = window.setTimeout(function() {
this.doShow(this.eventCopy);
- }.bind(this), this.delay);
+ }.bindAsEventListener(this), this.delay);
},
+ customHideHandler: function(event) {
+ if (this.hidingTimerHandle) {
+ return ;
+ }
+
+ this.eventCopy = A4J.AJAX.CloneObject(event, false);
+
+ this.hidingTimerHandle = window.setTimeout(function() {
+ this.doHide(this.eventCopy);
+ }.bindAsEventListener(this), this.hideDelay);
+ },
+
attachParentEvents: function(){
if(this.followMouse){
Event.observe(this.parent, 'mousemove', this.setToolTipPositionListner,
false);
@@ -264,7 +283,7 @@
if (this.ffcheck(relTarg)) return;
if (this.activationTimerHandle) {
- clearTimeout(this.activationTimerHandle);
+ window.clearTimeout(this.activationTimerHandle);
this.activationTimerHandle = undefined;
}
@@ -288,6 +307,11 @@
this.hintParentElement = null;
this.isMouseOvered = false;
this.onhide(e);
+
+ if (this.hidingTimerHandle) {
+ window.clearTimeout(this.hidingTimerHandle);
+ this.hidingTimerHandle = undefined;
+ }
},
doEnable: function(){