Esempio n. 1
0
  /**
   * Copies all NodeComponent information from <code>originalNode</code> into the current node. This
   * method is called from the <code>cloneNode</code> method which is, in turn, called by the <code>
   * cloneTree</code> method.
   *
   * <p>
   *
   * @param originalNode the original node to duplicate.
   * @param forceDuplicate when set to <code>true</code>, causes the <code>duplicateOnCloneTree
   *     </code> flag to be ignored. When <code>false</code>, the value of each node's <code>
   *     duplicateOnCloneTree</code> variable determines whether NodeComponent data is duplicated or
   *     copied.
   * @see Group#cloneNode
   * @see Node#duplicateNode
   * @see Node#cloneTree
   * @see NodeComponent#setDuplicateOnCloneTree
   */
  void duplicateAttributes(NodeComponent originalNode, boolean forceDuplicate) {

    if (forceDuplicate && originalNode.isCompiled()) {
      throw new RestrictedAccessException(J3dI18N.getString("NodeComponent1"));
    }

    super.duplicateSceneGraphObject(originalNode);
    setDuplicateOnCloneTree(originalNode.getDuplicateOnCloneTree());
  }
Esempio n. 2
0
 /**
  * Copies all node information from <code>originalNodeComponent</code> into the current node. This
  * method is called from the <code>cloneNodeComponent</code> method which is, in turn, called by
  * the <code>cloneNode</code> method. <br>
  * NOTE: Applications should <i>not</i> call this method directly. It should only be called by the
  * cloneNode method.
  *
  * @param originalNodeComponent the node to duplicate.
  * @param forceDuplicate when set to <code>true</code>, causes the <code>duplicateOnCloneTree
  *     </code> flag to be ignored. When <code>false</code>, the value of each node's <code>
  *     duplicateOnCloneTree</code> variable determines whether NodeComponent data is duplicated or
  *     copied.
  * @exception RestrictedAccessException if forceDuplicate is set and this object is part of a
  *     compiled scenegraph
  * @see NodeComponent#cloneNodeComponent
  * @see Node#cloneNode
  * @see Node#cloneTree
  * @since Java 3D 1.2
  */
 public void duplicateNodeComponent(NodeComponent originalNodeComponent, boolean forceDuplicate) {
   originalNodeComponent.forceDuplicate = forceDuplicate;
   try {
     duplicateNodeComponent(originalNodeComponent);
   } catch (RuntimeException e) {
     originalNodeComponent.forceDuplicate = false;
     throw e;
   }
   originalNodeComponent.forceDuplicate = false;
 }
Esempio n. 3
0
  /**
   * Copies all node information from <code>originalNodeComponent</code> into the current node
   * component. This method is called from subclass of <code>duplicateNodeComponent</code> method
   * which is, in turn, called by the <code>cloneNodeComponent</code> method.
   *
   * <p>For any <i>NodeComponent</i> objects contained by the object being duplicated, each
   * <i>NodeComponent</i> object's <code>duplicateOnCloneTree</code> value is used to determine
   * whether the <i>NodeComponent<i> should be duplicated in the new node or if just a reference to
   * the current node should be placed in the new node. This flag can be overridden by setting the
   * <code>forceDuplicate</code> parameter in the <code>cloneTree</code> method to <code>true</code>
   * .
   *
   * @param originalNodeComponent the original node component to duplicate.
   */
  final void checkDuplicateNodeComponent(NodeComponent originalNodeComponent) {

    if (originalNodeComponent.nodeHashtable != null) {
      duplicateAttributes(originalNodeComponent, originalNodeComponent.forceDuplicate);
    } else {
      //  user call cloneNodeComponent() or duplicateNodeComponent()
      // directly instead of via cloneTree()
      originalNodeComponent.nodeHashtable = new Hashtable();
      duplicateAttributes(originalNodeComponent, originalNodeComponent.forceDuplicate);
      originalNodeComponent.nodeHashtable = null;
    }
  }