Search in sources :

Example 1 with EntityDataItem

use of io.jmix.ui.data.impl.EntityDataItem in project jmix-docs by Haulmont.

the class EntityData method onInit.

@Subscribe
protected void onInit(InitEvent event) {
    ListDataProvider dataProvider = new ListDataProvider();
    dataProvider.addItem(new EntityDataItem((Entity) valueDescription(75, "Sky")));
    dataProvider.addItem(new EntityDataItem((Entity) valueDescription(7, "Shady side of pyramid")));
    dataProvider.addItem(new EntityDataItem((Entity) valueDescription(18, "Sunny side of pyramid")));
    chart.setDataProvider(dataProvider);
}
Also used : ListDataProvider(io.jmix.ui.data.impl.ListDataProvider) Entity(io.jmix.core.Entity) EntityDataItem(io.jmix.ui.data.impl.EntityDataItem)

Example 2 with EntityDataItem

use of io.jmix.ui.data.impl.EntityDataItem in project jmix by jmix-framework.

the class PivotTableDataItemsSerializer method getFormattedValueByEntityDatatype.

protected Optional<String> getFormattedValueByEntityDatatype(DataItem item, String property, Object value) {
    if (item instanceof EntityDataItem) {
        EntityDataItem entityItem = (EntityDataItem) item;
        MetaClass metaClass = metadata.getClass(entityItem.getItem());
        MetaPropertyPath mpp = resolveMetaPropertyPath(metaClass, property);
        if (mpp != null) {
            return Optional.of(mpp.getRange().asDatatype().format(value, getUserLocale()));
        }
    }
    return Optional.empty();
}
Also used : MetaClass(io.jmix.core.metamodel.model.MetaClass) EntityDataItem(io.jmix.ui.data.impl.EntityDataItem) MetaPropertyPath(io.jmix.core.metamodel.model.MetaPropertyPath)

Aggregations

EntityDataItem (io.jmix.ui.data.impl.EntityDataItem)2 Entity (io.jmix.core.Entity)1 MetaClass (io.jmix.core.metamodel.model.MetaClass)1 MetaPropertyPath (io.jmix.core.metamodel.model.MetaPropertyPath)1 ListDataProvider (io.jmix.ui.data.impl.ListDataProvider)1