protected void collectItemIds(GroupInfo groupId, final List<Object> itemIds) { GroupTableItems<E> groupTableSource = (GroupTableItems<E>) getItems(); if (groupTableSource.hasChildren(groupId)) { final List<GroupInfo> children = groupTableSource.getChildren(groupId); for (final GroupInfo child : children) { itemIds.add(child); collectItemIds(child, itemIds); } } else { itemIds.addAll(groupTableSource.getGroupItemIds(groupId)); } }
@Override public boolean hasGroups() { return getGroupTableSource().hasGroups(); }
protected List<Object> getAllItemIds(GroupTableItems<E> tableSource) { List<GroupInfo> roots = tableSource.rootGroups(); List<Object> result = new ArrayList<>(); for (final GroupInfo root : roots) { result.add(root); collectItemIds(root, result); } return result; }
protected List getCachedItemIds() { if (cachedItemIds == null) { if (getGroupTableSource().hasGroups()) { List<Object> result = new ArrayList<>(); List<GroupInfo> roots = getGroupTableSource().rootGroups(); if (!roots.isEmpty()) { for (GroupInfo root : roots) { result.add(root); collectItemIds(root, result); } } cachedItemIds = result; } else { Collection<?> itemIds = getGroupTableSource().getItemIds(); cachedItemIds = new ArrayList<>(itemIds); } if (!cachedItemIds.isEmpty()) { first = cachedItemIds.get(0); last = cachedItemIds.get(cachedItemIds.size() - 1); } } return cachedItemIds; }
Instance item = groupTableSource.getItemNN(itemId); captionValue = item.getValueEx(captionProperty); List<Entity> groupItems = ((Collection<Object>) groupTableSource.getGroupItemIds(groupInfo)).stream() .map((Function<Object, Entity>) groupTableSource::getItem) .collect(Collectors.toList()); List<GroupInfo> children = groupTableSource.getChildren(groupInfo); if (children.size() > 0) { for (GroupInfo child : children) { Collection<?> itemIds = groupTableSource.getGroupItemIds(groupInfo); for (Object itemId : itemIds) { createRow(table, columns, groupNumber, ++rowNumber, itemId);
&& ((GroupTableItems) tableItems).hasGroups()) { GroupTableItems groupTableSource = (GroupTableItems) tableItems; for (Object item : groupTableSource.rootGroups()) { if (checkIsRowNumberExceed(r)) { break;
@Override public void selectAll() { if (isMultiSelect()) { if (getItems() instanceof GroupTableItems) { GroupTableItems<E> tableSource = (GroupTableItems<E>) getItems(); Collection<?> itemIds = tableSource.hasGroups() ? getAllItemIds(tableSource) : tableSource.getItemIds(); if (!itemIds.isEmpty()) { // Filter items that don't exist in the datasource, e.g. GroupInfo itemIds = itemIds.stream() .filter(tableSource::containsId) .collect(Collectors.toList()); } component.setValue(itemIds); return; } } super.selectAll(); }
@Override public Collection<?> getChildren(Object id) { if (isGroup(id)) { return getGroupTableSource().getChildren((GroupInfo) id); } return Collections.emptyList(); }
@Override public Collection<?> getGroupItemIds(Object id) { if (isGroup(id)) { return getGroupTableSource().getGroupItemIds((GroupInfo) id); } return Collections.emptyList(); }
@Override public boolean isGroup(Object id) { return id instanceof GroupInfo && getGroupTableSource().containsGroup((GroupInfo) id); }
@Override public Collection<?> getGroupProperties() { if (hasGroups()) { return getGroupTableSource().getGroupProperties(); } return Collections.emptyList(); }
@Override public int getGroupItemsCount(Object id) { if (isGroup(id)) { return getGroupTableSource().getGroupItemsCount((GroupInfo) id); } return 0; }
@Override public Object getGroupPropertyValue(Object id) { if (isGroup(id)) { return getGroupTableSource().getGroupPropertyValue((GroupInfo) id); } return null; }
@Override public Object getGroupProperty(Object id) { if (isGroup(id)) { return getGroupTableSource().getGroupProperty((GroupInfo) id); } return null; }
protected void collectItemIds(GroupInfo groupId, List<Object> itemIds) { if (expandedGroups.contains(groupId)) { GroupTableItems<I> groupTableSource = getGroupTableSource(); if (groupTableSource.hasChildren(groupId)) { List<GroupInfo> children = groupTableSource.getChildren(groupId); for (GroupInfo child : children) { itemIds.add(child); collectItemIds(child, itemIds); } } else { itemIds.addAll(groupTableSource.getGroupItemIds(groupId)); } } }
@Override public Collection<?> rootGroups() { return getGroupTableSource().rootGroups(); }