) throws IOException {
if (!portionName.startsWith(SUB_ROWS_PORTION))
return super.encodeAjaxPortion(context, component, portionName, jsonParam);
String portionNameSuffix = portionName.substring(SUB_ROWS_PORTION.length());
int rowIndex = Integer.parseInt(portionNameSuffix);
TreeTable treeTable = (TreeTable) component;
boolean rowAvailableAfterRestoring = treeTable.isRowAvailableAfterRestoring(rowIndex);
if (rowAvailableAfterRestoring) {
treeTable.setRowIndex(rowIndex);
TreePath nodeKeyPath = treeTable.getNodeKeyPath();
treeTable.setNodeExpanded(nodeKeyPath, true);
}
int addedRowCount = rowAvailableAfterRestoring ? treeTable.loadSubNodes(rowIndex) : 0;
Map<Integer, CustomRowRenderingInfo> customRowRenderingInfos = (Map<Integer, CustomRowRenderingInfo>)
treeTable.getAttributes().get(TableStructure.CUSTOM_ROW_RENDERING_INFOS_KEY);
for (int i = treeTable.getRowCount(); i > rowIndex; i--) {
CustomRowRenderingInfo rowInfo = customRowRenderingInfos.remove(i);
if (rowInfo == null)
continue;
customRowRenderingInfos.put(i + addedRowCount, rowInfo);
}