From 8953147d96087582a7fea2c5284d585e70d768df Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Fri, 13 Nov 2015 10:58:35 +0200 Subject: Add some performance guidance to renderer javadocs. Change-Id: I5171c6eb6360a9c85b8afbc3096d9b6c5c8f4064 --- client/src/com/vaadin/client/renderers/Renderer.java | 8 +++++++- client/src/com/vaadin/client/renderers/WidgetRenderer.java | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/client/src/com/vaadin/client/renderers/Renderer.java b/client/src/com/vaadin/client/renderers/Renderer.java index a3faa1e9df..b2e9acd582 100644 --- a/client/src/com/vaadin/client/renderers/Renderer.java +++ b/client/src/com/vaadin/client/renderers/Renderer.java @@ -35,7 +35,13 @@ import com.vaadin.client.widgets.Grid; public interface Renderer { /** - * Called whenever the {@link Grid} updates a cell + * Called whenever the {@link Grid} updates a cell. + *

+ * For optimal performance, work done in this method should be kept to a + * minimum since it will be called continuously while the user is scrolling. + * It is recommended to set up the cell's DOM structure in + * {@link ComplexRenderer#init(RendererCellReference)} and only make + * incremental updates based on cell data in this method. * * @param cell * The cell. Note that the cell is a flyweight and should not be diff --git a/client/src/com/vaadin/client/renderers/WidgetRenderer.java b/client/src/com/vaadin/client/renderers/WidgetRenderer.java index 1a33894e8e..d7219e7241 100644 --- a/client/src/com/vaadin/client/renderers/WidgetRenderer.java +++ b/client/src/com/vaadin/client/renderers/WidgetRenderer.java @@ -60,6 +60,11 @@ public abstract class WidgetRenderer extends * information in the widget that is cell specific. Do not detach the Widget * here, it will be done automatically by the Grid when the widget is no * longer needed. + *

+ * For optimal performance, work done in this method should be kept to a + * minimum since it will be called continuously while the user is scrolling. + * The renderer can use {@link Widget#setLayoutData(Object)} to store cell + * data that might be needed in e.g. event listeners. * * @param cell * The cell to render. Note that the cell is a flyweight and -- cgit v1.2.3