示例#1
0
        private void ValuePushed(object sender, NodeControlValueEventArgs e)
        {
            if (e.Node != null && e.Node.Tag != null)
            {
                GrtListNode node = e.Node.Tag as GrtListNode;

                if (node != null)
                {
                    foreach (ColumnContent column in columns)
                    {
                        if (sender == column.control)
                        {
                            NodeTextBox tnode = column.control as NodeTextBox;

                            grtList.set_convert_field(node.NodeId, column.index, e.Value as String);
                            break;
                        }
                    }

                    // save selcted node
                    int selected = -1;
                    if (node != null && treeView.SelectedNode != null)
                    {
                        selected = treeView.SelectedNode.Index;
                    }

                    RefreshModel();

                    if (selected >= 0)
                    {
                        treeView.SelectedNode = treeView.Root.Children[selected];
                    }
                }
            }
        }
        public String GetRowAsText(TreeNodeAdv treeNode)
        {
            string rowText = "";

            if (treeNode != null && treeNode.Tag != null)
            {
                GrtListNode node = treeNode.Tag as GrtListNode;

                if (node != null)
                {
                    foreach (ColumnContent column in columns)
                    {
                        string caption;

                        model.get_field(node.NodeId, column.index, out caption);

                        if (rowText.Equals(""))
                        {
                            rowText = caption;
                        }
                        else
                        {
                            rowText += " | " + caption;
                        }
                    }
                }
            }

            return(rowText);
        }
        void contextMenuItem_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.ToolStripMenuItem mitem = sender as System.Windows.Forms.ToolStripMenuItem;

            List <NodeIdWrapper> selection = new List <NodeIdWrapper>();

            foreach (TreeNodeAdv node in treeView.SelectedNodes)
            {
                GrtListNode listNode = node.Tag as GrtListNode;
                if (listNode.IsValid)
                {
                    selection.Add(listNode.NodeId);
                }
            }

            grtList.activate_popup_item_for_nodes(mitem.Name, selection);
        }
        /// <summary>
        /// Event handler that gets the icon for the node
        /// </summary>
        /// <param name="sender">The object triggering the event</param>
        /// <param name="e">The event parameter</param>
        private void IconNeeded(object sender, NodeControlValueEventArgs e)
        {
            if (e.Node != null && e.Node.Tag != null)
            {
                // Use the GRT Icon manager to get the correct icon
                GrtListNode node = e.Node.Tag as GrtListNode;

                if (node != null)
                {
                    int   iconId = GrtList.get_field_icon(node.NodeId, 0, IconSize.Icon16);
                    Image icon   = IconManagerWrapper.get_instance().get_icon(iconId);

                    if (icon != null)
                    {
                        e.Value = icon;
                    }
                }
            }
        }
        void ContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = false;

            System.Windows.Forms.ContextMenuStrip menu = sender as System.Windows.Forms.ContextMenuStrip;

            menu.SuspendLayout();

            // repopulate the context menu with stuff provided by the backend
            menu.Items.Clear();

            List <NodeIdWrapper> selection = new List <NodeIdWrapper>();

            foreach (TreeNodeAdv node in treeView.SelectedNodes)
            {
                GrtListNode listNode = node.Tag as GrtListNode;
                selection.Add(listNode.NodeId);
            }

            List <MySQL.Base.MenuItem> items = grtList.get_popup_items_for_nodes(selection);

            foreach (MySQL.Base.MenuItem item in items)
            {
                if (item.get_type() == MySQL.Base.MenuItemType.MenuSeparator)
                {
                    menu.Items.Add(new System.Windows.Forms.ToolStripSeparator());
                }
                else
                {
                    System.Windows.Forms.ToolStripMenuItem mitem = new System.Windows.Forms.ToolStripMenuItem();

                    mitem.Name    = item.getInternalName();
                    mitem.Size    = new System.Drawing.Size(203, 22);
                    mitem.Text    = item.get_caption();
                    mitem.Enabled = item.get_enabled();
                    mitem.Click  += new EventHandler(contextMenuItem_Click);
                    menu.Items.Add(mitem);
                }
            }

            menu.ResumeLayout();
        }
示例#6
0
        public string  GetToolTip(TreeNodeAdv node, NodeControl nodeControl)
        {
            if (node != null && node.Tag != null)
            {
                GrtListNode lnode = node.Tag as GrtListNode;
                int         c     = 0;

                foreach (ColumnContent column in columns)
                {
                    if (column.control == nodeControl)
                    {
                        c = column.index;
                        break;
                    }
                }

                return(grtList.get_field_description(lnode.NodeId, c));
            }
            return("");
        }
示例#7
0
        /// <summary>
        /// Returns a node list of all child nodes of a given parent node
        /// </summary>
        /// <param name="treePath">The path of the parent node</param>
        /// <returns>The list of child nodes for the given parent path node</returns>
        public override System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            //List<GrtListNode> items = new List<GrtListNode>();

            // Get count but add the additional row for new columns
            int count = grtList.count();

            for (int i = 0; i < count; i++)
            {
                NodeIdWrapper nodeId = grtList.get_node(i);
                GrtListNode   node;
                string        caption;

                grtList.get_field(nodeId, columns[0].index, out caption);

                node = new GrtListNode(caption, nodeId, null, this);

                yield return(node);
            }
        }
示例#8
0
        /// <summary>
        /// Event handler that gets the caption for the value column
        /// </summary>
        /// <param name="sender">The object triggering the event</param>
        /// <param name="e">The event parameter</param>
        private void ValueNeeded(object sender, NodeControlValueEventArgs e)
        {
            if (e.Node != null && e.Node.Tag != null)
            {
                GrtListNode node = e.Node.Tag as GrtListNode;

                if (node != null)
                {
                    foreach (ColumnContent column in columns)
                    {
                        if (sender == column.control)
                        {
                            string caption;

                            grtList.get_field(node.NodeId, column.index, out caption);

                            e.Value = caption;
                            break;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Returns a node list of all child nodes of a given parent node
        /// </summary>
        /// <param name="treePath">The path of the parent node</param>
        /// <returns>The list of child nodes for the given parent path node</returns>
        public override System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            List<GrtListNode> items = new List<GrtListNode>();

              int count = grtList.count();
              for (int i = 0; i < count; i++)
              {
            NodeIdWrapper nodeId = grtList.get_node(i);
            GrtListNode node;
            string caption;

            grtList.get_field(nodeId, 0, out caption);

            node = new GrtListNode(caption, nodeId, null, this);

            items.Add(node);
              }
              return items;
        }
        /// <summary>
        /// Returns a node list of all child nodes of a given parent node
        /// </summary>
        /// <param name="treePath">The path of the parent node</param>
        /// <returns>The list of child nodes for the given parent path node</returns>
        public override System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            //List<GrtListNode> items = new List<GrtListNode>();

              // Get count but add the additional row for new columns
              int count = grtList.count();
              for (int i = 0; i < count; i++)
              {
            NodeIdWrapper nodeId = grtList.get_node(i);
            GrtListNode node;
            string caption;

            grtList.get_field(nodeId, columns[0].index, out caption);

            node = new GrtListNode(caption, nodeId, null, this);

            yield return node;
              }
        }