public void OnNodeCliked(TreeNode node) { view.tsbRemoveWSEnabled = false; view.tsbAddLinkWSEnabled = false; view.tsbRemoveLinkWSEnabled = false; NodeTypes?nodeType = node.Tag as NodeTypes?; if (nodeType == NodeTypes.Page || nodeType == NodeTypes.Section || nodeType == NodeTypes.SectionGroup || nodeType == NodeTypes.Notebook) { if (DisplayTreeView.IsNodeInWorkingSet(node) == false) { view.tsbAddLinkWSEnabled = true; } NavigateTo(node.Name); } if (nodeType == NodeTypes.WorkingSet) { view.tsbRemoveWSEnabled = true; } LazyTreeNode parentNode = node.Parent as LazyTreeNode; if (parentNode != null) { NodeTypes?parentType = parentNode.Tag as NodeTypes?; if (parentType == NodeTypes.WorkingSet) { view.tsbRemoveLinkWSEnabled = true; } } }
private List <LazyTreeNode> DataViewToNodes(DataView dataView) { var retTreeNodes = new List <LazyTreeNode>(); foreach (DataRowView drv in dataView) { string typeName = Enum.GetName(typeof(NodeTypes), drv["Nodetype"]); var newTreeNode = new LazyTreeNode { Name = drv["ID"].ToString(), Text = drv["DisplayName"].ToString(), Tag = (NodeTypes)drv["Nodetype"], // ImageKey = String.Format("TreeView4.Resources.{0}.bmp", typeName) , // SelectedImageKey = String.Format("TreeView4.Resources.{0}.bmp", typeName) }; if ((NodeTypes)newTreeNode.Tag == NodeTypes.Page) { newTreeNode.Nodes.Clear(); newTreeNode.IsLoaded = true; } retTreeNodes.Add(newTreeNode); } return(retTreeNodes); }
public void ChangeSelectedNode(string ID) { displayTree.BeginUpdate(); if (ID == null) { return; } clearDisplay(); setDisplayNode(AllNode); TreeNode[] matchNodes = displayTree.Nodes.Find(ID, true); for (int i = 0; i < matchNodes.Length; i++) { if (IsNodeInWorkingSet(matchNodes[i]) == true) { matchNodes[i] = null; } } if (matchNodes.Length == 0 || matchNodes[0] == null) { string parentID = presenter.GetNodeParent(ID); ChangeSelectedNode(parentID); matchNodes = AllNode.Nodes.Find(ID, true); } if (matchNodes.Length == 0) { return; } displayTree.Expand(matchNodes[0]); SelectedNode = matchNodes[0] as LazyTreeNode; displayTree.EndUpdate(); }
public void AddWorkingSetLink(LazyTreeNode tn, LazyTreeNode ws) { var frmWS = new AddWSLink(); frmWS.LoadList(ws); frmWS.WorkingSetSelectionMade += new AddWSLink.ChosenWorkingSet(frmWS_WorkingSetSelectionMade); AddLinkToWorkingSet = tn; frmWS.ShowDialog(); //dataManager.workingSet.AddWorkingSetLink(); }
private void RootsListRecurser(LazyTreeNode node) { LazyTreeNode parentNode = (LazyTreeNode)node.Parent; if (parentNode != null) { RootsListRecurser(parentNode); } tscbRootList.Items.Add(new ComboBoxItem(node)); }
private void btnOkClicked(object sender, EventArgs e) { LazyTreeNode newNode = lbWorkingSets.SelectedItem as LazyTreeNode; WorkingSetSelectedArgs args = new WorkingSetSelectedArgs(newNode); if (WorkingSetSelectionMade != null) { WorkingSetSelectionMade(this, args); } this.Close(); }
public void LoadList(LazyTreeNode node) { foreach (LazyTreeNode tn in node.Nodes) { lbWorkingSets.DisplayMember = "Text"; lbWorkingSets.Items.Add(tn); } if (lbWorkingSets.Items.Count > 0) { lbWorkingSets.SelectedItem = this.lbWorkingSets.Items[0]; } }
public override object Clone() { LazyTreeNode cloned = base.Clone() as LazyTreeNode; if (cloned == null) { return(base.Clone()); } else { cloned.IsLoaded = this.IsLoaded; return(cloned); } }
public void MakeRootButtonClicked() { LazyTreeNode selectedNode = view.DisplaySelectedNode; if (selectedNode == null) { return; } if (selectedNode.Nodes.Count == 0) { selectedNode = selectedNode.Parent as LazyTreeNode; } view.RootsList(selectedNode); view.SetDisplayRoot(selectedNode); }
private void OnNodeExpand(object sender, DoWorkEventArgs e) { TreeViewEventArgs tvargs = (TreeViewEventArgs)e.Argument; LazyTreeNode lazyNode = (LazyTreeNode)tvargs.Node; var retList = new List <LazyTreeNode>(); if (lazyNode != null) { if (lazyNode.Tag is NodeTypes) { retList = DataViewToNodes(presenter.GetNodeChildren(lazyNode.Name)); } else { retList = DataViewToNodes(presenter.GetNodeChildren((RootNodes)lazyNode.Tag)); } } e.Result = new object[] { retList }; }
public void RootsList(LazyTreeNode node) { // LazyTreeNode refNode = internalTree.Nodes[0] as LazyTreeNode ; // SetDisplayRoot(internalTreeMainRoot); LazyTreeNode currNode = this.treeManager.SelectedNode; this.tscbRootList.Items.Clear(); this.treeManager.clearDisplay(); RootsListRecurser(node); this.tscbRootList.SelectedIndexChanged -= new System.EventHandler(this.tscbRootListSelectionChanged); if (tscbRootList.Items.Count > 2) { this.tscbRootList.Items.RemoveAt(this.tscbRootList.Items.Count - 1); } this.tscbRootList.SelectedItem = this.tscbRootList.Items[this.tscbRootList.Items.Count - 1]; this.tscbRootList.SelectedIndexChanged += new System.EventHandler(this.tscbRootListSelectionChanged); if (currNode != null) { SetDisplayRoot(currNode); } }
public bool setDisplayNode(LazyTreeNode node) { displayTree.BeginUpdate(); clearDisplay(); TreeNode[] nodeRef = AllNode.Nodes.Find(node.Name, true); if (nodeRef.Count() < 1 && node.Name != AllNode.Name) { return(false); } if (node.Parent != null) { displayNodeParent = nodeRef[0].Parent as LazyTreeNode; } else { displayNodeParent = null; } if (node.Name == AllNode.Name) { nodeRef = new TreeNode[1]; nodeRef[0] = AllNode; } rootIndex = nodeRef[0].Index; nodeRef[0].Remove(); displayTree.Nodes.Add(nodeRef[0]); displayTree.Expand(nodeRef[0]); displayNodeKey = nodeRef[0].Name; displayTree.EndUpdate(); return(true); }
public void Expand(TreeNode treeNode) { this.BeginUpdate(); if (treeNode == null) { return; } LazyTreeNode lazyNode = treeNode as LazyTreeNode; if (lazyNode == null) { treeNode.Expand(); } else { OnAfterExpand(new TreeViewEventArgs(lazyNode)); while (!lazyNode.IsLoaded) { Application.DoEvents(); } lazyNode.Expand(); } this.EndUpdate(); }
public ComboBoxItem(LazyTreeNode node) { Node = node; }
public void SetDisplayRoot(LazyTreeNode node) { treeManager.setDisplayNode(node); }
public void LoadTree(Presenter setPresenter) { LoadImageList(); displayTree.BeginUpdate(); presenter = setPresenter; displayTree.Nodes.Clear(); AllNode = null; displayNodeKey = ""; displayNodeParent = null; rootIndex = 0; displayTree.OnAfterFirstExpandNode += OnNodeExpand; LazyTreeNode root = new LazyTreeNode(); root.Nodes.Clear(); root.Text = "All"; root.Name = "All"; root.Tag = "All"; LazyTreeNode newRootNode = null; #region Loading the Nodes with Special Root Labels foreach (RootNodes rootNode in Enum.GetValues(typeof(RootNodes))) { DataView dataView = presenter.GetNodeChildren(rootNode); if (dataView != null) { string imgName = Enum.GetName(typeof(RootNodes), rootNode); newRootNode = new LazyTreeNode { Name = Enum.GetName(typeof(RootNodes), rootNode), Text = Enum.GetName(typeof(RootNodes), rootNode), Tag = rootNode, // SelectedImageKey = String.Format("TreeView4.Resources.{0}.bmp", imgName), // ImageKey = String.Format("TreeView4.Resources.{0}.bmp", imgName) }; if (newRootNode.Name == "WorkingSets") { newRootNode.Text = "Favorite Folders"; } List <LazyTreeNode> children = DataViewToNodes(presenter.GetNodeChildren(rootNode)); newRootNode.Nodes.Clear(); newRootNode.Nodes.AddRange(children.ToArray()); newRootNode.IsLoaded = true; root.Nodes.Add(newRootNode); } } #endregion root.IsLoaded = true; this.AllNode = root; this.setDisplayNode(root); this.SelectedNode = root; // displayTree.ShowLines = false; // displayTree.ShowPlusMinus = false; displayTree.EndUpdate(); }
public WorkingSetSelectedArgs(LazyTreeNode lazyNode) { Node = lazyNode; }
public void ListSelectionChange(LazyTreeNode node) { view.RootsList(node); view.SetDisplayRoot(node); }
public void RootsList(LazyTreeNode node) { // LazyTreeNode refNode = internalTree.Nodes[0] as LazyTreeNode ; // SetDisplayRoot(internalTreeMainRoot); LazyTreeNode currNode = this.treeManager.SelectedNode; this.tscbRootList.Items.Clear(); this.treeManager.clearDisplay(); RootsListRecurser(node); this.tscbRootList.SelectedIndexChanged -= new System.EventHandler(this.tscbRootListSelectionChanged); if (tscbRootList.Items.Count > 2) { this.tscbRootList.Items.RemoveAt(this.tscbRootList.Items.Count - 1); } this.tscbRootList.SelectedItem = this.tscbRootList.Items[this.tscbRootList.Items.Count - 1]; this.tscbRootList.SelectedIndexChanged += new System.EventHandler(this.tscbRootListSelectionChanged); if(currNode!=null) SetDisplayRoot(currNode); }
private void RootsListRecurser(LazyTreeNode node) { LazyTreeNode parentNode = (LazyTreeNode) node.Parent; if(parentNode!=null) { RootsListRecurser(parentNode); } tscbRootList.Items.Add(new ComboBoxItem(node)); }