Reimplement moving dependencies when moving task
It wasn't working most of the time. Instead of fixing it, reimplement using simpler approach. FEA: ItEr75S08MigrationZK5
This commit is contained in:
parent
53c57655a1
commit
128342b8e8
4 changed files with 29 additions and 15 deletions
|
|
@ -105,7 +105,6 @@ public class TaskComponent extends Div implements AfterCompose {
|
|||
setContext("idContextMenuTaskAssignment");
|
||||
this.task = task;
|
||||
setClass(calculateCSSClass());
|
||||
|
||||
setId(UUID.randomUUID().toString());
|
||||
this.disabilityConfiguration = disabilityConfiguration;
|
||||
taskViolationListener = Constraint
|
||||
|
|
|
|||
|
|
@ -1,5 +1,20 @@
|
|||
zk.$package("common");
|
||||
|
||||
common.Common = zk.$extends(zk.Widget,{},{
|
||||
webAppContextPath : function(){ return window.location.pathname.split( '/' )[1];}
|
||||
})
|
||||
|
||||
webAppContextPath : function(){ return window.location.pathname.split( '/' )[1];},
|
||||
|
||||
memoize: function(timeoutTimeMillis, functionToExecute) {
|
||||
var lastTimeCalled = null;
|
||||
var cachedResult = null;
|
||||
return function() {
|
||||
var now = Date.now();
|
||||
if (lastTimeCalled !== null && ((now - lastTimeCalled) < timeoutTimeMillis)) {
|
||||
return cachedResult;
|
||||
}
|
||||
lastTimeCalled = now;
|
||||
cachedResult = functionToExecute.apply(null, arguments);
|
||||
return cachedResult;
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
@ -222,8 +222,6 @@ ganttz.DependencyComponent = zk.$extends(ganttz.DependencyComponentBase,{
|
|||
/*maybe move this listener to the $init method*/
|
||||
YAHOO.util.Event.onDOMReady(this.proxy(function() {
|
||||
this.draw();
|
||||
ganttz.TaskComponent.$(this.getIdTaskOrig()).addRelatedDependency(this);
|
||||
ganttz.TaskComponent.$(this.getIdTaskEnd()).addRelatedDependency(this);
|
||||
}));
|
||||
},
|
||||
draw : function() {
|
||||
|
|
|
|||
|
|
@ -114,23 +114,25 @@ ganttz.TaskComponent = zk.$extends(zul.Widget, {
|
|||
consolidateNewDependency : function(task){
|
||||
zAu.send(new zk.Event(this, 'onAddDependency', {dependencyId : task.id}));
|
||||
},
|
||||
addRelatedDependency : function(dependency){
|
||||
if(this._dependencies == undefined) this._dependencies = [];
|
||||
this._dependencies.push(dependency);
|
||||
},
|
||||
_addDragDrop : function(){
|
||||
var dragdropregion = this._getDragDropRegion();
|
||||
|
||||
var thisTaskId = this.$n().id;
|
||||
var relatedDependencies = common.Common.memoize(3000, function() {
|
||||
return jq('.dependency[idtaskorig='+ thisTaskId + ']')
|
||||
.add('.dependency[idtaskend='+ thisTaskId + ']')
|
||||
.get()
|
||||
.map(function(dep) {
|
||||
return ganttz.DependencyComponentBase.$(dep);
|
||||
});
|
||||
});
|
||||
dragdropregion.on('dragEvent', this.proxy(function(ev) {
|
||||
// Slight overload. It could be more efficent to overwrite the YUI
|
||||
// method
|
||||
// that is setting the top property
|
||||
jq(this.$n()).css('top','');
|
||||
if (this._dependencies != undefined) {
|
||||
jq.each(this._dependencies, function(index, dependency){
|
||||
dependency.draw();
|
||||
});
|
||||
}
|
||||
relatedDependencies().forEach(function(dependency) {
|
||||
dependency.draw();
|
||||
});
|
||||
}), null, false);
|
||||
// Register the event endDragEvent
|
||||
dragdropregion.on('endDragEvent', this.proxy(function(ev) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue