for (int i = 0, size = children.size(); i < size; i++) {
Node child = (Node) children.get(i);
if (child != null) {
Node childPreview = previewConvert(child);
if (childPreview != null) {
ConvertPosition position = converter
.getChildVisualPosition(child);
if (position != null) {
/* FIX for bug #179403
// FIXME: not using index here, need fix.
position.getParentNode().appendChild(childPreview);
*/
NodeList childNodes = position.getParentNode().getChildNodes();
if (childNodes.getLength() > position.getIndex()) {
Node item = childNodes.item(position.getIndex());
position.getParentNode().insertBefore(childPreview, item);
} else {
position.getParentNode().appendChild(childPreview);
}
}
}
}
}