From a24d391349354579a83ab2f6b50e9552fbe2566a Mon Sep 17 00:00:00 2001 From: Henrik Paul Date: Tue, 20 Aug 2013 15:47:54 +0300 Subject: Table ignores Container updates while painting (#12258) Vaadin threw an IllegalStateException if a Container was updated while Table was being painted. SQLContainer was known to invalidate its cached size during a Table repaint, resulting in an ItemSetChangeEvent. This fix has been copied over from how ComboBox handles this situation. Change-Id: I04af71a5ea3844da245cb9e31ada4a30ff704619 --- server/src/com/vaadin/ui/Table.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'server/src') diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java index 3507e6b0a5..bd2b7828de 100644 --- a/server/src/com/vaadin/ui/Table.java +++ b/server/src/com/vaadin/ui/Table.java @@ -564,6 +564,8 @@ public class Table extends AbstractSelect implements Action.Container, private List exceptionsDuringCachePopulation = new ArrayList(); + private boolean isBeingPainted; + /* Table constructors */ /** @@ -3166,6 +3168,15 @@ public class Table extends AbstractSelect implements Action.Container, @Override public void paintContent(PaintTarget target) throws PaintException { + isBeingPainted = true; + try { + doPaintContent(target); + } finally { + isBeingPainted = false; + } + } + + private void doPaintContent(PaintTarget target) throws PaintException { /* * Body actions - Actions which has the target null and can be invoked * by right clicking on the table body. @@ -4394,6 +4405,10 @@ public class Table extends AbstractSelect implements Action.Container, @Override public void containerItemSetChange(Container.ItemSetChangeEvent event) { + if (isBeingPainted) { + return; + } + super.containerItemSetChange(event); // super method clears the key map, must inform client about this to @@ -4416,6 +4431,10 @@ public class Table extends AbstractSelect implements Action.Container, @Override public void containerPropertySetChange( Container.PropertySetChangeEvent event) { + if (isBeingPainted) { + return; + } + disableContentRefreshing(); super.containerPropertySetChange(event); -- cgit v1.2.3