T
- The type of the Java Bean we want to use as a
SelectableItempublic class SelectableItem<T> extends com.vaadin.v7.data.util.PropertysetItem implements Selectable
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.BeanItem
,
Serialized FormConstructor and Description |
---|
SelectableItem(T bean) |
Modifier and Type | Method and Description |
---|---|
T |
getBean() |
protected static <T> Map<String,com.vaadin.v7.data.util.VaadinPropertyDescriptor> |
getPropertyDescriptors(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) |
public SelectableItem(T bean)
public boolean isSelected()
Selectable
isSelected
in interface Selectable
public void setSelected(boolean select)
public T getBean()
protected static <T> Map<String,com.vaadin.v7.data.util.VaadinPropertyDescriptor> getPropertyDescriptors(Class<? super T> clazz)
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.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.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. VaadinPropertyDescriptor
s, whereby
VaadinPropertyDescriptor.getName()
is
identically with the key of the returned map (and therefore represents
the property name).T
- clazz
- Copyright © 2021. All rights reserved.