public ModelTreeNode GetTreeView(TreeConfig treeConfig) { ModelTreeNode tn = new ModelTreeNode(getNodeName()); tn.NodeObject = this; return(tn); }
public ModelTreeNode GetTreeView(TreeConfig treeConfig) { ModelTreeNode n = new ModelTreeNode("Settings"); n.NodeObject = this; return(n); }
public void PerformContextAction(NodeElementContextAction actn, ModelTreeNode tn) { //throw new Exception("The method or operation is not implemented."); if (actn == NodeElementContextAction.Delete) { } }
public void PerformContextAction(NodeElementContextAction actn, ModelTreeNode tn) { if (actn == NodeElementContextAction.Delete) { foreach (RelationReference r in ChildRelations) { // remove all relations as this entity is going away ModelTreeNode top = (ModelTreeNode)tn.TreeView.TopNode.Parent; Model modl = (Model)top.NodeObject; modl.Relations.Remove(r.Relation); } ChildRelations = null; foreach (RelationReference p in ParentRelations) { // remove all relations as this entity is going away ModelTreeNode top = (ModelTreeNode)tn.TreeView.TopNode.Parent; Model modl = (Model)top.NodeObject; modl.Relations.Remove(p.Relation); } ParentRelations = null; ((ModelTreeNode)tn.Parent).NodeObject.PerformContextAction(actn, tn); } else if (actn == NodeElementContextAction.Add) { } }
public ModelTreeNode GetTreeView(TreeConfig treeConfig) { ModelTreeNode n = new ModelTreeNode("Project"); //n.NodeObject = this; n.Nodes.Add(Model.GetTreeView(treeConfig)); ModelTreeNode setns = Settings.GetTreeView(treeConfig); n.Nodes.Add(setns); return(n); }
public void PerformContextAction(NodeElementContextAction actn, ModelTreeNode tn) { if (actn == NodeElementContextAction.Delete) { Entity del = (Entity)tn.NodeObject; Remove(del); // remove item from memory tn.Parent.Nodes.Remove(tn); } else if (actn == NodeElementContextAction.Add) { Entity ne = new Entity(); ne.LogicalName = "New Entity"; ModelTreeNode mtn = new ModelTreeNode(ne.LogicalName); mtn.NodeObject = ne; tn.Parent.Nodes.Add(mtn); } }
/// <summary> /// Danger here as a recursive multi table loop will cause endless loop /// </summary> /// <param name="treeConfig"></param> /// <returns></returns> public ModelTreeNode GetTreeView(TreeConfig treeConfig) { ModelTreeNode tn = new ModelTreeNode(getNodeName()); if (treeConfig.ViewMode == TreeConfig.TreeViewMode.Heirarchical && ParentEntity.Entity.EntityID != ChildEntity.Entity.EntityID) { Entity chld = ChildEntity.Entity; tn.Nodes.Add(chld.GetTreeView(treeConfig)); // now cascade down the entity tree } else if (treeConfig.ViewMode == TreeConfig.TreeViewMode.Heirarchical && ParentEntity.Entity.EntityID != ChildEntity.Entity.EntityID) { ModelTreeNode self = new ModelTreeNode(ParentEntity.Entity.LogicalName); } tn.NodeObject = this; return(tn); }
public ModelTreeNode GetTreeView(TreeConfig treeConfig) { ModelTreeNode tn = new ModelTreeNode(getNodeName()); tn.NodeObject = this; // in Flat mode all entities are added to the root entity node // whereas in Heirarchical only the top entities are added to the top // the child relations then recurse down the tree adding the node as necessary if (treeConfig.ViewMode == TreeConfig.TreeViewMode.Flat) { ModelTreeNode tn0 = new ModelTreeNode("Parents"); tn.Nodes.Add(tn0); foreach (RelationReference rel in ParentRelations) { tn0.Nodes.Add(rel.Relation.GetTreeView(treeConfig)); } } ModelTreeNode tn1 = new ModelTreeNode("Children"); tn.Nodes.Add(tn1); // here in heirarchical mode // the Entity object must be searched for // and its GetTreeView called foreach (RelationReference rel in ChildRelations) { if (treeConfig.ViewMode == TreeConfig.TreeViewMode.Heirarchical && rel.Relation.Type.Usage == TypeUsage.Denormalization) { continue; } ModelTreeNode rNode = rel.Relation.GetTreeView(treeConfig); tn1.Nodes.Add(rNode); } ModelTreeNode tn2 = new ModelTreeNode("Fields"); foreach (Field fld in Fields) { tn2.Nodes.Add(fld.GetTreeView(treeConfig)); } tn.Nodes.Add(tn2); return(tn); }
public void PerformContextAction(NodeElementContextAction actn, ModelTreeNode tn) { throw new Exception("The method or operation is not implemented."); }
public ModelTreeNode GetTreeView(TreeConfig treeConfig) { List <Schemas> schems = new List <Schemas>(); ModelTreeNode tn = new ModelTreeNode("Model"); tn.NodeObject = this; foreach (Entity ent in _entityCollection) { Schemas sch = schems.Find(delegate(Schemas s) { return(s.SchemaName == ent.Schema); }); if (sch == null) { sch = new Schemas(); sch.SchemaName = ent.Schema; schems.Add(sch); } sch.Entities.Add(ent); } ModelTreeNode topNode; if (treeConfig.ProjectGrouping == TreeConfig.GroupBy.Schema) { topNode = new ModelTreeNode("Schemas"); topNode.NodeObject = EntityCollection; tn.Nodes.Add(topNode); } else { topNode = new ModelTreeNode("Entities"); topNode.NodeObject = EntityCollection; tn.Nodes.Add(topNode); } foreach (Schemas ss in schems) { ModelTreeNode tn1; if (treeConfig.ProjectGrouping == TreeConfig.GroupBy.Schema) { tn1 = new ModelTreeNode(ss.SchemaName); topNode.Nodes.Add(tn1); } else { tn1 = topNode; } foreach (Entity ent in ss.Entities) { if (treeConfig.ViewMode == TreeConfig.TreeViewMode.Flat || (treeConfig.ViewMode == TreeConfig.TreeViewMode.Heirarchical && (ent.ParentRelations.Count == 0 || ent.ParentRelations.Find(delegate(RelationReference r) { return(r.Relation.ParentEntity.Entity.LogicalName == ent.LogicalName); }) != null ))) { ModelTreeNode node = ent.GetTreeView(treeConfig); if (tn1.Nodes.Count == 0 || tn1.Nodes[0].Text.CompareTo(node.Text) > 0) { tn1.Nodes.Insert(0, node); } else if (tn1.Nodes[tn1.Nodes.Count - 1].Text.CompareTo(node.Text) < 0) { tn1.Nodes.Add(node); } else { // simple bubble sort as nodes are inserted for (int i = 0; i < tn1.Nodes.Count; i++) { if (tn1.Nodes[i].Text.CompareTo(node.Text) > 0) { tn1.Nodes.Insert(i, node); break; } } } } } } return(tn); }
public ModelTreeNode GetTreeView(TreeConfig treeConfig) { List<Schemas> schems = new List<Schemas>(); ModelTreeNode tn = new ModelTreeNode("Model"); tn.NodeObject = this; foreach (Entity ent in _entityCollection) { Schemas sch = schems.Find(delegate(Schemas s) { return s.SchemaName == ent.Schema; }); if (sch == null) { sch = new Schemas(); sch.SchemaName = ent.Schema; schems.Add(sch); } sch.Entities.Add(ent); } ModelTreeNode topNode; if (treeConfig.ProjectGrouping == TreeConfig.GroupBy.Schema) { topNode = new ModelTreeNode("Schemas"); topNode.NodeObject = EntityCollection; tn.Nodes.Add(topNode); } else { topNode = new ModelTreeNode("Entities"); topNode.NodeObject = EntityCollection; tn.Nodes.Add(topNode); } foreach (Schemas ss in schems) { ModelTreeNode tn1; if (treeConfig.ProjectGrouping == TreeConfig.GroupBy.Schema) { tn1 = new ModelTreeNode(ss.SchemaName); topNode.Nodes.Add(tn1); } else { tn1 = topNode; } foreach (Entity ent in ss.Entities) { if (treeConfig.ViewMode == TreeConfig.TreeViewMode.Flat || (treeConfig.ViewMode == TreeConfig.TreeViewMode.Heirarchical && (ent.ParentRelations.Count == 0 || ent.ParentRelations.Find(delegate(RelationReference r) { return r.Relation.ParentEntity.Entity.LogicalName == ent.LogicalName; }) != null ))) { ModelTreeNode node = ent.GetTreeView(treeConfig); if (tn1.Nodes.Count == 0 || tn1.Nodes[0].Text.CompareTo(node.Text) > 0) { tn1.Nodes.Insert(0, node); } else if (tn1.Nodes[tn1.Nodes.Count - 1].Text.CompareTo(node.Text) < 0) { tn1.Nodes.Add(node); } else { // simple bubble sort as nodes are inserted for (int i = 0; i < tn1.Nodes.Count; i++) { if (tn1.Nodes[i].Text.CompareTo(node.Text) > 0) { tn1.Nodes.Insert(i, node); break; } } } } } } return tn; }
public void PerformContextAction(NodeElementContextAction actn, ModelTreeNode tn) { Field fld = (Field)tn.NodeObject; tn.Parent.Nodes.Remove(tn); }
public ModelTreeNode GetTreeView(TreeConfig treeConfig) { ModelTreeNode tn = new ModelTreeNode(getNodeName()); tn.NodeObject = this; return tn; }
public ModelTreeNode GetTreeView(TreeConfig treeConfig) { ModelTreeNode tn = new ModelTreeNode(getNodeName()); tn.NodeObject = this; // in Flat mode all entities are added to the root entity node // whereas in Heirarchical only the top entities are added to the top // the child relations then recurse down the tree adding the node as necessary if (treeConfig.ViewMode == TreeConfig.TreeViewMode.Flat) { ModelTreeNode tn0 = new ModelTreeNode("Parents"); tn.Nodes.Add(tn0); foreach (RelationReference rel in ParentRelations) { tn0.Nodes.Add(rel.Relation.GetTreeView(treeConfig)); } } ModelTreeNode tn1 = new ModelTreeNode("Children"); tn.Nodes.Add(tn1); // here in heirarchical mode // the Entity object must be searched for // and its GetTreeView called foreach (RelationReference rel in ChildRelations) { if (treeConfig.ViewMode == TreeConfig.TreeViewMode.Heirarchical && rel.Relation.Type.Usage == TypeUsage.Denormalization) continue; ModelTreeNode rNode = rel.Relation.GetTreeView(treeConfig); tn1.Nodes.Add(rNode); } ModelTreeNode tn2 = new ModelTreeNode("Fields"); foreach (Field fld in Fields) { tn2.Nodes.Add(fld.GetTreeView(treeConfig)); } tn.Nodes.Add(tn2); return tn; }