Ejemplo n.º 1
0
 /// <summary>
 /// Performs custom actions for a node that has been removed from the DOM subtree</summary>
 /// <param name="node">Removed node</param>
 protected override void RemoveNode(DomNode node)
 {
     foreach (IHistoryContext context in node.AsAll <IHistoryContext>())
     {
         context.DirtyChanged -= History_DirtyChanged;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Performs custom actions for a node that has been removed from the DOM node subtree</summary>
 /// <param name="node">Removed node</param>
 protected override void RemoveNode(DomNode node)
 {
     foreach (HistoryContext historyContext in node.AsAll <HistoryContext>())
     {
         m_historyContexts.Remove(historyContext);
     }
     base.RemoveNode(node);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Performs custom actions for a node that has been added to the DOM subtree</summary>
 /// <param name="node">Added node</param>
 /// <remarks>Method overrides must call the base method.</remarks>
 protected override void AddNode(DomNode node)
 {
     foreach (IValidationContext validationContext in node.AsAll <IValidationContext>())
     {
         validationContext.Beginning += validationContext_Beginning;
         validationContext.Ending    += validationContext_Ending;
         validationContext.Ended     += validationContext_Ended;
         validationContext.Cancelled += validationContext_Cancelled;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Performs custom actions for a node that has been added to the DOM subtree</summary>
 /// <param name="node">Added node</param>
 protected override void AddNode(DomNode node)
 {
     // route all other histories into the global one
     foreach (HistoryContext historyContext in node.AsAll<HistoryContext>())
         if (historyContext != m_historyContext)
         {
             m_childHistoryContexts.Add(historyContext);
             historyContext.History = m_historyContext.History;
         }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Performs custom actions for a node that has been removed from the DOM subtree</summary>
 /// <param name="node">Removed node</param>
 protected override void RemoveNode(DomNode node)
 {
     // route all other histories back into a local history
     foreach (HistoryContext historyContext in node.AsAll<HistoryContext>())
         if (historyContext != m_historyContext)
         {
             m_childHistoryContexts.Remove(historyContext);
             historyContext.History = new CommandHistory();
         }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Performs custom actions for a node that has been added to the DOM node subtree</summary>
        /// <param name="node">Added node</param>
        protected override void AddNode(DomNode node)
        {
            foreach (HistoryContext historyContext in node.AsAll<HistoryContext>())
            {
                // Disable automatically combining attribute setting operations, as operations such as grouping pin index changes better run its course   
                historyContext.PendingSetOperationLifetime = TimeSpan.Zero;
                m_historyContexts.Add(historyContext);
            }

            base.AddNode(node);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Performs custom actions for a node that has been added to the DOM node subtree</summary>
        /// <param name="node">Added node</param>
        protected override void AddNode(DomNode node)
        {
            foreach (HistoryContext historyContext in node.AsAll <HistoryContext>())
            {
                // Disable automatically combining attribute setting operations, as operations such as grouping pin index changes better run its course
                historyContext.PendingSetOperationLifetime = TimeSpan.Zero;
                m_historyContexts.Add(historyContext);
            }

            base.AddNode(node);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Performs custom actions for a node that has been added to the DOM subtree</summary>
 /// <param name="node">Added node</param>
 protected override void AddNode(DomNode node)
 {
     // route all other histories into the global one
     foreach (HistoryContext historyContext in node.AsAll <HistoryContext>())
     {
         if (historyContext != m_historyContext)
         {
             m_childHistoryContexts.Add(historyContext);
             historyContext.History = m_historyContext.History;
         }
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Performs custom actions for a node that has been removed from the DOM subtree</summary>
 /// <param name="node">Removed node</param>
 protected override void RemoveNode(DomNode node)
 {
     // route all other histories back into a local history
     foreach (HistoryContext historyContext in node.AsAll <HistoryContext>())
     {
         if (historyContext != m_historyContext)
         {
             m_childHistoryContexts.Remove(historyContext);
             historyContext.History = new CommandHistory();
         }
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Performs custom actions for a node that has been added to the DOM node subtree</summary>
        /// <param name="node">Added node</param>
        protected override void AddNode(DomNode node)
        {
            foreach (HistoryContext historyContext in node.AsAll<HistoryContext>())
            {
                //Alan: re-enabled historyContext's merge feature.
                //      It was disabled with the below with comment. 
                //      But from the commit comment it seems that the feature was
                //      disabled because of some functional test failure in a particular ATF base tool (creature editor).
                //      
                // Disable automatically combining attribute setting operations, as operations such as grouping pin index changes better run its course   
                //historyContext.PendingSetOperationLifetime = TimeSpan.Zero;
                m_historyContexts.Add(historyContext);
            }

            base.AddNode(node);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Performs custom actions for a node that has been added to the DOM node subtree</summary>
        /// <param name="node">Added node</param>
        protected override void AddNode(DomNode node)
        {
            foreach (HistoryContext historyContext in node.AsAll <HistoryContext>())
            {
                //Alan: re-enabled historyContext's merge feature.
                //      It was disabled with the below with comment.
                //      But from the commit comment it seems that the feature was
                //      disabled because of some functional test failure in a particular ATF base tool (creature editor).
                //
                // Disable automatically combining attribute setting operations, as operations such as grouping pin index changes better run its course
                //historyContext.PendingSetOperationLifetime = TimeSpan.Zero;
                m_historyContexts.Add(historyContext);
            }

            base.AddNode(node);
        }
Ejemplo n.º 12
0
        public void TestDerivedDomNodeAdapters()
        {
            var baseType = new DomNodeType("baseType");

            baseType.Define(new ExtensionInfo <SimpleAdapter>());

            var derivedType = new DomNodeType("derivedType", baseType);

            derivedType.Define(new ExtensionInfo <DerivedAdapter>());

            var derivedNode         = new DomNode(derivedType);
            var derivedTypeAdapters = new List <DomNodeAdapter>(derivedNode.AsAll <DomNodeAdapter>());

            Assert.True(derivedTypeAdapters.Count == 2);
            Assert.True(ContainsExactType <SimpleAdapter>(derivedTypeAdapters));
            Assert.True(ContainsExactType <DerivedAdapter>(derivedTypeAdapters));
        }
Ejemplo n.º 13
0
        public void TestDuplicateExtensionInfo()
        {
            var ext1 = new ExtensionInfo <TestAdapter1>("foo");
            var ext2 = new ExtensionInfo <TestAdapter2>("foo");

            var domType = new DomNodeType(
                "test",
                null,
                EmptyEnumerable <AttributeInfo> .Instance,
                EmptyEnumerable <ChildInfo> .Instance,
                new ExtensionInfo[] { ext1, ext2 });

            var domNode = new DomNode(domType);

            object resultExt1 = domNode.GetExtension(ext1);
            object resultExt2 = domNode.GetExtension(ext2);

            Assert.IsTrue(resultExt1 is TestAdapter1);
            Assert.IsTrue(resultExt2 is TestAdapter2);

            object[] decorators = domNode.GetDecorators(typeof(object)).ToArray();
            Assert.IsTrue(
                decorators.Length == 2 &&
                decorators[0] == resultExt1 &&
                decorators[1] == resultExt2);

            DomNodeAdapter[] extensions = domNode.AsAll <DomNodeAdapter>().ToArray();
            Assert.IsTrue(
                extensions.Length == 2 &&
                extensions[0] == resultExt1 &&
                extensions[1] == resultExt2);

            // Searching by name is a problem, though. The search is ambiguous.
            // See tracker item for discussion: http://tracker.ship.scea.com/jira/browse/WWSATF-522
            Assert.Throws <InvalidOperationException>(() => domType.GetExtensionInfo("foo"));
        }
Ejemplo n.º 14
0
            public IEnumerable <object> GetChildren(object parent)
            {
                DomNode node = parent as DomNode;

                if (node != null)
                {
                    if (m_showAdapters)
                    {
                        // get all adapters, and wrap so that the TreeControlAdapter doesn't confuse
                        //  them with their parent DomNode; remember that the DomNode and its adapters
                        //  are logically Equal.
                        IEnumerable <DomNodeAdapter> adapters = node.AsAll <DomNodeAdapter>();
                        foreach (DomNodeAdapter adapter in adapters)
                        {
                            yield return(new Adapter(adapter));
                        }
                    }
                    // get child Dom objects
                    foreach (DomNode child in node.Children)
                    {
                        yield return(child);
                    }
                }
            }
Ejemplo n.º 15
0
 /// <summary>
 /// Performs custom actions for a node that has been removed from the DOM node subtree</summary>
 /// <param name="node">Removed node</param>
 protected override void RemoveNode(DomNode node)
 {
     foreach (HistoryContext historyContext in node.AsAll<HistoryContext>())
         m_historyContexts.Remove(historyContext);
     base.RemoveNode(node);        
 }
Ejemplo n.º 16
0
        public void TestDuplicateExtensionInfo()
        {
            var ext1 = new ExtensionInfo<TestAdapter1>("foo");
            var ext2 = new ExtensionInfo<TestAdapter2>("foo");

            var domType = new DomNodeType(
                "test",
                null,
                EmptyEnumerable<AttributeInfo>.Instance,
                EmptyEnumerable<ChildInfo>.Instance,
                new ExtensionInfo[] { ext1, ext2 });

            var domNode = new DomNode(domType);

            object resultExt1 = domNode.GetExtension(ext1);
            object resultExt2 = domNode.GetExtension(ext2);

            Assert.IsTrue(resultExt1 is TestAdapter1);
            Assert.IsTrue(resultExt2 is TestAdapter2);

            object[] decorators = domNode.GetDecorators(typeof(object)).ToArray();
            Assert.IsTrue(
                decorators.Length == 2 &&
                decorators[0] == resultExt1 &&
                decorators[1] == resultExt2);

            DomNodeAdapter[] extensions = domNode.AsAll<DomNodeAdapter>().ToArray();
            Assert.IsTrue(
                extensions.Length == 2 &&
                extensions[0] == resultExt1 &&
                extensions[1] == resultExt2);

            // Searching by name is a problem, though. The search is ambiguous.
            // See tracker item for discussion: http://tracker.ship.scea.com/jira/browse/WWSATF-522
            Assert.Throws<InvalidOperationException>(() => domType.GetExtensionInfo("foo"));
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Performs custom actions for a node that has been added to the DOM subtree</summary>
 /// <param name="node">Added node</param>
 /// <remarks>Method overrides must call the base method.</remarks>
 protected override void AddNode(DomNode node)
 {
     foreach (IValidationContext validationContext in node.AsAll<IValidationContext>())
     {
         validationContext.Beginning += validationContext_Beginning;
         validationContext.Ending += validationContext_Ending;
         validationContext.Ended += validationContext_Ended;
         validationContext.Cancelled += validationContext_Cancelled;
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Performs custom actions for a node that has been removed from the DOM subtree</summary>
 /// <param name="node">Removed node</param>
 protected override void RemoveNode(DomNode node)
 {
     foreach (IHistoryContext context in node.AsAll<IHistoryContext>())
         context.DirtyChanged -= History_DirtyChanged;
 }