示例#1
0
 private void AddCondition(Rotation rotation, AdvTree advTree)
 {
     var node = new Node();
     node.Text = rotation.Name;
     node.Tag = rotation;
     AddNode(node, advTree);
 }
示例#2
0
        /// <summary>
        /// Returns last rendered node on screen.
        /// </summary>
        /// <param name="tree">Tree control.</param>
        /// <returns>Last rendered node or null</returns>
        public static Node GetLastDisplayedNode(AdvTree tree)
        {
            Rectangle r = tree.NodeLayout.ClientArea;
            Node node = tree.SelectedNode;
            if (node == null) node = GetFirstVisibleNode(tree);
            Point scrollPos = Point.Empty;
            if (tree.AutoScroll)
                scrollPos = tree.GetAutoScrollPositionOffset();

            // Find last fully rendered node
            Node lastNode = null;
            if (r.IntersectsWith(node.Bounds))
                lastNode = node;
            while (node != null)
            {
                node = NodeOperations.GetNextVisibleNode(node);
                if (node != null && node.Selectable)
                {
                    Rectangle nodeRect = NodeDisplay.GetNodeRectangle(eNodeRectanglePart.NodeContentBounds, node, scrollPos);
                    if (nodeRect.Bottom > r.Bottom)
                        break;
                    else if (r.IntersectsWith(nodeRect))
                        lastNode = node;
                }
            }

            return lastNode;
        }
示例#3
0
        private void channel_list_NodeClick(object sender, DevComponents.AdvTree.TreeNodeMouseEventArgs e)
        {
            DevComponents.AdvTree.AdvTree tn = (DevComponents.AdvTree.AdvTree)sender;
            bool isbreak = false;

            foreach (DevComponents.AdvTree.Node item in tn.Nodes)
            {
                if (item.HasChildNodes)
                {
                    foreach (DevComponents.AdvTree.Node n in item.Nodes)
                    {
                        if (n.IsSelected)
                        {
                            //active_ch = n.Cells[n.Cells.Count-1].Text;
                            active_ch = n.Tag.ToString();
                            isbreak   = true;
                            break;
                        }
                    }
                    if (isbreak)
                    {
                        isbreak = false;
                        break;
                    }
                }
            }
            ac_ch(active_ch);
        }
示例#4
0
 private void AddCondition(Rule rule, AdvTree advTree)
 {
     var node = new Node();
     node.Text = rule.Name;
     node.Tag = rule;
     AddNode(node, advTree);
 }
示例#5
0
 private static bool PlusKeyDown(AdvTree tree, KeyEventArgs e)
 {
     Node node = tree.SelectedNode;
     if (node != null && tree.SelectedNodes.Count == 1 && !node.Expanded)
     {
         node.Expand();
         return true;
     }
     return false;
 }
示例#6
0
 /// <summary>
 /// 添加/移除操作
 /// </summary>
 /// <param name="AddTr">需要添加的书</param>
 /// <param name="DelTr">需要移除的树</param>
 private void AddOrRemoveNode(DevComponents.AdvTree.AdvTree AddTr, DevComponents.AdvTree.AdvTree DelTr)
 {
     //添加选中的项
     for (int i = 0; i < DelTr.Nodes.Count; i++)
     {
         if (DelTr.Nodes[i].Checked)
         {
             DelTr.Nodes[i].Checked = false;
             AddTr.Nodes.Add(DelTr.Nodes[i].Copy());
             DelTr.Nodes.Remove(DelTr.Nodes[i]);
             AddOrRemoveNode(AddTr, DelTr);
         }
     }
 }
示例#7
0
        /// <summary>
        ///  显示文书
        /// </summary>
        /// <param name="trvBook"></param>
        public static void ReflashBookTree(DevComponents.AdvTree.AdvTree trvBook)
        {
            //查出所有文书
            string SQl = "select * from T_TEXT where enable_flag='Y' order by shownum asc";
            //找出文书所有类别
            string  Sql_Category = "select * from t_data_code where type=31 and enable='Y'";
            DataSet ds           = new DataSet();

            ds = App.GetDataSet(SQl);
            Class_Text[] Directionarys = GetSelectClassDs(ds);
            //得到文书的类型
            DataSet ds_category = App.GetDataSet(Sql_Category);

            Class_Datacodecs[] datacodes = GetSelectDirectionary(ds_category);
            if (datacodes != null)
            {
                for (int j = 0; j < datacodes.Length; j++)    //添加文书类别节点
                {
                    Node tempNode = new Node();
                    tempNode.Name       = datacodes[j].Id;
                    tempNode.Text       = datacodes[j].Name;
                    tempNode.Tag        = datacodes[j] as object;
                    tempNode.ImageIndex = 1;
                    if (Directionarys != null)
                    {
                        for (int i = 0; i < Directionarys.Length; i++)
                        {
                            Node tn = new Node();
                            tn.Tag  = Directionarys[i];
                            tn.Text = Directionarys[i].Textname;
                            tn.Name = Directionarys[i].Id.ToString();
                            //插入顶级节点
                            if (Directionarys[i].Parentid == 0 && datacodes[j].Id.Equals(Directionarys[i].Txxttype))
                            {
                                tempNode.Nodes.Add(tn);
                                SetTreeView(Directionarys, tn);   //插入文书的子类文书。
                            }
                        }
                    }
                    trvBook.Nodes.Add(tempNode);
                    SetTreeNodesImage(trvBook.Nodes);
                }
            }
        }
示例#8
0
		public static void KeyDown(AdvTree tree, KeyEventArgs e)
		{
            Node node = tree.SelectedNode;
            if (node != null)
            {
                node.InternalKeyDown(e);
                if (e.Handled) return;
            }
            
			switch(e.KeyCode)
			{
				case Keys.Space:
					{
						SpaceKeyDown(tree, e);
						e.Handled = true;
						break;
					}
                case Keys.Add:
                    {
                        e.Handled = PlusKeyDown(tree, e);
                        break;
                    }
                case Keys.Subtract:
                    {
                        e.Handled = MinusKeyDown(tree, e);
                        break;
                    }
                case Keys.F2:
                    {
                        F2KeyDown(tree, e);
                        break;
                    }
                default:
			        {
                        if (e.Control && e.KeyCode == Keys.C)
                            CopyKeyDown(tree, e);
                        else if (e.Control && e.KeyCode == Keys.V)
                            PasteKeyDown(tree, e);
			            break;
			        }
			}
		}
示例#9
0
		/// <summary>
		/// Initializes control with default settings for connectors and nodes.
		/// </summary>
		/// <param name="tree">Control to initialize.</param>
		/// <param name="factory">Factory to use to create new instances of objects.</param>
		public static void InitializeTree(AdvTree tree, ComponentFactory factory)
		{
            //tree.RootConnector=factory.CreateComponent(typeof(NodeConnector)) as NodeConnector;
            //tree.RootConnector.LineWidth=1;
            //tree.RootConnector.LineColor = SystemColors.ControlText;
			tree.NodesConnector=factory.CreateComponent(typeof(NodeConnector)) as NodeConnector;
			tree.NodesConnector.LineWidth=1;
			tree.NodesConnector.LineColor=SystemColors.ControlText;
            tree.BackColor = SystemColors.Window;
			//eStyleBorderType border=eStyleBorderType.Solid;
			ElementStyle style=factory.CreateComponent(typeof(ElementStyle)) as ElementStyle;
			
			//style.BackColorSchemePart=eColorSchemePart.BarBackground;
			//style.BackColor2SchemePart=eColorSchemePart.BarBackground2;
			//style.BackColorGradientAngle=90;
			//style.CornerDiameter=4;
			//style.CornerType=eCornerType.Rounded;
			//style.BorderLeft=border;
			//style.BorderLeftWidth=1;
			//style.BorderTop=border;
			//style.BorderTopWidth=1;
			//style.BorderBottom=border;
			//style.BorderBottomWidth=1;
			//style.BorderRight=border;
			//style.BorderRightWidth=1;
			//style.BorderColorSchemePart=eColorSchemePart.BarDockedBorder;
			//style.PaddingBottom=3;
			//style.PaddingLeft=3;
			//style.PaddingRight=3;
			//style.PaddingTop=3;
            style.TextColor = SystemColors.ControlText;
			tree.Styles.Add(style);

			tree.NodeStyle=style;

            tree.BackgroundStyle.Class = ElementStyleClassKeys.TreeBorderKey;
            tree.AccessibleRole = AccessibleRole.Outline;
		}
示例#10
0
 /// <summary>
 /// Creates new instance of NodeComparer class. You can use NodeComparer to sort the nodes by specific column/cell by calling
 /// NodeCollection.Sort method and pass new instance of NodeComparer class. 
 /// </summary>
 public NodeFlatIndexComparer(AdvTree treeControl)
 {
     _TreeControl = treeControl;
 }
示例#11
0
 private void BeComDeleteRuleClick(object sender, EventArgs e)
 {
     if (_selected != null && _selectedTree != null)
     {
         _selectedTree.Nodes.Remove(_selected);
         _selectedTree = null;
         _selected = null;
     }
 }
示例#12
0
        private AdvTree.AdvTree CreatePropertyTree()
        {

            AdvTree.AdvTree tree = new DevComponents.AdvTree.AdvTree();
#if (!TRIAL)
            tree.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
#endif
            // Default node style
            ElementStyle elementStyle1 = new ElementStyle();
            elementStyle1.Name = STR_DefaultNodeStyle;
            elementStyle1.TextColor = System.Drawing.SystemColors.ControlText;
            elementStyle1.TextTrimming = eStyleTextTrimming.None;
            elementStyle1.TextLineAlignment = eStyleTextAlignment.Center;
            tree.Styles.Add(elementStyle1);
            tree.NodeStyle = elementStyle1;

            _ReadOnlyStyle = new ElementStyle();
            _ReadOnlyStyle.Name = "ReadOnlyStyle";
            _ReadOnlyStyle.TextColor = SystemColors.ControlDark;
            _ReadOnlyStyle.TextTrimming = eStyleTextTrimming.None;
            tree.Styles.Add(_ReadOnlyStyle);

            // Category style
            _CategoryStyle = new ElementStyle();
            _CategoryStyle.Name = "CategoryStyle";
            _CategoryStyle.TextColor = System.Drawing.SystemColors.ControlText;
            _CategoryStyle.BackColorSchemePart = eColorSchemePart.PanelBackground;
            _CategoryStyle.Font = new Font(this.Font, FontStyle.Bold);
            tree.Styles.Add(_CategoryStyle);

            // Value Changed Style
            _ValueChangedStyle = new ElementStyle();
            _ValueChangedStyle.Name = "ValueChangedStyle";
            _ValueChangedStyle.Font = new Font(this.Font, FontStyle.Bold);
            tree.Styles.Add(_ValueChangedStyle);

            tree.AccessibleRole = System.Windows.Forms.AccessibleRole.Outline;
            tree.AllowDrop = false;
            tree.DragDropEnabled = false;
            tree.BackColor = System.Drawing.SystemColors.Window;
            tree.BackgroundStyle.Class = "TreeBorderKey";
            tree.Name = "propertyTree";
            tree.PathSeparator = ";";
            tree.Size = new System.Drawing.Size(150, 100);
            tree.TabIndex = 0;
            tree.ExpandWidth = 12;
            tree.ExpandButtonType = eExpandButtonType.Triangle;
            tree.Indent = 0;
            tree.GridRowLines = true;
            tree.GridColumnLines = true;
            tree.GridColumnLineResizeEnabled = true;
            tree.GridLinesColor = Color.WhiteSmoke;
            tree.HScrollBarVisible = false;
            tree.SelectionPerCell = true;
            tree.SelectionBoxStyle = eSelectionStyle.FullRowSelect;
            tree.SelectionFocusAware = false;
            tree.CellHorizontalSpacing = 2;
            tree.BeforeNodeSelect += new AdvTreeNodeCancelEventHandler(PropertyTreeBeforeNodeSelect);
            tree.KeyboardSearchEnabled = false;
            tree.KeyPress += new KeyPressEventHandler(PropertyTreeKeyPress);
            tree.ColumnResizing += new EventHandler(PropertyTreeColumnResized);
            tree.DoubleClick += new EventHandler(PropertyTreeDoubleClick);
            tree.Leave += new EventHandler(PropertyTreeLeave);

            AdvTree.ColumnHeader header = new DevComponents.AdvTree.ColumnHeader();
            header.Name = "propertyName";
            header.Width.Relative = 50;
            tree.Columns.Add(header);

            header = new DevComponents.AdvTree.ColumnHeader();
            header.Name = "propertyValue";
            header.Width.Relative = 50;
            tree.Columns.Add(header);

            tree.ColumnsVisible = false;

            tree.Dock = DockStyle.Fill;
            return tree;
        }
示例#13
0
 private void ClearTree(AdvTree advTree)
 {
     advTree.BeginUpdate();
     advTree.Nodes.Clear();
     advTree.EndUpdate(true);
 }
示例#14
0
 private void BePrePullRulesNodeClick(object sender, TreeNodeMouseEventArgs e)
 {
     _selected = e.Node;
     _selectedTree = BePrePullRules;
 }
示例#15
0
		public static bool NavigateKeyDown(AdvTree tree, KeyEventArgs e)
		{
			if(tree.SelectedNode==null)
			{
				if(tree.DisplayRootNode!=null)
					tree.SelectNode(tree.DisplayRootNode, eTreeAction.Keyboard);
                else if (tree.Nodes.Count > 0)
                {
                    Node firstSelectable = NodeOperations.GetFirstVisibleNode(tree);
                    if (firstSelectable != null)
                    {
                        while (firstSelectable!=null && !firstSelectable.Selectable)
                            firstSelectable = NodeOperations.GetNextVisibleNode(firstSelectable);
                        if (firstSelectable != null)
                            tree.SelectNode(firstSelectable, eTreeAction.Keyboard);
                    }
                }
				return true;
			}

            Node node = tree.SelectedNode;
            if (node != null && !node.IsKeyboardNavigationEnabled(e))
            {
                return false;
            }

            if(e.KeyCode == Keys.Right)
			{
                if (node != null && node.Cells.Count > 1 && tree.SelectionPerCell && node.CellNavigationEnabled)
                {
                    if (node.SelectedCell == null)
                        node.SetSelectedCell(NodeOperations.GetNextVisibleCell(node, -1), eTreeAction.Keyboard);
                    else
                        node.SetSelectedCell(NodeOperations.GetNextVisibleCell(node, node.Cells.IndexOf(node.SelectedCell)), eTreeAction.Keyboard);
                    return true; 
                }

                if (tree.View == eView.Tile)
                {
                    Node nextNode = NodeOperations.GetNextVisibleNode(node);
                    if (nextNode != null)
                    {
                        if (node.Expanded || !node.HasChildNodes)
                            tree.SelectNode(nextNode, eTreeAction.Keyboard);
                        else
                            node.Expand(eTreeAction.Keyboard);
                    }
                    else if (node != null && node.ExpandVisibility == eNodeExpandVisibility.Visible && !node.Expanded)
                        node.Expand(eTreeAction.Keyboard);
                }
                else
                {
                    Node childNode = NodeOperations.GetFirstVisibleChildNode(node);
                    if (childNode != null)
                    {
                        if (node.Expanded)
                            tree.SelectNode(childNode, eTreeAction.Keyboard);
                        else
                            node.Expand(eTreeAction.Keyboard);
                    }
                    else if (node != null && node.ExpandVisibility == eNodeExpandVisibility.Visible && !node.Expanded)
                        node.Expand(eTreeAction.Keyboard);
                }
			}
			else if(e.KeyCode == Keys.Left)
			{
                if (node != null && node.Cells.Count > 1 && tree.SelectionPerCell && node.CellNavigationEnabled)
                {
                    if (node.SelectedCell == null)
                        node.SetSelectedCell(NodeOperations.GetPreviousVisibleCell(node, node.Cells.Count - 1), eTreeAction.Keyboard);
                    else 
                        node.SetSelectedCell(NodeOperations.GetPreviousVisibleCell(node, node.Cells.IndexOf(node.SelectedCell)), eTreeAction.Keyboard);
                    return true;
                }

                if (tree.View == eView.Tile)
                {
                    Node previousNode = NodeOperations.GetPreviousVisibleNode(node);
                    if (previousNode != null)
                        tree.SelectNode(previousNode, eTreeAction.Keyboard);
                }
                else
                {
                    if (node.Expanded && node.IsSelected && NodeOperations.GetFirstVisibleChildNode(node) != null)
                        node.Collapse(eTreeAction.Keyboard);
                    else if (node.Parent != null)
                        tree.SelectNode(node.Parent, eTreeAction.Keyboard);
                }
			}
            else if (e.KeyCode == Keys.End)
            {
                Node last = NodeOperations.GetLastVisibleNode(tree);
                if (last != null)
                {
                    if (!last.Selectable)
                    {
                        while (last != null)
                        {
                            last = NodeOperations.GetPreviousVisibleNode(last);
                            if (last!=null && last.Selectable) break;
                        }
                    }
                    if (last != null)
                        tree.SelectNode(last, eTreeAction.Keyboard);
                }
            }
            else if (e.KeyCode == Keys.Home || e.KeyCode == Keys.PageDown && node == null)
            {
                Node first = NodeOperations.GetFirstVisibleNode(tree);
                if (first != null)
                {
                    if (!first.Selectable)
                    {
                        while (first != null)
                        {
                            first = NodeOperations.GetNextVisibleNode(first);
                            if (first != null && first.Selectable) break;
                        }
                    }
                    if (first != null)
                        tree.SelectNode(first, eTreeAction.Keyboard);
                }
            }
            else if (e.KeyCode == Keys.PageDown)
            {
                // Find last fully rendered node
                Node lastNode = NodeOperations.GetLastDisplayedNode(tree);
                if (lastNode != null)
                {
                    if (tree.SelectedNode == lastNode)
                    {
                        if (tree.VScrollBar != null && tree.AutoScroll)
                        {
                            tree.AutoScrollPosition = new Point(tree.AutoScrollPosition.X, Math.Max(tree.AutoScrollPosition.Y - tree.VScrollBar.LargeChange, -(tree.VScrollBar.Maximum - tree.VScrollBar.LargeChange)));
                            lastNode = NodeOperations.GetLastDisplayedNode(tree);
                        }
                    }
                }
                if (lastNode != null)
                    tree.SelectNode(lastNode, eTreeAction.Keyboard);
            }
            else if (e.KeyCode == Keys.PageUp)
            {
                // Find last fully rendered node
                Node firstNode = NodeOperations.GetFirstDisplayedNode(tree);
                if (firstNode != null)
                {
                    if (tree.SelectedNode == firstNode)
                    {
                        if (tree.VScrollBar != null && tree.AutoScroll && tree.AutoScrollPosition.Y < 0)
                        {
                            tree.AutoScrollPosition = new Point(tree.AutoScrollPosition.X, Math.Min(0, tree.AutoScrollPosition.Y + tree.VScrollBar.LargeChange));
                            firstNode = NodeOperations.GetFirstDisplayedNode(tree);
                        }
                    }
                }
                if (firstNode != null)
                    tree.SelectNode(firstNode, eTreeAction.Keyboard);
            }
            else if ((e.KeyCode & Keys.Down) == Keys.Down)
            {
                int currentCell = 0;

                if (node != null && node.SelectedCell != null) currentCell = node.Cells.IndexOf(node.SelectedCell);

                Node nextNode = NodeOperations.GetNextVisibleNode(node);

                // Adjust nextNode so the multi-selection is proper
                if ((e.KeyData & Keys.Shift) == Keys.Shift && tree.MultiSelect && tree.SelectedNodes.Count > 1)
                {
                    if (tree.SelectedNodes[0].Bounds.Y > tree.SelectedNodes[tree.SelectedNodes.Count - 1].Bounds.Y)
                        nextNode = tree.SelectedNodes[tree.SelectedNodes.Count - 1];
                }

                if (nextNode != null)
                {
                    if (!nextNode.CanSelect)
                    {
                        int counter = 0;
                        while (nextNode != null && counter < 100)
                        {
                            nextNode = NodeOperations.GetNextVisibleNode(nextNode);
                            if (nextNode != null && nextNode.CanSelect) break;
                        }
                    }
                    if ((e.KeyData & Keys.Shift) == Keys.Shift && tree.MultiSelect && tree.SelectedNodes.Count > 0)
                    {
                        if (tree.MultiSelectRule == eMultiSelectRule.SameParent && tree.SelectedNodes[0].Parent != nextNode.Parent) return true;
                    
                        if (nextNode.IsSelected)
                            tree.SelectedNodes.Remove(nextNode, eTreeAction.Keyboard);
                        else
                            tree.SelectedNodes.Add(nextNode, eTreeAction.Keyboard);
                        nextNode.EnsureVisible();
                    }
                    else
                    {
                        tree.SelectNode(nextNode, eTreeAction.Keyboard);
                        if (tree.SelectionPerCell && currentCell < nextNode.Cells.Count && currentCell > 0)
                            nextNode.SetSelectedCell(nextNode.Cells[currentCell], eTreeAction.Keyboard);
                    }
                }
            }
            else if ((e.KeyCode & Keys.Up) == Keys.Up)
            {
                int currentCell = 0;
                if (node != null && node.SelectedCell != null) currentCell = node.Cells.IndexOf(node.SelectedCell);

                Node prevNode = NodeOperations.GetPreviousVisibleNode(node);
                if (prevNode != null)
                {
                    if (!prevNode.CanSelect)
                    {
                        int counter = 0;
                        while (prevNode != null && counter < 100)
                        {
                            prevNode = NodeOperations.GetPreviousVisibleNode(prevNode);
                            if (prevNode != null && prevNode.CanSelect) break;
                        }
                    }
                    if ((e.KeyData & Keys.Shift) == Keys.Shift && tree.MultiSelect && tree.SelectedNodes.Count > 0)
                    {
                        if (tree.MultiSelectRule == eMultiSelectRule.SameParent && tree.SelectedNodes[0].Parent != prevNode.Parent) return true;
                        if (prevNode.IsSelected)
                        {
                            tree.SelectedNodes.Remove(tree.SelectedNodes[tree.SelectedNodes.Count - 1], eTreeAction.Keyboard);
                        }
                        else
                            tree.SelectedNodes.Add(prevNode, eTreeAction.Keyboard);
                        prevNode.EnsureVisible();
                    }
                    else if (prevNode != null)
                    {
                        tree.SelectNode(prevNode, eTreeAction.Keyboard);
                        if (tree.SelectionPerCell && currentCell < prevNode.Cells.Count && currentCell > 0)
                            prevNode.SetSelectedCell(prevNode.Cells[currentCell], eTreeAction.Keyboard);
                    }
                }
            }
            return true;
		}
示例#16
0
		/// <summary>
		/// Load nodes from XmlElement.
		/// </summary>
		/// <param name="tree">Reference to AdvTree to be populated.</param>
		/// <param name="parent">XmlElement that tree was serialized to.</param>
		public static void Load(AdvTree tree, XmlElement parent)
		{
			tree.BeginUpdate();
			tree.DisplayRootNode = null;
			tree.Nodes.Clear();
			
			NodeSerializationContext context = new NodeSerializationContext();
			context.AdvTree = tree;
			context.HasDeserializeNodeHandlers  = tree.HasDeserializeNodeHandlers;
			context.HasSerializeNodeHandlers = tree.HasSerializeNodeHandlers;
			
			try
			{
				foreach(XmlNode xmlNode in parent.ChildNodes)
				{
					if(xmlNode.Name==XmlNodeName && xmlNode is XmlElement)
					{
						Node node=new Node();
						tree.Nodes.Add(node);
						context.RefXmlElement = xmlNode as XmlElement;
						LoadNode(node, context);
					}
				}
			}
			finally
			{
				tree.EndUpdate();
			}
		}
示例#17
0
		/// <summary>
		/// Load AdvTree Nodes from reader.
		/// </summary>
		/// <param name="tree">Reference to AdvTree to populate</param>
		/// <param name="reader">Reference to reader.</param>
		public static void Load(AdvTree tree, XmlReader reader)
		{
			XmlDocument document=new XmlDocument();
			document.Load(reader);
			Load(tree, document);
		}
示例#18
0
 private void BeComRulesNodeClick(object sender, TreeNodeMouseEventArgs e)
 {
     _selected = e.Node;
     _selectedTree = BeRotations;
 }
示例#19
0
	    private static void CopyKeyDown(AdvTree tree, KeyEventArgs args)
	    {
            if (tree.SelectedNode != null)
                tree.SelectedNode.InvokeKeyboardCopy(args);
	    }
示例#20
0
 public static void SpaceKeyDown(AdvTree tree, KeyEventArgs e)
 {
     Node node = tree.SelectedNode;
     if (node != null && node.CheckBoxVisible && node.Enabled)
     {
         if (node.CheckBoxThreeState)
         {
             if (node.CheckState == CheckState.Checked)
                 node.SetChecked(CheckState.Indeterminate, eTreeAction.Keyboard);
             else if (node.CheckState == CheckState.Unchecked)
                 node.SetChecked(CheckState.Checked, eTreeAction.Keyboard);
             else if (node.CheckState == CheckState.Indeterminate)
                 node.SetChecked(CheckState.Unchecked, eTreeAction.Keyboard);
         }
         else
             node.SetChecked(!node.Checked, eTreeAction.Keyboard);
         e.Handled = true;
     }
 }
示例#21
0
		/// <summary>
		/// Saves nodes to XmlWriter.
		/// </summary>
		/// <param name="tree">AdvTree to save</param>
		/// <param name="writer">XmlWriter to write nodes to</param>
		public static void Save(AdvTree tree, XmlWriter writer)
		{
			XmlDocument document=Save(tree);
			document.Save(writer);
		}
示例#22
0
		/// <summary>
		/// Saves Nodes to stream.
		/// </summary>
		/// <param name="tree">AdvTree to save</param>
		/// <param name="outStream">Stream to save nodes to.</param>
		public static void Save(AdvTree tree, Stream outStream)
		{
			XmlDocument document=Save(tree);
			document.Save(outStream);
		}
示例#23
0
		/// <summary>
		/// Saves Nodes to specified file.
		/// </summary>
		/// <param name="tree">AdvTree to save</param>
		/// <param name="fileName">Target file name</param>
		public static void Save(AdvTree tree, string fileName)
		{
			XmlDocument document=Save(tree);
			document.Save(fileName);
		}
示例#24
0
		/// <summary>
		/// Load AdvTree Nodes from file.
		/// </summary>
		/// <param name="tree">Reference to AdvTree to populate</param>
		/// <param name="fileName">File name.</param>
		public static void Load(AdvTree tree, string fileName)
		{
			XmlDocument document=new XmlDocument();
			document.Load(fileName);
			Load(tree, document);
		}
示例#25
0
		/// <summary>
		/// Load AdvTree Nodes from stream.
		/// </summary>
		/// <param name="tree">Reference to AdvTree to populate</param>
		/// <param name="inStream">Reference to stream</param>
		public static void Load(AdvTree tree, Stream inStream)
		{
			XmlDocument document=new XmlDocument();
			document.Load(inStream);
			Load(tree, document);
		}
示例#26
0
		public static void EnterKeyDown(AdvTree tree, KeyEventArgs e)
		{
            if (tree.SelectedNode != null && tree.SelectedNode.Nodes.Count > 0)
            {
                tree.SelectedNode.Toggle(eTreeAction.Keyboard);
            }
		}
示例#27
0
 private void AddNode(Node node, AdvTree advTree)
 {
     advTree.BeginUpdate();
     advTree.Nodes.Add(node);
     advTree.EndUpdate();
 }
示例#28
0
		/// <summary>
		/// Creates new XmlDocument and serializes AdvTree into it.
		/// </summary>
		/// <param name="tree">AdvTree to serialize</param>
		/// <returns>New instance of XmlDocument/returns>
		public static XmlDocument Save(AdvTree tree)
		{
			XmlDocument document=new XmlDocument();
			Save(tree, document);
			return document;
		}
示例#29
0
		/// <summary>
		/// Load AdvTree from XmlDocument that was created by Save method.
		/// </summary>
		/// <param name="tree">Tree Control to load</param>
		/// <param name="document">XmlDocument to load control from</param>
		public static void Load(AdvTree tree, XmlDocument document)
		{
			foreach(XmlNode xmlNode in document.ChildNodes)
			{
				if(xmlNode.Name==XmlAdvTreeName && xmlNode is XmlElement)
				{
					Load(tree, xmlNode as XmlElement);
					break;
				}
			}
		}
示例#30
0
	    private static void F2KeyDown(AdvTree tree, KeyEventArgs e)
        {
            if (tree.EditSelectedCell(eTreeAction.Keyboard))
                e.Handled = true;
        }
示例#31
0
		/// <summary>
		/// Saves AdvTree to an existing XmlDocument. New node AdvTree is created in document and Nodes are serialized into it.
		/// </summary>
		/// <param name="tree">AdvTree to serialize</param>
		/// <param name="document">XmlDocument instance.</param>
		public static void Save(AdvTree tree, XmlDocument document)
		{
			XmlElement parent = document.CreateElement(XmlAdvTreeName);
			document.AppendChild(parent);
			TreeSerializer.Save(tree, parent);
		}
示例#32
0
		/// <summary>
		/// Sets the node collection belongs to.
		/// </summary>
		/// <param name="parent">HeaderDefinition that is parent of this collection.</param>
		internal void SetParent(AdvTree parent)
		{
			m_Parent=parent;
		}
示例#33
0
		/// <summary>
		/// Serializes AdvTree object to XmlElement object.
		/// </summary>
		/// <param name="tree">Instance of AdvTree to serialize.</param>
		/// <param name="parent">XmlElement to serialize to.</param>
		public static void Save(AdvTree tree, XmlElement parent)
		{
			NodeSerializationContext context = new NodeSerializationContext();
			context.RefXmlElement = parent;
			context.AdvTree = tree;
			context.HasSerializeNodeHandlers = tree.HasSerializeNodeHandlers;
			context.HasDeserializeNodeHandlers = tree.HasDeserializeNodeHandlers;
			
			foreach(Node node in tree.Nodes)
			{
				Save(node, context);
			}
		}