aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-09-12 22:29:25 +0300
committerVaadin Code Review <review@vaadin.com>2016-09-13 08:36:23 +0000
commit29cdc9873442b8051066810e866bcc2b3f010a59 (patch)
tree068614020e234826e1ee68abdbe40ea70c9fa324 /uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java
parent8b91ebd61bf72d4f1fb2925cea073de297da94fa (diff)
downloadvaadin-framework-29cdc9873442b8051066810e866bcc2b3f010a59.tar.gz
vaadin-framework-29cdc9873442b8051066810e866bcc2b3f010a59.zip
Add context event support to new Grid
Change-Id: I21c5bb95feb3dbab1b543943adc0584aa8eec87b
Diffstat (limited to 'uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java
index cb7c3c28a5..caedc9f299 100644
--- a/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java
+++ b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java
@@ -1,6 +1,8 @@
package com.vaadin.tests.util;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Random;
import com.vaadin.v7.data.util.BeanItemContainer;
@@ -36,9 +38,18 @@ public class PersonContainer extends BeanItemContainer<Person>
}
public static PersonContainer createWithTestData(int size) {
- PersonContainer c = null;
+ PersonContainer c = new PersonContainer();
+ c.addAll(createTestData(size));
+ return c;
+ }
+
+ public static Collection<Person> createTestData() {
+ return createTestData(100);
+ }
+
+ public static Collection<Person> createTestData(int size) {
Random r = new Random(0);
- c = new PersonContainer();
+ ArrayList<Person> testData = new ArrayList<>();
for (int i = 0; i < size; i++) {
Person p = new Person();
p.setFirstName(TestDataGenerator.getFirstName(r));
@@ -51,10 +62,9 @@ public class PersonContainer extends BeanItemContainer<Person>
p.getAddress().setPostalCode(TestDataGenerator.getPostalCode(r));
p.getAddress()
.setStreetAddress(TestDataGenerator.getStreetAddress(r));
- c.addItem(p);
+ testData.add(p);
}
-
- return c;
+ return testData;
}
}