From 48ba72511d1dd4b5da832c37679911a896202020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Tue, 24 May 2011 16:46:18 +0200 Subject: [PATCH] Fix bug Parent recalculations must be the ones that are done first. FEA: ItEr74S04BugFixing --- .../org/zkoss/ganttz/data/GanttDiagramGraph.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/data/GanttDiagramGraph.java b/ganttzk/src/main/java/org/zkoss/ganttz/data/GanttDiagramGraph.java index c4351b7f4..8edfcc134 100644 --- a/ganttzk/src/main/java/org/zkoss/ganttz/data/GanttDiagramGraph.java +++ b/ganttzk/src/main/java/org/zkoss/ganttz/data/GanttDiagramGraph.java @@ -459,6 +459,13 @@ public class GanttDiagramGraph> implements @Override public int compare(Recalculation o1, Recalculation o2) { + // recalculations that are parent recalculations must go + // first + int result = asInt(o2.parentRecalculation) + - asInt(o1.parentRecalculation); + if (result != 0) { + return result; + } int o1Depth = onNullDefault( taskPointsByDepth.get(o1.taskPoint), Integer.MAX_VALUE, "no depth value for " @@ -467,12 +474,7 @@ public class GanttDiagramGraph> implements taskPointsByDepth.get(o2.taskPoint), Integer.MAX_VALUE, "no depth value for " + o2.taskPoint); - int result = o1Depth - o2Depth; - if (result == 0) { - return asInt(o2.parentRecalculation) - - asInt(o1.parentRecalculation); - } - return result; + return o1Depth - o2Depth; } private int asInt(boolean b) {