本文整理汇总了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;
}
}
示例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);
}
示例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);
}
};
}
示例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);
}
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例9: collectionChanged
import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) {
for (Action action : actionsHolder.getActions()) {
action.refreshState();
}
}