From f2ec1fa217fa0fe7f98b6a2b95ed075a2e874769 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Tue, 5 Feb 2013 13:08:33 +0200 Subject: Merge of first part of (#10513) to Vaadin 7. Recalculate column widths if vertical scrollbar has been added/removed. Change-Id: I093059b8eaad8ff9f9d87db213dec806993459d5 --- client/src/com/vaadin/client/ui/VScrollTable.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 75f5550790..75d67b82d6 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -500,7 +500,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, /** * Read from the "recalcWidths" -attribute. When it is true, the table will * recalculate the widths for columns - desirable in some cases. For #1983, - * marked experimental. + * marked experimental. See also variable refreshContentWidths + * in method {@link TableHead#updateCellsFromUIDL(UIDL)}. *

* For internal use only. May be removed or replaced in the future. */ @@ -570,6 +571,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, /** For internal use only. May be removed or replaced in the future. */ public ContextMenuDetails contextMenu = null; + private boolean hadScrollBars = false; + public VScrollTable() { setMultiSelectMode(MULTISELECT_MODE_DEFAULT); @@ -2038,6 +2041,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, Util.runWebkitOverflowAutoFix(scrollBodyPanel.getElement()); } }); + + hadScrollBars = willHaveScrollbarz; } /** @@ -2984,7 +2989,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, public void updateCellsFromUIDL(UIDL uidl) { Iterator it = uidl.getChildIterator(); HashSet updated = new HashSet(); - boolean refreshContentWidths = false; + boolean refreshContentWidths = initializedAndAttached + && hadScrollBars != willHaveScrollbars(); while (it.hasNext()) { final UIDL col = (UIDL) it.next(); final String cid = col.getStringAttribute("cid"); -- cgit v1.2.3