diff options
author | Matti Tahvonen <matti@vaadin.com> | 2013-12-07 17:51:56 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-12-18 09:04:53 +0000 |
commit | 0d303da73bca604474649a83817d1b7d5e09f2e2 (patch) | |
tree | 7957147de6eeaeb4d744f8d50b31d39bcc7fdc52 /server/src/com/vaadin/ui/AbstractSelect.java | |
parent | 78a6232b6b0dd2e6c89039e9ca50c164f2d9ab6a (diff) | |
download | vaadin-framework-0d303da73bca604474649a83817d1b7d5e09f2e2.tar.gz vaadin-framework-0d303da73bca604474649a83817d1b7d5e09f2e2.zip |
Added convenience method to add items as a varargs array (#13067)
Change-Id: Iab49d0960946cec5e949f4f60bb2f79dce66dcc3
Diffstat (limited to 'server/src/com/vaadin/ui/AbstractSelect.java')
-rw-r--r-- | server/src/com/vaadin/ui/AbstractSelect.java | 31 |
1 files changed, 31 insertions, 0 deletions
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<Object> 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<Object> itemIds) + throws UnsupportedOperationException { + addItems(itemIds.toArray()); + } + /* * (non-Javadoc) * |