/** * Lets the listener know a Containers Item set has changed. * * @see Container.ItemSetChangeListener#containerItemSetChange(Container.ItemSetChangeEvent) */ @Override public void containerItemSetChange(Container.ItemSetChangeEvent event) { // Clears the item id mapping table itemIdMapper.removeAll(); // Notify all listeners fireItemSetChange(); }
/** * Creates a new item into container with container managed id. The id of * the created new item is returned. The item can be fetched with getItem() * method. if the creation fails, null is returned. * * @return the Id of the created item or null in case of failure. * @see Container#addItem() */ @Override public Object addItem() throws UnsupportedOperationException { final Object retval = items.addItem(); if (retval != null && !(items instanceof Container.ItemSetChangeNotifier)) { fireItemSetChange(); } return retval; }
/** * Create a new item into container. The created new item is returned and * ready for setting property values. if the creation fails, null is * returned. In case the container already contains the item, null is * returned. * * This functionality is optional. If the function is unsupported, it always * returns null. * * @param itemId * the Identification of the item to be created. * @return the Created item with the given id, or null in case of failure. * @see Container#addItem(java.lang.Object) */ @Override public Item addItem(Object itemId) throws UnsupportedOperationException { final Item retval = items.addItem(itemId); if (retval != null && !(items instanceof Container.ItemSetChangeNotifier)) { fireItemSetChange(); } return retval; }
@Override public boolean removeItem(Object itemId) throws UnsupportedOperationException { unselect(itemId); final boolean retval = items.removeItem(itemId); itemIdMapper.remove(itemId); if (retval && !(items instanceof Container.ItemSetChangeNotifier)) { fireItemSetChange(); } return retval; }
/** * Removes all items from the container. * * This functionality is optional. If the function is unsupported, it always * returns false. * * @return True if the operation succeeded. * @see Container#removeAllItems() */ @Override public boolean removeAllItems() throws UnsupportedOperationException { final boolean retval = items.removeAllItems(); itemIdMapper.removeAll(); if (retval) { setValue(null); if (!(items instanceof Container.ItemSetChangeNotifier)) { fireItemSetChange(); } } return retval; }