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(); }
private void RenderRootCloseItem(jStringBuilder sb) { sb.AppendTabsFormatLineIf("</{0}>", PARENT_TAG); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (!this.text) sb.AppendTabsLineIf(".SetText(false)"); // icons must be set as a pair if (!string.IsNullOrEmpty(this.primaryIcon) || !string.IsNullOrEmpty(this.secondaryIcon)) { sb.AppendTabsFormatLineIf(".SetIcons(\"{0}\", \"{1}\")", this.primaryIcon, this.secondaryIcon); } 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(); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (!string.IsNullOrEmpty(this.downIconClass) && !string.IsNullOrEmpty(this.upIconClass)) sb.AppendTabsFormatLineIf(".SetIcons(\"{0}\", \"{1}\")", this.downIconClass, this.upIconClass); if (!string.IsNullOrEmpty(this.min)) sb.AppendTabsFormatLineIf(".SetMin({0})", this.min); if (!string.IsNullOrEmpty(this.max)) sb.AppendTabsFormatLineIf(".SetMax({0})", this.max); if (!string.IsNullOrEmpty(this.step)) sb.AppendTabsFormatLineIf(".SetStep({0})", this.step); if (this.page != Options.DEFAULT_PAGE) sb.AppendTabsFormatLineIf(".SetPage({0})", this.page); return sb.ToString(); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (!string.IsNullOrEmpty(this.animated)) { if (Helpers.Utils.IsBool(this.animated)) sb.AppendTabsFormatLineIf(".SetAnimated({0})", bool.Parse(this.animated).JsBool()); else if (!Helpers.Utils.IsNullEmptyOrDefault(this.animated, Widget.jAccordion.Options.DEFAULT_ANIMATED)) sb.AppendTabsFormatLineIf(".SetAnimated(\"{0}\")", this.animated); } if (!this.autoHeight) sb.AppendTabsLineIf(".SetAutoHeight(false)"); if (this.clearStyle) sb.AppendTabsLineIf(".SetClearStyle(true)"); if (this.collapsible) sb.AppendTabsLineIf(".SetCollapsible(true)"); if (!Helpers.Utils.IsNullEmptyOrDefault(this.evt, Widget.jAccordion.Options.DEFAULT_EVENT)) sb.AppendTabsFormatLineIf(".SetEvent(\"{0}\")", this.evt); if (this.fillSpace) sb.AppendTabsLineIf(".SetFillSpace(true)"); // icons have to be set as a pair bool addNormalIcon = !string.IsNullOrEmpty(this.headerIconClass) && this.headerIconClass != Widget.jAccordion.Options.DEFAULT_HEADER_ICON_CLASS; bool addSelectedIcon = !string.IsNullOrEmpty(this.headerSelectedIconClass) && this.headerSelectedIconClass != Widget.jAccordion.Options.DEFAULT_HEADER_SELECTED_ICON_CLASS; if (addNormalIcon || addSelectedIcon) { sb.AppendTabsFormatLineIf(".SetIcons(\"{0}\", \"{1}\")", this.headerIconClass, this.headerSelectedIconClass); } if (this.navigation) sb.AppendTabsLineIf(".SetNavigation(true)"); if (!string.IsNullOrEmpty(this.navigationFilter)) sb.AppendTabsFormatLineIf(".SetNavigationFilter({0})", this.navigationFilter); return sb.ToString(); }
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(); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.Disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (Helpers.Utils.IsBool(this.Animated)) { if (bool.Parse(this.Animated)) sb.AppendTabsLineIf(".SetAnimate(true)"); } else if (Helpers.Utils.IsNumeric(this.Animated)) { sb.AppendTabsFormatLineIf(".SetAnimate({0})", this.Animated); } if (this.Min != Options.DEFAULT_MIN) sb.AppendTabsFormatLineIf(".SetMin({0})", this.Min); if (this.Max != Options.DEFAULT_MAX) sb.AppendTabsFormatLineIf(".SetMax({0})", this.Max); if (Core.Orientation.StringToOrientation(this.Orientation) != Options.DEFAULT_ORIENTATION) sb.AppendTabsFormatLineIf(".SetOrientation(\"{0}\")", this.Orientation); if (Helpers.Utils.IsBool(this.Range)) { if (bool.Parse(this.Range)) sb.AppendTabsLineIf(".SetRange(true)"); } else { sb.AppendTabsFormatLineIf(".SetRange(\"{0}\")", this.Range); } if (this.Step != Options.DEFAULT_STEP) sb.AppendTabsFormatLineIf(".SetStep({0})", this.Step); if (this.Value != Options.DEFAULT_VALUE) sb.AppendTabsFormatLineIf(".SetValue({0})", this.Value); if (!string.IsNullOrEmpty(this.Values)) sb.AppendTabsFormatLineIf(".SetValues({0})", this.Values); sb.AppendTabsFormatLineIf(".SetSize(\"{0}\")", this.Size); return sb.ToString(); }
/// <summary> /// Renders the list of SelectMenuItems to the string builder. /// Note: For the SelectMenu this only happens for the root (i.e. this isn't recursive like the Menu control) /// </summary> /// <param name="sb">StringBuilder</param> protected internal void RenderChildren(jStringBuilder sb) { // Open list/item if (!_IsRoot) sb.AppendTabsFormat("<{0}>", CHILD_TAG); foreach (SelectMenuItemBase mi in this.Children._SelectMenuItems) { mi.BuildTagHtml(sb); } // Close list/item if (!_IsRoot) sb.AppendTabsFormatLineIf("</{0}>", CHILD_TAG); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (this.value != Options.DEFAULT_VALUE) sb.AppendTabsFormatLineIf(".SetValue({0})", this.value); return sb.ToString(); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.Disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (Core.Icons.StringToIcon(this.Icons) != Core.Icons.eIconClass.carat_1_e) { sb.AppendTabsFormatLineIf(".SetIcons(\"{0}\")", this.Icons); } return sb.ToString(); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.Disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (!string.IsNullOrEmpty(this.AltField)) sb.AppendTabsFormatLineIf(".SetAltField(\"{0}\")", this.AltField); if (!string.IsNullOrEmpty(this.AltFormat)) sb.AppendTabsFormatLineIf(".SetAltFormat(\"{0}\")", this.AltFormat); if (!string.IsNullOrEmpty(this.AppendText)) sb.AppendTabsFormatLineIf(".SetAppendText(\"{0}\")", this.AppendText); if (this.AutoSize) sb.AppendTabsLineIf(".SetAutoSize(true)"); if (!string.IsNullOrEmpty(this.ButtonImage)) sb.AppendTabsFormatLineIf(".SetButtonImage(\"{0}\")", this.ButtonImage); if (this.ButtonImageOnly) sb.AppendTabsLineIf(".SetButtonImageOnly(true)"); if (!Utils.IsNullEmptyOrDefault(this.ButtonText, Options.DEFAULT_BUTTON_TEXT)) sb.AppendTabsFormatLineIf(".SetButtonText(\"{0}\")", this.ButtonText); if (!Utils.IsNullEmptyOrDefault(this.CalculateWeek, Options.DEFAULT_CALCULATE_WEEK) ) sb.AppendTabsFormatLineIf(".SetCalculateWeek(\"{0}\")", this.CalculateWeek); if (this.ChangeMonth) sb.AppendTabsLineIf(".SetChangeMonth(true)"); if (this.ChangeYear) sb.AppendTabsLineIf(".SetChangeYear(true)"); if (!Utils.IsNullEmptyOrDefault(this.CloseText, Options.DEFAULT_CLOSE_TEXT)) sb.AppendTabsFormatLineIf(".SetCloseText(\"{0}\")", this.CloseText); if (!this.ConstrainInput) sb.AppendTabsLineIf(".SetConstraintInput(false)"); if (!Utils.IsNullEmptyOrDefault(this.CurrentText, Options.DEFAULT_CURRENT_TEXT)) sb.AppendTabsFormatLineIf(".SetCurrentText(\"{0}\")", this.CurrentText); if (!Utils.IsNullEmptyOrDefault(this.DateFormat, Options.DEFAULT_DATE_FORMAT)) sb.AppendTabsFormatLineIf(".SetDateFormat({0})", Utils.AddQuotesToJQueryDate(this.DateFormat)); if (!Utils.IsNullEmptyOrDefault(this.Duration, Options.DEFAULT_DURATION)) sb.AppendTabsFormatLineIf(".SetDuration(\"{0}\")", this.Duration); if (this.FirstDay != Options.DEFAULT_FIRST_DAY) sb.AppendTabsFormatLineIf(".SetFirstDay({0})", this.FirstDay); if (this.GotoCurrent) sb.AppendTabsLineIf(".SetGotoCurrent(true)"); if (this.HideIfNoPrevNext) sb.AppendTabsLineIf(".SetHideIfNoPrevNext(true)"); if (this.IsRTL) sb.AppendTabsLineIf(".SetIsRTL(true)"); if (!string.IsNullOrEmpty(this.MinDate)) sb.AppendTabsFormatLineIf(".SetMinDate({0})", Utils.AddQuotesToJQueryDate(this.MinDate)); if (!string.IsNullOrEmpty(this.MaxDate)) sb.AppendTabsFormatLineIf(".SetMaxDate({0})", Utils.AddQuotesToJQueryDate(this.MaxDate)); if (this.NavigationAsDateFormat) sb.AppendTabsLineIf(".SetNavigationAsDateFormat(true)"); if (!Utils.IsNullEmptyOrDefault(this.NextText, Options.DEFAULT_NEXT_TEXT)) sb.AppendTabsFormatLineIf(".SetNextText(\"{0}\")", this.NextText); if (!Utils.IsNullEmptyOrDefault(this.PrevText, Options.DEFAULT_PREV_TEXT)) sb.AppendTabsFormatLineIf(".SetPrevText(\"{0}\")", this.PrevText); if (this.NumberOfMonths != Options.DEFAULT_NUMBER_OF_MONTHS) { sb.AppendTabsFormatLineIf(".SetNumberOfMonths({0})", this.NumberOfMonths); } if (this.SelectOtherMonths) sb.AppendTabsLineIf(".SetSelectOtherMonths(true)"); if (!Utils.IsNullEmptyOrDefault(this.ShortYearCutoff, Options.DEFAULT_SHORT_YEAR_CUTOFF)) sb.AppendTabsFormatLineIf(".SetShortYearCutoff(\"{0}\")", this.ShortYearCutoff); if (!Utils.IsNullEmptyOrDefault(this.ShowAnim, Options.DEFAULT_SHOW_ANIM)) sb.AppendTabsFormatLineIf(".SetShowAnim(\"{0}\")", this.ShowAnim); if (this.ShowButtonPanel) sb.AppendTabsLineIf(".SetShowButtonPanel(true)"); if (this.ShowCurrentAtPos != Options.DEFAULT_SHOW_CURRENT_AT_POS) sb.AppendTabsFormatLineIf(".SetShowCurrentAtPos({0})", this.ShowCurrentAtPos); if (this.ShowMonthAfterYear) sb.AppendTabsFormatLine(".SetShowMonthAfterYear(true)"); if (!Utils.IsNullEmptyOrDefault(this.ShowOn, Options.DEFAULT_SHOW_ON)) sb.AppendTabsFormatLineIf(".SetShowOn(\"{0}\")", this.ShowOn); if (this.ShowOtherMonths) sb.AppendTabsFormatLineIf(".SetShowOtherMonths({0})", this.ShowOtherMonths); if (this.ShowWeek) sb.AppendTabsLineIf(".SetShowWeek(true)"); if (this.StepMonths != Options.DEFAULT_STEP_MONTHS) sb.AppendTabsFormatLineIf(".SetStepMonths({0})", this.StepMonths); if (!Utils.IsNullEmptyOrDefault(this.WeekHeader, Options.DEFAULT_WEEK_HEADER)) sb.AppendTabsFormatLineIf(".SetWeekHeader(\"{0}\")", this.WeekHeader); if (!Utils.IsNullEmptyOrDefault(this.YearRange, Options.DEFAULT_YEAR_RANGE)) sb.AppendTabsFormatLineIf(".SetYearRange(\"{0}\")", this.YearRange); if (!string.IsNullOrEmpty(this.YearSuffix)) sb.AppendTabsFormatLineIf(".SetYearSuffix(\"{0}\")", this.YearSuffix); if (this.FakeDayNamesChange) { if (!Utils.IsNullEmptyOrDefault(this.DayNames, Options.DEFAULT_DAY_NAMES)) sb.AppendTabsFormatLineIf(".SetDayNames(\"{0}\")", this.DayNames.JsArray()); if (!Utils.IsNullEmptyOrDefault(this.DayNamesMin, Options.DEFAULT_DAY_NAMES_MIN)) sb.AppendTabsFormatLineIf(".SetDayNamesMin(\"{0}\")", this.DayNamesMin.JsArray()); if (!Utils.IsNullEmptyOrDefault(this.DayNamesShort, Options.DEFAULT_DAY_NAMES_SHORT)) sb.AppendTabsFormatLineIf(".SetDayNamesShort(\"{0}\")", this.DayNamesShort.JsArray()); } if (this.FakeMonthNamesChange) { if (!Utils.IsNullEmptyOrDefault(this.MonthNames, Options.DEFAULT_MONTH_NAMES)) sb.AppendTabsFormatLineIf(".SetMonthNames(\"{0}\")", this.MonthNames.JsArray()); if (!Utils.IsNullEmptyOrDefault(this.MonthNamesShort, Options.DEFAULT_MONTH_NAMES_SHORT)) sb.AppendTabsFormatLineIf(".SetMonthNamesShort(\"{0}\")", this.MonthNamesShort.JsArray()); } return sb.ToString(); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (!string.IsNullOrEmpty(this.showEffect)) sb.AppendTabsFormatLineIf(".ShowAnimation.SetEffect(\"{0}\").Finish()", this.showEffect); if (!string.IsNullOrEmpty(this.hideEffect)) sb.AppendTabsFormatLineIf(".HideAnimation.SetEffect(\"{0}\").Finish()", this.hideEffect); if (this.track) sb.AppendTabsFormatLineIf(".SetTrack({0})", this.track.JsBool()); 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)"); if (!string.IsNullOrEmpty(this.fx)) sb.AppendTabsFormatLineIf(".SetEffect(\"{0}\")", this.fx); if (!Utils.IsNullEmptyOrDefault(this.evt, Options.DEFAULT_EVENT)) sb.AppendTabsFormatLineIf(".SetEvent(\"{0}\")", this.evt); 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(); }
/// <summary> /// Writes the closing part of the Tabs layout (i.e. the closing DIV tag). /// Also writes out the document.ready and tabs initialisation JavaScript /// </summary> protected internal void EndAccordion() { bool prettyRender = this.Rendering.PrettyRender; int tabDepth = this.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); // Closing Accordion DIV sb.AppendLineIf(); sb.AppendTabsFormatLineIf("</{0}>", this.Options.ContainerTag); this.Writer.Write(sb.ToString()); if (this.Rendering.AutoScript) { this.RenderStartUpScript(); } } // EndAccordion
/// <summary> /// Renders the list of MenuItems to the string builder. /// </summary> /// <param name="sb">StringBuilder</param> protected internal void RenderChildren(jStringBuilder sb) { // Open list/item if (!_IsRoot) sb.AppendTabsFormat("<{0}>", this.Menu.Options.Menus); foreach (MenuItem mi in this.Children._MenuItems) { mi.BuildTagHtml(sb); } // Close list/item if (!_IsRoot) sb.AppendTabsFormatLineIf("</{0}>", this.Menu.Options.Menus); }
/// <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 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
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(); }
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(); }
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(); }
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(); }
/// <summary> /// Writes out the closing tag for the content DIV of the tab /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (this._Disposed) return; this._Disposed = true; Accordion ac = this.OnAccordion; bool prettyRender = ac.Rendering.PrettyRender; int tabDepth = ac.Rendering.TabDepth + 1; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); // Close pane container div sb.AppendLineIf(); sb.AppendTabsFormatLineIf("</{0}>", ac.Options.ContentTag); _Writer.Write(sb.ToString()); } // Dispose
protected string PositionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 3); if (!string.IsNullOrEmpty(this.At1) && !string.IsNullOrEmpty(this.At2)) { sb.AppendTabsFormatLineIf(".SetAt(\"{0}\", \"{1}\")", this.At1, this.At2); } else if (!string.IsNullOrEmpty(this.At1)) { sb.AppendTabsFormatLineIf(".SetAt(\"{0}\")", this.At1); } else if (!string.IsNullOrEmpty(this.At2)) { sb.AppendTabsFormatLineIf(".SetAt(\"{0}\")", this.At2); } if (!string.IsNullOrEmpty(this.My1) && !string.IsNullOrEmpty(this.My2)) { sb.AppendTabsFormatLineIf(".SetMy(\"{0}\", \"{1}\")", this.My1, this.My2); } else if (!string.IsNullOrEmpty(this.My1)) { sb.AppendTabsFormatLineIf(".SetMy(\"{0}\")", this.My1); } else if (!string.IsNullOrEmpty(this.My2)) { sb.AppendTabsFormatLineIf(".SetMy(\"{0}\")", this.My2); } if (!Utils.IsNullEmptyOrDefault(this.Collision1, "none") && !Utils.IsNullEmptyOrDefault(this.Collision2, "none")) { sb.AppendTabsFormatLineIf(".SetCollision(\"{0}\", \"{1}\")", this.Collision1, this.Collision2); } else if (!Utils.IsNullEmptyOrDefault(this.Collision1, "none")) { sb.AppendTabsFormatLineIf(".SetCollision(\"{0}\")", this.Collision1); } else if (!Utils.IsNullEmptyOrDefault(this.Collision2, "none")) { sb.AppendTabsFormatLineIf(".SetCollision(\"{0}\")", this.Collision2); } return sb.ToString(); }
protected string OptionsCSharpCode() { jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 2); if (this.disabled) sb.AppendTabsLineIf(".SetDisabled(true)"); if (!string.IsNullOrEmpty(this.animate)) { if (Helpers.Utils.IsBool(this.animate)) sb.AppendTabsFormatLineIf(".SetAnimate({0})", bool.Parse(this.animate).JsBool()); else if (!Helpers.Utils.IsNullEmptyOrDefault(this.animate, Widget.jAccordion.Options.DEFAULT_ANIMATE)) sb.AppendTabsFormatLineIf(".SetAnimate(\"{0}\")", this.animate); } if (this.collapsible) sb.AppendTabsLineIf(".SetCollapsible(true)"); if (!Helpers.Utils.IsNullEmptyOrDefault(this.evt, Widget.jAccordion.Options.DEFAULT_EVENT)) sb.AppendTabsFormatLineIf(".SetEvent(\"{0}\")", this.evt); if (!string.IsNullOrEmpty(this.heightStyle)) { sb.AppendTabsFormatLineIf(".SetHeightStyle(\"{0}\")", this.heightStyle); } // icons have to be set as a pair bool addNormalIcon = !string.IsNullOrEmpty(this.headerIconClass) && this.headerIconClass != Widget.jAccordion.Options.DEFAULT_HEADER_ICON_CLASS; bool addSelectedIcon = !string.IsNullOrEmpty(this.activeHeaderIconClass) && this.activeHeaderIconClass != Widget.jAccordion.Options.DEFAULT_ACTIVE_HEADER_ICON_CLASS; if (addNormalIcon || addSelectedIcon) { sb.AppendTabsFormatLineIf(".SetIcons(\"{0}\", \"{1}\")", this.headerIconClass, this.activeHeaderIconClass); } return sb.ToString(); }