From d395f77dcac79df1ea4a189b1c7016c2ead01b46 Mon Sep 17 00:00:00 2001 From: Farruco Sanjurjo Date: Tue, 7 Sep 2010 13:10:08 +0200 Subject: [PATCH] Modified UnlinkedDependencyComponent and how it's inserted on the DOM * Commonly used properties are initialized now on the $init method. If we did it on the bind_ method there was an error as the unbind_ method was called even if the bind_ wasn't and at unbind_ we used properties set at bind_ * We dropped the overrided method appendChild at DepencyList. Instead of that, we now use the DependencyList mold and the appendChild(widget, ignoredom) method directly at TaskComponent * Removed event listeners used by the UnlinkedDependencyComponent FEA: ItEr02S03MigracionZK5 --- .../web/js/ganttz/DependencyComponent.js | 15 +++++++++++---- .../resources/web/js/ganttz/DependencyList.js | 5 ----- .../main/resources/web/js/ganttz/TaskComponent.js | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ganttzk/src/main/resources/web/js/ganttz/DependencyComponent.js b/ganttzk/src/main/resources/web/js/ganttz/DependencyComponent.js index 9885fba12..0452589c1 100644 --- a/ganttzk/src/main/resources/web/js/ganttz/DependencyComponent.js +++ b/ganttzk/src/main/resources/web/js/ganttz/DependencyComponent.js @@ -277,14 +277,21 @@ ganttz.DependencyComponent = zk.$extends(ganttz.DependencyComponentBase,{ },{}); ganttz.UnlinkedDependencyComponent = zk.$extends(ganttz.DependencyComponentBase,{ - bind_ : function(){ - this.$supers('bind_', arguments); + $init : function(){ + this.$supers('$init', arguments); this._DOMlisttasks = jq('#listtasks'); this._DOMlistdependencies = jq('#listdependencies'); this._WGTganttpanel = ganttz.GanttPanel.getInstance(); - + }, + bind_ : function(){ + this.$supers('bind_', arguments); this._updateArrow(); }, + unbind_ : function(){ + this.domUnlisten_(this._WGTganttpanel.$n(), 'onMousemove', '_updateArrow'); + this.domUnlisten_(this._WGTganttpanel.$n(), 'onClick', '_consolidateDependency'); + this.$supers('unbind_', arguments); + }, draw : function(){ this.domListen_(this._WGTganttpanel.$n(), 'onMousemove', '_updateArrow'); this.domListen_(this._WGTganttpanel.$n(), 'onClick', '_consolidateDependency'); @@ -314,7 +321,7 @@ ganttz.UnlinkedDependencyComponent = zk.$extends(ganttz.DependencyComponentBase, + Math.max(0, this._DOMorigin.outerWidth() - ganttz.TaskComponent.CORNER_WIDTH); -coordOrigin.top = coordOrigin.top - this._DOMlisttasks.position().top + + coordOrigin.top = coordOrigin.top - this._DOMlisttasks.position().top + this._DOMlistdependencies.position().top + ganttz.TaskComponent.HEIGHT; diff --git a/ganttzk/src/main/resources/web/js/ganttz/DependencyList.js b/ganttzk/src/main/resources/web/js/ganttz/DependencyList.js index ac9c9e1fb..6ef8f3403 100644 --- a/ganttzk/src/main/resources/web/js/ganttz/DependencyList.js +++ b/ganttzk/src/main/resources/web/js/ganttz/DependencyList.js @@ -4,11 +4,6 @@ ganttz.DependencyList = zk.$extends(zk.Widget, { $init : function(){ this.$supers('$init', arguments); this.$class.setInstance(this); - }, - appendChild : function(child){ - //true for ignoring DOM insertion - this.$supers('appendChild',[child,true]); - jq('#listdependencies').append(child); } },{ setInstance : function(instance){ diff --git a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js index d2198e9de..759341595 100644 --- a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js +++ b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js @@ -25,8 +25,8 @@ ganttz.TaskComponent = zk.$extends(zk.Widget, { var unlinkedDependency = new ganttz.UnlinkedDependencyComponent(); unlinkedDependency.setOrigin(this.$n()); - dependencylist.appendChild(unlinkedDependency); - dependencylist.rerender(); + WGTdependencylist.appendChild(unlinkedDependency, true); + WGTdependencylist.rerender(); unlinkedDependency.draw(); },