From 12277443f5a2afe9ee9b77eec35c85e25240bb69 Mon Sep 17 00:00:00 2001 From: Farruco Sanjurjo Date: Wed, 8 Sep 2010 14:51:45 +0200 Subject: [PATCH] Added a scroll listener for LimitingResourcesPanel * This will scroll the timetracker when the limiting resources is scrolled * Also, changed the superclass to zk.Macro FEA: ItEr02S03MigracionZK5 --- .../LimitingResourcesPanel.js | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/navalplanner-webapp/src/main/resources/web/js/limitingresources/LimitingResourcesPanel.js b/navalplanner-webapp/src/main/resources/web/js/limitingresources/LimitingResourcesPanel.js index b3ad063b1..ef83a59c7 100644 --- a/navalplanner-webapp/src/main/resources/web/js/limitingresources/LimitingResourcesPanel.js +++ b/navalplanner-webapp/src/main/resources/web/js/limitingresources/LimitingResourcesPanel.js @@ -1,3 +1,36 @@ zk.$package("limitingresources"); -limitingresources.LimitingResourcesPanel = zk.$extends(zk.Widget,{}) \ No newline at end of file +limitingresources.LimitingResourcesPanel = zk.$extends(zk.Macro,{ + $init : function(){ + this.$supers('$init', arguments); + + }, + bind_ : function(){ + this.$supers('bind_', arguments); + /* When the LimitingResourcesPanel widget is created we might be on another + * perspective and so all the elements that we are trying to select (as they have the same name), + * belong to this other perspective . We have to wait until everything + * is rendered to be sure that we are picking the proper ones + * + * So the _initializeProperties method can't be placed on $init + */ + + this._initializeProperties(); + this.domListen_(this._rightpanellayout,'onScroll', '_listenToScroll'); + }, + unbind_ : function(){ + this.domUnlisten_(this._rightpanellayout,'onScroll', '_listenToScroll'); + this.$supers('unbind_', arguments); + }, + _initializeProperties : function(){ + this._rightpanellayout = jq('.rightpanellayout div:first'); + this._timetrackergap = jq('.timetrackergap'); + this._resourcesload = jq('.resourcesloadgraph div:first'); + this._leftpanel = jq('.leftpanelgap .z-tree-body'); + }, + _listenToScroll : function(){ + this._timetrackergap.css('left', '-' + this._rightpanellayout.scrollLeft() + 'px'); + this._leftpanel.css('top', '-' + this._rightpanellayout.scrollTop() + 'px'); + this._resourcesload.scrollLeft(this._rightpanellayout.scrollLeft()); + } +}) \ No newline at end of file