Example #1
0
 private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
 {
     if (IsPrototypeItem(e.Child, e.Parent))
     {
         ItemRemoved.Raise(this, new ItemRemovedEventArgs <object>(e.Index, e.Child, e.Parent));
     }
 }
Example #2
0
        protected virtual void OnDomNodeChildInserted(object sender, ChildEventArgs e)
        {
            if (!e.Child.Is <T>())
            {
                return;
            }

            var child = e.Child.As <T>();

            if (child != null)
            {
                bool expanded;
                if (m_dictSaveStates.TryGetValue(child.UniqueName, out expanded))
                {
                    child.Expanded = true;
                }
            }

            // Respect variable filtering
            if ((child != null) && !child.Visible)
            {
                return;
            }

            ItemInserted.Raise(
                this,
                new ItemInsertedEventArgs <object>(
                    e.Index,
                    e.Child.As <T>(),
                    e.Parent.As <T>()));
        }
Example #3
0
 private void docNode_ChildRemoved(object sender, ChildEventArgs e)
 {
     if (e.Child.Is <Group>())
     {
         CloseEditingContext(e.Child.As <CircuitEditingContext>());
     }
 }
Example #4
0
 private void DomNodeStructureChanged(object sender, ChildEventArgs e)
 {
     if (!m_updating && e.ChildInfo.Equivalent(Schema.prefabInstanceType.objectChild))
     {
         throw new InvalidTransactionException("Structure of PrefabInstance cannot be changesd");
     }
 }
Example #5
0
 private void DomNode_HierarchyChanged(object sender, ChildEventArgs e)
 {
     if (e.Child.Is <IControlPoint>())
     {
         ComputeTranslation();
     }
 }
Example #6
0
 private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
 {
     if (e.Parent == DomNode)
     {
         CheckScaleFlags();
     }
 }
        private void DomNode_ChildInserting(object sender, ChildEventArgs e)
        {
            // check pseudo-state constraints
            StateBase state = e.Child.As <StateBase>();

            if (state != null && state.IsPseudoState)
            {
                Statechart statechart = e.Parent.As <Statechart>();
                CheckUniqueness(statechart, state.Type);
            }
            else
            {
                // check state transition constraints
                Transition transition = e.Child.As <Transition>();
                if (transition != null)
                {
                    if (transition.FromState.IsPseudoState)
                    {
                        if (transition.FromState.Type == StateType.Final)
                        {
                            throw new InvalidTransactionException(
                                      "Can't have a transition from the final state".Localize());
                        }
                    }
                    if (transition.ToState.IsPseudoState)
                    {
                        if (transition.ToState.Type == StateType.Start)
                        {
                            throw new InvalidTransactionException(
                                      "Can't have a transition to the start state".Localize());
                        }
                    }
                }
            }
        }
Example #8
0
 private void DomNode_ChildInserted(object sender, ChildEventArgs e)
 {
     if (IsStatechartItem(e.Child, e.Parent))
     {
         ItemInserted.Raise(this, new ItemInsertedEventArgs <object>(e.Index, e.Child, e.Parent));
     }
 }
Example #9
0
 private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
 {
     if (IsTimelineItem(e.Child))
     {
         OnObjectRemoved(new ItemRemovedEventArgs <object>(e.Index, e.Child, e.Parent));
     }
 }
 private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
 {
     if (e.Child.Type == Schema.transitionType.Type)
     {
         m_routingInvalid = true;
     }
 }
Example #11
0
 private void DomNodeOnChildRemoving(object sender, ChildEventArgs e)
 {
     if (Validating)
     {
         // removing a module from a sub-circuit?
         Element    element    = e.Child.As <Element>();
         SubCircuit subCircuit = e.Parent.As <SubCircuit>();
         if (element != null &&
             subCircuit != null)
         {
             ICircuitElementType type = element.Type;
             // todo: this test isn't quite right, because not all circuit elements
             //  necessarily have both inputs and outputs. For example, if the Speaker
             //  element from the Circuit Editor sample app is the only element in a Master,
             //  and then it is deleted, that will trigger this exception.
             if (type.Inputs.Count + type.Outputs.Count == 1)
             {
                 // Ensures that sub-circuit inputs/outputs aren't added or removed, as this would
                 //    invalidate wiring on instances of them.
                 throw new InvalidTransactionException(
                           "Can't remove connectors from sub-circuits".Localize());
             }
         }
     }
 }
Example #12
0
 /// <summary>
 /// Performs custom actions after a child is removed from the DOM node subtree</summary>
 /// <param name="sender">Sender (root DOM node)</param>
 /// <param name="e">Child event args</param>
 protected override void OnChildRemoved(object sender, ChildEventArgs e)
 {
     RemoveSubtree(e.Child);
     if (!m_undoingOrRedoing && e.Child.Is <Wire>())
     {
         UpdateGroupPinConnectivity(e.Child.Cast <Wire>());
     }
 }
Example #13
0
 private void root_ChildRemoved(object sender, ChildEventArgs e)
 {
     if (m_lastRemoveIndex >= 0)
     {
         ItemRemoved.Raise(this, new ItemRemovedEventArgs <object>(m_lastRemoveIndex, e.Child, e.Parent));
         m_root.As <SceneDocument>().Dirty = true;
     }
 }
Example #14
0
        private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
        {
            Character character = e.Child.As <Character>();

            if (character != null)
            {
                ItemRemoved.Raise(this, new ItemRemovedEventArgs <object>(e.Index, character));
            }
        }
Example #15
0
        /// <summary>
        /// Raises the ChildRemoved event and performs custom processing</summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">ChildEventArgs containing event data</param>
        protected override void OnChildRemoved(object sender, ChildEventArgs e)
        {
            if (Validating)
            {
                m_layoutInvalid = true;
            }

            base.OnChildRemoved(sender, e);
        }
Example #16
0
        private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
        {
            Resource resource = e.Child.As <Resource>();

            if (resource != null)
            {
                ItemRemoved.Raise(this, new ItemRemovedEventArgs <object>(e.Index, resource));
            }
        }
Example #17
0
        public void TestChildRemoveEvents()
        {
            DomNodeType type     = new DomNodeType("type");
            ChildInfo   info     = new ChildInfo("child", type);
            ChildInfo   infoList = new ChildInfo("childList", type, true);

            type.Define(info);
            type.Define(infoList);
            DomNode test = new DomNode(type);

            test.ChildRemoving += new EventHandler <ChildEventArgs>(test_ChildRemoving);
            test.ChildRemoved  += new EventHandler <ChildEventArgs>(test_ChildRemoved);

            // test child
            DomNode child = new DomNode(type);

            test.SetChild(info, child);
            ChildRemovingArgs = null;
            ChildRemovedArgs  = null;
            test.SetChild(info, null);
            ChildEventArgs expected = new ChildEventArgs(test, info, child, 0);

            Assert.True(Equals(ChildRemovingArgs, expected));
            Assert.True(Equals(ChildRemovedArgs, expected));

            // test inserting a child when there is one there already
            test.SetChild(info, child);
            DomNode newChild = new DomNode(type);

            ChildRemovingArgs = null;
            ChildRemovedArgs  = null;
            test.SetChild(info, newChild);
            expected = new ChildEventArgs(test, info, child, 0);
            Assert.True(Equals(ChildRemovingArgs, expected));
            Assert.True(Equals(ChildRemovedArgs, expected));

            // test child list
            IList <DomNode> list   = test.GetChildList(infoList);
            DomNode         child2 = new DomNode(type);

            list.Add(child2);
            DomNode child3 = new DomNode(type);

            list.Add(child3);
            ChildRemovingArgs = null;
            ChildRemovedArgs  = null;
            list.Remove(child3);
            expected = new ChildEventArgs(test, infoList, child3, 1);
            Assert.True(Equals(ChildRemovingArgs, expected));
            Assert.True(Equals(ChildRemovedArgs, expected));
            ChildRemovingArgs = null;
            ChildRemovedArgs  = null;
            list.Remove(child2);
            expected = new ChildEventArgs(test, infoList, child2, 0);
            Assert.True(Equals(ChildRemovingArgs, expected));
            Assert.True(Equals(ChildRemovedArgs, expected));
        }
Example #18
0
        private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
        {
            Event _event = e.Child.As <Event>();

            if (_event != null)
            {
                ItemRemoved.Raise(this, new ItemRemovedEventArgs <object>(e.Index, _event));
            }
        }
Example #19
0
        private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
        {
            Dirty = true;
            IReference <IGameDocument> gameRef = e.Child.As <IReference <IGameDocument> >();

            if (gameRef != null)
            {
                m_gameDocumentRegistry.Remove(gameRef.Target);
            }
        }
Example #20
0
        /// <summary>
        /// Performs custom actions after a child is inserted into the DOM subtree</summary>
        /// <param name="sender">Sender (root DOM node)</param>
        /// <param name="e">Child event args</param>
        protected override void OnChildInserted(object sender, ChildEventArgs e)
        {
            // if it's a ref, make sure the referenced resource is in this package
            UIRef uiRef = e.Child.As <UIRef>();

            if (uiRef != null)
            {
                m_referenceInserts.Add(e);
            }
        }
Example #21
0
        private void root_ChildInserted(object sender, ChildEventArgs e)
        {
            int index = GetChildIndex(e.Child, e.Parent);

            if (index >= 0)
            {
                ItemInserted.Raise(this, new ItemInsertedEventArgs <object>(index, e.Child, e.Parent));
                m_root.As <SceneDocument>().Dirty = true;
            }
        }
Example #22
0
        private void DomNodeChildRemoving(object sender, ChildEventArgs e)
        {
            if (!e.Child.Is <SledLuaStateType>())
            {
                return;
            }

            ItemRemoved.Raise(
                this,
                new ItemRemovedEventArgs <object>(e.Index, e.Child.As <SledLuaStateType>()));
        }
Example #23
0
        private void DomNodeChildInserted(object sender, ChildEventArgs e)
        {
            if (!e.Child.Is <SledCallStackType>())
            {
                return;
            }

            ItemInserted.Raise(
                this,
                new ItemInsertedEventArgs <object>(e.Index, e.Child.As <SledCallStackType>()));
        }
Example #24
0
        private void DomNode_ChildInserted(object sender, ChildEventArgs e)
        {
            Event _event = e.Child.As <Event>();

            if (_event != null)
            {
                ItemInserted.Raise(this, new ItemInsertedEventArgs <object>(e.Index, _event));
            }

            OnPropertyChanged();
        }
Example #25
0
        private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
        {
            Dirty = true;
#if DEBUG_VERBOSE
            if (e.Parent == DomNode)
            {
                Trace.TraceInformation("{0} --  Removed {1}  from parent {2}", CircuitUtil.GetDomNodeName(DomNode),
                                       CircuitUtil.GetDomNodeName(e.Child), CircuitUtil.GetDomNodeName(e.Parent));
            }
#endif
        }
Example #26
0
        private void DomNode_ChildInserted(object sender, ChildEventArgs e)
        {
            Resource resource = e.Child.As <Resource>();

            if (resource != null)
            {
                ItemInserted.Raise(this, new ItemInsertedEventArgs <object>(e.Index, resource));
            }

            OnPropertyChanged();
        }
Example #27
0
 private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
 {
     if (!IsHandledType(e.Child))
     {
         return;
     }
     ItemRemoved.Raise(this, new ItemRemovedEventArgs <object>(-1, e.Child, e.Parent));
     if (!IsMasterContext)
     {
         MasterContext.DomNode_ChildRemoved(sender, e);
     }
 }
Example #28
0
 public static bool Equals(ChildEventArgs e1, ChildEventArgs e2)
 {
     if (e1 == null || e2 == null)
     {
         return(e1 == e2);
     }
     return
         (e1.Parent == e2.Parent &&
          e1.ChildInfo == e2.ChildInfo &&
          e1.Child == e2.Child &&
          e1.Index == e2.Index);
 }
Example #29
0
        public void TestOnChildInserted()
        {
            DomNode   root      = new DomNode(m_rootType);
            Validator validator = root.As <Validator>();
            DomNode   child     = new DomNode(m_childType);

            root.SetChild(m_childInfo, child);
            Assert.AreSame(validator.Sender, root);
            ChildEventArgs e = (ChildEventArgs)validator.E;

            Assert.NotNull(e);
            Assert.AreSame(e.Parent, root);
        }
Example #30
0
        protected virtual void OnDomNodeChildRemoving(object sender, ChildEventArgs e)
        {
            if (!e.Child.Is <T>())
            {
                return;
            }

            ItemRemoved.Raise(
                this,
                new ItemRemovedEventArgs <object>(
                    e.Index,
                    e.Child.As <T>(),
                    e.Parent.As <T>()));
        }
Example #31
0
 private void DomNode_ChildRemoved(object sender, ChildEventArgs e)
 {
     RemoveSubtree(e.Child);
     OnChildRemoved(sender, e);
 }
Example #32
0
 private void DomNode_ChildInserted(object sender, ChildEventArgs e)
 {
     AddSubtree(e.Child);
     OnChildInserted(sender, e);
 }
Example #33
0
 /// <summary>
 /// Performs custom actions after a child is removed from the DOM subtree</summary>
 /// <param name="sender">Sender (root DOM node)</param>
 /// <param name="e">Child event args</param>
 protected virtual void OnChildRemoved(object sender, ChildEventArgs e)
 {
 }
Example #34
0
 /// <summary>
 /// Performs custom actions after a child is inserted into the DOM subtree</summary>
 /// <param name="sender">Sender (root DOM node)</param>
 /// <param name="e">Child event args</param>
 protected virtual void OnChildInserted(object sender, ChildEventArgs e)
 {
 }