Class SelectableItem<T>
- java.lang.Object
-
- com.vaadin.v7.data.util.PropertysetItem
-
- org.opennms.features.vaadin.jmxconfiggenerator.data.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 implementsSelectable
which determines that this item can be selected. This class is mainly a rough copy ofBeanItem
, but due to some limitations in how theBeanItemContainer
(orAbstractBeanContainer
) 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
-
-
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 toBeanItem.getPropertyDescriptors(java.lang.Class)
but adds an additionalVaadinPropertyDescriptor
to support a "is selectable" feature.boolean
isSelected()
Returns if selected or not.void
setSelected(boolean select)
-
-
-
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 interfaceSelectable
- 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 toBeanItem.getPropertyDescriptors(java.lang.Class)
but adds an additionalVaadinPropertyDescriptor
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 ofclazz
and builds accessors for it (read method, write method, etc. for a field, etc. Have a look atIntrospector
). 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 classclazz
. Each PropertyDescriptor is converted to a vaadinMethodPropertyDescriptor
(MethodPropertyDescriptor
is created. In addition a VaadinPropertyDescriptor is added to provide the "select" feature. For this we use theObjectProperty
of vaadin.
The build map is a mapping between property names and theVaadinPropertyDescriptor
s, wherebyVaadinPropertyDescriptor.getName()
is identically with the key of the returned map (and therefore represents the property name).- Type Parameters:
T
-- Parameters:
clazz
-- Returns:
-
-