/// <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.Append(">"); sb.Append(this.OnPanel.Title); // Closing heading (H3) sb.AppendFormatLineIf("</{0}>", ac.Options.HeadingTag); return sb.ToString(); }
/// <summary> /// Renders the HTML for the hyperlink. /// </summary> /// <returns>String of HTML</returns> public string GetTagHtml() { Accordion ac = this._Header.OnPanel.OnAccordion; bool prettyRender = ac.Rendering.PrettyRender; bool renderCss = ac.Rendering.RenderCSS; int tabDepth = ac.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); sb.AppendTabsFormatIf("<a href=\"{0}\">", this.URL); base.RenderAttributes(sb); sb.Append(this.Title); sb.Append("</a>"); 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 body of the accordion panel. /// </summary> /// <param name="sb">StringBuilder to render the object to</param> internal void RenderBody(jStringBuilder sb) { bool renderCss = this.OnAccordion.Rendering.RenderCSS; // Opening pane container div sb.AppendTabsFormatIf("<{0}", this.OnAccordion.Options.ContentTag); base.RenderAttributes(sb); if (renderCss) { sb.Append(" class=\"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); // may seem strange, but when renderCss is on, we always need the "ui-accordion-content-active" // presented otherwise the panel will be collapsed (hidden) and if JavaScript isn't on, the user // will have no way of seeing the content ! sb.Append(" ui-accordion-content-active"); sb.Append("\""); } sb.Append(">"); sb.AppendLineIf(); }
private void RenderRootOpenItem(jStringBuilder sb) { sb.AppendTabsFormat("<{0}", PARENT_TAG); if (!string.IsNullOrEmpty(this.Label)) { sb.AppendFormat(" {0}=\"{1}\"", LABEL_TAG, HttpUtility.HtmlAttributeEncode(this.Label) ); } if (this.IsDisabled) { sb.Append(" disabled=\"disabled\""); } this.RenderAttributes(sb); sb.Append(">"); }
/// <summary> /// Builds up the HTML for the AutoComplete control and options (and returns the generated HTML). /// </summary> /// <returns>Generated HTML for the control.</returns> protected internal string GetTagHtml() { // ID property is _mandatory_ if (string.IsNullOrEmpty(this.ID)) throw new ArgumentException("AutoComplete ID property _must_ be supplied."); bool prettyRender = this.Rendering.PrettyRender; bool renderCss = this.Rendering.RenderCSS; int tabDepth = this.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); if (renderCss) this.WithCss("ui-autocomplete-input"); // turn off autocomplete, so it doesn't compete with dropdown menu this.WithAttribute("autocomplete", "off"); sb.AppendTabsIf(); sb.AppendFormat("<input id=\"{0}\"", this.ID); this.RenderAttributes(sb); sb.Append(" />"); return sb.ToString(); }
/// <summary> /// Adds the content to appear between the opening and closing tags of the PushButton control. /// </summary> /// <param name="sb"></param> protected void RenderTagContent(jStringBuilder sb) { if (!Core.ButtonType.IsInputButton(this.InputType) && !string.IsNullOrEmpty(this.Label)) { // Label applied through the Value attribute for an INPUT tag, so only add tag content // for "a" and "button" tags sb.Append(">"); sb.Append(this.Label); } }
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(); }
/// <summary> /// Returns an HTML table of all available icons, split into <paramref name="numColumns"/>. /// </summary> /// <param name="numColumns">Number of columns to split the table into</param> /// <returns>HTML table of [rendered] icons</returns> public static string RenderAsTable(int numColumns) { int currCol = 0; jStringBuilder sb = new jStringBuilder(true, 1); sb.AppendTabsLine("<table id=\"table-icons\">"); List<string>.Enumerator e = Icons.ToList().GetEnumerator(); while (e.MoveNext()) { if (currCol == 0) sb.Append("<tr>"); sb.AppendTabs(); sb.AppendFormat("<td title=\".{0}\">", e.Current); sb.AppendFormat( "<span class=\"ui-icon {0}\"></span>", e.Current); sb.AppendFormat("</td>"); currCol++; if (currCol == numColumns) { sb.AppendLine("</tr>"); currCol = 0; } } sb.AppendTabsLine("</table>"); return sb.ToString(); }
private void RenderOpenItem(jStringBuilder sb) { bool renderCss = this.Menu.Rendering.RenderCSS; sb.AppendTabsFormat("<{0}", this.Tag); if (this.IsDivider) { if (renderCss) this.AddCssClass("ui-widget-content ui-menu-divider"); this.RenderAttributes(sb); sb.Append(">"); return; } if (renderCss) this.AddCssClass("ui-menu-item"); if (this.IsDisabled) this.AddCssClass("ui-state-disabled"); this.RenderAttributes(sb); sb.Append(">"); if (!string.IsNullOrEmpty(this.Html)) sb.Append(this.Html); else { if (!string.IsNullOrEmpty(this.TargetURL)) sb.AppendFormat("<a href=\"{0}\"", this.TargetURL); else sb.AppendFormat("<a href=\"#\""); if (renderCss) sb.Append(" class=\"ui-corner-all\""); sb.Append(">"); if (!string.IsNullOrEmpty(this.Icon)) { sb.AppendFormat("<span class=\"ui-icon {0}\"></span>", this.Icon); } // Title is mandatory when not using the HTML version sb.Append(this.Title); sb.Append("</a>"); } }
/// <summary> /// Builds up the opening HTML for the Accordion control. /// </summary> /// <returns>Opening HTML</returns> /// <remarks> /// Only renders the opening part as we need to allow the HTML in the "using" block /// to be rendered out and then close off). /// </remarks> protected string GetTagHtml() { bool prettyRender = this.Rendering.PrettyRender; bool renderCss = this.Rendering.RenderCSS; int tabDepth = this.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); _Panels.ResetPaneIndex(); // Work out if we have an accordion set as the active one _Panels.ResolveActivePane(); if (renderCss) { this.WithCss("ui-accordion ui-widget ui-helper-reset"); if (this.Options.AreIconsEnabled()) // icons are on, so add the main CSS class for the icons as well as the normal classes base.WithCss("ui-accordion-icons"); } base.WithID(this.ID); sb.AppendFormat("<{0}", this.Options.ContainerTag); base.RenderAttributes(sb); sb.Append(">"); return sb.ToString(); }
/// <summary> /// Renders the body of the accordion panel. /// </summary> /// <param name="sb">StringBuilder to render the object to</param> internal void RenderBody(jStringBuilder sb) { bool renderCss = this.OnAccordion.Rendering.RenderCSS; // Opening pane container div sb.AppendTabsFormatIf("<{0}", this.OnAccordion.Options.ContentTag); base.RenderAttributes(sb); if (renderCss) { sb.Append(" class=\"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); if (this.IsActive) sb.Append(" ui-accordion-content-active"); sb.Append("\""); } sb.Append(">"); sb.AppendLineIf(); }
/// <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(); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.Disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (!this.AutoOpen) sb.AppendTabsLineIf(".SetAutoOpen(false)"); if (!this.CloseOnEscape) sb.AppendTabsLineIf(".SetCloseOnEscape(false)"); if (!Utils.IsNullEmptyOrDefault(this.CloseText, Options.DEFAULT_CLOSE_TEXT)) sb.AppendTabsFormatLineIf(".SetCloseText(\"{0}\")", this.CloseText); if (!string.IsNullOrEmpty(this.DialogClass)) sb.AppendTabsFormatLineIf(".SetDialogClass(\"{0}\")", this.DialogClass); if (!this.Draggable) sb.AppendTabsLineIf(".SetDraggable(false)"); if (!Utils.IsNullEmptyOrDefault(this.Height, Options.DEFAULT_HEIGHT)) { if (Utils.IsNumeric(this.Height)) sb.AppendTabsFormatLineIf(".SetHeight({0})", this.Height); else sb.AppendTabsFormatLineIf(".SetHeight(\"{0}\")", this.Height); } if (!string.IsNullOrEmpty(this.HideEffect)) sb.AppendTabsFormatLineIf(".SetHideEffect(\"{0}\")", this.HideEffect); if (this.MinWidth != Options.DEFAULT_MIN_WIDTH) sb.AppendTabsFormatLineIf(".SetMinWidth({0})", this.MinWidth); if (!Utils.IsNullEmptyOrDefault(this.MaxWidth, Options.DEFAULT_MAX_WIDTH)) { if (Utils.IsNumeric(this.MaxWidth)) sb.AppendTabsFormatLineIf(".SetMaxWidth({0})", this.MaxWidth); else sb.AppendTabsFormatLineIf(".SetMaxWidth(\"{0}\")", this.MaxWidth); } if (this.MinHeight != Options.DEFAULT_MIN_HEIGHT) sb.AppendTabsFormatLineIf(".SetMinHeight({0})", this.MinHeight); if (!Utils.IsNullEmptyOrDefault(this.MaxHeight, Options.DEFAULT_MAX_HEIGHT)) { if (Utils.IsNumeric(this.MaxHeight)) sb.AppendTabsFormatLineIf(".SetMaxHeight({0})", this.MaxHeight); else sb.AppendTabsFormatLineIf(".SetMaxHeight(\"{0}\")", this.MaxHeight); } if (this.Modal) sb.AppendTabsFormatLineIf(".SetModal(true)"); if (!Utils.IsNullEmptyOrDefault(this.Position1, Options.DEFAULT_POSITION)) { // first one is populated, so there's something of interest here sb.AppendTabsIf(".SetPosition("); if (Utils.IsNumeric(this.Position1)) sb.Append(this.Position1); else sb.AppendFormat("\"{0}\"", this.Position1); if (!string.IsNullOrEmpty(this.Position2)) { // second one is populated too if (Utils.IsNumeric(this.Position2)) sb.AppendFormat(", {0}", this.Position2); else sb.AppendFormat(", \"{0}\"", this.Position2); } // and close sb.AppendLineIf(")"); } if (!this.Resizable) sb.AppendTabsFormatLineIf(".SetResizable(false)"); if (!string.IsNullOrEmpty(this.ShowEffect)) sb.AppendTabsFormatLineIf(".SetShowEffect(\"{0}\")", this.ShowEffect); if (!this.Stack) sb.AppendTabsLineIf(".SetStack(true)"); if (!string.IsNullOrEmpty(this.Title)) sb.AppendTabsFormatLineIf(".SetTitle(\"{0}\")", this.Title); if (this.Width != Options.DEFAULT_WIDTH) sb.AppendTabsFormatLineIf(".SetWidth({0})", this.Width); if (this.ZIndex != Options.DEFAULT_ZINDEX) sb.AppendTabsFormatLineIf(".SetZIndex({0})", this.ZIndex); // buttons are always added in the demo sb.AppendTabsLineIf(".AddButton(\"OK\", \"return OKClicked();\")"); sb.AppendTabsLineIf(".AddButton(\"Cancel\", \"return CancelClicked();\")"); 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(); }
private void RenderOpenItem(jStringBuilder sb) { sb.AppendTabsFormat("<{0}>", this.Tag); if (!string.IsNullOrEmpty(this.Html)) sb.Append(this.Html); else { if (!string.IsNullOrEmpty(this.TargetURL)) sb.AppendFormat("<a href=\"{0}\">", this.TargetURL); else sb.AppendFormat("<a href=\"#\">"); if (!string.IsNullOrEmpty(this.Icon)) { sb.AppendFormat("<span class=\"ui-icon {0}\"></span>", this.Icon); } // Title is mandatory when not using the HTML version sb.Append(this.Title); sb.Append("</a>"); } }
/// <summary> /// Builds the HTML required for the DatePicker control. /// JavaScript initialisation for the control is also added to the response stream if the /// AutoScript rendering option is true. /// </summary> /// <returns></returns> protected internal string GetTagHtml() { // ID property is _mandatory_ if (string.IsNullOrEmpty(this.ID)) throw new ArgumentException("DatePicker ID property _must_ be supplied."); bool prettyRender = this.Rendering.PrettyRender; bool renderCss = this.Rendering.RenderCSS; int tabDepth = this.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); this.WithID(this.ID); sb.AppendTabsIf(); if (this.Options.ShowInline) { sb.Append("<div"); } else { this.WithAttribute("type", "text"); sb.Append("<input"); } this.RenderAttributes(sb); if (this.Options.ShowInline) sb.Append("></div>"); else sb.Append(" />"); if (this.Rendering.AutoScript) { this.RenderStartUpScript(); } return sb.ToString(); }
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(); }
/// <summary> /// Renders the closing tag for the PushButton control. /// </summary> /// <param name="sb">StringBuilder to add the closing tag to</param> protected void RenderClosingTag(jStringBuilder sb) { if (Core.ButtonType.IsInputButton(this.InputType)) sb.Append(" />"); else sb.AppendFormat("</{0}>", Core.ButtonType.ButtonTypeToString(this.InputType)); }
private void RenderOpenItem(jStringBuilder sb) { bool renderCss = this.SelectMenu.Rendering.RenderCSS; sb.AppendTabsFormat("<{0}", this.Tag); this.RenderAttributes(sb); if (this.Selected) { sb.Append(" selected=\"selected\""); } if (!string.IsNullOrEmpty(this.Value)) { sb.AppendFormat(" value=\"{0}\"", this.Value); } sb.Append(">"); sb.Append(this.Title); }
/// <summary> /// Renders the registered attributes to the provided jStringBuilder object. The registered /// CSS classes and Style rules are also added at this point (as they're attributes as well really). /// </summary> protected internal void RenderAttributes(jStringBuilder sb) { bool hasID = _HtmlAttr.Keys.Any(x => x == "id"); // force the ID to come out first (as this is what you're interested in 90% of the time) if (hasID) { sb.AppendFormat(" id=\"{0}\"", HttpUtility.HtmlAttributeEncode(_HtmlAttr["id"].ToString()) ); } // add in any defined CSS classes if (_CssClasses.Any()) { sb.Append(" class=\""); sb.Append(this._CssClasses.ToSeparated(" ") ); sb.Append("\""); } // add in the full style rules if (_Styles.Any()) { sb.Append(" style=\""); foreach (string key in this._Styles.Keys) { sb.AppendFormat("{0}:{1};", HttpUtility.HtmlAttributeEncode(key), HttpUtility.HtmlAttributeEncode(_Styles[key].ToString()) ); } sb.TrimEnd(";"); sb.Append("\""); } if (_HtmlAttr.Any()) { // avoid ID as this will already have been added foreach (string key in _HtmlAttr.Keys.Where(x => x != "id")) { sb.AppendFormat(" {0}=\"{1}\"", key, HttpUtility.HtmlAttributeEncode(_HtmlAttr[key].ToString()) ); } } }
/// <summary> /// Builds and returns the HTML for the Slider control (basically the DIV). /// JavaScript initialisation for the control is also added to the response stream if the /// AutoScript rendering option is true. /// </summary> /// <returns>HTML for the Slider control.</returns> protected internal string GetTagHtml() { // ID property is _mandatory_ if (string.IsNullOrEmpty(this.ID)) throw new ArgumentException("Slider ID property _must_ be supplied."); bool prettyRender = this.Rendering.PrettyRender; bool renderCss = this.Rendering.RenderCSS; int tabDepth = this.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); this.WithID(this.ID); if (renderCss) { this.WithCss("ui-slider ui-widget ui-widget-content ui-corner-all"); this.WithCss("ui-slider-{0}", Core.Orientation.OrientationToString(this.Options.Orientation)); } if (this.Options.Orientation == Core.Orientation.eOrientation.Horizontal) { if (this.Options.Size != Options.DEFAULT_SIZE) this.WithStyle("width", this.Options.Size); } else { // vertical always has to be output otherwise the slider won't work, so no default // check here this.WithStyle("height", this.Options.Size); } sb.AppendTabsIf(); sb.Append("<div"); base.RenderAttributes(sb); sb.AppendLineIf("></div>"); if (this.Rendering.AutoScript) { this.RenderStartUpScript(); } return sb.ToString(); } // GetTagHtml
/// <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> /// Builds and returns the HTML for the Spinner control (basically the DIV). /// JavaScript initialisation for the control is also added to the response stream if the /// AutoScript rendering option is true. /// </summary> /// <returns>HTML for the Spinner control.</returns> protected internal string GetTagHtml() { // ID property is _mandatory_ if (string.IsNullOrEmpty(this.ID)) throw new ArgumentException("Spinner ID property _must_ be supplied."); bool prettyRender = this.Rendering.PrettyRender; bool renderCss = this.Rendering.RenderCSS; int tabDepth = this.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); this.WithID(this.ID); if (renderCss) { this.WithCss("ui-spinner-input"); } sb.AppendTabsIf(); if (renderCss) { sb.Append("<span class=\"ui-spinner ui-widget ui-widget-content ui-corner-all\""); } sb.Append("<input"); base.RenderAttributes(sb); sb.AppendLineIf(">"); if (renderCss) { // close the containing span sb.Append("</span>"); } // Note we don't render the Up/Down CSS even if RenderCSS is "true" as basically it doesn't make any // sense to render them as they won't do anything without the JavaScript to intercept the behaviour if (this.Rendering.AutoScript) { this.RenderStartUpScript(); } return sb.ToString(); } // GetTagHtml
/// <summary> /// Builds and returns the HTML for the opening part of the Dialog control (opening as we have /// to separate the closing so we can have the Dialog conten written to the response stream). /// </summary> /// <returns>Opening HTML for the dialog</returns> protected internal string GetTagHtml() { // ID property is _mandatory_ if (string.IsNullOrEmpty(this.ID)) throw new ArgumentException("Dialog ID property _must_ be supplied."); bool prettyRender = this.Rendering.PrettyRender; bool renderCss = this.Rendering.RenderCSS; int tabDepth = this.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); sb.AppendTabsIf(); sb.Append("<div"); this.WithID(this.ID); if (renderCss) this.WithCss("ui-dialog-content ui-widget-content"); this.RenderAttributes(sb); sb.Append(">"); //</div>"); 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(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(); }
} // 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(); }
/// <summary> /// Renders the accordion panel and returns the HTML /// </summary> /// <returns>Rendered HTML for the accordion panel</returns> internal string GetTagHtml() { bool prettyRender = this.OnAccordion.Rendering.PrettyRender; int tabDepth = this.OnAccordion.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth + 1); sb.Append(this.Header.GetTagHtml()); this.RenderBody(sb); return sb.ToString(); }