Class SelectableItem<T>

  • Type Parameters:
    T - The type of the Java Bean we want to use as a SelectableItem
    All Implemented Interfaces:
    com.vaadin.v7.data.Item, com.vaadin.v7.data.Item.PropertySetChangeNotifier, java.io.Serializable, java.lang.Cloneable, Selectable

    public class SelectableItem<T>
    extends com.vaadin.v7.data.util.PropertysetItem
    implements Selectable
    This class represents a selectable item. In encapsulates any java objects which fulfillths the java bean convention. In addition it implements Selectable which determines that this item can be selected. This class is mainly a rough copy of BeanItem, but due to some limitations in how the BeanItemContainer (or AbstractBeanContainer) handles the creation of a BeanItem I decided to implement a new SelectableItem. This may change in future releases in the vaadin core framework. So we may remove this item.
    Author:
    Markus von RĂ¼den
    See Also:
    BeanItem, Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.vaadin.v7.data.Item

        com.vaadin.v7.data.Item.Editor, com.vaadin.v7.data.Item.PropertySetChangeListener, com.vaadin.v7.data.Item.PropertySetChangeNotifier, com.vaadin.v7.data.Item.Viewer
    • Constructor Summary

      Constructors 
      Constructor Description
      SelectableItem​(T bean)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T getBean()  
      protected static <T> java.util.Map<java.lang.String,​com.vaadin.v7.data.util.VaadinPropertyDescriptor> getPropertyDescriptors​(java.lang.Class<? super T> clazz)
      Note:This method is simmilar to BeanItem.getPropertyDescriptors(java.lang.Class) but adds an additional VaadinPropertyDescriptor to support a "is selectable" feature.
      boolean isSelected()
      Returns if selected or not.
      void setSelected​(boolean select)  
      • Methods inherited from class com.vaadin.v7.data.util.PropertysetItem

        addItemProperty, addListener, addPropertySetChangeListener, clone, equals, getItemProperty, getItemPropertyIds, getListeners, hashCode, removeItemProperty, removeListener, removePropertySetChangeListener, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SelectableItem

        public SelectableItem​(T bean)
    • Method Detail

      • isSelected

        public boolean isSelected()
        Description copied from interface: Selectable
        Returns if selected or not.
        Specified by:
        isSelected in interface Selectable
        Returns:
        true if selected, false otherwise.
      • setSelected

        public void setSelected​(boolean select)
      • getBean

        public T getBean()
      • getPropertyDescriptors

        protected static <T> java.util.Map<java.lang.String,​com.vaadin.v7.data.util.VaadinPropertyDescriptor> getPropertyDescriptors​(java.lang.Class<? super T> clazz)
        Note:This method is simmilar to BeanItem.getPropertyDescriptors(java.lang.Class) but adds an additional VaadinPropertyDescriptor to support a "is selectable" feature. Because the earlier mentioned method is static, we cannot overwrite it. Therefore I decided to implement it in my own way.

        In short: It lookups all methods which fullfill the java bean convention of clazz and builds accessors for it (read method, write method, etc. for a field, etc. Have a look at Introspector). And in addition we a new "accessor" for a selectable item is added.

        In detail:
        Introspector is used to get all PropertyDescriptors from the given class clazz. Each PropertyDescriptor is converted to a vaadin MethodPropertyDescriptor( MethodPropertyDescriptor is created. In addition a VaadinPropertyDescriptor is added to provide the "select" feature. For this we use the ObjectProperty of vaadin.

        The build map is a mapping between property names and the VaadinPropertyDescriptors, whereby VaadinPropertyDescriptor.getName() is identically with the key of the returned map (and therefore represents the property name).
        Type Parameters:
        T -
        Parameters:
        clazz -
        Returns: