protected string RenderCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 1); if (this.renderCSS || !this.prettyRender) { // only add if we're using the non-default settings sb.AppendTabsLineIf(".Rendering"); sb.IncIndent(); if (!this.prettyRender) sb.AppendTabsLineIf(".Compress()"); if (this.renderCSS) sb.AppendTabsLineIf(".ShowCSS()"); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } return sb.ToString(); }
public string CSharpCode(ProgressBar pb) { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0); sb.AppendTabsLineIf("<%"); sb.AppendTabsFormatLineIf("Html.CreateProgressBar(\"{0}\")", pb.ID ); string optionsCode = OptionsCSharpCode(); string showEventsCode = ShowEventsCSharpCode(); string renderCode = base.RenderCSharpCode(); bool showOptions = (optionsCode.Length > 0 || showEventsCode.Length > 0 || renderCode.Length > 0); if (showOptions) { sb.IncIndent(); if (optionsCode.Length > 0) { sb.AppendTabsLineIf(".Options"); sb.IncIndent(); sb.Append(optionsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (showEventsCode.Length > 0) { sb.AppendTabsLineIf(".Events"); sb.IncIndent(); sb.Append(showEventsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (renderCode.Length > 0) sb.Append(renderCode); sb.DecIndent(); } sb.AppendTabsLineIf(".Render();"); sb.AppendTabsLineIf("%>"); return sb.ToString(); }
/// <summary> /// Renders the panel header and returns the HTML /// </summary> /// <returns></returns> internal string GetTagHtml() { Accordion ac = this.OnPanel.OnAccordion; bool prettyRender = ac.Rendering.PrettyRender; bool renderCss = ac.Rendering.RenderCSS; int tabDepth = ac.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth + 1); // H3 tag (or whatever if it's been overridden in the options) sb.AppendLineIf(); sb.AppendTabsFormatIf("<{0}", ac.Options.HeadingTag); if (renderCss) { base.WithCss("ui-accordion-header ui-helper-reset ui-state-default"); if (this.OnPanel.IsActive) base.WithCss("ui-state-active ui-corner-top"); else base.WithCss("ui-corner-all"); } // add in any attributes the user has added base.RenderAttributes(sb); // and close off the starting H3 tag sb.AppendLineIf(">"); // now add in the hyperlink that lives inside the H3 sb.IncIndent(); sb.AppendTabsLineIf(this.Hyperlink.GetTagHtml()); sb.DecIndent(); // Closing heading (H3) sb.AppendTabsFormatLineIf("</{0}>", ac.Options.HeadingTag); return sb.ToString(); }
} // Render /// <summary> /// Writes out the calling script for the jQuery Tabs plugin, adding options that have been /// a defined. /// </summary> /// <param name="tabDepth"> /// How far to indent the script code setting. /// </param> /// <returns> /// Returns rendered initialisation script /// </returns> protected internal string GetControlScript(int tabDepth) { jStringBuilder sb = new jStringBuilder(this.Rendering.PrettyRender, this.Rendering.TabDepth); sb.IncIndent(); sb.AppendTabsFormatIf("$(\"#{0}\").autocomplete(", this.ID); Core.ScriptOptions options = new Core.ScriptOptions(); this.Options.DiscoverOptions(options); this.Events.DiscoverOptions(options); options.Render(sb); sb.Append(");"); sb.DecIndent(); return sb.ToString(); }
public string CSharpCode(AutoComplete ac) { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0); sb.AppendTabsLineIf("<%"); sb.AppendTabsFormatLineIf("Html.CreateAutoComplete(\"{0}\", {1})", ac.ID, this.GetSource()); string optionsCode = OptionsCSharpCode(); string positionOptionsCode = PositionsCSharpCode(); string showEventsCode = ShowEventsCSharpCode(); string renderCode = base.RenderCSharpCode(); bool showOptions = (optionsCode.Length > 0 || positionOptionsCode.Length > 0 || showEventsCode.Length > 0 || renderCode.Length > 0); if (showOptions) { sb.IncIndent(); if (optionsCode.Length > 0 || positionOptionsCode.Length > 0) { sb.AppendTabsLineIf(".Options"); sb.IncIndent(); sb.Append(optionsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (positionOptionsCode.Length > 0) { sb.AppendTabsLineIf(".Options"); sb.IncIndent(); sb.Append(optionsCode); if (positionOptionsCode.Length > 0) { sb.AppendTabsLineIf(".Position"); sb.Append(positionOptionsCode); sb.AppendTabsLineIf(".Finish()"); } sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (showEventsCode.Length > 0) { sb.AppendTabsLineIf(".Events"); sb.IncIndent(); sb.Append(showEventsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (renderCode.Length > 0) sb.Append(renderCode); sb.DecIndent(); } sb.AppendTabsLineIf(".Render();"); sb.AppendTabsLineIf("%>"); return sb.ToString(); }
public string CSharpCode(Accordion ac) { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0); sb.AppendTabsLineIf("<%"); sb.AppendTabsFormatLineIf("var ac = Html.CreateAccordion(\"{0}\")", ac.ID); string optionsCode = OptionsCSharpCode(); string showEventsCode = ShowEventsCSharpCode(); string renderCode = base.RenderCSharpCode(); sb.IncIndent(); if (optionsCode.Length > 0) { sb.AppendTabsLineIf(".Options"); sb.IncIndent(); sb.Append(optionsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (showEventsCode.Length > 0) { sb.AppendTabsLineIf(".Events"); sb.IncIndent(); sb.Append(showEventsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (renderCode.Length > 0) sb.Append(renderCode); sb.DecIndent(); sb.IncIndent(); sb.AppendTabsLineIf(".Panels"); sb.IncIndent(); sb.AppendTabsFormatLineIf(".Add(\"My Panel 1\"{0})", (this.activePanel == 0 ? ", true" : "") ); sb.AppendTabsFormatLineIf(".Add(\"My Panel 2\"{0})", (this.activePanel == 1 ? ", true" : "") ); sb.AppendTabsFormatLineIf(".Add(\"My Panel 3\"{0})", (this.activePanel == 2 ? ", true" : "") ); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); sb.DecIndent(); sb.AppendTabsLineIf(";"); sb.AppendTabsLineIf("%>"); sb.AppendLineIf(); sb.AppendTabsLineIf("<%using (ac.RenderContainer()) {%>"); sb.IncIndent(); sb.AppendTabsLineIf("<%using (ac.Panels.RenderNextPane()) {%>"); sb.AppendTabsLineIf("\t<p>Proin ...</p>"); sb.AppendTabsLineIf("<%}%>"); sb.AppendTabsLineIf("<%using (ac.Panels.RenderNextPane()) {%>"); sb.AppendTabsLineIf("\t<p>Morbi ...</p>"); sb.AppendTabsLineIf("<%}%>"); sb.AppendTabsLineIf("<%using (ac.Panels.RenderNextPane()) {%>"); sb.AppendTabsLineIf("\t<p>Mauris ...</p>"); sb.AppendTabsLineIf("<%}%>"); sb.DecIndent(); sb.AppendTabsLineIf("<%}%>"); return sb.ToString(); }
} // RenderHeader /// <summary> /// Writes out the opening part of the content part of the jQuery UI tab (the DIV just after the LI header) /// that belongs to this particular tab. So basically this marries up the LI and the content for the LI. /// </summary> /// <param name="sb"></param> private void RenderBody(jStringBuilder sb) { bool renderCss = this.Panes.Tabs.Rendering.RenderCSS; bool prettyRender = this.Panes.Tabs.Rendering.PrettyRender; this.WithID(this.IDOrLocation); if (renderCss) this.WithCss("ui-tabs-panel ui-widget-content ui-corner-bottom"); sb.IncIndent(); sb.AppendTabsIf("<div"); base.RenderAttributes(sb); sb.AppendLineIf(">"); sb.DecIndent(); }
/// <summary> /// Writes out the opening part of a jQuery UI tab (the LI) /// </summary> internal void RenderHeader(jStringBuilder sb) { if (!this.Visible) // literally nothing to see here! return; string selected = ""; bool prettyRender = this.Panes.Tabs.Rendering.PrettyRender; bool renderCss = this.Panes.Tabs.Rendering.RenderCSS; if (renderCss) { if (this.IsActive) selected = " ui-tabs-active ui-state-active"; sb.AppendTabsFormatLineIf("<li class=\"ui-state-default ui-corner-top{0}\">", selected); } else { sb.AppendTabsFormatLineIf("<li>"); } sb.IncIndent(); if (this.Panes.Tabs._AsDynamic) { sb.AppendTabsFormatLineIf("<a href=\"{0}\"><span>{1}</span></a>", this.IDOrLocation, HttpUtility.HtmlEncode(this.Title) ); } else { sb.AppendTabsFormatLineIf("<a href=\"#{0}\" title=\"{1}\">{1}</a>", HttpUtility.HtmlEncode(this.IDOrLocation), HttpUtility.HtmlEncode(this.Title) ); } sb.DecIndent(); sb.AppendTabsLineIf("</li>"); } // RenderHeader
public string CSharpCode(Menu mnu) { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0); sb.AppendTabsLineIf("<%"); sb.AppendTabsLineIf("Html.CreateMenu(\"mnu\")"); string optionsCode = OptionsCSharpCode(); string positionOptionsCode = PositionsCSharpCode(); string showEventsCode = ShowEventsCSharpCode(); string renderCode = base.RenderCSharpCode(); bool showOptions = (optionsCode.Length > 0 || positionOptionsCode.Length > 0 || showEventsCode.Length > 0 || renderCode.Length > 0); if (showOptions) { sb.IncIndent(); if (optionsCode.Length > 0 || positionOptionsCode.Length > 0) { sb.AppendTabsLineIf(".Options"); sb.IncIndent(); sb.Append(optionsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (positionOptionsCode.Length > 0) { sb.IncIndent(); if (positionOptionsCode.Length > 0) { sb.AppendTabsLineIf(".Position"); sb.Append(positionOptionsCode); sb.AppendTabsLineIf(".Finish()"); } sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (showEventsCode.Length > 0) { sb.AppendTabsLineIf(".Events"); sb.IncIndent(); sb.Append(showEventsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (renderCode.Length > 0) sb.Append(renderCode); sb.DecIndent(); } sb.AppendTabsLineIf(".Render();"); sb.AppendTabsLineIf("%>"); return sb.ToString(); }
public string CSharpCode(Tabs tabs) { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0); sb.AppendTabsLineIf("<%"); sb.AppendTabsFormatLineIf("var tabs = Html.CreateTabs(\"{0}\")", tabs.ID); string optionsCode = OptionsCSharpCode(); string showEventsCode = ShowEventsCSharpCode(); string renderCode = base.RenderCSharpCode(); bool showOptions = (optionsCode.Length > 0 || showEventsCode.Length > 0 || renderCode.Length > 0); if (showOptions) { sb.IncIndent(); if (optionsCode.Length > 0) { sb.AppendTabsLineIf(".Options"); sb.IncIndent(); sb.Append(optionsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (showEventsCode.Length > 0) { sb.AppendTabsLineIf(".Events"); sb.IncIndent(); sb.Append(showEventsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (renderCode.Length > 0) sb.Append(renderCode); sb.DecIndent(); } sb.IncIndent(); sb.AppendTabsLineIf(".Panes"); sb.IncIndent(); sb.AppendTabsFormatLineIf(".Add(\"tab1\", \"Tab #1\"{0})", (this.selectedTab == 0 ? ", true" : "") ); sb.AppendTabsFormatLineIf(".Add(\"tab2\", \"Tab #2\"{0})", (this.selectedTab == 1 ? ", true" : "") ); sb.AppendTabsFormatLineIf(".Add(\"tab3\", \"Tab #3\"{0})", (this.selectedTab == 2 ? ", true" : "") ); sb.DecIndent(); sb.AppendTabsLineIf(".Finish();"); sb.DecIndent(); sb.AppendTabsLineIf("%>"); sb.AppendLineIf(); sb.AppendTabsLineIf("<%using (tabs.RenderHeader()) {%>"); sb.IncIndent(); sb.AppendTabsLineIf("<%using (tabs.Panes.RenderNextPane()) {%>"); sb.AppendTabsLineIf("\t<p>Proin ...</p>"); sb.AppendTabsLineIf("<%}%>"); sb.AppendTabsLineIf("<%using (tabs.Panes.RenderNextPane()) {%>"); sb.AppendTabsLineIf("\t<p>Morbi ...</p>"); sb.AppendTabsLineIf("<%}%>"); sb.AppendTabsLineIf("<%using (tabs.Panes.RenderNextPane()) {%>"); sb.AppendTabsLineIf("\t<p>Mauris ...</p>"); sb.AppendTabsLineIf("<%}%>"); sb.DecIndent(); sb.AppendTabsLineIf("<%}%>"); return sb.ToString(); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (this.collapsible) sb.AppendTabsLineIf(".SetCollapsible(true)"); sb.AppendTabsLineIf(".ShowAnimation"); sb.IncIndent(); sb.AppendTabsFormatLineIf(".SetEffect(\"{0}\")", this.showEffect); if (!Utils.IsNullEmptyOrDefault(this.showDuration, Fluqi.Utilities.jAnimation.Options.DEFAULT_DURATION)) sb.AppendTabsFormatLineIf(".SetDuration(\"{0}\")", this.showDuration); sb.AppendTabsLineIf(".Finish()"); sb.DecIndent(); sb.AppendTabsLineIf(".HideAnimation"); sb.IncIndent(); sb.AppendTabsFormatLineIf(".SetEffect(\"{0}\")", this.hideEffect); if (!Utils.IsNullEmptyOrDefault(this.hideDuration, Fluqi.Utilities.jAnimation.Options.DEFAULT_DURATION)) sb.AppendTabsFormatLineIf(".SetDuration(\"{0}\")", this.hideDuration); sb.AppendTabsLineIf(".Finish()"); sb.DecIndent(); if (!Utils.IsNullEmptyOrDefault(this.evt, Options.DEFAULT_EVENT)) sb.AppendTabsFormatLineIf(".SetEvent(\"{0}\")", this.evt); return sb.ToString(); }
/// <summary> /// Builds and returns the HTML required for the opening of the Tabs control. /// </summary> /// <returns>HTML for the opening of the tabs control.</returns> protected internal string GetTagHtml() { bool prettyRender = this.Rendering.PrettyRender; bool renderCss = this.Rendering.RenderCSS; int tabDepth = this.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); // Work out if we have an active tab set, if not default to the first one if (!this.Panes.HasSelectedTab() && _Panes._Panes.Any()) _Panes._Panes.Values.FirstOrDefault().IsSelected = true; if (renderCss) { this.WithCss("ui-tabs ui-widget ui-widget-content ui-corner-all"); } this.WithID(this.ID); sb.Append("<div"); this.RenderAttributes(sb); sb.AppendLineIf(">"); // Open Tabs header sb.IncIndent(); if (renderCss) sb.AppendTabsFormatLineIf("<ul class=\"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all\">"); else sb.AppendTabsLineIf("<ul>"); // Have each tab render it's Header link _HeaderRendered = true; // main header rendered sb.IncIndent(); foreach (Pane tb in _Panes._Panes.Values) { tb.RenderHeader(sb); } // Close Tabs header sb.DecIndent(); sb.AppendTabsLineIf("</ul>"); // Finally prep for iterating over the tabs this.Panes.ResetEnumerator(); return sb.ToString(); }
/// <summary> /// Writes out the calling script for the jQuery Tabs plugin, adding options that have been /// a defined. /// </summary> /// <param name="tabDepth"> /// How far to indent the script code setting. /// </param> /// <returns> /// Returns rendered initialisation script /// </returns> protected internal string GetControlScript(int tabDepth) { jStringBuilder sb = new jStringBuilder(this.Rendering.PrettyRender, this.Rendering.TabDepth); string selector = ""; if (IsGlobal()) selector = Options.DEFAULT_TARGET; else selector = string.Format("\"#{0}\"", this.ID); sb.IncIndent(); sb.AppendTabsFormatIf("$({0}).tooltip(", selector); Core.ScriptOptions options = new Core.ScriptOptions(); this.Options.DiscoverOptions(options); this.Events.DiscoverOptions(options); options.Render(sb); sb.Append(");"); sb.DecIndent(); return sb.ToString(); }
/// <summary> /// Writes out the calling script for the jQuery Tabs plugin, adding options that have been /// a defined. /// </summary> /// <param name="tabDepth"> /// How far to indent the script code (see <see cref="Core.Rendering.PrettyRender"/> setting. /// </param> /// <returns> /// Returns rendered initialisation script /// </returns> public string GetControlScript(int tabDepth) { jStringBuilder sb = new jStringBuilder(this.Rendering.PrettyRender, this.Rendering.TabDepth); sb.IncIndent(); sb.AppendTabsFormatIf("$.ajax(", this.ID); Core.ScriptOptions options = new Core.ScriptOptions(); this.Options.DiscoverOptions(options); options.Render(sb); sb.Append(");"); sb.DecIndent(); return sb.ToString(); }
public string CSharpCode() { Dialog dlg = BuildDialogFromModel(this.Writer, "js_dlg"); jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0); sb.AppendTabsLineIf("<%"); sb.AppendTabsLineIf("Dialog dlg = Html.CreateDialog(\"dlg\")"); string optionsCode = OptionsCSharpCode(); string showEventsCode = ShowEventsCSharpCode(); string renderCode = base.RenderCSharpCode(); bool showOptions = (optionsCode.Length > 0 || showEventsCode.Length > 0 || renderCode.Length > 0); if (showOptions) { sb.IncIndent(); if (optionsCode.Length > 0) { sb.AppendTabsLineIf(".Options"); sb.IncIndent(); sb.Append(optionsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (showEventsCode.Length > 0) { sb.AppendTabsLineIf(".Events"); sb.IncIndent(); sb.Append(showEventsCode); sb.DecIndent(); sb.AppendTabsLineIf(".Finish()"); } if (renderCode.Length > 0) sb.Append(renderCode); sb.DecIndent(); } sb.AppendTabsLineIf(";"); sb.AppendTabsLineIf("%>"); sb.AppendLineIf(); sb.AppendTabsLineIf("<%using (dlg.RenderDialog()) {%>"); sb.AppendTabsLineIf("\t<p>Proin ...</p>"); sb.AppendTabsLineIf("<%}%>"); return sb.ToString(); }
/// <summary> /// Writes out the calling script for the jQuery Tabs plugin, adding options that have been /// a defined. /// </summary> /// <param name="tabDepth"> /// How far to indent the script code setting. /// </param> /// <returns> /// Returns rendered initialisation script /// </returns> protected internal string GetControlScript(int tabDepth) { jStringBuilder sb = new jStringBuilder(this.Rendering.PrettyRender, this.Rendering.TabDepth); sb.IncIndent(); sb.AppendTabsFormatIf("$(\"#{0}\").button(", this.ID); Core.ScriptOptions options = new Core.ScriptOptions(); this.Options.DiscoverOptions(options); this.Events.DiscoverOptions(options); options.Render(sb); sb.Append(");"); if (!string.IsNullOrEmpty(this.Events.ClickEvent)) { // as ClickEvent isn't a "real" jQuery UI button event, it has to be wired up separately sb.AppendLineIf(); sb.AppendTabsFormatLineIf("$(\"#{0}\").click(function() {{", this.ID); sb.Append(this.Events.ClickEvent); sb.AppendLineIf(); sb.AppendTabsLineIf("});"); } sb.DecIndent(); return sb.ToString(); }