/** * Gets the item icon. * * @param itemId * the id of the item to be assigned an icon. * @return the icon for the item or null, if not specified. */ public Resource getItemIcon(Object itemId) { final Resource explicit = itemIcons.get(itemId); if (explicit != null) { return explicit; } if (getItemIconPropertyId() == null) { return null; } final Property<?> ip = getContainerProperty(itemId, getItemIconPropertyId()); if (ip == null) { return null; } final Object icon = ip.getValue(); if (icon instanceof Resource) { return (Resource) icon; } return null; }
final Property<?> p = getContainerProperty(itemId, getItemCaptionPropertyId()); if (p != null) {
final Property<?> p = getContainerProperty(itemId, getItemCaptionPropertyId()); if (p instanceof Property.ValueChangeNotifier) { final Property p = getContainerProperty(itemId, getItemIconPropertyId()); if (p instanceof Property.ValueChangeNotifier) {
@Override public void addNewItem(String newItemCaption) { // Checks for readonly if (isReadOnly()) { throw new Property.ReadOnlyException(); } // Adds new option if (addItem(newItemCaption) != null) { // Sets the caption property, if used if (getItemCaptionPropertyId() != null) { getContainerProperty(newItemCaption, getItemCaptionPropertyId()) .setValue(newItemCaption); } if (isMultiSelect()) { Set values = new HashSet((Collection) getValue()); values.add(newItemCaption); setValue(values); } else { setValue(newItemCaption); } } } }