当前位置: 首页>>代码示例>>Java>>正文


Java CollectionDatasource.getMetaClass方法代码示例

本文整理汇总了Java中com.haulmont.cuba.gui.data.CollectionDatasource.getMetaClass方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionDatasource.getMetaClass方法的具体用法?Java CollectionDatasource.getMetaClass怎么用?Java CollectionDatasource.getMetaClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.haulmont.cuba.gui.data.CollectionDatasource的用法示例。


在下文中一共展示了CollectionDatasource.getMetaClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CollectionDsWrapper

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public CollectionDsWrapper(CollectionDatasource datasource, Collection<MetaPropertyPath> properties,
                           boolean autoRefresh, CollectionDsListenersWrapper collectionDsListenersWrapper) {
    this.datasource = datasource;
    this.autoRefresh = autoRefresh;
    this.collectionDsListenersWrapper = collectionDsListenersWrapper;

    final View view = datasource.getView();
    final MetaClass metaClass = datasource.getMetaClass();

    if (properties == null) {
        createProperties(view, metaClass);
    } else {
        this.properties.addAll(properties);
    }

    cdsItemPropertyChangeListener = createItemPropertyChangeListener();
    cdsStateChangeListener = createStateChangeListener();
    cdsCollectionChangeListener = createCollectionChangeListener();

    collectionDsListenersWrapper.addItemPropertyChangeListener(cdsItemPropertyChangeListener);
    collectionDsListenersWrapper.addStateChangeListener(cdsStateChangeListener);
    collectionDsListenersWrapper.addCollectionChangeListener(cdsCollectionChangeListener);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:25,代码来源:CollectionDsWrapper.java

示例2: addInitialColumns

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
protected void addInitialColumns(CollectionDatasource datasource) {
    if (this.columns.isEmpty()) {
        MessageTools messageTools = AppBeans.get(MessageTools.NAME);
        MetaClass metaClass = datasource.getMetaClass();
        Collection<MetaPropertyPath> paths = datasource.getView() != null ?
                // if a view is specified - use view properties
                metadataTools.getViewPropertyPaths(datasource.getView(), metaClass) :
                // otherwise use all properties from meta-class
                metadataTools.getPropertyPaths(metaClass);
        for (MetaPropertyPath metaPropertyPath : paths) {
            MetaProperty property = metaPropertyPath.getMetaProperty();
            if (!property.getRange().getCardinality().isMany() && !metadataTools.isSystem(property)) {
                String propertyName = property.getName();
                ColumnImpl column = new ColumnImpl(propertyName, metaPropertyPath, this);
                MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(metaPropertyPath);
                column.setCaption(messageTools.getPropertyCaption(propertyMetaClass, propertyName));

                addColumn(column);
            }
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:WebDataGrid.java

示例3: DataGridIndexedCollectionDsWrapper

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public DataGridIndexedCollectionDsWrapper(CollectionDatasource datasource, Collection<MetaPropertyPath> properties,
                                          boolean autoRefresh,
                                          CollectionDsListenersWrapper collectionDsListenersWrapper) {
    if (!(datasource instanceof CollectionDatasource.Indexed)) {
        throw new IllegalArgumentException("Datasource must implement " +
                "com.haulmont.cuba.gui.data.CollectionDatasource.Indexed");
    }
    this.datasource = (CollectionDatasource.Indexed) datasource;
    this.autoRefresh = autoRefresh;
    this.collectionDsListenersWrapper = collectionDsListenersWrapper;

    final View view = datasource.getView();
    final MetaClass metaClass = datasource.getMetaClass();

    if (properties == null) {
        createProperties(view, metaClass);
    } else {
        this.properties.addAll(properties);
    }

    cdsItemPropertyChangeListener = createItemPropertyChangeListener();
    cdsStateChangeListener = createStateChangeListener();
    cdsCollectionChangeListener = createCollectionChangeListener();

    collectionDsListenersWrapper.addItemPropertyChangeListener(cdsItemPropertyChangeListener);
    collectionDsListenersWrapper.addStateChangeListener(cdsStateChangeListener);
    collectionDsListenersWrapper.addCollectionChangeListener(cdsCollectionChangeListener);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:30,代码来源:DataGridIndexedCollectionDsWrapper.java

示例4: AbstractConditionDescriptor

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
public AbstractConditionDescriptor(String name, String filterComponentName, CollectionDatasource datasource) {
    this.name = name;
    this.filterComponentName = filterComponentName;
    this.datasource = datasource;
    this.datasourceMetaClass = datasource.getMetaClass();

    String query = datasource.getQuery();
    QueryParser parser = QueryTransformerFactory.createParser(query);
    entityAlias = parser.getEntityAlias(datasourceMetaClass.getName());
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:AbstractConditionDescriptor.java

示例5: OptionsDsWrapper

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public OptionsDsWrapper(CollectionDatasource datasource, Collection<MetaPropertyPath> properties, boolean autoRefresh) {
    this.datasource = datasource;
    this.autoRefresh = autoRefresh;

    final View view = datasource.getView();
    final MetaClass metaClass = datasource.getMetaClass();

    if (properties == null) {
        createProperties(view, metaClass);
    } else {
        this.properties.addAll(properties);
    }

    dsStateChangeListener = e -> itemsCache.clear();

    dsItemPropertyChangeListener = e -> {
        Item wrapper = getItemWrapper(e.getItem());

        // MetaProperty worked wrong with properties from inherited superclasses
        MetaPropertyPath metaPropertyPath = datasource.getMetaClass().getPropertyPath(e.getProperty());
        if (metaPropertyPath == null) {
            return;
        }
        Property itemProperty = wrapper.getItemProperty(metaPropertyPath);
        if (itemProperty instanceof PropertyWrapper) {
            ((PropertyWrapper) itemProperty).fireValueChangeEvent();
        }
    };

    cdsCollectionChangeListener = e -> {
        final boolean prevIgnoreListeners = ignoreListeners;
        try {
            itemsCache.clear();
            fireItemSetChanged();
        } finally {
            ignoreListeners = prevIgnoreListeners;
        }
    };

    weakDsListenerAdapter = new WeakDsListenerAdapter(datasource, dsItemPropertyChangeListener, dsStateChangeListener, cdsCollectionChangeListener);
    datasource.addCollectionChangeListener(weakDsListenerAdapter);
    datasource.addStateChangeListener(weakDsListenerAdapter);
    datasource.addItemPropertyChangeListener(weakDsListenerAdapter);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:46,代码来源:OptionsDsWrapper.java


注:本文中的com.haulmont.cuba.gui.data.CollectionDatasource.getMetaClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。