コード例 #1
0
ファイル: toolbar.cs プロジェクト: tralivali1234/IL2JS
        internal override void RefreshInternal()
        {
            ToolbarProperties props = (ToolbarProperties)Properties;
            bool twoRow             = (CUIUtility.SafeString(props.Size) == DataNodeWrapper.TWOROW);

            // Create the outer DOM Element of the toolbar if it hasn't been created yet
            if (CUIUtility.IsNullOrUndefined(ElementInternal))
            {
                CreateToolbarStructure(twoRow);
            }

            ElementInternal = Utility.RemoveChildNodes(ElementInternal);

            if (twoRow)
            {
                // Add the toolbar structure to the page
                ElementInternal.AppendChild(_elmToolbarTopBars);

                // Add the buttondocks
                AppendChildrenToElement(_elmTopBar2);
            }
            else
            {
                // Add the jewel to the toolbar
                if (_hasJewel)
                {
                    ElementInternal.AppendChild(_elmJewelPlaceholder);
                }

                // Add the buttondocks
                AppendChildrenToElement(ElementInternal);
            }

            Dirty = false;
        }
コード例 #2
0
ファイル: tooltip.cs プロジェクト: tralivali1234/IL2JS
        /// <summary>
        /// Display the tooltip.
        /// </summary>
        /// <owner alias="HillaryM" />
        internal bool Display()
        {
            RefreshInternal();

            // Hide tooltip while positioning
            ElementInternal.Style.Visibility = "hidden";
            ElementInternal.Style.Position   = "absolute";
            ElementInternal.Style.Top        = "0px";
            ElementInternal.Style.Left       = "0px";
            Browser.Document.Body.AppendChild(ElementInternal);
            PositionToolTip();

            // For IE, we need a backframe IFrame in order for the tooltip to show up over
            // ActiveX controls
            if (BrowserUtility.InternetExplorer)
            {
                Utility.PositionBackFrame(Root.TooltipBackFrame, ElementInternal);
                Root.TooltipBackFrame.Style.Visibility = "visible";
            }

            // Show menu once it is positioned
            ElementInternal.Style.Visibility = "visible";
            Visible = true;

            // set the aria visibility
            ElementInternal.SetAttribute("aria-hidden", "false");
            return(true);
        }
コード例 #3
0
ファイル: gallery.cs プロジェクト: tralivali1234/IL2JS
        internal override void RefreshInternal()
        {
            EnsureDOMElementAndEmpty();
            TableBody tbody = new TableBody();

            ElementInternal.AppendChild(tbody);
            AppendChildrenToElement(tbody);
        }
コード例 #4
0
        internal override void EnsureDOMElement()
        {
            if (!CUIUtility.IsNullOrUndefined(ElementInternal))
            {
                return;
            }

            base.EnsureDOMElement();

            // aria supoort for tabs
            ElementInternal.SetAttribute("role", "tabpanel");
            ElementInternal.SetAttribute("aria-labelledby", Id + "-title");
        }
コード例 #5
0
        private void AppendRow(List <Component> children, int rowNumber)
        {
            Row row = (Row)children[rowNumber - 1];

            row.EnsureDOMElement();

            if (this.Type == SectionType.TwoRow)
            {
                row.ElementInternal.ClassName = "ms-cui-row-tworow";
            }
            ElementInternal.AppendChild(row.ElementInternal);
            row.EnsureRefreshed();
        }
コード例 #6
0
ファイル: tooltip.cs プロジェクト: tralivali1234/IL2JS
 /// <summary>
 /// Hide the ToolTip.
 /// </summary>
 /// <owner alias="HillaryM" />
 internal void Hide()
 {
     if (!CUIUtility.IsNullOrUndefined(ElementInternal))
     {
         ElementInternal.Style.Visibility = "hidden";
         // set the aria visibility
         ElementInternal.SetAttribute("aria-hidden", "true");
     }
     if (BrowserUtility.InternetExplorer)
     {
         Root.TooltipBackFrame.Style.Visibility = "hidden";
     }
     Visible = false;
 }
コード例 #7
0
ファイル: grouppopup.cs プロジェクト: tralivali1234/IL2JS
        internal override void RefreshInternal()
        {
            EnsureDOMElementAndEmpty();

            if (CUIUtility.IsNullOrUndefined(_elmTitle))
            {
                _elmTitle           = new Div();
                _elmTitle.ClassName = "ms-cui-groupTitle";
            }
            else
            {
                _elmTitle = (Div)Utility.RemoveChildNodes(_elmTitle);
            }

            if (CUIUtility.IsNullOrUndefined(_elmBody))
            {
                _elmBody           = new Div();
                _elmBody.ClassName = "ms-cui-groupBody";
            }
            else
            {
                _elmBody = (Div)Utility.RemoveChildNodes(_elmBody);
            }

            // Refresh the text of the group name
            UIUtility.SetInnerText(_elmTitle, _group.Title);

            ElementInternal.AppendChild(_elmBody);
            ElementInternal.AppendChild(_elmTitle);

            Layout layout = (Layout)_group.GetChildByTitle(_layoutTitle);

            if (CUIUtility.IsNullOrUndefined(layout))
            {
                throw new InvalidOperationException("Cannot find Layout with title: " + _layoutTitle +
                                                    " for this GroupPopup to use from the Group with id: " + _group.Id);
            }

            // TODO(josefl): fix this.  This cloning for popup groups does not scale.
            // it should only be recloned if the master layout has been dirtied and in
            // this case, somehow the control should not have to keep track of all the old
            // stale ControlComponents.
            Layout clonedLayout = (Layout)layout.Clone(true);

            this.RemoveChildren();
            this.AddChild(clonedLayout);
            AppendChildrenToElement(_elmBody);
            base.RefreshInternal();
        }
コード例 #8
0
ファイル: grouppopup.cs プロジェクト: tralivali1234/IL2JS
        private void ShowGlass()
        {
            if (_glassIsShown)
            {
                return;
            }

            if (_elmGlass == null)
            {
                _elmGlass        = Utility.CreateGlassElement();
                _elmGlass.Click += OnGlassClick;
                ElementInternal.AppendChild(_elmGlass);
            }

            _elmGlass.Style.Display = "";
            _glassIsShown           = true;
        }
コード例 #9
0
        /// <summary>
        /// The job of RefreshInternal is to synchronize the in-memory component
        /// hierarchy with the DOM.  In other words, refresh()'s job is to
        /// cause the DOM to reflect the in-memory hierarchy.
        /// </summary>
        internal override void RefreshInternal()
        {
            if (NeedsDelayIniting)
            {
                DoDelayedInit();
            }

            EnsureDOMElementAndEmpty();
            if (CUIUtility.IsNullOrUndefined(InnerDiv))
            {
                InnerDiv           = new Div();
                InnerDiv.ClassName = "ms-cui-contextmenu-inner";
            }

            ElementInternal.AppendChild(InnerDiv);
            this.AppendChildrenToElement(InnerDiv);
            base.RefreshInternal();
        }
コード例 #10
0
ファイル: tooltip.cs プロジェクト: tralivali1234/IL2JS
        /// <summary>
        /// Creates the HTML for the ToolTip.
        /// </summary>
        /// <owner alias="HillaryM" />
        internal override void RefreshInternal()
        {
            if (NeedsDelayIniting)
            {
                DoDelayedInit();
            }

            EnsureDOMElementAndEmpty();

            // set the aria role
            ElementInternal.SetAttribute("role", "tooltip");

            // set the aria visibility
            ElementInternal.SetAttribute("aria-hidden", "true");

            if (CUIUtility.IsNullOrUndefined(_elmBody))
            {
                _elmBody           = new Div();
                _elmBody.ClassName = "ms-cui-tooltip-body";
            }
            else
            {
                _elmBody = (Div)Utility.RemoveChildNodes(_elmBody);
            }
            ElementInternal.AppendChild(_elmBody);

            if (CUIUtility.IsNullOrUndefined(_elmInnerDiv))
            {
                _elmInnerDiv           = new Div();
                _elmInnerDiv.ClassName = "ms-cui-tooltip-glow";
                _elmBody.AppendChild(_elmInnerDiv);
            }
            else
            {
                _elmInnerDiv = (Div)Utility.RemoveChildNodes(_elmInnerDiv);
            }

            // set the title and shortcut
            if (CUIUtility.IsNullOrUndefined(_elmTitle))
            {
                _elmTitle = new Heading1();
                if (TitleInternal.Length > _controlTitleLength)
                {
                    UIUtility.SetInnerText(_elmTitle, TitleInternal.Substring(0, _controlTitleLength));
                }
                else
                {
                    UIUtility.SetInnerText(_elmTitle, Title);
                }
                _elmInnerDiv.AppendChild(_elmTitle);
            }

            // set the image if available
            if (CUIUtility.IsNullOrUndefined(_elmDescriptionImage) &&
                !string.IsNullOrEmpty(Properties.ToolTipImage32by32))
            {
                _elmDescriptionImage     = new Image();
                _elmDescriptionImageCont = Utility.CreateClusteredImageContainerNew(
                    ImgContainerSize.Size32by32,
                    Properties.ToolTipImage32by32,
                    Properties.ToolTipImage32by32Class,
                    _elmDescriptionImage,
                    true,
                    false,
                    Properties.ToolTipImage32by32Top,
                    Properties.ToolTipImage32by32Left);
                _elmDescriptionImageCont.ClassName = _elmDescriptionImageCont.ClassName + " ms-cui-tooltip-bitmap ";
                _elmInnerDiv.AppendChild(_elmDescriptionImageCont);
            }

            // set the description
            string selectedItemTitle = Properties.ToolTipSelectedItemTitle;
            string descriptionText   = Description;

            if (CUIUtility.IsNullOrUndefined(_elmDescription) &&
                (!string.IsNullOrEmpty(descriptionText) ||
                 !string.IsNullOrEmpty(selectedItemTitle)))
            {
                _elmDescription           = new Div();
                _elmDescription.ClassName = "ms-cui-tooltip-description";
                if (!string.IsNullOrEmpty(Properties.ToolTipImage32by32))
                {
                    _elmDescription.Style.Width = "80%";
                }
                _elmInnerDiv.AppendChild(_elmDescription);

                string seletedItemTitlePrefix = Root.Properties.ToolTipSelectedItemTitlePrefix;
                if (!string.IsNullOrEmpty(selectedItemTitle) &&
                    !string.IsNullOrEmpty(seletedItemTitlePrefix))
                {
                    string selectedItemText = String.Format(seletedItemTitlePrefix, selectedItemTitle);
                    _elmSelectedItemTitle = new Paragraph();
                    UIUtility.SetInnerText(_elmSelectedItemTitle, selectedItemText);

                    _elmDescription.AppendChild(_elmSelectedItemTitle);
                    _spacerRow3 = new Break();
                    _elmDescription.AppendChild(_spacerRow3);
                }
                if (!string.IsNullOrEmpty(descriptionText))
                {
                    if (descriptionText.Length > _controlDescriptionLength)
                    {
                        _elmDescription.InnerHtml = _elmDescription.InnerHtml + Utility.HtmlEncodeAllowSimpleTextFormatting(descriptionText.Substring(0, _controlDescriptionLength), true);
                    }
                    else
                    {
                        _elmDescription.InnerHtml = _elmDescription.InnerHtml + Utility.HtmlEncodeAllowSimpleTextFormatting(descriptionText, true);
                    }
                }
            }

            // Disabled info explaining why a command is currently disabled
            if (CUIUtility.IsNullOrUndefined(_elmDisabledInfo) &&
                !CUIUtility.IsNullOrUndefined(_disabledInfoProperties) &&
                !string.IsNullOrEmpty(_disabledInfoProperties.Title))
            {
                // provide spacer to distinguish from main description above
                _spacerDiv1           = new Div();
                _spacerDiv1.ClassName = "ms-cui-tooltip-clear";
                _elmInnerDiv.AppendChild(_spacerDiv1);

                _spacerRow1 = new HorizontalRule();
                _elmInnerDiv.AppendChild(_spacerRow1);

                // title for this message
                _elmDisabledInfoTitle           = new Div();
                _elmDisabledInfoTitle.ClassName = "ms-cui-tooltip-footer";
                _elmInnerDiv.AppendChild(_elmDisabledInfoTitle);

                _elmDisabledInfoTitleText = new Div();
                UIUtility.SetInnerText(_elmDisabledInfoTitleText, _disabledInfoProperties.Title);

                // icon for this message
                _elmDisabledInfoIcon     = new Image();
                _elmDisabledInfoIconCont = Utility.CreateClusteredImageContainerNew(
                    ImgContainerSize.Size16by16,
                    _disabledInfoProperties.Icon,
                    _disabledInfoProperties.IconClass,
                    _elmDisabledInfoIcon,
                    true,
                    false,
                    _disabledInfoProperties.IconTop,
                    _disabledInfoProperties.IconLeft);

                _elmDisabledInfoIconCont.Style.VerticalAlign = "top";

                // switch display based on text direction
                // REVIEW(jkern,josefl): I don't think that we need to manually do this.  We should get it for free in
                // the browser with the "dir=rtl" attribute.  Check this when the RTL work is done.
                if (Root.TextDirection == Direction.LTR)
                {
                    _elmDisabledInfoTitle.AppendChild(_elmDisabledInfoIconCont);
                    _elmDisabledInfoTitle.AppendChild(_elmDisabledInfoTitleText);
                }
                else
                {
                    _elmDisabledInfoTitle.AppendChild(_elmDisabledInfoTitleText);
                    _elmDisabledInfoTitle.AppendChild(_elmDisabledInfoIconCont);
                }

                // disabled info text
                if (!string.IsNullOrEmpty(_disabledInfoProperties.Description))
                {
                    _elmDisabledInfo             = new Div();
                    _elmDisabledInfo.ClassName   = "ms-cui-tooltip-description";
                    _elmDisabledInfo.Style.Width = "90%";
                    UIUtility.SetInnerText(_elmDisabledInfo, _disabledInfoProperties.Description);
                    _elmInnerDiv.AppendChild(_elmDisabledInfo);
                }
            }

            // set the footer
            if (!CUIUtility.IsNullOrUndefined(_elmFooter) &&
                !string.IsNullOrEmpty(Root.Properties.ToolTipFooterText) &&
                !string.IsNullOrEmpty(Root.Properties.ToolTipFooterImage16by16) &&
                (((!CUIUtility.IsNullOrUndefined(_disabledInfoProperties)) &&
                  (!string.IsNullOrEmpty(_disabledInfoProperties.HelpKeyWord))) ||
                 (!string.IsNullOrEmpty(Properties.ToolTipHelpKeyWord))))
            {
                _spacerDiv2           = new Div();
                _spacerDiv2.ClassName = "ms-cui-tooltip-clear";
                _elmInnerDiv.AppendChild(_spacerDiv2);

                _spacerRow2 = new HorizontalRule();
                _elmInnerDiv.AppendChild(_spacerRow2);

                _elmFooter           = new Div();
                _elmFooter.ClassName = "ms-cui-tooltip-footer";
                _elmInnerDiv.AppendChild(_elmFooter);

                _elmFooterTitleText = new Div();
                UIUtility.SetInnerText(_elmFooterTitleText, Root.Properties.ToolTipFooterText);

                _elmFooterIcon = new Image();

                _elmFooterIconCont = Utility.CreateClusteredImageContainerNew(
                    ImgContainerSize.Size16by16,
                    Root.Properties.ToolTipFooterImage16by16,
                    Root.Properties.ToolTipFooterImage16by16Class,
                    _elmFooterIcon,
                    true,
                    false,
                    Root.Properties.ToolTipFooterImage16by16Top,
                    Root.Properties.ToolTipFooterImage16by16Left
                    );

                _elmFooterIconCont.Style.VerticalAlign = "top";

                // switch display based on text direction
                // REVIEW(jkern,josefl): I don't think that we need to manually do this.  We should get it for free in
                // the browser with the "dir=rtl" attribute.  Check this when the RTL work is done.
                if (Root.TextDirection == Direction.LTR)
                {
                    _elmFooter.AppendChild(_elmFooterIconCont);
                    _elmFooter.AppendChild(_elmFooterTitleText);
                }
                else
                {
                    _elmFooter.AppendChild(_elmFooterTitleText);
                    _elmFooter.AppendChild(_elmFooterIconCont);
                }
            }

            // build DOM structure
            this.AppendChildrenToElement(_elmBody);
            base.RefreshInternal();
        }
コード例 #11
0
        internal override void RefreshInternal()
        {
            // TODO: possible perf implication.
            // We do not always have to remove the children.
            EnsureDOMElementAndEmpty();

            if (CUIUtility.IsNullOrUndefined(_elmTitle))
            {
                _elmTitle           = new Span();
                _elmTitle.ClassName = "ms-cui-groupTitle";
            }
            else
            {
                _elmTitle = (Span)Utility.RemoveChildNodes(_elmTitle);
            }

            if (CUIUtility.IsNullOrUndefined(_elmBody))
            {
                _elmBody           = new Span();
                _elmBody.ClassName = "ms-cui-groupBody";
            }
            else
            {
                _elmBody = (Span)Utility.RemoveChildNodes(_elmBody);
            }

            if (CUIUtility.IsNullOrUndefined(_elmSeparator))
            {
                _elmSeparator           = new Span();
                _elmSeparator.ClassName = "ms-cui-groupSeparator";
            }

            // Refresh the text of the group name
            string title = Title;

            if (!string.IsNullOrEmpty(title))
            {
                UIUtility.SetInnerText(_elmTitle, title);
            }

            _elmTitle.Title = Title;

            if (!CUIUtility.IsNullOrUndefined(_selectedLayout) &&
                typeof(GroupPopupLayout).IsInstanceOfType(_selectedLayout))
            {
                _selectedLayout.EnsureDOMElement();
                ElementInternal.AppendChild(_selectedLayout.ElementInternal);
                ElementInternal.AppendChild(_elmSeparator);
                _selectedLayout.EnsureRefreshed();
            }
            else
            {
                Span elmContainer = new Span();
                elmContainer.ClassName = "ms-cui-groupContainer";

                elmContainer.AppendChild(_elmBody);
                elmContainer.AppendChild(_elmTitle);

                ElementInternal.AppendChild(elmContainer);
                ElementInternal.AppendChild(_elmSeparator);

                if (!CUIUtility.IsNullOrUndefined(_selectedLayout))
                {
                    _selectedLayout.EnsureDOMElement();
                    _elmBody.AppendChild(_selectedLayout.ElementInternal);
                    _selectedLayout.EnsureRefreshed();
                }
            }

            base.RefreshInternal();
        }
コード例 #12
0
ファイル: menusection.cs プロジェクト: tralivali1234/IL2JS
        internal override void RefreshInternal()
        {
            EnsureDOMElementAndEmpty();
            _elmWrapper           = new Div();
            _elmWrapper.ClassName = "ms-cui-menusection";
            ElementInternal.AppendChild(_elmWrapper);
            if (!string.IsNullOrEmpty(Title))
            {
                _elmTitle = new Div();
                UIUtility.SetInnerText(_elmTitle, Title);
                _elmTitle.ClassName = "ms-cui-menusection-title";
                _elmWrapper.AppendChild(_elmTitle);
            }
            _elmItems           = new UnorderedList();
            _elmItems.ClassName = "ms-cui-menusection-items";

            string cssclassname;

            if (_displayMode == "Menu32")
            {
                if (Root.TextDirection == Direction.LTR)
                {
                    cssclassname = "ms-cui-menusection-items32";
                }
                else
                {
                    cssclassname = "ms-cui-menusection-items32rtl";
                }

                Component parent = Parent;
                if (parent is Menu)
                {
                    // For IE7, we can't put a max width on the menu section since hasLayout
                    // will become enabled and force the menu items to not be full-width
                    // We can, however, set a max-width on the menu itself if there are any menu32
                    // sections within it. (O14:448689)
                    Utility.EnsureCSSClassOnElement(parent.ElementInternal, "ms-cui-menu32");
                }
            }
            else if (_displayMode == "Menu16")
            {
                if (Root.TextDirection == Direction.LTR)
                {
                    cssclassname = "ms-cui-menusection-items16";
                }
                else
                {
                    cssclassname = "ms-cui-menusection-items16rtl";
                }
            }
            else
            {
                cssclassname = "";
            }

            if (cssclassname != "")
            {
                Utility.EnsureCSSClassOnElement(_elmItems, cssclassname);
            }

            if (_scrollable)
            {
                _elmItems.Style.OverflowY = "auto";
                _elmItems.Style.Position  = "relative";
            }

            if (!string.IsNullOrEmpty(_maxHeight))
            {
                _elmItems.Style.MaxHeight = _maxHeight;
            }
            _elmWrapper.AppendChild(_elmItems);
            AppendChildrenToElement(_elmItems);
        }
コード例 #13
0
ファイル: toolbar.cs プロジェクト: tralivali1234/IL2JS
 internal override void EnsureDOMElement()
 {
     base.EnsureDOMElement();
     ElementInternal.SetAttribute("role", "toolbar");
 }