protected static Element FactSetRender(AdaptiveFactSet factSet, ElementAdaptiveRenderContext context)
        {
            var uiFactSet = new List()
                            .AddClass($"ac-{factSet.Type.Replace(".", "").ToLower()}")
                            .Style("overflow", "hidden");

            foreach (var fact in factSet.Facts)
            {
                AdaptiveTextBlock factTitle = new AdaptiveTextBlock()
                {
                    Text     = fact.Title,
                    Size     = context.Config.FactSet.Title.Size,
                    Color    = context.Config.FactSet.Title.Color,
                    Weight   = context.Config.FactSet.Title.Weight,
                    IsSubtle = context.Config.FactSet.Title.IsSubtle,
                    Wrap     = context.Config.FactSet.Title.Wrap,
                    MaxWidth = context.Config.FactSet.Title.MaxWidth
                };
                var uiTitle = context.Render(factTitle)
                              .AddClass("ac-facttitle")
                              .Style("margin-right", $"{context.Config.FactSet.Spacing}px");

                AdaptiveTextBlock factValue = new AdaptiveTextBlock()
                {
                    Text     = fact.Value,
                    Size     = context.Config.FactSet.Value.Size,
                    Color    = context.Config.FactSet.Value.Color,
                    Weight   = context.Config.FactSet.Value.Weight,
                    IsSubtle = context.Config.FactSet.Value.IsSubtle,
                    Wrap     = context.Config.FactSet.Value.Wrap,
                    // MaxWidth is not supported on the Value of FactSet. Do not set it.
                };
                var uiValue = context.Render(factValue)
                              .AddClass("ac-factvalue");

                // create row in factset
                var uiRow = new ListItem();
                uiRow.Style("height", "1px");

                // add elements as cells
                uiRow.AppendChild(new Heading(3)
                                  .AddClass("ac-factset-titlecell").Style("height", "inherit")
                                  .Style("max-width", $"{context.Config.FactSet.Title.MaxWidth}px")
                                  .AppendChild(uiTitle));
                uiRow.AppendChild(new Span()
                                  .AddClass("ac-factset-valuecell")
                                  .Style("height", "inherit")
                                  .AppendChild(uiValue));

                uiFactSet.AppendChild(uiRow);
            }
            return(uiFactSet);
        }
示例#2
0
        private void UpdateItems()
        {
            _cells.Clear();

            var items = TemplatedItemsView.TemplatedItems;

            if (!items.Any())
            {
                return;
            }

            bool grouping = Element.IsGroupingEnabled;

            if (grouping)
            {
                return;
            }

            foreach (var item in items)
            {
                var cell = GetCell(item);

                var listItem = new ListItem();
                listItem.Style["list-style-type"] = "none";

                listItem.AppendChild(cell);

                _cells.Add(listItem);
            }

            foreach (var cell in _cells)
            {
                _listView.AppendChild(cell);
            }
        }
示例#3
0
        // This needs to be Ensured separately from the body of the tab
        // so that we can refresh the body of the tab on demand.
        /// <summary>
        /// Ensures that the title of this tab is refreshed based on the current properties of the Tab.
        /// </summary>
        internal void EnsureTitleRefreshed()
        {
            string ctxTabClasses = " ";

            // If the anchor element hasn't been instantiated, then it is possible
            // that the title element has only been shallowly instantiated and all its
            // parts still need to be created and the event handlers set.
            if (CUIUtility.IsNullOrUndefined(_elmTitleA))
            {
                EnsureTitleDOMElement();

                _elmTitleA = new Anchor();
                Utility.NoOpLink(_elmTitleA);
                _elmTitleA.ClassName = "ms-cui-tt-a";

                _elmTitleSpan           = new Span();
                _elmTitleSpan.ClassName = "ms-cui-tt-span";
                _elmTitle.AppendChild(_elmTitleA);
                _elmTitleA.AppendChild(_elmTitleSpan);

                AttachEvents();
            }
            else
            {
                ctxTabClasses += _elmTitle.ClassName.IndexOf("ms-cui-ct-first") > -1 ? "ms-cui-ct-first " : "";
                ctxTabClasses += _elmTitle.ClassName.IndexOf("ms-cui-ct-last") > -1 ? "ms-cui-ct-last" : "";
                ctxTabClasses  = ctxTabClasses.TrimEnd();
            }

            _elmTitle.ClassName = GetTitleCSSClassName() + ctxTabClasses;
            _elmTitle.Id        = Id + "-title";
            _elmTitle.SetAttribute("role", "tab");
            _elmTitle.SetAttribute("aria-selected", _selected.ToString());

            // Refresh the title, text and description
            UIUtility.SetInnerText(_elmTitleSpan, Title);
            _elmTitle.Title = Title;

            if (!string.IsNullOrEmpty(Description))
            {
                _elmTitleA.SetAttribute("title", Description);
            }
            else
            {
                _elmTitleA.SetAttribute("title", Title);
            }
        }
        /// <summary>
        /// Recursively creates a list.
        /// </summary>
        /// <param name="authoringEngine"></param>
        /// <param name="parentElement"></param>
        /// <param name="list"></param>
        /// <param name="index"></param>
        /// <param name="previousQualifier"></param>
        /// <param name="attributes"></param>
        /// <returns></returns>
        private static DomElement CreateListRecursive(IAuthoringEngine authoringEngine,
                                                      DomElement parentElement, Internal.List list, ref int index, string previousQualifier,
                                                      BlockElementAttributes attributes)
        {
            //
            // Creating DOM object
            List domList = previousQualifier[previousQualifier.Length - 1] == '#' ?
                           (List) new OrderedList(parentElement, attributes) :
                           new UnorderedList(parentElement, attributes);

            //
            // Iterating through items.
            for (; index < list.Items.GetLength(0); ++index)
            {
                //
                // Creating DOM list item and adding it to the
                // list created above.
                ListItem listItem = new ListItem(domList, BlockElementAttributes.Empty);
                authoringEngine.ParseInlineElements(listItem, list.Items[index].Title);

                /*listItem.AppendChild(new TextBlock(listItem, InlineElementAttributes.Empty,
                 *  list.Items[index].Title, TextBlockFormatting.Unknown));*/

                domList.AppendChild(listItem);

                if (index < list.Items.GetLength(0) - 1)
                {
                    string nextQualifier = list.Items[index + 1].Qualifier;

                    if (nextQualifier.Length != previousQualifier.Length)
                    {
                        if (nextQualifier.Length > previousQualifier.Length)
                        {
                            ++index;
                            listItem.AppendChild(CreateListRecursive(authoringEngine,
                                                                     listItem, list, ref index, nextQualifier, BlockElementAttributes.Empty));
                        } // if
                        else
                        {
                            break;
                        }
                    } // if
                }     // if
            }         // for

            return(domList);
        }
示例#5
0
        protected override void AppendChildrenToElement(HtmlElement elm)
        {
            ListItem listItem;

            foreach (Component child in Children)
            {
                // Put all menu items into a list item for semantics
                listItem           = new ListItem();
                listItem.ClassName = "ms-cui-menusection-items";

                // This is very important for performance
                // We should always try to append an empty child DOM Element
                // first and then call EnsureRefreshed() where the child fills it
                child.EnsureDOMElement();
                listItem.AppendChild(child.ElementInternal);
                elm.AppendChild(listItem);
                child.EnsureRefreshed();
            }
        }
示例#6
0
        public PiWebPage() : base("div")
        {
            AddStyling(StylingOption.MarginTop, 5);
            AddStyling(StylingOption.MarginLeft, 5);
            Heading  heading  = new Heading(1, "Willkommen auf PiWeb.");
            Heading  heading2 = new Heading(4, "Aktuell gibt es folgende Projekte:");
            List     uList    = new List();
            ListItem listItem = new ListItem();

            listItem.AppendChild(new Anchor("/overview", "WateringWeb"));
            uList.AppendChild(listItem);

            //listItem = new ListItem();
            //listItem.AppendChild(new Anchor("/test", "Test"));
            //uList.AppendChild(listItem);

            AppendChild(heading);
            AppendChild(heading2);
            AppendChild(uList);

            //AppendChild(new TabNoc.MyOoui.UiComponents.Chart(400, 400));
        }