List<Treeitem> treeItems = parent.getParent().getChildren();
int myPosition = parent.indexOf();
if (myPosition < treeItems.size() - 1) {
// the current node is not the last one
Treerow downTreerow = treeItems.get(myPosition + 1)
.getTreerow();
focusCorrectBox(downTreerow, position, Navigation.RIGHT);
} else {
// the node is the last brother
if (parent.getParent().getParent() instanceof Treeitem) {
focusGoDown((Treeitem) parent.getParent()
.getParent(), position, true);
}
}
} else {
// Moving from a parent node to its children
Treechildren treechildren = parent.getTreechildren();
if (treechildren.getChildren().size() == 0) {
// the children are unloaded yet
focusGoDown(parent, position, true);
return;
}
Treerow downTreerow = ((Treeitem) treechildren
.getChildren().get(0)).getTreerow();
if (!downTreerow.isVisible()) {
// children are loaded but not visible
focusGoDown(parent, position, true);
return;
}