本文整理汇总了Java中com.vaadin.event.selection.MultiSelectionEvent类的典型用法代码示例。如果您正苦于以下问题:Java MultiSelectionEvent类的具体用法?Java MultiSelectionEvent怎么用?Java MultiSelectionEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultiSelectionEvent类属于com.vaadin.event.selection包,在下文中一共展示了MultiSelectionEvent类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateSelection
import com.vaadin.event.selection.MultiSelectionEvent; //导入依赖的package包/类
private void updateSelection(final SerializableConsumer<Collection<T>> handler, final boolean userOriginated, final boolean sortingNeeded) {
final LinkedHashSet<T> oldSelection = new LinkedHashSet<>(getSelectedItems());
final List<T> selection = new ArrayList<>(getSelectedItems());
handler.accept(selection);
if (sortingNeeded) {
this.sortingSelection = Collections.unmodifiableCollection(selection);
}
// TODO selection is private, have to use reflection (remove later)
try {
final Field f1 = getSelectionBaseClass().getDeclaredField("selection");
f1.setAccessible(true);
f1.set(this, selection);
}
catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
doSetSelectedKeys(selection);
fireEvent(new MultiSelectionEvent<>(this, oldSelection, userOriginated));
getDataCommunicator().reset();
getDataProvider().refreshAll();
}
示例2: ListBuilder
import com.vaadin.event.selection.MultiSelectionEvent; //导入依赖的package包/类
public ListBuilder() {
super();
registerRpc(new ListBuilderServerRpc() {
@Override
public void updateValue(List<String> newValue) {
List<String> clone = new ArrayList<>(newValue);
for (T item : orderedValue) {
clone.remove(getDataCommunicator().getKeyMapper().key(item));
}
LinkedHashSet<T> oldSelection = new LinkedHashSet<>(orderedValue);
orderedValue = newValue.stream().map(key -> getDataCommunicator().getKeyMapper().get(key))
.collect(Collectors.toCollection(LinkedHashSet::new));
updateState();
if (clone.isEmpty()) {
fireEvent(new MultiSelectionEvent<>(ListBuilder.this, oldSelection, true));
}
}
});
}
示例3: buildSelectionEvent
import com.vaadin.event.selection.MultiSelectionEvent; //导入依赖的package包/类
protected SelectionEvent<T> buildSelectionEvent(MultiSelectionEvent<ITEM> event) {
return new DefaultSelectionEvent<>(fromInternalValue(event.getAllSelectedItems()), event.isUserOriginated());
}