protected void handleElementAdded(CompositeGraphicsNode gn,
Node parent,
Element childElt) {
// build the graphics node
GVTBuilder builder = ctx.getGVTBuilder();
GraphicsNode childNode = builder.build(ctx, childElt);
if (childNode == null) {
return; // the added element is not a graphic element
}
// Find the index where the GraphicsNode should be added
int idx = -1;
for(Node ps = childElt.getPreviousSibling(); ps != null;
ps = ps.getPreviousSibling()) {
if (ps.getNodeType() != Node.ELEMENT_NODE)
continue;
Element pse = (Element)ps;
GraphicsNode psgn = ctx.getGraphicsNode(pse);
while ((psgn != null) && (psgn.getParent() != gn)) {
// In some cases the GN linked is
// a child (in particular for images).
psgn = psgn.getParent();
}
if (psgn == null)
continue;
idx = gn.indexOf(psgn);
if (idx == -1)