Author: sergeyhalipov
Date: 2007-10-22 11:57:44 -0400 (Mon, 22 Oct 2007)
New Revision: 3473
Modified:
branches/3.1.x/ui/tooltip/src/main/config/component/toolTip.xml
branches/3.1.x/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
branches/3.1.x/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
branches/3.1.x/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
Log:
http://jira.jboss.com/jira/browse/RF-1124
Modified: branches/3.1.x/ui/tooltip/src/main/config/component/toolTip.xml
===================================================================
--- branches/3.1.x/ui/tooltip/src/main/config/component/toolTip.xml 2007-10-22 15:24:55
UTC (rev 3472)
+++ branches/3.1.x/ui/tooltip/src/main/config/component/toolTip.xml 2007-10-22 15:57:44
UTC (rev 3473)
@@ -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: branches/3.1.x/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
===================================================================
---
branches/3.1.x/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2007-10-22
15:24:55 UTC (rev 3472)
+++
branches/3.1.x/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2007-10-22
15:57:44 UTC (rev 3473)
@@ -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:
branches/3.1.x/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
===================================================================
---
branches/3.1.x/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-10-22
15:24:55 UTC (rev 3472)
+++
branches/3.1.x/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-10-22
15:57:44 UTC (rev 3473)
@@ -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:
branches/3.1.x/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
===================================================================
---
branches/3.1.x/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2007-10-22
15:24:55 UTC (rev 3472)
+++
branches/3.1.x/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2007-10-22
15:57:44 UTC (rev 3473)
@@ -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])
@@ -119,11 +126,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);
@@ -251,7 +270,7 @@
if(!needToHide) return;
if (this.activationTimerHandle) {
- clearTimeout(this.activationTimerHandle);
+ window.clearTimeout(this.activationTimerHandle);
this.activationTimerHandle = undefined;
}
@@ -272,6 +291,11 @@
this.isMouseOvered = false;
this.onhide(e);
}
+
+ if (this.hidingTimerHandle) {
+ window.clearTimeout(this.hidingTimerHandle);
+ this.hidingTimerHandle = undefined;
+ }
},
doEnable: function(){
@@ -459,4 +483,4 @@
}
}
-}
\ No newline at end of file
+}