コード例 #1
0
 private void updateMappingInfo(DbTreeNode node)
 {
     if (node.metaObj.mappable)
     {
         // do sjizzle
     }
 }
コード例 #2
0
 private void updateNodes(DbTreeNode node, bool childnode)
 {
     foreach (DbTreeNode cNode in node.Nodes)
     {
         updateTreeNodes(cNode, true);
     }
 }
コード例 #3
0
        private void dbStructure_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            DbTreeNode node = e.Node as DbTreeNode;

            updateTreeNodes(node, false);
            dbStructure.Refresh();
        }
コード例 #4
0
ファイル: DbTreeNode.cs プロジェクト: sakwa-im/design-studio
        public string getFqn()
        {
            DbTreeNode dbNode = this;

            string name = "";

            while (dbNode != null)
            {
                if (dbNode.metaObj.mappable)
                {
                    name = dbNode.Text + "." + name;
                }
                dbNode = (dbNode.Parent as DbTreeNode);
            }
            name = name.TrimEnd(new char[] { '.', ' ' });
            return(name);
        }
コード例 #5
0
        private void updateTreeNodes(DbTreeNode node, bool childnode)
        {
            IPgDatabase db = PgDatabase.Interface;

            db.PgConnection = this.findConnection();

            if (node.Nodes.Count > 0)
            {
                if (!childnode)
                {
                    updateNodes(node, childnode);
                }
            }
            else
            {
                node.Nodes.AddRange(this.createNodesFromMetaObject(node.metaObj, childnode).ToArray());
            }
        }
コード例 #6
0
        private void dataGridView1_DragDrop(object sender, DragEventArgs e)
        {
            TreeNode[] nodes = getTreeNodesFromDragEventArgs(e);
            if (nodes.Length > 0)
            {
                foreach (TreeNode node in nodes)
                {
                    DbTreeNode dbNode = (node as DbTreeNode);

                    foreach (MetaInfoViewRow row in dbNode.metaObj.MetaInfo)
                    {
                        if (!this.bindingSoure1.Contains(row))
                        {
                            this.bindingSoure1.Add(row);
                        }
                    }
                }
            }
        }
コード例 #7
0
        private void tabPage1_DragDrop(object sender, DragEventArgs e)
        {
            TabPage tab = sender as TabPage;

            TreeNode[] nodes = getTreeNodesFromDragEventArgs(e);
            if (nodes.Length > 0)
            {
                foreach (TreeNode node in nodes)
                {
                    DbTreeNode dbNode = (node as DbTreeNode);

                    int   index = tab.Controls.Count + 1;
                    Label lbl   = new Label();
                    lbl.AutoSize = true;
                    lbl.Name     = string.Format("Label-{0}", index);
                    lbl.Text     = dbNode.getFqn();
                    lbl.Location = new Point(20, index * 20);

                    tab.Controls.Add(lbl);
                }
            }
        }
コード例 #8
0
        private void InitTree()
        {
            IPgDatabase db = PgDatabase.Interface;

            db.PgConnection = findConnection();

            if (!db.IsConnectionLife)
            {
                return;
            }

            IDataSourceMetadata meta = new SqlMetadataImpl(db);
            MetaObject          root = meta.GetRoot().First <MetaObject>();

            DbTreeNode rootNode = new DbTreeNode(root.type, root.value);

            rootNode.metaObj = root;
            this.updateTreeNodes(rootNode, true);
            this.addPanel();

            // foreach schema get tables.
            dbStructure.Nodes.Add(rootNode);
        }
コード例 #9
0
        private List <DbTreeNode> createNodesFromMetaObject(MetaObject metaObject, bool childnode)
        {
            List <DbTreeNode> Nodes = new List <DbTreeNode>();

            foreach (MetaObject mo in metaObject.children)
            {
                DbTreeNode cNode = new DbTreeNode(mo.type, mo.value);

                cNode.metaObj = mo;

                if (!childnode)
                {
                    foreach (MetaObject childMo in mo.children)
                    {
                        DbTreeNode gcNode = new DbTreeNode(childMo.type, childMo.value);
                        gcNode.metaObj = childMo;
                        cNode.Nodes.Add(gcNode);
                    }
                }
                Nodes.Add(cNode);
            }
            return(Nodes);
        }