From 39ee85c823ecab75760e4f9768e003cf60b7e796 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 1 Sep 2009 07:05:43 +0000 Subject: [PATCH] Performance improvement for #2998 - Table rendering in Firefox is very slow when the table contains components svn changeset:8600/svn branch:6.1 --- .../terminal/gwt/client/ui/VScrollTable.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index 7396aa35c9..1409ae9b8f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -286,6 +286,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler { if (isAttached()) { sizeInit(); } + + restoreRowVisibility(); } if (selectMode == Table.SELECT_MODE_NONE) { @@ -300,6 +302,18 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler { headerChangedDuringUpdate = false; } + private void restoreRowVisibility() { + // Restore row visibility which is set to "none" when the row is + // rendered. + TableSectionElement tableBodyElement = scrollBody.tBodyElement; + final int rows = tableBodyElement.getChildCount(); + for (int row = 0; row < rows; row++) { + final Element cell = tableBodyElement.getChild(row).cast(); + cell.getStyle().setProperty("visibility", ""); + } + + } + private void setCacheRate(double d) { if (cache_rate != d) { cache_rate = d; @@ -413,6 +427,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler { } scrollBody.fixSpacers(); + restoreRowVisibility(); } /** @@ -2211,6 +2226,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler { public VScrollTableRow(UIDL uidl, char[] aligns) { this(uidl.getIntAttribute("key")); + /* + * Rendering the rows as hidden improves Firefox and Safari + * performance drastically. + */ + getElement().getStyle().setProperty("visibility", "hidden"); + String rowStyle = uidl.getStringAttribute("rowstyle"); if (rowStyle != null) { addStyleName(CLASSNAME + "-row-" + rowStyle); -- 2.39.5