From 8e548c916ccd65d00b20937cbb80520c60b12d83 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Tue, 22 Apr 2008 11:47:29 +0000 Subject: [PATCH] fixes for #1584 (untested) svn changeset:4204/svn branch:trunk --- .../gwt/server/CommunicationManager.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java index 8c5a44f0ef..281ee45a23 100644 --- a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java +++ b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java @@ -292,16 +292,27 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { } if (paintables != null) { - // Sorts the Paintable list so that parents - // are always painted before children + // We need to avoid painting children before parent. + // This is ensured by ordering list by depth in component + // tree Collections.sort(paintables, new Comparator() { public int compare(Object o1, Object o2) { - final Component c1 = (Component) o1; - final Component c2 = (Component) o2; - if (isChildOf(c1, c2)) { + Component c1 = (Component) o1; + Component c2 = (Component) o2; + int d1 = 0; + while (c1.getParent() != null) { + d1++; + c1 = c1.getParent(); + } + int d2 = 0; + while (c2.getParent() != null) { + d2++; + c2 = c2.getParent(); + } + if (d1 < d2) { return -1; } - if (isChildOf(c2, c1)) { + if (d1 > d2) { return 1; } return 0; -- 2.39.5