public void setMarginSize(int margin) { this.MARGIN_SIZE = margin; CompoundModel root = this; while (root.getParentModel() != null) { root = root.getParentModel(); } for (Object o : root.getChildren()) { if (o instanceof CompoundModel) { updateMarginSize((CompoundModel) o); } } }
public boolean isAncestorofNode(NodeModel node) { CompoundModel root = node.getParentModel(); while (root != null) { if (root == this) { return true; } else { root = root.getParentModel(); } } return false; }