Esempio n. 1
0
		/// <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();
		}
Esempio n. 2
0
		/// <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();
		}
Esempio n. 3
0
		/// <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();
		}
Esempio n. 4
0
		/// <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);
			
			//sb.IncIndent();
			//sb.AppendTabsFormatIf("$.cookie(", this.ID);
			Core.ScriptOptions options = new Core.ScriptOptions();
			this.Options.DiscoverOptions(options);
			options.Render(sb);
			//sb.Append(");");
			//sb.DecIndent();
			
			return sb.ToString();
		}
Esempio n. 5
0
		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();
		}
Esempio n. 6
0
		/// <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();
		}
Esempio n. 7
0
		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();
		}
Esempio n. 8
0
		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();	
		}
Esempio n. 9
0
		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);
		}
Esempio n. 10
0
		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();
		}
Esempio n. 11
0
		/// <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();
		}
Esempio n. 12
0
		/// <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();
		}
Esempio n. 13
0
		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();
		}
Esempio n. 14
0
		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();			
		}
Esempio n. 15
0
		/// <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();
		}
Esempio n. 16
0
		/// <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
Esempio n. 17
0
		private void RenderRootCloseItem(jStringBuilder sb) {
			sb.AppendTabsFormat("</{0}>", PARENT_TAG);
		}
Esempio n. 18
0
		} // BuildTagHtml
		
		private void RenderRootOpenItem(jStringBuilder sb) {
			sb.AppendTabsFormat("<{0}", PARENT_TAG);
			this.SelectMenu.RenderAttributes(sb);
			sb.AppendLineIf(">");
		}
Esempio n. 19
0
		/// <summary>
		/// Returns an HTML list (ul/li set) of all the available icons.
		/// </summary>
		/// <returns>HTML list (ul/li set) of all the available icons.</returns>
		public static string RenderAsList() {
			jStringBuilder sb = new jStringBuilder(true, 1);
			sb.AppendTabsLine("<ul id=\"icons\">");
			List<string>.Enumerator e = Icons.ToList().GetEnumerator();
			while (e.MoveNext()) {
				sb.AppendTabs();
				sb.AppendFormat("<li title=\".{0}\">", e.Current);
				sb.AppendFormat(  "<span class=\"ui-icon {0}\"></span>", e.Current);
				sb.AppendFormat("</li>");
				sb.AppendLine();
			}			 
			sb.AppendTabsLine("</ul>");
			return sb.ToString();
		}
Esempio n. 20
0
		private void RenderCloseItem(jStringBuilder sb) {
			sb.AppendFormat("</{0}>", this.Tag);
		}
Esempio n. 21
0
		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();	
		}
Esempio n. 22
0
		/// <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);
		}
Esempio n. 23
0
		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();
		}
Esempio n. 24
0
		/// <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();
		} 
Esempio n. 25
0
		/// <summary>
		/// Override entry-point for the SelectMenuItem and SelectOptGroups classes to render how they should be
		/// </summary>
		/// <param name="sb"></param>
		virtual protected internal void BuildTagHtml(jStringBuilder sb) {

		}
Esempio n. 26
0
		/// <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
Esempio n. 27
0
		/// <summary>
		/// Builds and returns the HTML for the Menu 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 Menu control.</returns>
		protected internal string GetTagHtml() {
			// ID property is _mandatory_
			if (string.IsNullOrEmpty(this.ID))
				throw new ArgumentException("Menu 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)
				// it's the top level, so output CSS (if required)
				this.WithCss("ui-menu ui-widget ui-widget-content ui-corner-all");

			this.Root.BuildTagHtml(sb);

			if (this.Rendering.AutoScript) {
				this.RenderStartUpScript();
			}

			return sb.ToString();

		} // GetTagHtml
Esempio n. 28
0
		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();
		}
Esempio n. 29
0
		} // 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();
		}
Esempio n. 30
0
		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();
		}