private void SetAsCurrent(StaticEntityNode node) { node.Graph = this; var entity = node.Entity.Dereference(Registry); entity.EntityGroup = node.Graph.EntityGroupRef.Dereference(Registry); }
private void RemoveFromGraph(List <StaticEntityNode> inspect, StaticEntityNode toRemove, bool unlink = false) { if (inspect.Remove(toRemove)) { if (unlink) { DeleteLink(toRemove.Entity.Dereference(Registry)); } } }
private void BuildFromNode(StaticEntityNode node, HierarchyTreeItemBase parentItem) { var entity = node.Entity.Dereference(m_Context.Registry); if (entity.Name.IndexOf(FilterString, StringComparison.OrdinalIgnoreCase) < 0) { return; } var item = new HierarchyStaticEntity { Value = node, id = GetInstanceId(node), depth = parentItem.depth + 1, displayName = entity.Name }; parentItem.AddChild(item); }
public void Insert(int siblingIndex, StaticEntityNode node) { if (this != node.Graph) { // Remove from old Graph node.Graph.RemoveFromGraph(node.Graph.StaticEntities, node); SetAsCurrent(node); } StaticEntities.Remove(node); if (siblingIndex < 0 || siblingIndex >= StaticEntities.Count) { StaticEntities.Add(node); } else { StaticEntities.Insert(siblingIndex, node); } }
public IEntityNode CreateStatic() { var entity = Registry.CreateEntity(new UTinyId(System.Guid.NewGuid()), GetUniqueName(StaticEntities.Select(e => e.Entity), "Entity")); var entityRef = (UTinyEntity.Reference)entity; CreateLink(entity); var entityGroup = EntityGroupRef.Dereference(Registry); Assert.IsNotNull(entityGroup); entityGroup.AddEntityReference(entityRef); var node = new StaticEntityNode { Entity = entityRef, Graph = this }; node.Graph.Add(node); return(node); }
private static void PopulateFromNode(StaticEntityNode node, List <UTinyEntity.Reference> list) { list.Add(node.Entity); }
private void StealFromGraph(List <StaticEntityNode> inspect, StaticEntityNode toRemove) { inspect.Remove(toRemove); }
public void Delete(StaticEntityNode node) { Assert.IsTrue(this == node.Graph); RemoveFromGraph(StaticEntities, node, true); Unregister(node); }
public void Add(StaticEntityNode node) { Insert(-1, node); }