Exemplo n.º 1
0
        // intIndex is the index into the intermediate node types
        // to consider user for adding this node
        protected void AddLogicalNode(IBrowserNode child, int intIndex)
        {
            BrowserTreeNode childNode = (BrowserTreeNode)child;

            // See if we have an intermediate node type
            if (childNode._intermediateNodeTypes != null &&
                intIndex < childNode._intermediateNodeTypes.Count)
            {
                AddChildToIntermediate(childNode,
                                       (IntermediateNodeType)childNode.
                                       _intermediateNodeTypes[intIndex],
                                       intIndex);
            }
            else
            {
                ((TreeListView)TreeView).Add(Nodes, childNode);
            }

            // Update the logical tree only when the child is
            // added to the first level intermediate node
            if (intIndex == 0)
            {
                childNode._logicalParent = this;
                _logicalNodes.Add(childNode);
                childNode.AddedToTree();
            }
        }
 // Returns false if something went wrong
 public override bool Paste(IBrowserNode node, bool isCopy)
 {
     try {
         // Save the object, cuz it may get removed if this is a cut
         Object cutCopyObj = ((ObjectTreeNode)node).Obj;
         // First, remove the old object from its parent.  This is
         // necessary to handle things like moving controls; they
         // will be upset if they are added to another node without
         // first removing them from the previous one.
         if (!isCopy)
         {
             node.RemoveLogicalNode();
         }
         if (AddObject(cutCopyObj) == null)
         {
             return(false);
         }
     } catch (Exception ex) {
         ErrorDialog.Show(ex,
                          "Exception during paste",
                          MessageBoxIcon.Error);
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
 protected override void OnBeforeExpand(TreeViewCancelEventArgs e)
 {
     if (e.Node is IBrowserNode)
     {
         try {
             IBrowserNode node = (IBrowserNode)e.Node;
             // Expansion could take a while
             Cursor save = Cursor.Current;
             Cursor.Current = Cursors.WaitCursor;
             // Allow the expansion to be cancelled
             // Do select processing on expansion as well
             //BeginUpdate();
             if (node.ExpandNode())
             {
                 e.Cancel = true;
             }
             //EndUpdate();
             Cursor.Current = save;
         } catch (Exception ex) {
             ErrorDialog.Show(ex,
                              "(this is a bug, please report) "
                              + "Exception on node expand",
                              MessageBoxIcon.Error);
         }
     }
     base.OnBeforeExpand(e);
 }
Exemplo n.º 4
0
 internal void TreeNodePopupPaste(object sender, EventArgs e)
 {
     ((IBrowserNode)SelectedNode).Paste(_cutCopyNode, _isCopy);
     if (!_isCopy)
     {
         _cutCopyNode = null;
     }
 }
Exemplo n.º 5
0
        internal void TreeNodePopupDelete(object sender, EventArgs e)
        {
            IBrowserNode node = (IBrowserNode)SelectedNode;

            if (node != null)
            {
                node.RemoveLogicalNode();
            }
        }
 /// <summary>
 /// Builds the root and first-level of the tree
 /// </summary>
 /// <param name="treeView"></param>
 /// <param name="dataRoot"></param>
 private void BuildTreeView(TreeView treeView, IBrowserNode dataRoot)
 {
     treeView.Nodes.Clear();
     if (dataRoot != null)
     {
         TreeNode treeRoot = new TreeNode(dataRoot.DisplayName);
         treeRoot.Tag = dataRoot;
         treeView.Nodes.Add(treeRoot);
         BuildNextTreeLevel(treeRoot);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Builds the root and first-level of the tree
 /// </summary>
 /// <param name="treeView"></param>
 /// <param name="dataRoot"></param>
 private void BuildTreeView(TreeView treeView, IBrowserNode dataRoot)
 {
     treeView.Nodes.Clear();
     if (dataRoot != null)
     {
         TreeNode treeRoot = new TreeNode(dataRoot.DisplayName);
         treeRoot.Tag = dataRoot;
         treeView.Nodes.Add(treeRoot);
         BuildNextTreeLevel(treeRoot);
     }
 }
        /// <summary>
        /// Called to build subsequent levels of the tree as they are expanded
        /// </summary>
        /// <param name="treeNode"></param>
        private void BuildNextTreeLevel(TreeNode treeNode)
        {
            IBrowserNode dataNode = (IBrowserNode)treeNode.Tag;

            foreach (IBrowserNode dataChild in dataNode.ChildNodes)
            {
                TreeNode treeChild = new TreeNode(dataChild.DisplayName);
                treeChild.Tag       = dataChild;
                treeChild.ForeColor = dataChild.Enabled ? treeNode.TreeView.ForeColor : Color.DimGray;
                treeNode.Nodes.Add(treeChild);
            }
        }
Exemplo n.º 9
0
 protected void AddChild(IBrowserNode child)
 {
     _childNodes.Add(child);
 }
Exemplo n.º 10
0
 internal void TreeNodePopupCopy(object sender, EventArgs e)
 {
     _cutCopyNode = (IBrowserNode)SelectedNode;
     _isCopy      = true;
 }
Exemplo n.º 11
0
		public virtual bool Paste(IBrowserNode node, bool isCopy)
		{
			throw new Exception("Paste not implemented");
		}
Exemplo n.º 12
0
		public void AddLogicalNode(IBrowserNode child)
		{
			AddLogicalNode(child, 0);
		}
Exemplo n.º 13
0
 public void AddLogicalNode(IBrowserNode child)
 {
     AddLogicalNode(child, 0);
 }
Exemplo n.º 14
0
 protected void AddChild(IBrowserNode child)
 {
     _childNodes.Add(child);
 }
Exemplo n.º 15
0
		internal void TreeNodePopupPaste(object sender, EventArgs e)
		{
			((IBrowserNode)SelectedNode).Paste(_cutCopyNode, _isCopy);
			if (!_isCopy)
				_cutCopyNode = null;
		}
Exemplo n.º 16
0
		internal void TreeNodePopupCopy(object sender, EventArgs e)
		{
			_cutCopyNode = (IBrowserNode)SelectedNode;
			_isCopy = true;
		}
Exemplo n.º 17
0
 public virtual bool Paste(IBrowserNode node, bool isCopy)
 {
     throw new Exception("Paste not implemented");
 }
Exemplo n.º 18
0
		// Returns false if something went wrong
		public override bool Paste(IBrowserNode node, bool isCopy)
		{
			try {
				// Save the object, cuz it may get removed if this is a cut
				Object cutCopyObj = ((ObjectTreeNode)node).Obj;
				// First, remove the old object from its parent.  This is
				// necessary to handle things like moving controls; they
				// will be upset if they are added to another node without
				// first removing them from the previous one.
				if (!isCopy)
					node.RemoveLogicalNode();
				if (AddObject(cutCopyObj) == null)
					return false;
			} catch (Exception ex) {
				ErrorDialog.Show(ex,
								"Exception during paste",
								MessageBoxIcon.Error);
				return false;
			}
			return true;
		}
Exemplo n.º 19
0
		// intIndex is the index into the intermediate node types
		// to consider user for adding this node
		protected void AddLogicalNode(IBrowserNode child, int intIndex)
		{
			BrowserTreeNode childNode = (BrowserTreeNode)child;
			// See if we have an intermediate node type
			if (childNode._intermediateNodeTypes != null &&
				intIndex < childNode._intermediateNodeTypes.Count) {
				AddChildToIntermediate(childNode,
									   (IntermediateNodeType)childNode.
									  _intermediateNodeTypes[intIndex],
									  intIndex);
			} else {
				((TreeListView)TreeView).Add(Nodes, childNode);
			}
			
			// Update the logical tree only when the child is 
			// added to the first level intermediate node
			if (intIndex == 0) {
				childNode._logicalParent = this;
				_logicalNodes.Add(childNode);
				childNode.AddedToTree();
			}
		}