Example usage for com.vaadin.v7.data.util MethodProperty setValue

List of usage examples for com.vaadin.v7.data.util MethodProperty setValue

Introduction

In this page you can find the example usage for com.vaadin.v7.data.util MethodProperty setValue.

Prototype

@Override
public void setValue(T newValue) throws Property.ReadOnlyException 

Source Link

Document

Sets the value of the property.

Usage

From source file:org.jpos.qi.EntityContainer.java

License:Open Source License

public void updateItem(Item item) {
    clearInternalCache();//from  w  w  w.j  a  v a 2 s.c o m
    Object id = item.getItemProperty("id").getValue();
    try {
        DB.execWithTransaction((db) -> {
            Object obj = db.session().get(clazz, (Serializable) id);
            for (String propertyId : props.keySet()) {
                MethodProperty<Object> p = new MethodProperty<>(obj, propertyId);
                if (!p.isReadOnly())
                    p.setValue(item.getItemProperty(propertyId).getValue());
            }
            db.session().update(obj);
            ((EntityItem) item).setEntity(obj); // refresh entity
            return null;
        });
    } catch (Exception e) {
        QI.getQI().getLog().error(e);
    }
    fireContentsChange(-1);
}