private void updateMappingInfo(DbTreeNode node) { if (node.metaObj.mappable) { // do sjizzle } }
private void updateNodes(DbTreeNode node, bool childnode) { foreach (DbTreeNode cNode in node.Nodes) { updateTreeNodes(cNode, true); } }
private void dbStructure_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { DbTreeNode node = e.Node as DbTreeNode; updateTreeNodes(node, false); dbStructure.Refresh(); }
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); }
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()); } }
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); } } } } }
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); } } }
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); }
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); }