From 911f4bc258ae0948ae8591f1dfbe2a977b438367 Mon Sep 17 00:00:00 2001 From: Farruco Sanjurjo Date: Thu, 12 Aug 2010 10:44:24 +0200 Subject: [PATCH] Created widget-class for TaskComponent * Now it just handles (not perfectly) the events that trigger the tooltip FEA: ItEr02S03MigracionZK5 --- .../resources/web/js/ganttz/TaskComponent.js | 45 ++++++++++++++++--- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js index 04f2132b9..0a7d102de 100644 --- a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js +++ b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js @@ -1,9 +1,44 @@ zk.$package("ganttz"); ganttz.TaskComponent = zk.$extends(zk.Widget, { - $define :{ - resourcesText : null, - labelsText : null, - tooltipText : null - } + $define :{ + resourcesText : null, + labelsText : null, + tooltipText : null + }, + bind_ : function(event){ + this.$supers('bind_', arguments); + this.domListen_(this.$n(), "onMouseover", '_showToolTip'); + this.domListen_(this.$n(), "onMouseout", '_hideToolTip'); + }, + unbind_ : function(event){ + this.domUnlisten_(this.$n(), "onMouseout", '_hideToolTip'); + this.domUnListen_(this.$n(), "onMouseover", '_showToolTip'); + this.$supers('unbind_', arguments); + }, + _showToolTip : function(){ + this._tooltipTimeout = setTimeout(jQuery.proxy(function(offset) { + var element = jq("#tasktooltip" + this.uuid); + if (element!=null) { + element.show(); + offset = ganttz.GanttPanel.getInstance().getXMouse() + - element.parent().offset().left + - jq('.leftpanelcontainer').offsetWidth + - this.$class._PERSPECTIVES_WIDTH + + jq('.rightpanellayout div').scrollLeft(); + element.css( 'left' , offset +'px' ); + } + }, this), this.$class._TOOLTIP_DELAY); + }, + _hideToolTip : function(){ + if (this._tooltipTimeout) { + clearTimeout(this._tooltipTimeout); + } + jq('#tasktooltip' + this.uuid).hide(); + } + +},{ + //"Class" methods and properties + _TOOLTIP_DELAY : 10, // 10 milliseconds + _PERSPECTIVES_WIDTH : 80 }); \ No newline at end of file