public override void ResetValue(object component)
            {
                TreeNodeX tnx = component as TreeNodeX;

                if (tnx != null)
                {
                    tnx.ResetValue(Name);
                }
            }
            public override object GetValue(object component)
            {
                TreeNodeX tnx = component as TreeNodeX;

                if (tnx != null)
                {
                    return(tnx.GetValue(this.Name));
                }
                return(null);
            }
예제 #3
0
 public override void OnCategoryNodeLoaded(TreeNodeX node)
 {
     if (this.TreeNodeId == node.TreeNodeId)
     {
         _dataNode = node;
     }
     else
     {
         base.OnCategoryNodeLoaded(node);
     }
 }
예제 #4
0
 public override void SyncShortcuts(TreeNodeX node)
 {
     if (node.TreeNodeId == this.TreeNodeId)
     {
         _dataNode = node;
         VPLUtil.CopyProperties(node, this);
     }
     else
     {
         base.SyncShortcuts(node);
     }
 }
        private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            TreeNodeX tnx = propertyGrid1.SelectedObject as TreeNodeX;

            if (tnx != null)
            {
                if (!tnx.IsShortcut)
                {
                    treeView1.SyncShortcuts(tnx);
                }
            }
        }
예제 #6
0
 public override void OnSubNodeCreated(TreeNodeX parentNode, TreeNodeX subNode)
 {
     if (this.TreeNodeId == parentNode.TreeNodeId)
     {
         TreeNode tnx = subNode.CreatePointer();
         this.Nodes.Add(tnx);
     }
     else
     {
         base.OnSubNodeCreated(parentNode, subNode);
     }
 }
예제 #7
0
 public override void SyncShortcutsValueList(TreeNodeX node)
 {
     if (node.TreeNodeId == this.TreeNodeId)
     {
         SetValueList(node.GetValueList());
         _dataNode = node;
         ResetNextLevel();
     }
     else
     {
         base.SyncShortcuts(node);
     }
 }
예제 #8
0
 public override void OnValueListLoaded(TreeNodeX node)
 {
     if (this.TreeNodeId == node.TreeNodeId)
     {
         this.SetValueList(node.GetValueList());
         if (this.NextLevelLoaded)
         {
             this.ResetNextLevel();
         }
     }
     else
     {
         base.OnValueListLoaded(node);
     }
 }
예제 #9
0
        void _data_BeforeNameChange(object sender, EventArgs e)
        {
            NameChangeEventArgs ce = e as NameChangeEventArgs;

            if (ce != null)
            {
                TreeNodeX tnx = this.Parent as TreeNodeX;
                if (tnx != null)
                {
                    if (tnx.IsNameUsed(ce.Name))
                    {
                        ce.Cancel = true;
                    }
                }
            }
        }
 public void PrepareCurrentNode()
 {
     if (_fields != null)
     {
         TreeViewX tv = this.TreeView as TreeViewX;
         if (tv != null)
         {
             int       level = this.Level + 1;               //for query loading the next level
             DataQuery dq    = tv.GetDataQuery(level);
             if (dq != null)
             {
                 FieldList fs = dq.Fields;
                 if (fs != null)
                 {
                     for (int i = 0; i < _fields.Count; i++)
                     {
                         EPField f = fs[_fields[i].Name];
                         if (f != null)
                         {
                             f.Value = _fields[i].Value;
                         }
                     }
                 }
             }
         }
         if (_template != null)
         {
             FieldList fs = _template.Fields;
             if (fs != null)
             {
                 for (int i = 0; i < _fields.Count; i++)
                 {
                     EPField f = fs[_fields[i].Name];
                     if (f != null)
                     {
                         f.Value = _fields[i].Value;
                     }
                 }
             }
         }
         TreeNodeX tx = this.Parent as TreeNodeX;
         if (tx != null)
         {
             tx.PrepareCurrentNode();
         }
     }
 }
 public virtual TreeNodeX CreateDuplicatedNode(TreeViewX targetHolder)
 {
     if (_xmlNode == null)
     {
         TreeNodeX tnx = (TreeNodeX)this.Clone();
         return(tnx);
     }
     else
     {
         XmlNode     dataXml;
         XmlDocument docTarget = targetHolder.GetXmlDocument();
         if (docTarget == _xmlNode.OwnerDocument)
         {
             dataXml = _xmlNode.CloneNode(true);
         }
         else
         {
             dataXml = docTarget.ImportNode(_xmlNode, true);
         }
         XmlUtil.SetLibTypeAttribute(dataXml, this.GetType());
         XmlNodeList ndLst = dataXml.SelectNodes(string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                               "..//*[@{0}]", TreeViewX.XMLATT_Guid));
         Dictionary <Guid, Guid> idMaps = new Dictionary <Guid, Guid>();
         foreach (XmlNode nd in ndLst)
         {
             Guid id = XmlUtil.GetAttributeGuid(nd, TreeViewX.XMLATT_Guid);
             if (id == Guid.Empty)
             {
                 throw new TreeViewXException("Guid not found");
             }
             else
             {
                 Guid id2;
                 if (!idMaps.TryGetValue(id, out id2))
                 {
                     id2 = Guid.NewGuid();
                     idMaps.Add(id, id2);
                 }
             }
             XmlUtil.SetAttribute(nd, TreeViewX.XMLATT_Guid, Guid.NewGuid().ToString("D"));
         }
         TreeNodeX tnx = new TreeNodeX(dataXml);
         VPLUtil.CopyProperties(this, tnx);
         return(tnx);
     }
 }
 public virtual void OnCategoryNodeLoaded(TreeNodeX node)
 {
     if (this != node)
     {
         if (NextLevelLoaded)
         {
             for (int i = 0; i < Nodes.Count; i++)
             {
                 TreeNodeX tnx = Nodes[i] as TreeNodeX;
                 if (tnx != null)
                 {
                     tnx.OnCategoryNodeLoaded(node);
                 }
             }
         }
     }
 }
 public void OnValueNameChanged(Guid categoryId, string oldName, string valueName)
 {
     if (this.NextLevelLoaded)
     {
         if (this.TreeNodeId == categoryId)
         {
             foreach (TreeNode tn in Nodes)
             {
                 TreeNodeValue tnv = tn as TreeNodeValue;
                 if (tnv != null)
                 {
                     if (string.CompareOrdinal(valueName, tnv.DataName) == 0)
                     {
                         if (_data != null)
                         {
                             if (_data.ContainsKey(oldName))
                             {
                                 TypedNamedValue v = _data[oldName];
                                 _data.Remove(oldName);
                                 _data.Add(valueName, v);
                             }
                         }
                         tnv.OnDataNameChanged();
                         break;
                     }
                 }
             }
         }
         else
         {
             foreach (TreeNode tn in Nodes)
             {
                 TreeNodeX tnx = tn as TreeNodeX;
                 if (tnx != null)
                 {
                     tnx.OnValueNameChanged(categoryId, oldName, valueName);
                 }
             }
         }
     }
 }
예제 #14
0
        void _data_AfterNameChange(object sender, EventArgs e)
        {
            string oldName = Name;

            Name = _data.Name;
            showText();
            if (_xmlNode != null)
            {
                XmlUtil.SetNameAttribute(_xmlNode, _data.Name);
            }
            TreeViewX tvx = TreeView as TreeViewX;

            if (tvx != null)
            {
                TreeNodeX tnx = this.Parent as TreeNodeX;
                if (tnx != null)
                {
                    tvx.OnValueNameChanged(tnx.TreeNodeId, oldName, _data.Name);
                }
            }
        }
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNodeShortcut tns = e.Node as TreeNodeShortcut;

            if (tns != null)
            {
                propertyGrid1.SelectedObject = tns;
                //
                buttonAddValue.Enabled = false;
                buttonDelNode.Enabled  = true;
                buttonDelVal.Enabled   = false;
                buttonSubNode.Enabled  = false;
            }
            else
            {
                TreeNodeX tnx = e.Node as TreeNodeX;
                if (tnx != null)
                {
                    propertyGrid1.SelectedObject = tnx;
                    //
                    buttonAddValue.Enabled = !tnx.IsShortcut;
                    buttonDelNode.Enabled  = !tnx.IsShortcut;
                    buttonDelVal.Enabled   = false;
                    buttonSubNode.Enabled  = !tnx.IsShortcut;
                }
                else
                {
                    TreeNodeValue tnv = e.Node as TreeNodeValue;
                    if (tnv != null)
                    {
                        propertyGrid1.SelectedObject = tnv.Data;
                        //
                        buttonAddValue.Enabled = false;
                        buttonDelNode.Enabled  = false;
                        buttonDelVal.Enabled   = true;
                        buttonSubNode.Enabled  = false;
                    }
                }
            }
        }
        //private void enableButtons()
        //{
        //    TreeNodeTemp tnx = treeView1.SelectedNode as TreeNodeTemp;
        //    if (tnx != null)
        //    {
        //        buttonAddSub.Enabled = true;
        //        buttonAddValue.Enabled = true;
        //        buttonDelNode.Enabled = true;
        //        buttonDelValue.Enabled = false;
        //    }
        //    else
        //    {
        //    }
        //}
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNodeX tnx = e.Node as TreeNodeX;

            if (tnx != null)
            {
                _selectedId = tnx.TreeNodeId;
                propertyGrid1.SelectedObject = tnx;
                //
                buttonAddValue.Enabled = true;
                buttonDelNode.Enabled  = true;
                buttonDelValue.Enabled = false;
                buttonAddSub.Enabled   = true;
            }
            else
            {
                TreeNodeValue tnv = e.Node as TreeNodeValue;
                if (tnv != null)
                {
                    propertyGrid1.SelectedObject = tnv.Data;
                    //
                    buttonAddValue.Enabled = false;
                    buttonDelNode.Enabled  = false;
                    buttonDelValue.Enabled = true;
                    buttonAddSub.Enabled   = false;
                }
                else
                {
                    propertyGrid1.SelectedObject = null;
                    //
                    buttonAddValue.Enabled = false;
                    buttonDelNode.Enabled  = false;
                    buttonDelValue.Enabled = false;
                    buttonAddSub.Enabled   = false;
                }
            }
        }
 public void RemoveAllShortcuts(Guid id)
 {
     if (NextLevelLoaded)
     {
         List <TreeNodeShortcut> l = new List <TreeNodeShortcut>();
         for (int i = 0; i < Nodes.Count; i++)
         {
             TreeNodeShortcut ts = Nodes[i] as TreeNodeShortcut;
             if (ts != null && ts.TreeNodeId == id)
             {
                 l.Add(ts);
             }
             TreeNodeX tnx = Nodes[i] as TreeNodeX;
             if (tnx != null)
             {
                 tnx.RemoveAllShortcuts(id);
             }
         }
         foreach (TreeNodeShortcut ts in l)
         {
             ts.Remove();
         }
     }
 }
 public virtual void SyncShortcuts(TreeNodeX node)
 {
     if (this != node)
     {
         if (node.TreeNodeId == this.TreeNodeId)
         {
             VPLUtil.CopyProperties(node, this);
         }
         else
         {
             if (NextLevelLoaded)
             {
                 for (int i = 0; i < Nodes.Count; i++)
                 {
                     TreeNodeX tnx = Nodes[i] as TreeNodeX;
                     if (tnx != null)
                     {
                         tnx.SyncShortcuts(node);
                     }
                 }
             }
         }
     }
 }
 public virtual void SyncShortcutsValueList(TreeNodeX node)
 {
     if (this != node)
     {
         if (this.TreeNodeId == node.TreeNodeId)
         {
             this.SetValueList(node.GetValueList());
         }
         else
         {
             if (NextLevelLoaded)
             {
                 for (int i = 0; i < Nodes.Count; i++)
                 {
                     TreeNodeX tnx = Nodes[i] as TreeNodeX;
                     if (tnx != null)
                     {
                         tnx.SyncShortcutsValueList(node);
                     }
                 }
             }
         }
     }
 }
예제 #20
0
 public TreeNodeXMouseClickEventArgs(TreeNodeX node, MouseButtons buttons, int clicks, int x, int y)
     : base(node, buttons, clicks, x, y)
 {
     _node = node;
 }
예제 #21
0
 public void SetReferenceNode(TreeNodeX node)
 {
     _dataNode = node;
 }
예제 #22
0
 public TreeNodeXMouseClickEventArgs(TreeNodeX node, TreeNodeMouseClickEventArgs e)
     : base(node, e.Button, e.Clicks, e.X, e.Y)
 {
     _node = node;
 }
예제 #23
0
 public TreeNodeXEventArgs(TreeNodeX node, TreeViewAction action)
 {
     _node = node;
     _act  = action;
 }
 public virtual void LoadNextLevel(TreeNodeX parentNode)
 {
     parentNode.LoadNextLevelNodes();
 }