ItEr13S14ArquitecturaClientesItEr11S12: It doesn't invalidate when adding a task.

This commit is contained in:
Óscar González Fernández 2009-06-16 12:29:40 +02:00 committed by Javier Moran Rua
parent 3e8165ab96
commit 7ca314c56e
5 changed files with 17 additions and 8 deletions

View file

@ -123,7 +123,6 @@ public class Planner extends XulElement implements AfterCompose {
public void addTask(TaskBean newTask) { public void addTask(TaskBean newTask) {
getTaskList().addTask(newTask); getTaskList().addTask(newTask);
getDependencyList().invalidate();
dependencyRegistry.add(newTask); dependencyRegistry.add(newTask);
} }

View file

@ -76,12 +76,11 @@ public class TaskList extends XulElement implements AfterCompose {
} }
public void addTask(TaskBean newTask) { public void addTask(TaskBean newTask) {
addTask(Task.asTask(newTask)); addTask(Task.asTask(newTask), true);
} }
public synchronized void addTask(Task task) { public synchronized void addTask(final Task task, boolean relocate) {
task.setParent(this); task.setParent(this);
invalidate();
addContextMenu(task); addContextMenu(task);
addListenerForTaskEditForm(task); addListenerForTaskEditForm(task);
ListIterator<WeakReference<DependencyAddedListener>> iterator = listeners ListIterator<WeakReference<DependencyAddedListener>> iterator = listeners
@ -95,6 +94,9 @@ public class TaskList extends XulElement implements AfterCompose {
} }
} }
task.afterCompose(); task.afterCompose();
if (relocate) {
response(null, new AuInvoke(task, "recolocateAfterAdding"));
}
} }
private void addListenerForTaskEditForm(final Task task) { private void addListenerForTaskEditForm(final Task task) {
@ -187,7 +189,7 @@ public class TaskList extends XulElement implements AfterCompose {
@Override @Override
public void afterCompose() { public void afterCompose() {
for (TaskBean taskBean : originalTasks) { for (TaskBean taskBean : originalTasks) {
addTask(Task.asTask(taskBean)); addTask(Task.asTask(taskBean), false);
} }
if (zoomLevelChangedListener == null) { if (zoomLevelChangedListener == null) {
zoomLevelChangedListener = new ZoomLevelChangedListener() { zoomLevelChangedListener = new ZoomLevelChangedListener() {

View file

@ -4,6 +4,7 @@
<c:set var="self" value="${requestScope.arg.self}"/> <c:set var="self" value="${requestScope.arg.self}"/>
<div id="row${self.uuid}" class="row" z.valor="boxid="${self.uuid}"> <div id="row${self.uuid}" class="row" z.valor="boxid="${self.uuid}">
<div id="${self.uuid}" z.type="ganttz.task.Task" idTask="${self.id}" z.autoz="true"${self.outerAttrs}"> <div id="${self.uuid}" z.type="ganttz.task.Task" idTask="${self.id}" z.autoz="true"${self.outerAttrs}">
<span id="${self.uuid}!real">${self.taskName}</span> <span id="${self.uuid}!real">${self.taskName}</span>

View file

@ -24,7 +24,8 @@
<script type="text/javascript"> <script type="text/javascript">
document.body.class = "yui-skin-sam"; document.body.class = "yui-skin-sam";
var myContainer = document.body.appendChild(document.createElement("div")); /*var myContainer = document.body.insertBefore(document.createElement("div"),document.body.childNodes[0]);
var myLogReader = new YAHOO.widget.LogReader(myContainer);*/
</script> </script>

View file

@ -23,6 +23,13 @@ zkTask.getDD = function(cmp) {
return cmp.created_dd; return cmp.created_dd;
} }
zkTask.recolocateAfterAdding = function(cmp){
var row = cmp.parentNode;
var taskList = row.parentNode.parentNode;
row.parentNode.removeChild(row);
taskList.appendChild(row);
}
zkTask.init = function(cmp) { zkTask.init = function(cmp) {
// Configure the drag&drop over the component // Configure the drag&drop over the component
var dd = zkTask.getDD(cmp); var dd = zkTask.getDD(cmp);
@ -83,7 +90,6 @@ zkTask.init = function(cmp) {
}, zkTask, true); }, zkTask, true);
}; };
zkTask.xMouse; zkTask.xMouse;