private HtmlGenericControl GetPreLoadControl(JsonTab mouseOverTemp, string imageName) { HtmlGenericControl preload = new HtmlGenericControl("span"); preload.Attributes.Add("id", this.JsonId + "_preload_" + imageName); preload.Style.Add("position", "absolute"); preload.Style.Add("top", "-1000"); preload.Style.Add("left", "-1000"); preload.Style.Add(HtmlTextWriterStyle.BackgroundImage, string.Format("url('{0}')", mouseOverTemp.GetTabImageUrl(imageName))); return(preload); }
public override void WireScriptsAndValidate() { this.ValidateColors(); controlToRender.Attributes.Add("id", this.DomId); if (!this.IsFirst) { controlToRender.Style.Add("margin-left", "-4"); } else { controlToRender.Style.Add("margin-bottom", "-1"); } this.mouseOverProxy = new JsonTab(); this.SetMouseOverProperties(); if (!this.Selected) { this.CreateEventScript(mouseoverFunction, mouseOverProxy); this.CreateEventScript(mouseoutFunction, this); this.wireupFunction.AppendScriptBodyFormat("JSUI.AddEventHandler('{0}', {1}, 'mouseover');", this.DomId, mouseoverFunction.JsonId); this.wireupFunction.AppendScriptBodyFormat("JSUI.AddEventHandler('{0}', {1}, 'mouseout');", this.DomId, mouseoutFunction.JsonId); this.AddJsonFunction(this.mouseoverFunction); this.AddJsonFunction(this.mouseoutFunction); } if (this.ClickActionType != ClientClickActionType.None) { this.wireupFunction.AppendScriptBodyFormat("JSUI.AddEventHandler('{0}', {1}, 'click');", this.DomId, clickFunction.JsonId); switch (this.ClickActionType) { case ClientClickActionType.Script: this.clickFunction.AppendScriptBodyFormat("{0}();", this.ClickActionTarget); break; case ClientClickActionType.Navigate: this.clickFunction.AppendScriptBodyFormat("window.location = '{0}';", this.ClickActionTarget); break; } this.AddJsonFunction(this.clickFunction); } this.wireupFunction.AppendScriptBodyFormat("JSUI.SetHandCursor('{0}');", this.DomId); this.wireupFunction.ExecutionType = JavascriptExecutionTypes.OnWindowLoad; this.AddJsonFunction(wireupFunction); }
private void CreateEventScript(JsonFunction targetFunction, JsonTab tabDefinition) { targetFunction.AppendScriptBodyFormat( "JSUI.GetElement('{0}').style.backgroundImage = \"url({1})\";", this.JsonId + "_mid", tabDefinition.GetTabImageUrl("MiddleSection")); targetFunction.AppendScriptBodyFormat( "JSUI.GetElement('{0}').style.backgroundImage = \"url({1})\";", this.JsonId + "_left", tabDefinition.GetTabImageUrl("FirstSide")); targetFunction.AppendScriptBodyFormat( "JSUI.GetElement('{0}').style.backgroundImage = \"url({1})\";", this.JsonId + "_right", tabDefinition.GetTabImageUrl("LastSide")); //this.AddJsonFunction(targetFunction); }
private HtmlGenericControl GetPreLoadControl(JsonTab mouseOverTemp, string imageName) { HtmlGenericControl preload = new HtmlGenericControl("span"); preload.Attributes.Add("id", this.JsonId + "_preload_" + imageName); preload.Style.Add("position", "absolute"); preload.Style.Add("top", "-1000"); preload.Style.Add("left", "-1000"); preload.Style.Add(HtmlTextWriterStyle.BackgroundImage, string.Format("url('{0}')", mouseOverTemp.GetTabImageUrl(imageName))); return preload; }
public override void WireScriptsAndValidate() { this.ValidateColors(); controlToRender.Attributes.Add("id", this.DomId); if (!this.IsFirst) controlToRender.Style.Add("margin-left", "-4"); else controlToRender.Style.Add("margin-bottom", "-1"); this.mouseOverProxy = new JsonTab(); this.SetMouseOverProperties(); if (!this.Selected) { this.CreateEventScript(mouseoverFunction, mouseOverProxy); this.CreateEventScript(mouseoutFunction, this); this.wireupFunction.AppendScriptBodyFormat("JSUI.AddEventHandler('{0}', {1}, 'mouseover');", this.DomId, mouseoverFunction.JsonId); this.wireupFunction.AppendScriptBodyFormat("JSUI.AddEventHandler('{0}', {1}, 'mouseout');", this.DomId, mouseoutFunction.JsonId); this.AddJsonFunction(this.mouseoverFunction); this.AddJsonFunction(this.mouseoutFunction); } if (this.ClickActionType != ClientClickActionType.None) { this.wireupFunction.AppendScriptBodyFormat("JSUI.AddEventHandler('{0}', {1}, 'click');", this.DomId, clickFunction.JsonId); switch (this.ClickActionType) { case ClientClickActionType.Script: this.clickFunction.AppendScriptBodyFormat("{0}();", this.ClickActionTarget); break; case ClientClickActionType.Navigate: this.clickFunction.AppendScriptBodyFormat("window.location = '{0}';", this.ClickActionTarget); break; } this.AddJsonFunction(this.clickFunction); } this.wireupFunction.AppendScriptBodyFormat("JSUI.SetHandCursor('{0}');", this.DomId); this.wireupFunction.ExecutionType = JavascriptExecutionTypes.OnWindowLoad; this.AddJsonFunction(wireupFunction); }
public void AddTab(JsonTab tab) { tabs.Add(tab); }
public override void WireScriptsAndValidate() { if (!wired) { List <string> tabHeaders = new List <string>();; if (!string.IsNullOrEmpty(this.TabHeaders)) { tabHeaders = new List <string>(StringExtensions.DelimitSplit(this.TabHeaders, new string[] { ",", ";" }, true)); } List <string> tabColors = new List <string>(); if (!string.IsNullOrEmpty(this.TabColors)) { tabColors = new List <string>(StringExtensions.DelimitSplit(this.TabColors, new string[] { ",", ";" }, true)); } List <string> tabLineWidths = new List <string>(); if (!string.IsNullOrEmpty(this.TabLineWidths)) { tabLineWidths = new List <string>(StringExtensions.DelimitSplit(this.TabLineWidths, new string[] { ",", ";" }, true)); } List <string> tabMouseOverFillColors = new List <string>(); if (!string.IsNullOrEmpty(this.TabColorsMouseOver)) { tabMouseOverFillColors = new List <string>(StringExtensions.DelimitSplit(this.TabColorsMouseOver, new string[] { ",", ";" }, true)); } List <string> tabHeights = new List <string>(); if (!string.IsNullOrEmpty(this.TabHeights)) { tabHeights = new List <string>(StringExtensions.DelimitSplit(this.TabHeights, new string[] { ",", ";" }, true)); } for (int i = 0; i < tabHeaders.Count; i++) { JsonTab tab = new JsonTab(tabHeaders[i]); tab.TextPadding = this.TextPadding; tab.HorizontalMargin = this.TabSpacing; tab.CornerRadius = this.TabCornerRadius; tab.VerticalMargin = this.TabVerticalMargin; tab.LineColor = this.TabLineColor; tab.MouseOverLineColor = this.MouseOverLineColor; if (!string.IsNullOrEmpty(this.TabCssClass)) { tab.CssClass = this.TabCssClass; } if (this.SelectedIndex == i) { tab.Selected = true; if (!string.IsNullOrEmpty(this.SelectedCssClass)) { tab.CssClass = this.SelectedCssClass; } } tab.MouseOverBackgroundColor = this.BackgroundColor; tab.BackgroundColor = this.BackgroundColor; if (this.clickActions.Count > i) { tab.ClickActionTarget = this.clickActions[i].Target; tab.ClickActionType = this.clickActions[i].ActionType; } if (tabMouseOverFillColors.Count > i) { tab.MouseOverFillColor = tabMouseOverFillColors[i]; } else { if (tab.Selected) { tab.MouseOverFillColor = this.SelectedColor; } else { tab.MouseOverFillColor = this.MouseOverTabColor; } } if (tabColors.Count > i) { tab.FillColor = tabColors[i]; } else { if (tab.Selected) { tab.FillColor = this.SelectedColor; } else { tab.FillColor = this.TabColor; } } if (tabLineWidths.Count > i) { tab.LineWidth = Convert.ToInt32(tabLineWidths[i]); } else { tab.LineWidth = this.TabLineWidth; } if (tabHeights.Count > i && !tab.Selected) { int height = -1; if (int.TryParse(tabHeights[i], out height)) { tab.TabHeight = height; } } else if (tab.Selected) { tab.TabHeight = this.TabHeight + 5; } else { tab.TabHeight = this.TabHeight; } tab.WireScriptsAndValidate(); tab.RenderScripts = false; foreach (JsonFunction function in tab.Scripts) { this.AddJsonFunction(function); } this.AddTab(tab); } //if (this.tabs.Count >= this.SelectedIndex) //{ // this.tabs[this.SelectedIndex].Selected = true; // this.tabs[this.SelectedIndex].TabHeight += 5; // this.tabs[this.SelectedIndex].FillColor = this.SelectedColor; // this.tabs[this.SelectedIndex].MouseOverFillColor = this.SelectedColor; // this.tabs[this.SelectedIndex].SetMouseOverProperties(); //} for (int i = 1; i < this.tabs.Count; i++) { this.tabs[i].IsFirst = false; } wired = true; } }
public override void WireScriptsAndValidate() { if (!wired) { List<string> tabHeaders = new List<string>(); ; if (!string.IsNullOrEmpty(this.TabHeaders)) tabHeaders = new List<string>(StringExtensions.DelimitSplit(this.TabHeaders, new string[] { ",", ";" }, true)); List<string> tabColors = new List<string>(); if (!string.IsNullOrEmpty(this.TabColors)) tabColors = new List<string>(StringExtensions.DelimitSplit(this.TabColors, new string[] { ",", ";" }, true)); List<string> tabLineWidths = new List<string>(); if (!string.IsNullOrEmpty(this.TabLineWidths)) tabLineWidths = new List<string>(StringExtensions.DelimitSplit(this.TabLineWidths, new string[] { ",", ";" }, true)); List<string> tabMouseOverFillColors = new List<string>(); if (!string.IsNullOrEmpty(this.TabColorsMouseOver)) tabMouseOverFillColors = new List<string>(StringExtensions.DelimitSplit(this.TabColorsMouseOver, new string[] { ",", ";" }, true)); List<string> tabHeights = new List<string>(); if (!string.IsNullOrEmpty(this.TabHeights)) tabHeights = new List<string>(StringExtensions.DelimitSplit(this.TabHeights, new string[] { ",", ";" }, true)); for (int i = 0; i < tabHeaders.Count; i++) { JsonTab tab = new JsonTab(tabHeaders[i]); tab.TextPadding = this.TextPadding; tab.HorizontalMargin = this.TabSpacing; tab.CornerRadius = this.TabCornerRadius; tab.VerticalMargin = this.TabVerticalMargin; tab.LineColor = this.TabLineColor; tab.MouseOverLineColor = this.MouseOverLineColor; if (!string.IsNullOrEmpty(this.TabCssClass)) tab.CssClass = this.TabCssClass; if (this.SelectedIndex == i) { tab.Selected = true; if (!string.IsNullOrEmpty(this.SelectedCssClass)) tab.CssClass = this.SelectedCssClass; } tab.MouseOverBackgroundColor = this.BackgroundColor; tab.BackgroundColor = this.BackgroundColor; if (this.clickActions.Count > i) { tab.ClickActionTarget = this.clickActions[i].Target; tab.ClickActionType = this.clickActions[i].ActionType; } if (tabMouseOverFillColors.Count > i) { tab.MouseOverFillColor = tabMouseOverFillColors[i]; } else { if (tab.Selected) tab.MouseOverFillColor = this.SelectedColor; else tab.MouseOverFillColor = this.MouseOverTabColor; } if (tabColors.Count > i) { tab.FillColor = tabColors[i]; } else { if (tab.Selected) tab.FillColor = this.SelectedColor; else tab.FillColor = this.TabColor; } if (tabLineWidths.Count > i) tab.LineWidth = Convert.ToInt32(tabLineWidths[i]); else tab.LineWidth = this.TabLineWidth; if (tabHeights.Count > i && !tab.Selected) { int height = -1; if (int.TryParse(tabHeights[i], out height)) { tab.TabHeight = height; } } else if (tab.Selected) { tab.TabHeight = this.TabHeight + 5; } else { tab.TabHeight = this.TabHeight; } tab.WireScriptsAndValidate(); tab.RenderScripts = false; foreach (JsonFunction function in tab.Scripts) { this.AddJsonFunction(function); } this.AddTab(tab); } //if (this.tabs.Count >= this.SelectedIndex) //{ // this.tabs[this.SelectedIndex].Selected = true; // this.tabs[this.SelectedIndex].TabHeight += 5; // this.tabs[this.SelectedIndex].FillColor = this.SelectedColor; // this.tabs[this.SelectedIndex].MouseOverFillColor = this.SelectedColor; // this.tabs[this.SelectedIndex].SetMouseOverProperties(); //} for (int i = 1; i < this.tabs.Count; i++) { this.tabs[i].IsFirst = false; } wired = true; } }