Search in sources :

Example 6 with Formatter

use of com.haulmont.cuba.gui.components.Formatter in project cuba by cuba-platform.

the class DesktopAbstractTable method addColumn.

@Override
public void addColumn(Column column) {
    checkNotNullArgument(column, "Column must be non null");
    Object columnId = column.getId();
    columns.put(columnId, column);
    columnsOrder.add(column);
    if (tableModel != null) {
        tableModel.addColumn(column);
    }
    if (datasource != null && column.isEditable() && columnId instanceof MetaPropertyPath) {
        if (!editableColumns.contains(columnId)) {
            editableColumns.add((MetaPropertyPath) columnId);
        }
    }
    setColumnIdentifiers();
    refresh();
    column.setOwner(this);
    if (column.getFormatter() == null && columnId instanceof MetaPropertyPath) {
        MetaProperty metaProperty = ((MetaPropertyPath) columnId).getMetaProperty();
        if (Collection.class.isAssignableFrom(metaProperty.getJavaType())) {
            final Formatter collectionFormatter = new CollectionFormatter();
            column.setFormatter(collectionFormatter);
        }
    }
}
Also used : CollectionFormatter(com.haulmont.cuba.gui.components.formatters.CollectionFormatter) Formatter(com.haulmont.cuba.gui.components.Formatter) MetaPropertyPath(com.haulmont.chile.core.model.MetaPropertyPath) MetaProperty(com.haulmont.chile.core.model.MetaProperty) CollectionFormatter(com.haulmont.cuba.gui.components.formatters.CollectionFormatter)

Aggregations

Formatter (com.haulmont.cuba.gui.components.Formatter)6 MetaClass (com.haulmont.chile.core.model.MetaClass)4 MetaProperty (com.haulmont.chile.core.model.MetaProperty)4 CollectionFormatter (com.haulmont.cuba.gui.components.formatters.CollectionFormatter)3 MetaPropertyPath (com.haulmont.chile.core.model.MetaPropertyPath)2 Range (com.haulmont.chile.core.model.Range)2 Entity (com.haulmont.cuba.core.entity.Entity)2 AppConfig (com.haulmont.cuba.gui.AppConfig)2 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)2 DsBuilder (com.haulmont.cuba.gui.data.DsBuilder)2 DsContextImplementation (com.haulmont.cuba.gui.data.impl.DsContextImplementation)2 ComponentsFactory (com.haulmont.cuba.gui.xml.layout.ComponentsFactory)2 SimpleDateFormat (java.text.SimpleDateFormat)2 java.util (java.util)2 Inject (javax.inject.Inject)2 StringUtils (org.apache.commons.lang.StringUtils)2 Files (com.google.common.io.Files)1 Dom4j (com.haulmont.bali.util.Dom4j)1 ParamsMap (com.haulmont.bali.util.ParamsMap)1 Datatype (com.haulmont.chile.core.datatypes.Datatype)1