Reputation: 5
I want a particular desired behavior for my Nattable tree structure. In the following diagram, contents of Row no 36, 37 are children of content in Row 20.
Row 21, 23, 23 … 34 are in turn children of Row 20.
Row 22 is a child of Row 21. (you could say it is grandchild of 20)
I want Row 36, 37 to be shown first ie. In place of Row 21 and so on, that is I want to change the order in which it is shown as a child of Row 20.
I am currently using a treelist implementation to render my data in the Nattable.
My current nattable:
private List<ISectionInfo> getFlatList(List<ISectionInfo> inputList)
{
List<ISectionInfo> flatList = new ArrayList<ISectionInfo>();
for (ISectionInfo node : inputList)
{
if (node instanceof SectionInfo)
{
SectionInfo secNode = (SectionInfo) node;
if (!hasChildren(secNode))
{
flatList.add(secNode);
flatList.addAll(secNode.getModuleInfoList());
}
if (hasChildren(secNode))
{
flatList.addAll(secNode.getModuleInfoList());
flatList.add(secNode);
for (ISectionInfo iternode : secNode.getChildren())
{
flatList.addAll(((SectionInfo) iternode).getModuleInfoList());
flatList.add(iternode);
}
}
}
}
return flatList;
}
Upvotes: 0
Views: 62