public void RemoveNode (TreeDataNode node) { if (_children.Contains (node)) { _children.Remove(node); node._parent = null; } }
public void RemoveNode(TreeDataNode node) { if (_children.Contains(node)) { _children.Remove(node); node._parent = null; } }
public override int GetChildrenCount(NSOutlineView outlineView, NSObject item) { if (item is TreeDataNode) { TreeDataNode nodeItem = item as TreeDataNode; return(nodeItem.Nodes.Count); } return(_nodes.Count); }
public override bool ItemExpandable(NSOutlineView outlineView, NSObject item) { TreeDataNode nodeItem = item as TreeDataNode; if (nodeItem != null) { return(nodeItem.HasChildren); } return(false); }
public override NSObject GetChild(NSOutlineView outlineView, int childIndex, NSObject ofItem) { TreeDataNode nodeItem = ofItem as TreeDataNode; if (nodeItem != null) { return(nodeItem.Nodes [childIndex]); } return(Nodes[childIndex]); }
public override NSObject GetObjectValue(NSOutlineView outlineView, NSTableColumn forTableColumn, NSObject byItem) { TreeDataNode nodeItem = byItem as TreeDataNode; if (nodeItem == null) { return(null); } return((NSString)nodeItem.CombinedName); }
private void DeleteNode (TreeDataNode node) { if (node == null) return; if (!node.Data.CanDeleteNode) return; if (node.Data.DeleteNode()) { UpdateUI(node.Parent.Data); //UpdateNodeText(node.Parent); TreeDataNode parent = node.Parent; node.Remove(); _mainOutlineView.ReloadItem(parent, true); } }
private void RenameNode (TreeDataNode node) { if (node == null) return; if (!node.Data.CanRenameNode) return; if (node.Data.RenameNode()) { //node.Text = dataNode.NodeDisplay; UpdateUI(node.Data); } }
private void EditNode (TreeDataNode node) { if (node == null) return; if (!node.Data.CanEditNode) return; if (node.Data.EditNode()) { //node.Text = node.Data.NodeDisplay; UpdateUI(node.Data); } }
private void PasteNode (TreeDataNode node) { if (node == null) return; if (!node.Data.CanPasteIntoNode) return; if (node.Data.PasteNode()) { //node.Text = dataNode.NodeDisplay; RefreshChildNodes(node, node.Data); UpdateUI(node.Data); } }
private void CutNode (TreeDataNode node) { if (node == null) return; if (!node.Data.CanCutNode) return; if (node.Data.CutNode()) { TreeDataNode parent = node.Parent; UpdateUI(parent.Data); node.Remove(); _mainOutlineView.ReloadItem(parent, true); } }
public void AddNode (TreeDataNode node) { node._parent = this; _children.Add(node); }
private void RefreshChildNodes (TreeDataNode node, DataNode dataNode) { Dictionary<DataNode, TreeDataNode> currentNodes = new Dictionary<DataNode, TreeDataNode>(); foreach (TreeDataNode child in node.Nodes) { currentNodes.Add(child.Data, child); } node.Nodes.Clear(); foreach (DataNode child in dataNode.Nodes) { if (!currentNodes.ContainsKey(child)) node.Nodes.Add(new TreeDataNode(child)); else node.Nodes.Add(currentNodes[child]); } //foreach (TreeDataNode child in node.Nodes) // child.ContextMenuStrip = BuildNodeContextMenu(child.Tag as DataNode); if (node.Nodes.Count == 0 && dataNode.HasUnexpandedChildren) { ExpandNode(node); _mainOutlineView.ExpandItem(node); //node.Expand(); } _mainOutlineView.ReloadItem(node, true); }
private void CollapseNode (TreeDataNode node) { if (node == null || !node.IsExpanded) return; //Console.WriteLine("Collapse Node: " + node.Data.NodeDisplay); DataNode backNode = node.Data; if (backNode.IsModified) return; backNode.Collapse(); node.IsExpanded = false; node.Nodes.Clear(); }
private void ExpandNode (TreeDataNode node) { if (node == null || node.IsExpanded) return; //Console.WriteLine ("Expand Node: " + node.Data.NodeDisplay); node.IsExpanded = true; node.Nodes.Clear (); DataNode backNode = node.Data; if (!backNode.IsExpanded) { backNode.Expand (); } foreach (DataNode child in backNode.Nodes) { if (child != null) { node.AddNode (new TreeDataNode (child)); } } }
private void MoveNodeDown (TreeDataNode node) { if (node == null) return; if (!node.Data.CanMoveNodeDown) return; node.Data.ChangeRelativePosition(1); RefreshChildNodes(node.Parent, node.Data.Parent); }
private void SearchNode (TreeDataNode node) { if (node == null) return; if (!node.Data.CanSearchNode) return; FindWindowController form = new FindWindowController(); if (RunWindow (form) != ModalResult.OK) return; _searchState = new SearchStateMac(this) { RootNode = node.Data, SearchName = form.NameToken, SearchValue = form.ValueToken, DiscoverCallback = SearchDiscoveryCallback, CollapseCallback = SearchCollapseCallback, EndCallback = SearchEndCallback, }; SearchNextNode(); }
private void CreateNode (TreeDataNode node, TagType type) { if (node == null) return; if (!node.Data.CanCreateTag(type)) return; if (node.Data.CreateNode(type)) { //node.Text = dataNode.NodeDisplay; RefreshChildNodes(node, node.Data); UpdateUI(node.Data); } }
private void CopyNode (TreeDataNode node) { if (node == null) return; if (!node.Data.CanCopyNode) return; node.Data.CopyNode(); }
public void AddNode(TreeDataNode node) { node._parent = this; _children.Add(node); }