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
This commit is contained in:
Farruco Sanjurjo 2010-09-07 13:10:08 +02:00
parent a61037aa1d
commit d395f77dca
3 changed files with 13 additions and 11 deletions

View file

@ -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;

View file

@ -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){

View file

@ -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();
},