Ejemplo 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();
		}
Ejemplo 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();
		}
Ejemplo 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();
		}
Ejemplo 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();
		}
Ejemplo n.º 5
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();
		}
Ejemplo n.º 6
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();
		}
Ejemplo n.º 7
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();
		}
Ejemplo n.º 8
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();
		}
Ejemplo n.º 9
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();
		}
Ejemplo n.º 10
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();	
		}
Ejemplo n.º 11
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();
		}
Ejemplo n.º 12
0
		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();
		}
Ejemplo n.º 13
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();	
		}
Ejemplo n.º 14
0
		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();
		}
Ejemplo n.º 15
0
		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();
		}
Ejemplo n.º 16
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();
		}
Ejemplo n.º 17
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();
		}
Ejemplo n.º 18
0
		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();
		}
Ejemplo n.º 19
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
Ejemplo n.º 20
0
		public string CSharpCode(Slider sldr) {
			jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0);

			sb.AppendTabsLineIf("<%");
			sb.AppendTabsLineIf("Html.CreateSlider(\"sldr\")");

			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();
		}
Ejemplo n.º 21
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();
		}
Ejemplo n.º 22
0
		/// <summary>
		/// Writes out the content pane of the Tab to the response
		/// </summary>
		internal Pane Render() {
			if (!this.Visible)
				// literally nothing to see here!
				return this;

			int tabDepth = this.Panes.Tabs.Rendering.TabDepth;
			bool prettyRender = this.Panes.Tabs.Rendering.PrettyRender;
			jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth);

			this.RenderBody(sb);

			_Writer.Write(sb.ToString());
			return this;
		}
Ejemplo n.º 23
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();			
		}
Ejemplo n.º 24
0
		/// <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)
			{
				this._Disposed = true;
				bool prettyRender = this.Panes.Tabs.Rendering.PrettyRender;
				int tabDepth = this.Panes.Tabs.Rendering.TabDepth + 1;
				jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth);

				if (this.Visible) { 
					// Close pane
					sb.AppendLineIf();
					sb.AppendTabsLineIf("</div>");
				
					_Writer.Write(sb.ToString());
				}
			}
		}
Ejemplo n.º 25
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();
		}
Ejemplo n.º 26
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();
		} 
Ejemplo 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
Ejemplo n.º 28
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
Ejemplo 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();
		}
Ejemplo n.º 30
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();
		}