protected Map<Object, Object> getParentsMapping(TreeTableItems<E> tableSource, Object nullParentItemId) { Map<Object, Object> parentsMapping = new LinkedHashMap<>(); Collection<?> itemIds = tableSource.getItemIds(); for (Object itemId : itemIds) { Object parentId = tableSource.getParent(itemId); if (itemIds.contains(parentId)) { parentsMapping.put(itemId, parentId); } else { parentsMapping.put(itemId, nullParentItemId); } } return parentsMapping; }
protected List<Object> getCollapsedItemIds() { TreeTableItems<E> treeTableSource = getTreeTableSource(); if (treeTableSource == null) { return Collections.emptyList(); } Collection<?> itemIds = treeTableSource.getItemIds(); return itemIds.stream() .filter(itemId -> component.isCollapsed(itemId)) .collect(Collectors.toList()); }