Exemple #1
0
        public JsonTab()
            : base()
        {
            controlToRender.TagName = "span";
            this.Styles[HtmlTextWriterStyle.Display] = "inline-block";
            if (BrowserAccessHelper.IsIELessThanOrEqualTo(6))
            {
                this.Styles[HtmlTextWriterStyle.Width] = "100%";
            }
            this.TabHeight                = 20;
            this.VerticalMargin           = 3;
            this.LineWidth                = 1;
            this.LineColor                = "#000000";
            this.MouseOverLineColor       = "#000000";
            this.BackgroundColor          = "#FFFFFF";
            this.MouseOverBackgroundColor = "#FFFFFF";
            this.FillColor                = "#787878";
            this.MouseOverFillColor       = "#9A9A9A";
            this.TextPadding              = 10;
            this.CornerRadius             = 8;
            this.HorizontalMargin         = 3;
            this.IsFirst = true;

            this.mouseoverFunction = new JsonFunction();
            this.mouseoverFunction.ExecutionType = JavascriptExecutionTypes.Call;
            this.mouseoutFunction = new JsonFunction();
            this.mouseoutFunction.ExecutionType = JavascriptExecutionTypes.Call;
            this.wireupFunction = new JsonFunction();
            this.clickFunction  = new JsonFunction();
            this.clickFunction.ExecutionType = JavascriptExecutionTypes.Call;
        }
Exemple #2
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);


            this.controlToRender.Style.Add(HtmlTextWriterStyle.Height, this.SpanHeight + "px");

            HtmlGenericControl preloadLeft   = GetPreLoadControl(mouseOverProxy, "FirstSide");
            HtmlGenericControl preloadMiddle = GetPreLoadControl(mouseOverProxy, "MiddleSection");
            HtmlGenericControl preloadRight  = GetPreLoadControl(mouseOverProxy, "LastSide");

            this.controlToRender.Style.Add("vertical-align", "bottom");
            this.controlToRender.Style.Add("padding", "0px");
            HtmlGenericControl middleImage = new HtmlGenericControl("span");

            middleImage.Attributes.Add("id", this.JsonId + "_mid");
            middleImage.Style.Add(HtmlTextWriterStyle.BackgroundImage, string.Format("url('{0}')", this.GetTabImageUrl("MiddleSection")));
            middleImage.Style.Add("background-repeat", "repeat-x");
            middleImage.Style.Add("height", this.SpanHeight + "px");
            //middleImage.Style.Add("height", "100%");
            middleImage.Style.Add("display", "block");
            middleImage.Style.Add("vertical-align", "bottom");

            HtmlGenericControl leftSide = new HtmlGenericControl("span");

            leftSide.Attributes.Add("id", this.JsonId + "_left");
            leftSide.Style.Add(HtmlTextWriterStyle.BackgroundImage, string.Format("url('{0}')", this.GetTabImageUrl("FirstSide")));
            leftSide.Style.Add("background-repeat", "no-repeat");
            leftSide.Style.Add("height", this.SpanHeight + "px");
            //leftSide.Style.Add("height", "100%");
            leftSide.Style.Add("display", "block");

            HtmlGenericControl rightSide = new HtmlGenericControl("span");

            rightSide.Attributes.Add("id", this.JsonId + "_right");
            rightSide.Style.Add(HtmlTextWriterStyle.BackgroundImage, string.Format("url('{0}')", this.GetTabImageUrl("LastSide")));
            rightSide.Style.Add("background-repeat", "no-repeat");
            rightSide.Style.Add("background-position", "right top");
            rightSide.Style.Add("display", "block");
            rightSide.Style.Add("height", this.SpanHeight + "px");
            //rightSide.Style.Add("height", "100%");

            HtmlGenericControl tabText = new HtmlGenericControl("span");

            tabText.Attributes.Add("id", this.JsonId + "_text");

            tabText.Attributes.Add("class", this.CssClass);
            //tabText.Style.Add("height", "100%");
            tabText.Style.Add("display", "block");
            if (BrowserAccessHelper.IsIELessThanOrEqualTo(6))
            {
                tabText.Style.Add("width", "100%");
            }
            tabText.Style.Add("vertical-align", "middle");
            tabText.Style.Add("padding", this.TextPadding + "px");
            tabText.Controls.Add(new LiteralControl(this.Text));

            rightSide.Controls.Add(tabText);
            leftSide.Controls.Add(rightSide);
            middleImage.Controls.Add(leftSide);
            controlToRender.Controls.Add(middleImage);

            controlToRender.Controls.Add(preloadLeft);
            controlToRender.Controls.Add(preloadMiddle);
            controlToRender.Controls.Add(preloadRight);

            controlToRender.RenderControl(writer);
            if (RenderScripts)
            {
                this.RenderConglomerateScript(writer);
            }
        }
Exemple #3
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);
            this.controlToRender.Attributes.Add("id", this.DomId);
            this.controlToRender.Attributes.Add("jsonid", this.JsonId);
            this.controlToRender.Style.Add("white-space", "nowrap");

            if (BrowserAccessHelper.IsIELessThanOrEqualTo(6))
            {
                this.RenderScripts = false;
                HtmlTable table = new HtmlTable();
                table.CellPadding = 0;
                table.CellSpacing = 0;
                HtmlTableRow row = new HtmlTableRow();
                table.Style.Add("width", this.IE6Width + "px");
                table.Style.Add("border", "1px solid " + this.TabLineColor);
                int  index = 0;
                bool first = true;
                foreach (JsonTab tab in this.tabs)
                {
                    HtmlTableCell cell = new HtmlTableCell();
                    cell.Style.Add("whitespace", "nowrap");
                    cell.Style.Add("vertical-align", "bottom");
                    cell.Style.Add("padding", this.TabCornerRadius + "px");
                    if (!first)
                    {
                        cell.Style.Add("border-left", "1px solid black");
                    }

                    HtmlGenericControl text = ControlHelper.NewSpan(tab.Text, "");
                    if (tab.Selected)
                    {
                        cell.Style.Add("background-color", this.SelectedColor);
                    }
                    else
                    {
                        cell.Style.Add("background-color", this.TabColor);
                        cell.Attributes.Add("onmouseover", "this.style.backgroundColor = '" + this.MouseOverTabColor + "'");
                        cell.Attributes.Add("onmouseout", "this.style.backgroundColor = '" + this.TabColor + "'");
                        cell.Style.Add("cursor", "pointer");
                        cell.Style.Add("cursor", "hand");
                        if (this.clickActions.Count > index)
                        {
                            if (this.clickActions[index].ActionType == ClientClickActionType.Navigate)
                            {
                                cell.Attributes.Add("onclick", "window.location = '" + this.clickActions[index].Target + "';");
                            }
                            else
                            {
                                cell.Attributes.Add("onclick", this.clickActions[index].Target);
                            }
                        }
                    }
                    cell.Controls.Add(text);
                    row.Cells.Add(cell);
                    first = false;
                    index++;
                }
                table.Rows.Add(row);
                this.controlToRender.Controls.Add(table);
            }
            else
            {
                foreach (JsonTab tab in this.tabs)
                {
                    this.controlToRender.Controls.Add(tab);
                }
            }

            this.controlToRender.RenderControl(writer);
            if (this.RenderScripts)
            {
                this.RenderConglomerateScript(writer);
            }
        }