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


Java CollectionDatasource.CollectionChangeEvent方法代码示例

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


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

示例1: collectionChanged

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
    itemsCache.clear();

    final boolean prevIgnoreListeners = ignoreListeners;
    try {
        fireItemSetChanged();
    } finally {
        ignoreListeners = prevIgnoreListeners;
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:CollectionDsWrapper.java

示例2: collectionChanged

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
    // replacement for collectionChangeSelectionListener
    // #PL-2035, reload selection from ds
    Set<Object> selectedItemIds = getSelectedItemIds();
    if (selectedItemIds == null) {
        selectedItemIds = Collections.emptySet();
    }

    Set<Object> newSelection = new HashSet<>();
    for (Object entityId : selectedItemIds) {
        if (e.getDs().containsItem(entityId)) {
            newSelection.add(entityId);
        }
    }

    if (e.getDs().getState() == Datasource.State.VALID && e.getDs().getItem() != null) {
        newSelection.add(e.getDs().getItem().getId());
    }

    if (newSelection.isEmpty()) {
        setSelected((E) null);
    } else {
        setSelectedIds(newSelection);
    }

    super.collectionChanged(e);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:30,代码来源:WebTree.java

示例3: createCollectionChangeListener

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
protected CollectionDatasource.CollectionChangeListener createCollectionChangeListener() {
    return new ContainerDatasourceCollectionChangeListener(){
        @Override
        public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
            Collection groupProperties = component.getGroupProperties();
            component.groupBy(groupProperties.toArray());
            super.collectionChanged(e);
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:WebGroupTable.java

示例4: collectionChanged

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
    // #PL-2035, reload selection from ds
    Collection<Object> selectedItemIds = component.getSelectedRows();
    if (selectedItemIds == null) {
        selectedItemIds = Collections.emptySet();
    }

    //noinspection unchecked
    Set<Object> newSelection = selectedItemIds.stream()
            .filter(entityId -> e.getDs().containsItem(entityId))
            .collect(Collectors.toSet());

    if (e.getDs().getState() == Datasource.State.VALID && e.getDs().getItem() != null) {
        newSelection.add(e.getDs().getItem().getId());
    }

    if (newSelection.isEmpty()) {
        setSelected((E) null);
    } else {
        setSelectedIds(newSelection);
    }

    for (Action action : getActions()) {
        action.refreshState();
    }

    if (getEventRouter().hasListeners(CollectionDatasource.CollectionChangeListener.class)) {
        getEventRouter().fireEvent(CollectionDatasource.CollectionChangeListener.class,
                CollectionDatasource.CollectionChangeListener::collectionChanged, e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:34,代码来源:WebDataGrid.java

示例5: collectionChanged

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
    CollectionChangeListener collectionChangeListener = reference.get();
    if (collectionChangeListener != null) {
        collectionChangeListener.collectionChanged(e);
    } else {
        collectionDatasource.removeCollectionChangeListener(this);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:WeakCollectionChangeListener.java

示例6: collectionChanged

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
    if (listener instanceof CollectionDatasourceListener) {
        CollectionDatasourceListener.Operation operation;

        switch (e.getOperation()) {
            case ADD:
                operation = CollectionDatasourceListener.Operation.ADD;
                break;

            case CLEAR:
                operation = CollectionDatasourceListener.Operation.CLEAR;
                break;

            case REFRESH:
                operation = CollectionDatasourceListener.Operation.REFRESH;
                break;

            case REMOVE:
                operation = CollectionDatasourceListener.Operation.REMOVE;
                break;

            case UPDATE:
                operation = CollectionDatasourceListener.Operation.UPDATE;
                break;

            default:
                throw new IllegalStateException(
                        "Unable to convert CollectionDatasourceListener.Operation to legacy CollectionDatasourceListener.Operation");
        }

        ((CollectionDatasourceListener) listener).collectionChanged(e.getDs(), operation, e.getItems());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:35,代码来源:CompatibleDatasourceListenerWrapper.java

示例7: collectionChanged

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
    CollectionDatasource.CollectionChangeListener collectionChangeListener = collectionChangeListenerReference.get();
    if (collectionChangeListener != null) {
        collectionChangeListener.collectionChanged(e);
    } else {
        collectionDatasource.removeCollectionChangeListener(this);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:WeakDsListenerAdapter.java

示例8: collectionChanged

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
    if (getEventRouter().hasListeners(CollectionDatasource.CollectionChangeListener.class)) {
        getEventRouter().fireEvent(CollectionDatasource.CollectionChangeListener.class,
                CollectionDatasource.CollectionChangeListener::collectionChanged, e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:CollectionDsListenersWrapper.java

示例9: collectionChanged

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
    for (Action action : actionsHolder.getActions()) {
        action.refreshState();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:7,代码来源:CollectionDsActionsNotifier.java


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