Example usage for com.vaadin.v7.ui AbstractSelect getContainerProperty

List of usage examples for com.vaadin.v7.ui AbstractSelect getContainerProperty

Introduction

In this page you can find the example usage for com.vaadin.v7.ui AbstractSelect getContainerProperty.

Prototype

@Override
public Property getContainerProperty(Object itemId, Object propertyId) 

Source Link

Document

Gets the Property identified by the given itemId and propertyId from the Container.

Usage

From source file:com.haulmont.cuba.web.gui.components.table.CalculatableColumnGenerator.java

License:Apache License

protected com.vaadin.ui.Component generateCell(AbstractSelect source, Object itemId, Object columnId) {
    CollectionDatasource ds = table.getDatasource();
    MetaPropertyPath propertyPath = ds.getMetaClass().getPropertyPath(columnId.toString());

    PropertyWrapper propertyWrapper = (PropertyWrapper) source.getContainerProperty(itemId, propertyPath);

    com.haulmont.cuba.gui.components.Formatter formatter = null;
    Table.Column column = table.getColumn(columnId.toString());
    if (column != null) {
        formatter = column.getFormatter();
    }/*from  w w  w.j av a 2  s  .  c om*/

    com.vaadin.ui.Label label = new com.vaadin.ui.Label();
    setLabelText(label, propertyWrapper.getValue(), formatter);
    label.setWidthUndefined();

    //add property change listener that will update a label value
    propertyWrapper.addListener(new CalculatablePropertyValueChangeListener(label, formatter));

    return label;
}