Search in sources :

Example 11 with EntityTableItems

use of io.jmix.ui.component.data.meta.EntityTableItems in project jmix by jmix-framework.

the class AbstractTable method generateCellStyle.

@Nullable
protected String generateCellStyle(@Nullable Object itemId, @Nullable Object propertyId) {
    String style = null;
    if (propertyId != null && itemId != null && !component.isColumnEditable(propertyId) && (component.getColumnGenerator(propertyId) == null || isValueGeneratedColumn(propertyId))) {
        MetaPropertyPath propertyPath;
        if (propertyId instanceof MetaPropertyPath) {
            propertyPath = (MetaPropertyPath) propertyId;
        } else {
            EntityTableItems<E> entityTableSource = (EntityTableItems<E>) getItems();
            propertyPath = entityTableSource != null ? entityTableSource.getEntityMetaClass().getPropertyPath(propertyId.toString()) : null;
        }
        style = generateDefaultCellStyle(itemId, propertyId, propertyPath);
    }
    if (styleProviders != null) {
        String generatedStyle = getGeneratedCellStyle(itemId, propertyId);
        // all cells with custom styles will have v-table-cell-content-cs style name in class
        if (style != null) {
            if (generatedStyle != null) {
                style = CUSTOM_STYLE_NAME_PREFIX + generatedStyle + " " + style;
            }
        } else if (generatedStyle != null) {
            style = CUSTOM_STYLE_NAME_PREFIX + generatedStyle;
        }
    }
    return style == null ? null : (CUSTOM_STYLE_NAME_PREFIX + style);
}
Also used : MetaPropertyPath(io.jmix.core.metamodel.model.MetaPropertyPath) EntityTableItems(io.jmix.ui.component.data.meta.EntityTableItems) Nullable(javax.annotation.Nullable)

Aggregations

EntityTableItems (io.jmix.ui.component.data.meta.EntityTableItems)11 MetaPropertyPath (io.jmix.core.metamodel.model.MetaPropertyPath)6 CollectionDatasource (com.haulmont.cuba.gui.data.CollectionDatasource)3 Datasource (com.haulmont.cuba.gui.data.Datasource)3 DatasourceImplementation (com.haulmont.cuba.gui.data.impl.DatasourceImplementation)3 MetaClass (io.jmix.core.metamodel.model.MetaClass)2 TableSettings (io.jmix.ui.settings.component.TableSettings)2 Nullable (javax.annotation.Nullable)2 com.vaadin.ui (com.vaadin.ui)1 AbstractComponent (com.vaadin.ui.AbstractComponent)1 Component (com.vaadin.ui.Component)1 FetchPlan (io.jmix.core.FetchPlan)1 KeyValueMetaClass (io.jmix.core.impl.keyvalue.KeyValueMetaClass)1 GroupTable (io.jmix.ui.component.GroupTable)1 HasValueSource (io.jmix.ui.component.data.HasValueSource)1 TableItems (io.jmix.ui.component.data.TableItems)1 InstanceContainer (io.jmix.ui.model.InstanceContainer)1 GroupTableSettings (io.jmix.ui.settings.component.GroupTableSettings)1 JmixGroupTable (io.jmix.ui.widget.JmixGroupTable)1 ArrayList (java.util.ArrayList)1