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