Ejemplo n.º 1
0
        protected virtual void RenderContents(WebTabStripRenderingContext renderingContext, IWebTab tab)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);

            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassTabAnchorBody);
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Span); // Begin anchor body span

            bool hasIcon = tab.Icon != null && tab.Icon.HasRenderingInformation;
            bool hasText = !string.IsNullOrEmpty(tab.Text);

            if (hasIcon)
            {
                tab.Icon.Render(renderingContext.Writer, renderingContext.Control);
            }
            if (hasIcon && hasText)
            {
                renderingContext.Writer.Write(" ");
            }
            if (hasText)
            {
                var textWithHotkey = HotkeyParser.Parse(tab.Text);
                renderingContext.Writer.Write(_hotkeyFormatter.FormatText(textWithHotkey, false)); // Do not HTML encode
            }
            if (!hasIcon && !hasText)
            {
                renderingContext.Writer.Write(" ");
            }

            renderingContext.Writer.RenderEndTag(); // End anchor body span
        }
Ejemplo n.º 2
0
        private void RenderWrapperBegin(WebTabStripRenderingContext renderingContext, IWebTab tab)
        {
            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Id, GetTabClientID(renderingContext, tab));
            string cssClass;

            if (tab.IsSelected)
            {
                cssClass = CssClassTabSelected;
            }
            else
            {
                cssClass = CssClassTab;
            }
            if (!tab.EvaluateEnabled())
            {
                cssClass += " " + CssClassDisabled;
            }
            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);

            if (RenderingFeatures.EnableDiagnosticMetadata)
            {
                if (!string.IsNullOrEmpty(tab.ItemID))
                {
                    renderingContext.Writer.AddAttribute(DiagnosticMetadataAttributes.ItemID, tab.ItemID);
                }

                if (!string.IsNullOrEmpty(tab.Text))
                {
                    renderingContext.Writer.AddAttribute(DiagnosticMetadataAttributes.Content, HtmlUtility.StripHtmlTags(tab.Text));
                }
            }

            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Span); // Begin tab span
        }
Ejemplo n.º 3
0
        public void Render(WebTabStripRenderingContext renderingContext, IWebTab tab, bool isEnabled, bool isLast, WebTabStyle style)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);
            ArgumentUtility.CheckNotNull("style", style);

            ScriptUtility.Instance.RegisterElementForBorderSpans(renderingContext.Control, "#" + GetTabClientID(renderingContext, tab) + " > *:first");

            RenderTabBegin(renderingContext);
            RenderSeperator(renderingContext);
            RenderWrapperBegin(renderingContext, tab);

            var command = RenderBeginTagForCommand(renderingContext, tab, isEnabled, style);

            RenderContents(renderingContext, tab);
            RenderEndTagForCommand(renderingContext, command);

            renderingContext.Writer.RenderEndTag(); // End tab span
            renderingContext.Writer.RenderEndTag(); // End tab wrapper span

            if (isLast)
            {
                renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassTabLast);
                renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Span);
                renderingContext.Writer.RenderEndTag();
            }

            renderingContext.Writer.RenderEndTag(); // End list item
        }
Ejemplo n.º 4
0
        protected virtual void RenderEndTagForCommand(WebTabStripRenderingContext renderingContext, Command command)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);
            ArgumentUtility.CheckNotNull("command", command);

            command.RenderEnd(renderingContext.Writer);
        }
Ejemplo n.º 5
0
 private void RenderSeperator(WebTabStripRenderingContext renderingContext)
 {
     renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassSeparator);
     renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Span);
     renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Span);
     renderingContext.Writer.RenderEndTag();
     renderingContext.Writer.RenderEndTag();
 }
        protected void AddAttributesToRender(WebTabStripRenderingContext renderingContext)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);

            AddStandardAttributesToRender(renderingContext);

            if (string.IsNullOrEmpty(renderingContext.Control.CssClass) && string.IsNullOrEmpty(renderingContext.Control.Attributes["class"]))
            {
                renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassBase);
            }
        }
Ejemplo n.º 7
0
        private void RenderTabBegin(WebTabStripRenderingContext renderingContext)
        {
            if (renderingContext.Control.IsDesignMode)
            {
                renderingContext.Writer.AddStyleAttribute("float", "left");
                renderingContext.Writer.AddStyleAttribute("display", "block");
                renderingContext.Writer.AddStyleAttribute("white-space", "nowrap");
            }

            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Li); // Begin list item

            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, "tabStripTabWrapper");
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Span); // Begin tab wrapper span
        }
        public void Render(WebTabStripRenderingContext renderingContext)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);

            AddAttributesToRender(renderingContext);
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div);
            RenderBeginTabsPane(renderingContext);

            foreach (var webTabRenderer in renderingContext.WebTabRenderers)
            {
                webTabRenderer.Render(renderingContext);
                renderingContext.Writer.WriteLine();
            }

            RenderEndTabsPane(renderingContext);
            RenderClearingPane(renderingContext);
            renderingContext.Writer.RenderEndTag();
        }
        private void RenderBeginTabsPane(WebTabStripRenderingContext renderingContext)
        {
            bool isEmpty = renderingContext.Control.Tabs.Count == 0;

            string cssClass = CssClassTabsPane;

            if (isEmpty)
            {
                cssClass += " " + CssClassTabsPaneEmpty;
            }
            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);

            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div); // Begin Div

            if (renderingContext.Control.IsDesignMode)
            {
                renderingContext.Writer.AddStyleAttribute("list-style", "none");
                renderingContext.Writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
                renderingContext.Writer.AddStyleAttribute("display", "inline");
            }
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Ul); // Begin List
        }
Ejemplo n.º 10
0
        protected virtual Command RenderBeginTagForCommand(WebTabStripRenderingContext renderingContext, IWebTab tab, bool isEnabled, WebTabStyle style)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);
            ArgumentUtility.CheckNotNull("style", style);

            var command = new Command();

            command.OwnerControl = renderingContext.Control;
            command.ItemID       = tab.ItemID + "_Command";
            if (isEnabled && tab.EvaluateEnabled())
            {
                command.Type = CommandType.Event;

                var textWithHotkey = HotkeyParser.Parse(tab.Text);
                if (textWithHotkey.Hotkey.HasValue)
                {
                    command.AccessKey = _hotkeyFormatter.FormatHotkey(textWithHotkey);
                }
            }
            else
            {
                command.Type = CommandType.None;
            }

            command.RenderBegin(
                renderingContext.Writer,
                RenderingFeatures,
                tab.GetPostBackClientEvent(),
                new string[0],
                string.Empty,
                null,
                new NameValueCollection(),
                false,
                style);

            return(command);
        }
Ejemplo n.º 11
0
        public void Render(WebTabStripRenderingContext renderingContext)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);

            _webTabRenderer.Render(renderingContext, _webTab, _isEnabled, _isLast, _webTabStyle);
        }
Ejemplo n.º 12
0
 private string GetTabClientID(WebTabStripRenderingContext renderingContext, IWebTab tab)
 {
     return(renderingContext.Control.ClientID + "_" + tab.ItemID);
 }
 private void RenderClearingPane(WebTabStripRenderingContext renderingContext)
 {
     renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassClearingPane);
     renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div);
     renderingContext.Writer.RenderEndTag();
 }
 private void RenderEndTabsPane(WebTabStripRenderingContext renderingContext)
 {
     renderingContext.Writer.RenderEndTag(); // End List
     renderingContext.Writer.RenderEndTag(); // End Div
 }