Пример #1
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();
        }
Пример #2
0
        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();
        }
Пример #3
0
        internal override void RefreshInternal()
        {
            // If this menu hasn't been refreshed yet, then we synchronously refresh it
            // TODO(josefl): revisit this to see if we need to make this work asynchronously
            // like Tabs.  Right now the plan is to always download all Menu/Gallery info
            // but to delay initialize them.  If we ever need to fetch them from the server
            // on demand like Tabs, then this code needs to change to suppor that.
            if (NeedsDelayIniting)
                DoDelayedInit();

            EnsureDOMElementAndEmpty();

            // Right now we always set this
            // This means that there is no "inherit" setting
            // If we need this, we should add Direction.Inherit
            Direction dir = Root.TextDirection;
            HtmlElement _elementInternal = ElementInternal;
            Div _innerDiv = InnerDiv;
            if (dir == Direction.LTR)
            {
                _elementInternal.Style.Direction = "ltr";
            }
            else if (dir == Direction.RTL)
            {
                Utility.EnsureCSSClassOnElement(_elementInternal, "ms-cui-rtl");
                _elementInternal.Style.Direction = "rtl";
            }

            if (CUIUtility.IsNullOrUndefined(_innerDiv))
            {
                _innerDiv = new Div();
                _innerDiv.ClassName = "ms-cui-smenu-inner";
            }

            // Setting aria role attribute
            _elementInternal.SetAttribute("role", "menu");
            _elementInternal.AppendChild(_innerDiv);

            if (!string.IsNullOrEmpty(_maxWidth))
            {
                _elementInternal.Style.MaxWidth = _maxWidth;
            }

            this.AppendChildrenToElement(_innerDiv);
            base.RefreshInternal();
            _elementInternal.ContextMenu += Utility.ReturnFalse;
        }
Пример #4
0
 public override void Dispose()
 {
     base.Dispose();
     _elmItems = null;
     _elmTitle = null;
     _elmWrapper = null;
 }
Пример #5
0
        public override void Dispose()
        {
            _disposed = true;

            ClearModalDivEvents();

            if (_rootScrollEventsInitialized)
                Browser.Window.Scroll -= OnWindowScroll;

            if (!CUIUtility.IsNullOrUndefined(ElementInternal) && _addedContextMenuHandler)
                ElementInternal.ContextMenu -= Utility.ReturnFalse;

            // This is needed because of a bug in the Microsoft.Ajax toolkit.  Please see O14:207300
            try
            {
                Browser.Document.KeyDown -= OnModalKeyPress;
            }
            catch (Exception)
            {
            }

            Browser.Window.Unload -= OnPageUnload;

            _elmModalDiv = null;
            _rootUser = null;
            _builder = null;
            base.Dispose();
        }
Пример #6
0
 /// <summary>
 /// Named "Attempt" because it is a valid case if the DOM element is not present in the DOM.
 /// This is unlike all the components whose DOM elements are expected to be there and 
 /// it is a bug if they are not when Attach() is called.
 /// </summary>
 internal void AttemptAttachDOMElements()
 {
     ListItem elm = (ListItem)Browser.Document.GetById(Id);
     if (!CUIUtility.IsNullOrUndefined(elm))
     {
         _elmMain = elm;
         _elmTitle = (Div)_elmMain.ChildNodes[0].ChildNodes[0];
         _elmTabTitleContainer = (UnorderedList)_elmMain.ChildNodes[1];
     }
 }
Пример #7
0
        private void HandleHighlightingTitleAndPreview(Div outerDiv)
        {
            int idx = GetIndexFromElement(outerDiv);

            // If the cell with the focus has not changed since the last time then there
            // nothing to change.
            if (_oldIdx == idx)
                return;

            HandleHighlightingTitleAndPreviewForIndex(idx);
        }
Пример #8
0
 private void SetTitleOnAnchor(Div elmOuterDiv)
 {
     Anchor elm = (Anchor)elmOuterDiv.ChildNodes[0].ChildNodes[0];
     int idx = GetIndexFromElement(elmOuterDiv);
     elm.Title = GetCellTitle(GetRowFromIndex(idx) + 1, GetColFromIndex(idx) + 1);
 }
Пример #9
0
        private void EnsurePeripheralPlaceholders()
        {
            // Create peripheral content placeholders as necessary
            if (CUIUtility.IsNullOrUndefined(_elmQATRowCenter))
                _elmQATRowCenter = (Div)Browser.Document.GetById(ClientID + "-" + RibbonPeripheralSection.QATRowCenter);

            if (CUIUtility.IsNullOrUndefined(_elmQATRowRight))
                _elmQATRowRight = (Div)Browser.Document.GetById(ClientID + "-" + RibbonPeripheralSection.QATRowRight);

            if (CUIUtility.IsNullOrUndefined(_elmTabRowLeft))
                _elmTabRowLeft = (Div)Browser.Document.GetById(ClientID + "-" + RibbonPeripheralSection.TabRowLeft);

            if (CUIUtility.IsNullOrUndefined(_elmTabRowRight))
                _elmTabRowRight = (Div)Browser.Document.GetById(ClientID + "-" + RibbonPeripheralSection.TabRowRight);
        }
Пример #10
0
 private void EnsureTabContainer()
 {
     // Do this if this is the first time that the Ribbon is being refreshed
     if (CUIUtility.IsNullOrUndefined(_elmTabContainer))
     {
         _elmTabContainer = new Div();
         Utility.DisableElement(_elmTabContainer);
     }
 }
Пример #11
0
        private void EnsureTopBars()
        {
            if (CUIUtility.IsNullOrUndefined(_elmNavigationInstructions))
            {
                _elmNavigationInstructions = new Span();
                _elmNavigationInstructions.ClassName = "ms-cui-hidden";
                _elmNavigationInstructions.Id = "ribboninstruction";
                UIUtility.SetInnerText(_elmNavigationInstructions, ((RibbonProperties)Properties).NavigationHelpText);
            }

            if (CUIUtility.IsNullOrUndefined(_elmRibbonTopBars))
            {
                _elmRibbonTopBars = new Div();
                _elmRibbonTopBars.ClassName = "ms-cui-ribbonTopBars";
                ElementInternal.AppendChild(_elmNavigationInstructions);
                ElementInternal.AppendChild(_elmRibbonTopBars);
            }
        }
Пример #12
0
        private void EnsureTopBars1And2()
        {
            if (CUIUtility.IsNullOrUndefined(_elmTopBar1))
            {
                _elmTopBar1 = new Div();
                _elmTopBar1.ClassName = "ms-cui-topBar1";
                _elmTopBar1.Style.Display = "none";
                _elmRibbonTopBars.AppendChild(_elmTopBar1);
            }

            if (CUIUtility.IsNullOrUndefined(_elmTopBar2))
            {
                _elmTopBar2 = new Div();
                _elmTopBar2.ClassName = "ms-cui-topBar2";
                _elmRibbonTopBars.AppendChild(_elmTopBar2);
            }
        }
Пример #13
0
        public EventLinkPage()
        {
            var text = new Div() { Text = "Server Address:" };
            var textbox = new Input() { Value="elipc:4040" };
            var div = new Div();
            div.Add(text);
            div.Add(textbox);
            Browser.Document.Body.Add(div);

            // Conventional DOM interaction
            var jsonButton = new Button { InnerHtml = "Test JSON..." };
            jsonButton.Click += e =>
            {
                MemoryStream st = new MemoryStream();
                PrincipalObject obj = new PrincipalObject() { Sid = "sa", Id = "eli" };
                Console.WriteLine(obj);

                JsonPayloadWriter w = new JsonPayloadWriter(st);
                var pl = new ObjectPayload(Guid.NewGuid(), obj, Guid.NewGuid(), "ObjectName");
                Console.WriteLine(pl);
                w.Write(string.Empty, pl);
                StreamReader sr = new StreamReader(st);
                string output = sr.ReadToEnd();
                Console.WriteLine(output);
                return;



                //DUMMY TEST
                //string jsont = "{ \"ChannelName\": \"test\" }";
                //JsonPayloadReader jsr = new JsonPayloadReader(jsont);
                //Console.WriteLine(jsr.ReadString("ChannelName"));

                string ns = "namespace1";
                string subscriptionId = "1234";
                Guid clientId = Guid.NewGuid();
                Guid parentId = Guid.NewGuid();
                Guid objectId = Guid.NewGuid();

                Payload payload = new ClientConnectPayload(subscriptionId, clientId, ns, NamespaceLifetime.ServerInstance);
                ETag eTag = new ETag(clientId, 2);
                string json = WriteToJson(payload);
                Console.WriteLine("WROTE: {0}", json);

                JsonPayloadReader jsonReader = new JsonPayloadReader(json);
                var payloadResult = jsonReader.ReadObject<Payload>(string.Empty, Payload.CreateInstance);
                Console.WriteLine("READ OBJECT: {0}", payloadResult);

                EventSet[] events = new EventSet[]
                {
                    new EventSet { Sequence = 0, ChannelName = "test", Payloads = new Payload[] { new ClientConnectPayload(subscriptionId, clientId , ns, NamespaceLifetime.ConnectedOnly) } }
                };

                json = WriteToJson(events);
                Console.WriteLine(json);

                MemoryStream ms = new MemoryStream();
                StreamWriter sw = new StreamWriter(ms);
                sw.Write(json);
                sw.Flush();

                var eventsResult = EventSet.CreateEventSetsFromStream(ms, PayloadFormat.JSON);
                Console.WriteLine(eventsResult);

                var principal = new PrincipalObject() { Id = "Eli", Sid = "sa" };
                var es = new EventSet { Sequence = 0, ChannelName = "test", Payloads = new Payload[] { new ClientConnectPayload(subscriptionId, clientId, ns, NamespaceLifetime.ConnectedOnly, principal) } };

                json = WriteToJson(es);
                Console.Write(json);

                return;              
            };
            Browser.Document.Body.Add(jsonButton);
            
            var soButton = new Button { InnerHtml = "Subscribe Shared Objects Client" };
            soButton.Click += e =>
            {
                var guid = Guid.NewGuid();
                var txt = textbox.Value;

                string path = string.Format("http://{0}/{1}", txt, guid.ToString());

                SharedObjectsClient soc = new SharedObjectsClient(path, NamespaceLifetime.ConnectedOnly);
                PrincipalObject principal = new PrincipalObject() { Id = "ClientA", Sid = "sa" };
                soc.PrincipalObject = principal;
                
                soc.Connect();
                Console.WriteLine("Connecting to:{0}", path);
                soc.Connected += (s, ec) =>
                {
                    Console.WriteLine("CONNECTED TO SHARED OBJECTS SERVER");
                };
            };
            Browser.Document.Body.Add(soButton);

            // Conventional DOM interaction
            var subButton = new Button { InnerHtml = "Subscribe..." };
            subButton.Click += e =>
            {
                Console.WriteLine("Subscribing...");

                Uri uri = new Uri("http://elipc:4040/");
                this.client = new EventLinkClient(uri, "3bb04637-af98-40e9-ad65-64fb2668a0d2", (s, ex) =>
                {
                    Console.WriteLine(string.Format("Error state:{0} exception:{1}", s, ex));
                });
                this.client.Subscribe("99ca2aff-538e-49f2-a71c-79b7720e3f21ClientControl", EventLinkEventsReceived, this.OnSubscriptionInitialized);
                return;

                //this.Channel = new EventLinkChannel(new Uri("http://elipc:4040/"), "nameSpace", (c1, c2) =>
                //{
                //    Write("Error state changed");
                //});

                //this.Channel.SubscriptionInitialized += OnIncomingChannelsInitialized;
                //this.Channel.EventsReceived += OnIncomingChannelsDataReceived;
                //string name = Channels.GetClientName(Guid.NewGuid());
                //this.Channel.SubscribeAsync(name);

                //Uri uri = new Uri("http://elipc:4040/");
                //this.client = new EventLinkClient(uri, "f148dc15-ad26-484e-9f74-8d0655e8fc0d", (s, ex) =>
                //{
                //    Console.WriteLine(string.Format("Error state:{0} exception:{1}", s, ex));
                //});
                //this.client.Subscribe("81dddf4c-f84c-414f-9f04-99f926fc8c68ClientControl", EventLinkEventsReceived, () => this.OnSubscriptionInitialized());
            };
            Browser.Document.Body.Add(subButton);

            // Conventional DOM interaction
            var secButton = new Button { InnerHtml = "Test Security..." };
            secButton.Click += e =>
            {
                Console.WriteLine("sec");

                //var el = new EventLinkClient(new Uri("http://localhost:4040/"), "partitionA", (c) =>
                //{
                //    Write("EventLinkClient Connected");
                //});

                //var att = new SharedAttributes();
                //Write(att);

                //var client = new SharedObjectsClient("http://www.cnn.com/namespaceName");
                //Write(client);

                //client.Connect();

                Guid g = Guid.NewGuid();
                Console.WriteLine(g);

                Guid g2 = Guid.Empty;
                Console.WriteLine(g2);

                ETag e2 = new ETag(Guid.Empty);
                Console.WriteLine(e2);

                SharedObjectSecurity s = new SharedObjectSecurity("Security", false, new ETag(Guid.Empty));
                s.AddAccessRule(new SharedObjectAccessRule("Idenity", ObjectRights.ChangePermissions, System.Security.AccessControl.InheritanceFlags.ContainerInherit, System.Security.AccessControl.AccessControlType.Allow));
                Console.WriteLine(s);

                PrincipalObject p = new PrincipalObject() { Id = "Hello", Sid = "Sid" };
                Console.WriteLine(p);

                SharedEntryMap<SampleEntry> map = new SharedEntryMap<SampleEntry>();
                Console.WriteLine(map);

                var attr = new SharedAttributes();
                Console.WriteLine(attr);

                var ep = new ObjectExpirationPolicy("timespan", TimeSpan.FromDays(1), TimeSpan.FromMilliseconds(100));
                Console.WriteLine(ep);

                var v = new ProtocolVersion(1, 0);
                Console.WriteLine(v);

                //var tp = new TracePayload("Message", Guid.Empty);
                //Write(tp);


                
                //ObjectDeletedPayload p2 = new ObjectDeletedPayload(Guid.Empty, Guid.NewGuid());
                //Write(p2);

                ////WAIT FOR SAHRED PROEPRPT
                ////ClientConnectPayload c = new ClientConnectPayload("sub", Guid.Empty, "namespace");
                ////Write(c);



                //var principalObject = new PrincipalObject() { Id = "Eli", Sid = "sa" };
                ////                var principal = new ObjectPayload(Guid.NewGuid(), principalObject, Guid.NewGuid(), "NamedObject");

                //var sharedProps = new Dictionary<short, SharedProperty>();
                //Write(sharedProps);

                ////TODO THIS IS BROKEN 
                ////var spd = new SharedPropertyDictionary();
                ////Write(spd);
                
                //var puo = new PropertyUpdateOperation();
                //Write(puo);



                //JavascriptHttpStream str = new JavascriptHttpStream(null);
                //BinaryReader br = new BinaryReader(str);
                //BinaryWriter bw = new BinaryWriter(str);
                //BinaryReader br = new BinaryReader(null);
                //BinaryWriter bw = new BinaryWriter(null);

                
                
            };
            //Browser.Document.Body.Add(secButton);

            // Conventional DOM interaction
            var linqButton = new Button { InnerHtml = "Test Linq..." };
            linqButton.Click += e =>
            {
                int value = "abc".Select(a => a - 'a').Sum();
                Console.WriteLine(value);

                value = "abcdefg".Select(a => a - 'a').Sum();
                Console.WriteLine(value);
            };

            //Browser.Document.Body.Add(linqButton);
        }
Пример #14
0
 public override void Dispose()
 {
     base.Dispose();
     _elmBody = null;
     _elmDescription = null;
     _elmDescriptionImage = null;
     _elmDescriptionImageCont = null;
     _elmDisabledInfo = null;
     _elmDisabledInfoIcon = null;
     _elmDisabledInfoTitle = null;
     _elmDisabledInfoTitleText = null;
     _elmFooter = null;
     _elmFooterIcon = null;
     _elmFooterIconCont = null;
     _elmFooterTitleText = null;
     _elmInnerDiv = null;
     _elmTitle = null;
     _elmSelectedItemTitle = null;
 }
Пример #15
0
        /// <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();
        }
Пример #16
0
 internal static void Debug(string message)
 {
     Div div = new Div();
     UIUtility.SetInnerText(div, message);
     div.Style.FontSize = "10px";
     div.Style.Color = "red";
     Browser.Document.Body.AppendChild(div);
 }
Пример #17
0
        private void OnReturnRibbonAndInitialTab(DataQueryResult res)
        {
            PMetrics.PerfMark(PMarker.perfCUIRibbonInitStart);

            RibbonBuildContext rbc = (RibbonBuildContext)res.ContextData;

            // Apply any extensions to the data.
            res.QueryData = ApplyDataExtensions(res.QueryData);
            Utility.EnsureCSSClassOnElement(Placeholder, "loaded");
            JSObject templates = DataNodeWrapper.GetFirstChildNodeWithName(res.QueryData, DataNodeWrapper.TEMPLATES);
            if (!CUIUtility.IsNullOrUndefined(templates))
                TemplateManager.Instance.LoadTemplates(templates);

            Ribbon = BuildRibbon(res.QueryData, rbc);
            Ribbon.RibbonBuilder = this;
            BuildClient.OnComponentCreated(Ribbon, Ribbon.Id);
            if (RibbonBuildOptions.Minimized)
            {
                Ribbon.MinimizedInternal = true;
            }
            else
            {
                Ribbon.MinimizedInternal = false;
                Tab firstTab = (Tab)Ribbon.GetChild(rbc.InitialTabId);
                if (!CUIUtility.IsNullOrUndefined(firstTab))
                {
                    // We need this in order to set the "ChangedByUser" property of the first
                    // TabSwitch command that comes out of the ribbon correctly.
                    firstTab.SelectedByUser = RibbonBuildOptions.InitialTabSelectedByUser;
                    Ribbon.MakeTabSelectedInternal(firstTab);
                }
            }

            Ribbon.ClientID = RibbonBuildOptions.ClientID;

            bool shouldAttach = !RibbonBuildOptions.Minimized && RibbonBuildOptions.AttachToDOM;

            if (shouldAttach)
            {
                // Scale the ribbon to the scaling index that matches the ribbon that was
                // rendered by the server.  This sets the in memory Ribbon structure to match
                // what was rendered by the server.  This is needed so that Ribbon.AttachInternal()
                // will work properly.  
                if (!((RibbonBuildOptions)Options).Minimized)
                {
                    // We subtract one from this scaling index because internally
                    // this scaling index is an entry into an array of "<ScaleStep>" so
                    // the MaxSize for all the groups is actually index "-1" and the first 
                    // step is index 0.
                    Ribbon.ScaleIndex(rbc.InitialScalingIndex - 1);
                }

                Ribbon.AttachInternal(true);

                // Attach to the QAT and Jewel
                if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowQATId))
                    Ribbon.BuildAndSetQAT(RibbonBuildOptions.ShowQATId, true, DataSource);
                if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowJewelId))
                    Ribbon.BuildAndSetJewel(RibbonBuildOptions.ShowJewelId, true, DataSource);

#if DEBUG
                // Validate that the server rendered ribbon is identical to the client rendered one
                // for this tab.
                if (Options.ValidateServerRendering)
                {
                    RibbonBuilder rb2 = new RibbonBuilder(this.RibbonBuildOptions,
                                                          this.Placeholder,
                                                          null);

                    DataSource ds = new DataSource(this.DataSource.DataUrl,
                                                   this.DataSource.Version,
                                                   this.DataSource.Lcid);

                    rb2.DataSource = ds;
                    SPRibbon r2 = rb2.BuildRibbon(res.QueryData, rbc);
                    r2.Id += "-client";
                    r2.ClientID = RibbonBuildOptions.ClientID + "-client";
                    r2.RibbonBuilder = this;
                    if (!RibbonBuildOptions.Minimized)
                        r2.Minimized = false;

                    // Clone all the peripheral sections for the client-rendering version
                    Div p_qrc = (Div)Browser.Document.GetById(RibbonBuildOptions.ClientID + "-" + RibbonPeripheralSection.QATRowCenter);
                    Div p_qrr = (Div)Browser.Document.GetById(RibbonBuildOptions.ClientID + "-" + RibbonPeripheralSection.QATRowRight);
                    Div p_trl = (Div)Browser.Document.GetById(RibbonBuildOptions.ClientID + "-" + RibbonPeripheralSection.TabRowLeft);
                    Div p_trr = (Div)Browser.Document.GetById(RibbonBuildOptions.ClientID + "-" + RibbonPeripheralSection.TabRowRight);

                    Div hiddenClonedPeripherals = new Div();
                    hiddenClonedPeripherals.Style.Display = "none";
                    Browser.Document.Body.AppendChild(hiddenClonedPeripherals);

                    Div clone;
                    if (null != p_qrc)
                    {
                        clone = (Div)p_qrc.CloneNode(true);
                        clone.Id = clone.Id.Replace(RibbonBuildOptions.ClientID, r2.ClientID);
                        hiddenClonedPeripherals.AppendChild(clone);
                    }
                    if (null != p_qrr)
                    {
                        clone = (Div)p_qrr.CloneNode(true);
                        clone.Id = clone.Id.Replace(RibbonBuildOptions.ClientID, r2.ClientID);
                        hiddenClonedPeripherals.AppendChild(clone);
                    }
                    if (null != p_trl)
                    {
                        clone = (Div)p_trl.CloneNode(true);
                        clone.Id = clone.Id.Replace(RibbonBuildOptions.ClientID, r2.ClientID);
                        hiddenClonedPeripherals.AppendChild(clone);
                    }
                    if (null != p_trr)
                    {
                        clone = (Div)p_trr.CloneNode(true);
                        clone.Id = clone.Id.Replace(RibbonBuildOptions.ClientID, r2.ClientID);
                        hiddenClonedPeripherals.AppendChild(clone);
                    }

                    r2.MakeTabSelectedInternal((Tab)r2.GetChild(rbc.InitialTabId));
                    r2.RefreshInternal();

                    if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowQATId))
                        r2.BuildAndSetQAT(RibbonBuildOptions.ShowQATId, false, ds);
                    if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowJewelId))
                        r2.BuildAndSetJewel(RibbonBuildOptions.ShowJewelId, false, ds);

                    r2.ScaleIndex(rbc.InitialScalingIndex - 1);
                    r2.CompleteConstruction();

                    // If this returns a message it means that it found some inconsistencies
                    // between the DOM Nodes
                    CompareNodes(Ribbon.ElementInternal, r2.ElementInternal);
                }
#endif
            }
            else
            {
                // Do the minimum amount of work necessary in order to be able to 
                // get the outer ribbon element and to be able to attach the Jewel and QAT.
                Ribbon.EnsureDOMElement();

                // Build the QAT and Jewel after the ribbon so that the placeholders
                // will have been created within the ribbon via Ribbon.RefreshInternal()
                if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowQATId))
                    Ribbon.BuildAndSetQAT(RibbonBuildOptions.ShowQATId, false, DataSource);
                if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowJewelId))
                    Ribbon.BuildAndSetJewel(RibbonBuildOptions.ShowJewelId, false, DataSource);

                // Remove anything else that is in the placeholder in case there is a temporary
                // animated gif or a static ribbon in there while the ribbon is loading.
                // We're doing this the slow way since partners might have a reference to this node
                Utility.RemoveChildNodesSlow(Placeholder);
                Placeholder.AppendChild(Ribbon.ElementInternal);
            }

            Ribbon.Scale();
            OnRootBuilt(Ribbon);
            BuildClient.OnComponentBuilt(Ribbon, Ribbon.Id);
            if (RibbonBuildOptions.LaunchedByKeyboard)
                Ribbon.SetFocusOnRibbon();

            PMetrics.PerfMark(PMarker.perfCUIRibbonInitPercvdEnd);
        }
Пример #18
0
        public override void Dispose()
        {
            Disposed = true;

            Root root = this.Root;
            if (!CUIUtility.IsNullOrUndefined(root))
            {
                int timer = root.TooltipLauncherTimer;
                if (!CUIUtility.IsNullOrUndefined(timer))
                {
                    Browser.Window.ClearTimeout(timer);
                }

                root.CloseOpenTootips();
            }

            // This property set will remove the event handler
            WindowResizedHandlerEnabled = false;

            ElementInternal.KeyDown -= OnRibbonEscKeyPressed;
            if (_eventHandlerAttached)
            {
                ElementInternal.KeyDown -= OnKeydownGroupShortcuts;
                Browser.Document.KeyDown -= OnKeydownRibbonShortcuts;
            }

            base.Dispose();
            _previousTab = null;
            _selectedTab = null;
            _elmRibbonTopBars = null;
            _elmTabTitles = null;
            _elmJewelPlaceholder = null;
            _elmTabContainer = null;
            _elmTabRowLeft = null;
            _elmTabRowRight = null;
            _elmQATPlaceholder = null;
            _elmQATRowCenter = null;
            _elmQATRowRight = null;
            _elmTopBar1 = null;
            _elmTopBar2 = null;

            foreach (ContextualGroup cg in _contextualGroups.Values)
            {
                cg.Dispose();

            }
            _contextualGroups.Clear();
            _contextualGroups = null;
        }
Пример #19
0
 private int GetIndexFromElement(Div element)
 {
     return Int32.Parse(element.Id.Substring(this.Id.Length + 1));
 }
Пример #20
0
        internal override void AttachDOMElements()
        {
            // Attach the outer Ribbon Element
            base.AttachDOMElements();
            DomNodeCollection childElms = ElementInternal.ChildNodes;
            _elmScrollCurtain = Browser.Document.GetById("cui-" + Id + "-scrollCurtain");
            _elmNavigationInstructions = (Span)childElms[0];
            _elmRibbonTopBars = (Div)childElms[1];
            _elmTopBar1 = (Div)_elmRibbonTopBars.ChildNodes[0];
            _elmTopBar2 = (Div)_elmRibbonTopBars.ChildNodes[1];
            _elmJewelPlaceholder = (Div)_elmTopBar2.ChildNodes[0];
            if (childElms.Length > 2)
                _elmTabContainer = (Div)childElms[2];

            _elmQATPlaceholder = (Span)Utility.GetFirstChildElementByClassName(_elmTopBar1, "ms-cui-qat-container");
            _elmTabTitles = (UnorderedList)Utility.GetFirstChildElementByClassName(_elmTopBar2, "ms-cui-tts");
            if (CUIUtility.IsNullOrUndefined(_elmTabTitles))
                _elmTabTitles = (UnorderedList)Utility.GetFirstChildElementByClassName(_elmTopBar2, "ms-cui-tts-scale-1");
            if (CUIUtility.IsNullOrUndefined(_elmTabTitles))
                _elmTabTitles = (UnorderedList)Utility.GetFirstChildElementByClassName(_elmTopBar2, "ms-cui-tts-scale-2");
        }
Пример #21
0
        protected override HtmlElement CreateDOMElementForDisplayMode(string displayMode)
        {
            switch (displayMode)
            {
                case "Menu":
                    _elmDefault = new Table();
                    _elmDefault.SetAttribute("mscui:controltype", ControlType);

                    _elmDefaultTbody = new TableBody();
                    _elmDefaultTbody.ClassName = "ms-cui-it";
                    _elmDefault.SetAttribute("cellspacing", "0");
                    _elmDefault.SetAttribute("cellpadding", "0");
                    _elmDefaultTbody.SetAttribute("cellspacing", "0");
                    _elmDefaultTbody.SetAttribute("cellpadding", "0");

                    _elmDefault.MouseOut += OnControlMouseOut;

                    EnsureDivArrays();

                    TableRow elmRow;
                    TableCell elmCell;
                    Anchor elmCellA;
                    Div elmDiv;
                    Div elmDivOuter;
                    int idx = 0;
                    for (int i = 0; i < 10; i++)
                    {
                        elmRow = new TableRow();
                        _elmDefaultTbody.AppendChild(elmRow);
                        for (int j = 0; j < 10; j++)
                        {
                            elmCell = new TableCell();
                            elmCell.Style.Padding = "0px";
                            elmRow.AppendChild(elmCell);

                            elmCellA = new Anchor();

                            Utility.NoOpLink(elmCellA);
                            Utility.SetAriaTooltipProperties(Properties, elmCellA);

                            elmCellA.Focus += OnCellFocus;
                            elmDiv = new Div();
                            elmDiv.ClassName = "ms-cui-it-inactiveCell";

                            elmDivOuter = new Div();
                            elmDivOuter.Id = this.Id + "-" + idx;
                            elmDivOuter.ClassName = "ms-cui-it-inactiveCellOuter";

                            elmCell.MouseOver += OnCellHover;
                            elmCell.Click += OnCellClick;
                            elmCell.AppendChild(elmDivOuter);
                            elmDivOuter.AppendChild(elmDiv);
                            elmDiv.AppendChild(elmCellA);

                            _innerDivs[idx] = elmDiv;
                            _outerDivs[idx] = elmDivOuter;
                            idx++;
                        }
                    }

                    _elmDefault.AppendChild(_elmDefaultTbody);
                    return _elmDefault;
                default:
                    EnsureValidDisplayMode(displayMode);
                    break;
            }
            return null;
        }
Пример #22
0
 private void EnsureJewelPlaceholder()
 {
     if (CUIUtility.IsNullOrUndefined(_elmJewelPlaceholder))
     {
         _elmJewelPlaceholder = new Div();
         _elmJewelPlaceholder.Id = "jewelcontainer";
         _elmJewelPlaceholder.ClassName = "ms-cui-jewel-container";
         _elmJewelPlaceholder.Style.Display = "none";
         _elmTopBar2.AppendChild(_elmJewelPlaceholder);
     }
 }
Пример #23
0
 public void Dispose()
 {
     _elmMain = null;
     _elmTitle = null;
     _elmTabTitleContainer = null;
     _tabCount = 0;
 }
Пример #24
0
        /// <summary>
        /// Create some rows or cells in _colorTable
        /// </summary>
        /// <param name="colorRules"></param>
        /// <param name="styleName"></param>
        private void AddColorCells(HtmlElement colorTableBody, ColorStyle[] colorRules)
        {
            int rowNumber = 0;
            TableRow row = new TableRow();
            int totalRows = colorRules.Length / ColumnSize;

            for (int i = 0; i < colorRules.Length; i++)
            {
                if ((i % ColumnSize) == 0)
                {
                    row = new TableRow();
                    colorTableBody.AppendChild(row);
                    rowNumber++;
                }

                TableCell cell = new TableCell();
                cell.ClassName = NormalCellCssClassName;
                cell.SetAttribute("arrayPosition", i.ToString());
                // Make the first row have spacing.
                if (rowNumber == 1)
                {
                    cell.Style.Padding = "2px";
                    cell.Style.Height = "16px";
                }

                row.AppendChild(cell);
                Anchor link = new Anchor();
                link.Href = "javascript:";
                string displayName = colorRules[i].Title;
                link.Title = displayName;
                link.ClassName = CellAnchorCssClassName;

                link.Focus += OnCellFocus;
                Div elmDiv = new Div();
                string color = colorRules[i].DisplayColor;
                elmDiv.Style.BackgroundColor = color;
                elmDiv.ClassName = CellDivClassName;
                int size = DefaultCellHeight;
                if (rowNumber == 1 || rowNumber == 2)
                {
                    elmDiv.Style.BorderTopWidth = "1px";
                    size--;
                }
                if (rowNumber == 1 || rowNumber == totalRows)
                {
                    elmDiv.Style.BorderBottomWidth = "1px";
                    size--;
                }
                if (size != DefaultCellHeight)
                {
                    elmDiv.Style.Height = size + "px";
                }

                Div internalelmDiv = new Div();
                internalelmDiv.ClassName = CellInternalDivClassName;

                link.MouseOver += OnCellHover;
                link.MouseOut += OnCellBlur;
                link.Click += OnCellClick;

                cell.AppendChild(link);
                link.AppendChild(elmDiv);
                elmDiv.AppendChild(internalelmDiv);

                cell.SetAttribute(ColorInformation + "Color", colorRules[i].Color);
                cell.SetAttribute(ColorInformation + "Style", colorRules[i].Style);

                // add the cell to _colorCells so that we could reset the highlight
                _colorCells.Add(cell);
            }
        }
Пример #25
0
        private void EnsureEndModal()
        {
            if (!InModalMode)
                return;

            // Don't remove modal div unless all modal controllers are closed
            if (_modalControllerStack.Count == 0)
            {
                Browser.Document.Body.RemoveChild(ModalDiv);
                _modal = false;
                if (BrowserUtility.InternetExplorer)
                {
                    // Office14#39330: Null the div, forcing it to be recreated.
                    // This fixes an IE7-specific WAC bug where the overlay was not getting rendered.
                    ClearModalDivEvents();
                    _elmModalDiv = null;
                }
            }
        }
Пример #26
0
 public Page1()
 {
   var div = new Div { InnerText = "Welcome to IL2JS!" };
   Browser.Document.Body.Add(div);
 }
Пример #27
0
        protected void CreateToolbarStructure(bool twoRow)
        {
            if (_hasJewel)
            {
                _elmJewelPlaceholder = new Div();
                _elmJewelPlaceholder.Id = "jewelcontainer";
                _elmJewelPlaceholder.ClassName = "ms-cui-jewel-container";
                _elmJewelPlaceholder.Style.Display = "none";
            }

            if (twoRow)
            {
                _elmTopBar1 = new Div();
                _elmTopBar1.ClassName = "ms-cui-topBar1";
                _elmTopBar1.Style.Display = "none";

                _elmTopBar2 = new Div();
                _elmTopBar2.ClassName = "ms-cui-topBar2";

                if (_hasJewel)
                    _elmTopBar2.AppendChild(_elmJewelPlaceholder);

                _elmToolbarTopBars = new Div();
                _elmToolbarTopBars.ClassName = "ms-cui-ribbonTopBars";
                _elmToolbarTopBars.AppendChild(_elmTopBar1);
                _elmToolbarTopBars.AppendChild(_elmTopBar2);

                // Create peripheral content placeholders as necessary
                _elmQATRowCenter = (Div)Browser.Document.GetById(ClientID + "-" + RibbonPeripheralSection.QATRowCenter);
                _elmQATRowRight = (Div)Browser.Document.GetById(ClientID + "-" + RibbonPeripheralSection.QATRowRight);

                if (!CUIUtility.IsNullOrUndefined(_elmQATRowCenter))
                {
                    _elmQATRowCenter.ParentNode.RemoveChild(_elmQATRowCenter);
                    _elmTopBar1.AppendChild(_elmQATRowCenter);
                    _elmQATRowCenter.Style.Display = "inline-block";
                    _elmTopBar1.Style.Display = "block";
                    Utility.SetUnselectable(_elmQATRowCenter, true, false);
                }

                if (!CUIUtility.IsNullOrUndefined(_elmQATRowRight))
                {
                    _elmQATRowRight.ParentNode.RemoveChild(_elmQATRowRight);
                    _elmTopBar1.AppendChild(_elmQATRowRight);
                    _elmQATRowRight.Style.Display = "inline-block";
                    _elmTopBar1.Style.Display = "block";
                    Utility.SetUnselectable(_elmQATRowRight, true, false);
                }
            }

            // Initialize the outer DOM element of this component
            EnsureDOMElement();
        }
Пример #28
0
        public static void PerfReport()
        {
            int l = Records.Count;
            if (l == 0)
                return;

            Div elmResults = (Div)Browser.Document.GetById("perf-markers");
            if (CUIUtility.IsNullOrUndefined(elmResults))
            {
                elmResults = new Div();
                elmResults.Id = "perf-markers";
                elmResults.Style.Position = "fixed";
                elmResults.Style.Right = "0px";
                elmResults.Style.Bottom = "0px";
                elmResults.Style.BorderColor = "#000000";
                elmResults.Style.BorderStyle = "outset";
                elmResults.Style.BorderWidth = "2px";
                elmResults.Style.BackgroundColor = "#e0e0e0";
                elmResults.Style.FontFamily = "Helvetica";
                elmResults.Style.FontSize = "10pt";
            }

            int recordCount = Records.Count;

            if (recordCount != 2)
            {
                Records.Clear();
                return;
            }

            PRecord start = Records[0];
            PRecord finish = Records[1];
            TimeSpan diff = finish.mt - start.mt;

            // string rstr = "";
            // rstr += "<p><span class='startTime'>Start Time : " + start.mt.ToString() + "</span></p>";
            // rstr += "<p><span class='difference'>Difference :" + diff.Milliseconds + " (ms)</span></p>";
            // rstr += "<p><span class='finishTime'>Finish Time : " + finish.mt.ToString() + "</span></p>";
            // elmResults.InnerHtml += rstr;

            elmResults.InnerText = "Time: " + diff.Milliseconds + "ms";

            Browser.Document.Body.AppendChild(elmResults);
            Records.Clear();
        }
Пример #29
0
        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);
        }
Пример #30
0
        public override void Dispose()
        {
            base.Dispose();
            _elmInnerDiv = null;
            _lastMenuItem = null;
            _firstMenuItem = null;
            _selectedMenuItem = null;

            if (ElementInternal != null)
                ElementInternal.ContextMenu -= Utility.ReturnFalse;
        }