/** * * <code>detachChildAt</code> removes a child at a given index. That child is returned for saving purposes. * * @param index * the index of the child to be removed. * @return the child at the supplied index. */ public Spatial detachChildAt(final int index) { final Spatial child = _children.remove(index); if (child != null) { child.setParent(null); markDirty(child, DirtyType.Detached); if (child.getListener() != null) { child.setListener(null); } if (logger.isLoggable(Level.INFO)) { logger.fine("Child removed."); } } return child; }
/** * * <code>detachChildAt</code> removes a child at a given index. That child is returned for saving purposes. * * @param index * the index of the child to be removed. * @return the child at the supplied index. */ public Spatial detachChildAt(final int index) { final Spatial child = _children.remove(index); if (child != null) { child.setParent(null); markDirty(child, DirtyType.Detached); if (child.getListener() != null) { child.setListener(null); } if (logger.isLoggable(Level.INFO)) { logger.fine("Child removed."); } } return child; }
/** * * <code>attachChild</code> attaches a child to this node. This node becomes the child's parent. The current number * of children maintained is returned. <br> * If the child already had a parent it is detached from that former parent. * * @param child * the child to attach to this node. * @return the number of children maintained by this node. */ public int attachChild(final Spatial child) { if (child != null) { if (child == this || (child instanceof Node && hasAncestor((Node) child))) { throw new IllegalArgumentException("Child is already part of this hierarchy."); } if (child.getParent() != this) { if (child.getParent() != null) { child.getParent().detachChild(child); } child.setParent(this); _children.add(child); child.markDirty(DirtyType.Attached); if (logger.isLoggable(Level.FINE)) { logger.fine("Child (" + child.getName() + ") attached to this" + " node (" + getName() + ")"); } } } return _children.size(); }
/** * * <code>attachChildAt</code> attaches a child to this node at an index. This node becomes the child's parent. The * current number of children maintained is returned. <br> * If the child already had a parent it is detached from that former parent. * * @param child * the child to attach to this node. * @return the number of children maintained by this node. */ public int attachChildAt(final Spatial child, final int index) { if (child != null) { if (child == this || (child instanceof Node && hasAncestor((Node) child))) { throw new IllegalArgumentException("Child is already part of this hierarchy."); } if (child.getParent() != this) { if (child.getParent() != null) { child.getParent().detachChild(child); } child.setParent(this); _children.add(index, child); child.markDirty(DirtyType.Attached); if (logger.isLoggable(Level.FINE)) { logger.fine("Child (" + child.getName() + ") attached to this" + " node (" + getName() + ")"); } } } return _children.size(); }
/** * * <code>attachChildAt</code> attaches a child to this node at an index. This node becomes the child's parent. The * current number of children maintained is returned. <br> * If the child already had a parent it is detached from that former parent. * * @param child * the child to attach to this node. * @return the number of children maintained by this node. */ public int attachChildAt(final Spatial child, final int index) { if (child != null) { if (child == this || (child instanceof Node && hasAncestor((Node) child))) { throw new IllegalArgumentException("Child is already part of this hierarchy."); } if (child.getParent() != this) { if (child.getParent() != null) { child.getParent().detachChild(child); } child.setParent(this); _children.add(index, child); child.markDirty(DirtyType.Attached); if (logger.isLoggable(Level.FINE)) { logger.fine("Child (" + child.getName() + ") attached to this" + " node (" + getName() + ")"); } } } return _children.size(); }
/** * * <code>attachChild</code> attaches a child to this node. This node becomes the child's parent. The current number * of children maintained is returned. <br> * If the child already had a parent it is detached from that former parent. * * @param child * the child to attach to this node. * @return the number of children maintained by this node. */ public int attachChild(final Spatial child) { if (child != null) { if (child == this || (child instanceof Node && hasAncestor((Node) child))) { throw new IllegalArgumentException("Child is already part of this hierarchy."); } if (child.getParent() != this) { if (child.getParent() != null) { child.getParent().detachChild(child); } child.setParent(this); _children.add(child); child.markDirty(DirtyType.Attached); if (logger.isLoggable(Level.FINE)) { logger.fine("Child (" + child.getName() + ") attached to this" + " node (" + getName() + ")"); } } } return _children.size(); }