code: private void processItemIdIndexMapping(final Map<String, List<Integer>> map, final List<Integer> rowIndex,
  			final TreeItemModel treeModel, final Set<String> expandedRows) {
  
  		// Add current item
  		String id = treeModel.getItemId(rowIndex);
  		if (id == null) {
  			return;
  		}
  		map.put(id, rowIndex);
  
  		// Check row is expandable
  		if (!treeModel.isExpandable(rowIndex)) {
  			return;
  		}
  
  		// Check has children
  		if (!treeModel.hasChildren(rowIndex)) {
  			return;
  		}
  
  		// Add children if expanded ROWS null or contains ID
  		boolean addChildren = expandedRows == null || expandedRows.contains(id);
  		if (!addChildren) {
  			return;
  		}
  
  		// Get actual child count
  		int children = treeModel.getChildCount(rowIndex);
  		if (children == 0) {
  			// Could be there are no children even though hasChildren returned true
  			return;
  		}
  
  		// Add children by processing each child row
  		for (int i = 0; i < children; i++) {
  			// Add next level
  			List<Integer> nextRow = new ArrayList<>(rowIndex);
  			nextRow.add(i);
  			processItemIdIndexMapping(map, nextRow, treeModel, expandedRows);
  		}
  	}
docs: Iterate through the table model to add the item ids and their row index.
  
  @param map the map of item ids
  @param rowIndex the current row index
  @param treeModel the tree model
  @param expandedRows the set of expanded rows, null if include all