/// <summary> /// Creates a new TreeNode with identical content (recursively) as this node, /// but compatible with the given Presentation (factories, managers, /// channels, etc.). /// </summary> /// <param name="destPres">The destination Presentation to which this node (and all its content, recursively) should be exported.</param> /// <returns>The exported node</returns> /// <exception cref="exception.MethodParameterIsNullException">Thrown when <paramref name="destPres"/> is null</exception> /// <exception cref="exception.FactoryCannotCreateTypeException"> /// Thrown when the facotries of <paramref name="destPres"/> can not create a node in the sub-tree beginning at <c>this</c> /// or a property associated object for one of the nodes in the sub-tree /// </exception> protected override TreeNode ExportProtected(Presentation destPres) { ExampleCustomTreeNode node = base.ExportProtected(destPres) as ExampleCustomTreeNode; if (node == null) { throw new exception.FactoryCannotCreateTypeException(String.Format( "The TreeNodefactory cannot create a ExampleCustomTreeNode matching QName {1}:{0}", XukLocalName, XukNamespaceUri)); } node.CustomTreeNodeData = CustomTreeNodeData; node.Label = Label; return(node); }
/// <summary> /// Copies the <see cref="ExampleCustomTreeNode"/> /// </summary> /// <param name="deep">If true, then include the node's entire subtree. /// Otherwise, just copy the node itself.</param> /// <param name="inclProperties">If true, then include property of the node, /// if false just copy the node itself.</param> /// <returns>A <see cref="ExampleCustomTreeNode"/> containing the copied data.</returns> /// <exception cref="urakawa.exception.FactoryCannotCreateTypeException"> /// Thrown when the <see cref="TreeNodeFactory"/> of the <see cref="Presentation"/> to which the instance belongs /// can not create an <see cref="ExampleCustomTreeNode"/> instance /// </exception> protected override TreeNode CopyProtected(bool deep, bool inclProperties) { TreeNode theCopy = base.CopyProtected(deep, inclProperties); if (!(theCopy is ExampleCustomTreeNode)) { throw new urakawa.exception.FactoryCannotCreateTypeException(String.Format( "The TreeNodeFactory of the Presentation can not create an {0}:ExampleCustomTreeNode", XukAble.XUK_NS)); } ExampleCustomTreeNode theTypedCopy = (ExampleCustomTreeNode)theCopy; theTypedCopy.CustomTreeNodeData = CustomTreeNodeData; theTypedCopy.Label = Label; return(theTypedCopy); }