/** * Removes a branch graph rooted at BranchGroup from * the list of branch graphs. * @param branchGroup root of the branch graph to be removed * @exception IllegalStateException if this Locale has been * removed from its VirtualUniverse. * @exception CapabilityNotSetException if the ALLOW_DETACH capability is * not set in the specified BranchGroup node. */ public void removeBranchGraph(BranchGroup branchGroup){ if (universe == null) { throw new IllegalStateException(J3dI18N.getString("Locale4")); } if (! branchGroup.getCapability(BranchGroup.ALLOW_DETACH)) { throw new CapabilityNotSetException(J3dI18N.getString("Locale1")); } universe.resetWaitMCFlag(); synchronized (universe.sceneGraphLock) { doRemoveBranchGraph(branchGroup, null, 0); universe.setLiveState.reset(this); } universe.waitForMC(); }
/** * Detaches this BranchGroup from its parent. */ public void detach() { Group parent; if (isLiveOrCompiled()) { if(!this.getCapability(ALLOW_DETACH)) throw new CapabilityNotSetException(J3dI18N.getString("BranchGroup1")); if (((BranchGroupRetained)this.retained).parent != null) { parent = (Group)((BranchGroupRetained)this.retained).parent.source; if(!parent.getCapability(Group.ALLOW_CHILDREN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("BranchGroup2")); } } ((BranchGroupRetained)this.retained).detach(); }
/** * Moves the specified branch group node from its existing location to * the end of this group node's list of children. * @param branchGroup the branch group node to move to this node's list * of children * @exception CapabilityNotSetException if the appropriate capability is * not set and this group node is part of live or compiled scene graph */ public void moveTo(BranchGroup branchGroup) { if (isLiveOrCompiled()) { if(!this.getCapability(ALLOW_CHILDREN_EXTEND)) throw new CapabilityNotSetException(J3dI18N.getString("Group16")); if (! branchGroup.getCapability(BranchGroup.ALLOW_DETACH)) { throw new CapabilityNotSetException(J3dI18N.getString("Group4")); } } ((GroupRetained)this.retained).moveTo(branchGroup); }
if (! oldGroup.getCapability(BranchGroup.ALLOW_DETACH)) { throw new CapabilityNotSetException(J3dI18N.getString("Locale1"));
(! ((BranchGroup)oldchild).getCapability(BranchGroup.ALLOW_DETACH))) { throw new CapabilityNotSetException(J3dI18N.getString("Group4"));
/** * Removes the specified child node from this group node's * list of children. * If the specified object is not in the list, the list is not modified. * * @param child the child node to be removed. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception RestrictedAccessException if this group node is part of * live or compiled scene graph and the child node being removed is not * a BranchGroup node * * @since Java 3D 1.3 */ public void removeChild(Node child) { if (isLiveOrCompiled()) { if (!(child instanceof BranchGroup)) { throw new RestrictedAccessException(J3dI18N.getString("Group7")); } if (!this.getCapability(ALLOW_CHILDREN_WRITE)) { throw new CapabilityNotSetException(J3dI18N.getString("Group15")); } if (!((BranchGroup)child).getCapability(BranchGroup.ALLOW_DETACH)) { throw new CapabilityNotSetException(J3dI18N.getString("Group4")); } } ((GroupRetained)retained).removeChild(child); }
/** * Removes the child node at the specified index from this group node's * list of children. * @param index which child to remove. The <code>index</code> * must be a value * greater than or equal to 0 and less than <code>numChildren()</code>. * @exception CapabilityNotSetException if the appropriate capability is * not set and this group node is part of live or compiled scene graph * @exception RestrictedAccessException if this group node is part of * live or compiled scene graph and the child node being removed is not * a BranchGroup node * @exception IndexOutOfBoundsException if <code>index</code> is invalid. */ public void removeChild(int index) { if (isLiveOrCompiled()) { Node child = ((GroupRetained)this.retained).getChild(index); if (!(child instanceof BranchGroup)) { throw new RestrictedAccessException(J3dI18N.getString("Group7")); } if (!this.getCapability(ALLOW_CHILDREN_WRITE)) { throw new CapabilityNotSetException(J3dI18N.getString("Group15")); } if (!((BranchGroup)child).getCapability(BranchGroup.ALLOW_DETACH)) { throw new CapabilityNotSetException(J3dI18N.getString("Group4")); } } ((GroupRetained)this.retained).removeChild(index); }
/** * Removes all children from this Group node. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception RestrictedAccessException if this group node is part of * live or compiled scene graph and any of the children being removed are * not BranchGroup nodes * * @since Java 3D 1.3 */ public void removeAllChildren() { if (isLiveOrCompiled()) { GroupRetained groupR = (GroupRetained)this.retained; for (int index = groupR.numChildren() - 1; index >= 0; index--) { Node child = groupR.getChild(index); if (! (child instanceof BranchGroup)) throw new RestrictedAccessException(J3dI18N.getString("Group7")); if (!this.getCapability(ALLOW_CHILDREN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Group15")); if (!((BranchGroup)child).getCapability(BranchGroup.ALLOW_DETACH)) { throw new CapabilityNotSetException(J3dI18N.getString("Group4")); } } } ((GroupRetained)retained).removeAllChildren(); }