for (int row = 0; row < g.ranks.size(); row++) {
Rank rank = g.ranks.getRank(row);
for (int n = 0; n < rank.size(); n++) {
Node node = rank.getNode(n);
InternalNode internalNode = (InternalNode) node.data;
Insets padNode = g.getPadding(node);
internalNode.setSize(internalNode.getWidthInLayout(), 25);
if (node.getLeft()!=null) {
// check space to left
Node left = node.getLeft();
if (left.data instanceof InternalNode) {
InternalNode internalLeft = (InternalNode) left.data;
Insets padLeft = g.getPadding(left);
double left_end = internalLeft.getCurrentX() + internalLeft.getWidthInLayout() + padLeft.right + padNode.left;
if (internalNode.getCurrentX() <= left_end) {
// node overlaps with left neighbor
// node.x = (int)left_end;
internalNode.setLocation(left_end, internalNode.getCurrentY());
}
} else {
Activator.getLogger().warning("Unsupported object " + left.data + " can't be cast to InternalNode!");
}
}
if (node.getRight()!=null) {
// check space to right
Node right = node.getRight();
if (right.data instanceof InternalNode) {
InternalNode internalRight = (InternalNode) right.data;
Insets padRight = g.getPadding(right);
double node_end = internalNode.getCurrentX() + internalNode.getWidthInLayout() + padNode.right + padRight.left;
if (node_end >= internalRight.getCurrentX()) {
// node overlaps with right neighbor
// right.x = (int)node_end;