示例#1
0
        public RelDocNodeProxy ClonePathOnly(Main.IDocumentNode newparent)
        {
            RelDocNodeProxy result = new RelDocNodeProxy();

            result.CopyPathOnlyFrom(this, newparent);
            return(result);
        }
示例#2
0
            public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                RelDocNodeProxy s = (RelDocNodeProxy)obj;

                System.Diagnostics.Debug.Assert(s._parentNode != null);
                Main.DocumentPath path = Main.DocumentPath.GetRelativePathFromTo(s._parentNode, (Main.IDocumentNode)s._docNode);
                info.AddValue("Node", path);
            }
示例#3
0
        /// <summary>
        /// Creates a copy of a docnode proxy
        /// </summary>
        /// <param name="from"></param>
        /// <param name="copyPathOnly">If true, only the path is copied, and the document is then resolved using the provided <paramref name="parentNode"/> as start point of the path.
        /// If <c>false</c>, and the proxy to copy from has a valid document, that document is used also for this instance, and a new relative path from  <paramref name="parentNode"/> to the document is calculated.</param>
        /// <param name="parentNode">The parent node of this proxy.</param>
        public RelDocNodeProxy(RelDocNodeProxy from, bool copyPathOnly, Main.IDocumentNode parentNode)
        {
            _parent      = parentNode;
            _docNodePath = from._docNodePath.Clone();

            if (!copyPathOnly && null != from.Document)
            {
                InternalSetDocNode(from.Document, parentNode);
            }

            ResolveDocumentObject();
        }
示例#4
0
            public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                RelDocNodeProxy s = null != o ? (RelDocNodeProxy)o : new RelDocNodeProxy();

                if (!(parent is Main.IDocumentNode))
                {
                    throw new ArgumentException("Parent should be a valid document node");
                }

                s._parentNode  = (Main.IDocumentNode)parent;
                s._docNodePath = (Main.DocumentPath)info.GetValue("Node", s);

                // create a callback to resolve the instance as early as possible
                if (s._docNodePath != null && s._docNode == null)
                {
                    info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(s.EhXmlDeserializationFinished);
                }


                return(s);
            }
 /// <summary>
 /// Copying constructor.
 /// </summary>
 /// <param name="from">Object to clone from.</param>
 /// <param name="newparent"></param>
 public void CopyFrom(RelDocNodeProxy from, Main.IDocumentNode newparent)
 {
     this.SetDocNode(from._docNode, newparent); // than the new Proxy refers to the same document node
 }
 public RelDocNodeProxy ClonePathOnly(Main.IDocumentNode newparent)
 {
   RelDocNodeProxy result = new RelDocNodeProxy();
   result.CopyPathOnlyFrom(this, newparent);
   return result;
 }
 public void CopyPathOnlyFrom(RelDocNodeProxy from, Main.IDocumentNode newparent)
 {
   this.ClearDocNode();
   this._parentNode = newparent;
   this._docNodePath = from._docNodePath==null ? null : (Main.DocumentPath)from._docNodePath.Clone();
 }
示例#8
0
		protected override System.Collections.Generic.IEnumerable<Main.DocumentNodeAndName> GetDocumentNodeChildrenWithName()
		{
			if (null != _scaleWrapped)
				yield return new Main.DocumentNodeAndName(_scaleWrapped, () => _scaleWrapped = null, "ScaleWrapped");

			if (null != _linkParameters)
				yield return new Main.DocumentNodeAndName(_linkParameters, () => _linkParameters = null, "LinkParameters");

			if (null != _scaleLinkedToProxy)
				yield return new Main.DocumentNodeAndName(_scaleLinkedToProxy, () => _scaleLinkedToProxy = null, "ScaleLinkedTo");
		}
示例#9
0
 /// <summary>
 /// Copying constructor.
 /// </summary>
 /// <param name="from">Object to clone from.</param>
 /// <param name="newparent"></param>
 public void CopyFrom(RelDocNodeProxy from, Main.IDocumentNode newparent)
 {
     this.SetDocNode(from._docNode, newparent); // than the new Proxy refers to the same document node
 }
示例#10
0
 public void CopyPathOnlyFrom(RelDocNodeProxy from, Main.IDocumentNode newparent)
 {
     this.ClearDocNode();
     this._parentNode  = newparent;
     this._docNodePath = from._docNodePath == null ? null : (Main.DocumentPath)from._docNodePath.Clone();
 }
示例#11
0
		/// <summary>
		/// Creates a copy of a docnode proxy
		/// </summary>
		/// <param name="from"></param>
		/// <param name="copyPathOnly">If true, only the path is copied, and the document is then resolved using the provided <paramref name="parentNode"/> as start point of the path.
		/// If <c>false</c>, and the proxy to copy from has a valid document, that document is used also for this instance, and a new relative path from  <paramref name="parentNode"/> to the document is calculated.</param>
		/// <param name="parentNode">The parent node of this proxy.</param>
		public RelDocNodeProxy(RelDocNodeProxy from, bool copyPathOnly, Main.IDocumentNode parentNode)
		{
			this._parent = parentNode;
			this._docNodePath = from._docNodePath.Clone();

			if (!copyPathOnly && null != from.Document)
				InternalSetDocNode(from.Document, parentNode);

			ResolveDocumentObject();
		}