Exemple #1
0
        public DataScopeRulesDrawing(
            IDebugDrawing drawing,
            DrawingElement page,
            DebugDataScopeRules debugDataScope,
            int headingLevel,
            bool showButtons,
            int depth)
            : base(
                page,
                debugDataScope.Name,
                headingLevel)
        {
            CssClass = "data-scope";

            var details = new List <string>();

            AddDebugInfo(details, debugDataScope);

            if (details.Count > 0)
            {
                if (showButtons)
                {
                    AddDetails(details, AddHeaderButton(page, "Detail"));
                }
                else
                {
                    AddDetails(details, this);
                }
            }

            if (!ReferenceEquals(debugDataScope.Scopes, null) && debugDataScope.Scopes.Count > 0)
            {
                var scopeList = new TitledListDrawing(
                    "Data scopes",
                    debugDataScope.Scopes.Select(s => s.ToString().InitialCaps()));
                AddChild(scopeList);
            }

            if (!ReferenceEquals(debugDataScope.DataSupplies, null) && debugDataScope.DataSupplies.Count > 0)
            {
                AddChild(new TextDrawing
                {
                    CssClass = "h3",
                    Text     = new[] { "Data supplied" }
                });

                foreach (var supply in debugDataScope.DataSupplies)
                {
                    AddChild(new SuppliedDependencyDrawing(supply));
                }
            }

            if (depth != 0 && debugDataScope.Children != null && debugDataScope.Children.Count > 0)
            {
                foreach (var child in debugDataScope.Children)
                {
                    if (child.HasData())
                    {
                        var childDrawing = new DataScopeRulesDrawing(
                            drawing,
                            page,
                            child as DebugDataScopeRules,
                            headingLevel,
                            showButtons,
                            depth - 1);
                        AddChild(childDrawing);
                    }
                }
            }
        }
        public RegionDrawing(
            IDebugDrawing drawing,
            DrawingElement page,
            DebugRegion debugRegion,
            int headingLevel,
            bool showButtons)
            : base(
                page,
                "zone '" + debugRegion.Name + "'",
                headingLevel)
        {
            CssClass = "region";

            string repeat = null;

            if (!ReferenceEquals(debugRegion.RepeatType, null))
            {
                repeat = debugRegion.RepeatType.DisplayName(TypeExtensions.NamespaceOption.None);

                if (!string.IsNullOrEmpty(debugRegion.RepeatScope))
                {
                    repeat = "'" + debugRegion.RepeatScope + "' " + repeat;
                }

                if (!string.IsNullOrEmpty(debugRegion.ListScope))
                {
                    repeat += " from a list in '" + debugRegion.ListScope + "' scope";
                }

                repeat = "Repeat for each " + repeat;

                if (showButtons)
                {
                    AddChild(new TextDrawing {
                        Text = new[] { repeat }
                    });
                }
            }

            var details = new List <string>();

            if (!string.IsNullOrEmpty(repeat))
            {
                details.Add(repeat);
            }
            AddDebugInfo(details, debugRegion);

            if (details.Count > 0)
            {
                if (showButtons)
                {
                    AddDetails(details, AddHeaderButton(page, "Detail"));
                }
                else
                {
                    AddDetails(details, this);
                }
            }

            if (!ReferenceEquals(debugRegion.Scope, null) && debugRegion.Scope.HasData())
            {
                var dataScopeDrawing = new DataScopeRulesDrawing(
                    drawing,
                    page,
                    debugRegion.Scope,
                    headingLevel + 1,
                    false,
                    0);

                if (showButtons)
                {
                    AddHeaderButton(page, "Scope").AddChild(dataScopeDrawing);
                }
                else
                {
                    AddChild(dataScopeDrawing);
                }
            }

            if (!ReferenceEquals(debugRegion.DataContext, null) && debugRegion.DataContext.HasData())
            {
                var dataScopeDrawing = new DataScopeRulesDrawing(
                    drawing,
                    page,
                    debugRegion.DataContext,
                    headingLevel + 1,
                    false,
                    0);

                if (showButtons)
                {
                    AddHeaderButton(page, "Context").AddChild(dataScopeDrawing);
                }
                else
                {
                    AddChild(dataScopeDrawing);
                }
            }

            if (showButtons && !ReferenceEquals(debugRegion.Element, null))
            {
                var elementDebugInfo = debugRegion.Element.GetDebugInfo <DebugRegion>();
                if (elementDebugInfo != null && elementDebugInfo.HasData())
                {
                    AddHeaderButton(page, "Definition")
                    .AddChild(new RegionDrawing(
                                  drawing,
                                  page,
                                  elementDebugInfo,
                                  headingLevel + 1,
                                  false));
                }
            }

            if (debugRegion.Children != null &&
                debugRegion.Children.Count > 0 &&
                debugRegion.Children[0] != null &&
                debugRegion.Children[0].HasData())
            {
                var content = drawing.DrawDebugInfo(page, debugRegion.Children[0], headingLevel, showButtons);
                AddChild(content);
            }
        }