From 0d303da73bca604474649a83817d1b7d5e09f2e2 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Sat, 7 Dec 2013 17:51:56 +0200 Subject: Added convenience method to add items as a varargs array (#13067) Change-Id: Iab49d0960946cec5e949f4f60bb2f79dce66dcc3 --- server/src/com/vaadin/ui/AbstractSelect.java | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'server/src') diff --git a/server/src/com/vaadin/ui/AbstractSelect.java b/server/src/com/vaadin/ui/AbstractSelect.java index 556b16943f..a32d40b11d 100644 --- a/server/src/com/vaadin/ui/AbstractSelect.java +++ b/server/src/com/vaadin/ui/AbstractSelect.java @@ -878,6 +878,37 @@ public abstract class AbstractSelect extends AbstractField implements return retval; } + /** + * Adds given items with given item ids to container. + * + * @since 7.2 + * @param itemId + * item identifiers to be added to underlying container + * @throws UnsupportedOperationException + * if the underlying container don't support adding items with + * identifiers + */ + public void addItems(Object... itemId) throws UnsupportedOperationException { + for (Object id : itemId) { + addItem(id); + } + } + + /** + * Adds given items with given item ids to container. + * + * @since 7.2 + * @param itemIds + * item identifiers to be added to underlying container + * @throws UnsupportedOperationException + * if the underlying container don't support adding items with + * identifiers + */ + public void addItems(Collection itemIds) + throws UnsupportedOperationException { + addItems(itemIds.toArray()); + } + /* * (non-Javadoc) * -- cgit v1.2.3