Exemplo n.º 1
0
        private void SetAsCurrent(StaticEntityNode node)
        {
            node.Graph = this;
            var entity = node.Entity.Dereference(Registry);

            entity.EntityGroup = node.Graph.EntityGroupRef.Dereference(Registry);
        }
Exemplo n.º 2
0
 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);
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 private static void PopulateFromNode(StaticEntityNode node, List <UTinyEntity.Reference> list)
 {
     list.Add(node.Entity);
 }
Exemplo n.º 7
0
 private void StealFromGraph(List <StaticEntityNode> inspect, StaticEntityNode toRemove)
 {
     inspect.Remove(toRemove);
 }
Exemplo n.º 8
0
 public void Delete(StaticEntityNode node)
 {
     Assert.IsTrue(this == node.Graph);
     RemoveFromGraph(StaticEntities, node, true);
     Unregister(node);
 }
Exemplo n.º 9
0
 public void Add(StaticEntityNode node)
 {
     Insert(-1, node);
 }