From 0950fb132351c6860953a173272415d70421b413 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 11 Mar 2010 09:33:44 +0000 Subject: [PATCH] test case for #4299 svn changeset:11773/svn branch:6.3 --- .../table/TableCacheBuildEfficiency.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tests/src/com/vaadin/tests/components/table/TableCacheBuildEfficiency.java diff --git a/tests/src/com/vaadin/tests/components/table/TableCacheBuildEfficiency.java b/tests/src/com/vaadin/tests/components/table/TableCacheBuildEfficiency.java new file mode 100644 index 0000000000..e9055bf2b8 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/table/TableCacheBuildEfficiency.java @@ -0,0 +1,59 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Property; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.CssLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.Button.ClickEvent; + +public class TableCacheBuildEfficiency extends TestBase { + + @Override + protected String getDescription() { + return "On each add, row property values should be queried only once (one log row for first addition)."; + } + + @Override + protected Integer getTicketNumber() { + return 4299; + } + + @Override + protected void setup() { + + final CssLayout log = new CssLayout(); + log.setWidth("100%"); + + final Table table = new Table() { + @Override + public Property getContainerProperty(Object itemId, + Object propertyId) { + log("Fetched container property \"" + propertyId + + "\" for item \"" + itemId + "\""); + return super.getContainerProperty(itemId, propertyId); + } + + private void log(String string) { + log.addComponent(new Label(string)); + + } + }; + + table.addContainerProperty("foo", String.class, "bar"); + + Button b = new Button("Click to add row", new Button.ClickListener() { + + public void buttonClick(ClickEvent event) { + table.addItem(); + + } + }); + + getLayout().addComponent(table); + getLayout().addComponent(b); + getLayout().addComponent(log); + + } +} -- 2.39.5