summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2011-04-08 15:28:28 +0000
committerArtur Signell <artur.signell@itmill.com>2011-04-08 15:28:28 +0000
commit61ea50cec193252032fa7cb3cfa0445135ea0082 (patch)
tree0f1f9479ed7a44d23ed0ccec7e1859c0e4dab987 /src/com
parentd4d1a7c8f43c4caa9f0cdd9292fa9364ea2a7d60 (diff)
downloadvaadin-framework-61ea50cec193252032fa7cb3cfa0445135ea0082.tar.gz
vaadin-framework-61ea50cec193252032fa7cb3cfa0445135ea0082.zip
#6780 AbstractSelect's setItemIconPropertyId fails silently
svn changeset:18189/svn branch:6.6
Diffstat (limited to 'src/com')
-rw-r--r--src/com/vaadin/ui/AbstractSelect.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/com/vaadin/ui/AbstractSelect.java b/src/com/vaadin/ui/AbstractSelect.java
index ef09becb00..ab17498f7f 100644
--- a/src/com/vaadin/ui/AbstractSelect.java
+++ b/src/com/vaadin/ui/AbstractSelect.java
@@ -1256,7 +1256,7 @@ public abstract class AbstractSelect extends AbstractField implements
* <p>
* If the property id is set to a valid value, each item is given an icon
* got from the given property of the items. The type of the property must
- * be assignable to Icon.
+ * be assignable to Resource.
* </p>
*
* <p>
@@ -1271,14 +1271,23 @@ public abstract class AbstractSelect extends AbstractField implements
* .
*
* @param propertyId
- * the Id of the property that specifies icons for items.
- */
- public void setItemIconPropertyId(Object propertyId) {
- if ((propertyId != null)
- && Resource.class.isAssignableFrom(getType(propertyId))) {
+ * the id of the property that specifies icons for items or null
+ * @throws IllegalArgumentException
+ * If the propertyId is not in the container or is not of a
+ * valid type
+ */
+ public void setItemIconPropertyId(Object propertyId)
+ throws IllegalArgumentException {
+ if (propertyId == null) {
+ itemIconPropertyId = null;
+ } else if (!getContainerPropertyIds().contains(propertyId)) {
+ throw new IllegalArgumentException(
+ "Property id not found in the container");
+ } else if (Resource.class.isAssignableFrom(getType(propertyId))) {
itemIconPropertyId = propertyId;
} else {
- itemIconPropertyId = null;
+ throw new IllegalArgumentException(
+ "Property id must be assignable to Resource");
}
requestRepaint();
}