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