本文整理汇总了C#中Fluqi.Extension.Helpers.jStringBuilder类的典型用法代码示例。如果您正苦于以下问题:C# jStringBuilder类的具体用法?C# jStringBuilder怎么用?C# jStringBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
jStringBuilder类属于Fluqi.Extension.Helpers命名空间,在下文中一共展示了jStringBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTagHtml
/// <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();
}
示例2: GetControlScript
/// <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 tabs in the script code.
/// </param>
/// <returns>
/// Returns rendered initialisation script
/// </returns>
public string GetControlScript(int tabDepth) {
jStringBuilder sb = new jStringBuilder(this.Rendering.PrettyRender, this.Rendering.TabDepth);
Core.ScriptOptions options = new Core.ScriptOptions();
this.Options.DiscoverOptions(options);
options.Render(sb);
return sb.ToString();
}
示例3: GetStartUpScript
/// <summary>
/// Writes out the document.ready, text/JavaScript and tabs initialisation script
/// to the Response.
/// </summary>
/// <param name="incDocReady">
/// If true wraps the initialisation script with a jQuery document.ready section
/// If false only the control initialisation script is written.
/// </param>
/// <remarks>
/// Useful if you want more control over where the initialisation takes place.
/// </remarks>
public string GetStartUpScript(bool incDocReady) {
bool prettyRender = this.Rendering.PrettyRender;
int tabDepth = this.Rendering.TabDepth;
jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth);
if (incDocReady)
sb.AppendUIStartUp(this.GetControlScript(tabDepth));
else
sb.AppendLineIf(this.GetControlScript(tabDepth));
return sb.ToString();
}
示例4: CSharpCode
public string CSharpCode(ToolTip tip) {
jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0);
sb.AppendTabsLineIf("<%");
sb.AppendTabsLineIf("Html.CreateToolTip(\"name\")");
string optionsCode = OptionsCSharpCode();
string positionOptionsCode = PositionsCSharpCode();
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 || 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();
}
示例5: GetTagHtml
/// <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();
}
示例6: RenderCSharpCode
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();
}
示例7: CSharpCode
public string CSharpCode(PushButton btn) {
jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0);
sb.AppendTabsLineIf("<%");
sb.AppendTabsFormatLineIf("Html.CreateButton(\"{0}\", \"{1}\")", btn.ID, this.label);
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();
}
示例8: RenderOpenItem
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);
}
示例9: ShowEventsCSharpCode
protected string ShowEventsCSharpCode() {
if (!this.showEvents)
// nothing to see here
return "";
jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2);
sb.AppendTabsLineIf(".SetCreateEvent(\"return createEvent(event, ui);\")");
sb.AppendTabsLineIf(".SetChangeEvent(\"return changeEvent(event, ui);\")");
sb.AppendTabsLineIf(".SetChangeStartEvent(\"return changeStartEvent(event, ui);\")");
return sb.ToString();
}
示例10: GetTagHtml
/// <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();
}
示例11: ToString
/// <summary>
/// Renders the JavaScript required to set the options with
/// the settings that are configured for this widget.
/// </summary>
/// <returns>
/// Returns the JavaScript to initialise the jQuery UI widget, given the configured options.
/// </returns>
public override string ToString() {
Core.ScriptOptions scripting = new Core.ScriptOptions();
this.DiscoverOptions(scripting);
jStringBuilder sb = new jStringBuilder(false/*includeWhitespace*/, 0/*tabDepth*/);
scripting.Render(sb);
return sb.ToString();
}
示例12: ShowEventsCSharpCode
protected string ShowEventsCSharpCode() {
if (!this.showEvents)
// nothing to see here
return "";
jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2);
sb.AppendTabsLineIf(".SetCreateEvent(\"createEvent(event, ui);\")");
sb.AppendTabsLineIf(".SetSearchEvent(\"searchEvent(event, ui);\")");
sb.AppendTabsLineIf(".SetResponseEvent(\"responseEvent(event, ui);\")");
sb.AppendTabsLineIf(".SetOpenEvent(\"openEvent(event, ui);\")");
sb.AppendTabsLineIf(".SetFocusEvent(\"focusEvent(event, ui);\")");
sb.AppendTabsLineIf(".SetSelectEvent(\"selectEvent(event, ui);\")");
sb.AppendTabsLineIf(".SetCloseEvent(\"closeEvent(event, ui);\")");
sb.AppendTabsLineIf(".SetChangeEvent(\"changeEvent(event, ui);\")");
return sb.ToString();
}
示例13: OptionsCSharpCode
protected string OptionsCSharpCode() {
jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2);
if (this.disabled)
sb.AppendTabsLineIf(".SetDisabled(true)");
if (!Utils.IsNullEmptyOrDefault(this.appendTo, Options.DEFAULT_APPEND_TO))
sb.AppendTabsFormatLineIf(".SetAppendTo(\"{0}\")", this.appendTo);
if (this.autoFocus)
sb.AppendTabsLineIf(".SetAutoFocus(true)");
if (this.delay != Options.DEFAULT_DELAY)
sb.AppendTabsFormatLineIf(".SetDelay({0})", this.delay);
if (this.minLength != Options.DEFAULT_MINIMUM_LENGTH)
sb.AppendTabsFormatLineIf(".SetMinimumLength({0})", this.minLength);
return sb.ToString();
}
示例14: RenderAsTable
/// <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();
}
示例15: GetTagHtml
/// <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