}
public DefaultMutableTreeTableNode generateTreeTableModel() {
List<Cell> cellList = rack.getCellList();
DefaultMutableTreeTableNode aRoot = new DefaultMutableTreeTableNode(
new Sample());
for (Iterator<Cell> iterator = cellList.iterator(); iterator.hasNext();) {
Cell cell = iterator.next();
cell.addObserver(this);
if (!cell.hasChildren()) {
aRoot.add(new DefaultMutableTreeTableNode(cell));
} else {
DefaultMutableTreeTableNode currentNode = new DefaultMutableTreeTableNode(
cell);
aRoot.add(currentNode);
Map<CellPosition, SubCell> positionChildrenMap = cell
.getChildrenMap();
Set<CellPosition> positions = positionChildrenMap.keySet();
List<CellPosition> orderedPositions = new ArrayList<CellPosition>(
positions);
Collections.sort(orderedPositions);
for (Iterator<CellPosition> iterator2 = orderedPositions
.iterator(); iterator2.hasNext();) {
CellPosition position = iterator2.next();
SubCell subCell = positionChildrenMap.get(position);
currentNode.add(new DefaultMutableTreeTableNode(subCell));
}
}
}
treeTableModel = new RackTreeTableModel(model, aRoot);
return aRoot;