public virtual void OnReadFromXmlNode(IXmlCodeReader serializer, XmlNode node)
        {
            ObjectXmlReader xr = new ObjectXmlReader();
            Point           l;

            if (xr.ReadValueFromChildNode <Point>(node, XML_Location, out l))
            {
                _location = l;
            }
            else
            {
                _location = this.Location;
            }
            if (NeedSaveSize)
            {
                Size s;
                if (xr.ReadValueFromChildNode <Size>(node, XML_Size, out s))
                {
                    this.Size = s;
                }
            }
            if (_location.X < 0)
            {
                _location.X = 0;
            }
            if (_location.Y < 0)
            {
                _location.Y = 0;
            }
            this.Location = _location;
        }
 private void checkLoadValues()
 {
     if (_data == null && _xmlNode != null)
     {
         XmlNodeList     nds = _xmlNode.SelectNodes(TreeViewX.XML_Value);
         ObjectXmlReader xr  = new ObjectXmlReader();
         foreach (XmlNode nd in nds)
         {
             TreeNodeValue tnv = new TreeNodeValue(nd, xr);
             tnv.IsShortcut = IsShortcut;
             if (!tnv.IsShortcut)
             {
                 AddValue(tnv.Name, tnv.Value);
             }
         }
         if (!IsShortcut)
         {
             TreeViewX tvx = TreeView as TreeViewX;
             if (tvx != null)
             {
                 tvx.OnValueListLoaded(this);
             }
         }
     }
 }
        public TreeNode CreatePointer()
        {
            TreeNodePointer obj = new TreeNodePointer(_xmlNode);

            if (this.IsShortcut)
            {
                bool      loaded = false;
                TreeViewX tvx    = this.TreeView as TreeViewX;
                if (tvx != null)
                {
                    TreeNodeX tnx = tvx.GetCategoryNodeById(this.TreeNodeId);
                    if (tnx != null)
                    {
                        VPLUtil.CopyProperties(tnx, obj);
                        loaded = true;
                    }
                }
                if (!loaded)
                {
                    ObjectXmlReader oxr = new ObjectXmlReader();
                    oxr.ReadProperties(_xmlNode, obj);
                }
            }
            else
            {
                VPLUtil.CopyProperties(this, obj);
            }
            return(obj);
        }
Beispiel #4
0
        public TreeNodeValue(XmlNode node, ObjectXmlReader reader)
        {
            _xmlNode = node;
            string name = XmlUtil.GetNameAttribute(_xmlNode);
            Type   type = XmlUtil.GetLibTypeAttribute(_xmlNode);
            object d    = reader.ReadValue(_xmlNode, null, type);

            _data = new TypedNamedValue(name, new TypedValue(type, d));
            init();
        }
Beispiel #5
0
        public override TreeNodeX CreateDuplicatedNode(TreeViewX targetHolder)
        {
            XmlDocument docTarget = targetHolder.GetXmlDocument();

            if (docTarget != _pointerXmlNode.OwnerDocument)
            {
                throw new TreeViewXException("Cannot duplicate shortcut bewteen different tree views");
            }
            ObjectXmlReader  oxr        = new ObjectXmlReader();
            XmlNode          pointerXml = _pointerXmlNode.Clone();
            TreeNodeShortcut tns        = new TreeNodeShortcut(pointerXml, oxr);

            return(tns);
        }
Beispiel #6
0
        public void LoadShortCutFromXmlNode(XmlNode node, ObjectXmlReader reader)
        {
            _pointerXmlNode = node;
            Guid id = XmlUtil.GetAttributeGuid(node, TreeViewX.XMLATT_Guid);

            if (id == Guid.Empty)
            {
                throw new TreeViewXException("Guid not found in the shortcut node. Shortcut Path:{0}", XmlUtil.GetPath(node));
            }
            XmlNode dataNode = node.OwnerDocument.SelectSingleNode(string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                                                 "//{0}[@{1}='{2}']",
                                                                                 TreeViewX.XML_Item, TreeViewX.XMLATT_Guid, id.ToString("D")));

            if (dataNode == null)
            {
                throw new TreeViewXException("XmlNode not found for {0}. Shortcut Path:{1}", id, XmlUtil.GetPath(node));
            }
            DataXmlNode = dataNode;
            reader.ReadProperties(dataNode, this);
            ClearValues();
        }
Beispiel #7
0
        public void LoadFromDataXmlNode(XmlNode node)
        {
            ObjectXmlReader rd = new ObjectXmlReader();

            rd.ReadProperties(node, this);
        }
Beispiel #8
0
 public TreeNodeShortcut(XmlNode node, ObjectXmlReader reader)
 {
     LoadShortCutFromXmlNode(node, reader);
 }