Ejemplo n.º 1
0
		/// <summary>
		/// Creates an AutoComplete control that can then be configured and rendered on the page.
		/// </summary>
		/// <param name="page">WebForms page to render the control onto</param>
		/// <param name="id">ID to give to the accordion (must be unique on the page)</param>
		/// <param name="source">Source to use for the AutoComplete control 
		/// (can be a JavaScript array, JavaScript callback function, URL, etc - see http://jqueryui.com/demos/autocomplete/#option-source </param>
		/// <returns>Created AutoComplete control</returns>
		public static AutoComplete CreateAutoComplete(this System.Web.UI.Page page, string id, string source) 
		{
			TextWriter writer = page.Response.Output;
			AutoComplete ac = new AutoComplete(writer, id, source);

			return ac;
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="ac">Autocomplete object to be configured</param>
		public Options(AutoComplete ac)
		 : base()
		{
			this.AutoComplete = ac;
			this.Position = new PositionOptions(this);
			this.Reset();
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Creates an AutoComplete control that can then be configured and rendered on the page.
		/// </summary>
		/// <param name="html">Html helper (used to get the HttpResponse object to render onto)</param>
		/// <param name="id">ID to give to the accordion (must be unique on the page)</param>
		/// <param name="source">Source to use for the AutoComplete control 
		/// (can be a JavaScript array, JavaScript callback function, URL, etc - see http://jqueryui.com/demos/autocomplete/#option-source </param>
		/// <returns>Created AutoComplete control</returns>
		public static AutoComplete CreateAutoComplete(this HtmlHelper html, string id, string source) 
		{
			TextWriter writer = html.ViewContext.Writer;
			AutoComplete ac = new AutoComplete(writer, id, source);

			return ac;
		}
Ejemplo n.º 4
0
		internal static AutoComplete SetupSimpleAutoCompleteObject(TextWriter writer) 
		{
			// nothing special, just create a simple dummy tab helper as a starting point 
			// (saves having the same code everywhere!)
			AutoComplete ac = new AutoComplete(writer, "ac", "['c++', 'java', 'php']");

			return ac;
		}
Ejemplo n.º 5
0
		public void ConfigureAutoComplete(AutoComplete ac) {
			ac
				.Rendering
					.SetPrettyRender(true)
				.Finish()
				.Options
					.SetDisabled(this.disabled)
					.SetAppendTo(this.appendTo)
					.SetAutoFocus(this.autoFocus)
					.SetDelay(this.delay)
					.SetMinimumLength(this.minLength)
					.Position
						.SetAt(this.At1, this.At2)
						.SetMy(this.My1, this.My2)
						.SetCollision(this.Collision1, this.Collision2)
					.Finish()				
				.Finish()
			;

			if (this.showEvents) {
				ac.Events
					.SetCreateEvent("createEvent(event, ui);")
					.SetSearchEvent("searchEvent(event, ui);")
					.SetResponseEvent("responseEvent(event, ui);")
					.SetOpenEvent("openEvent(event, ui);")
					.SetFocusEvent("focusEvent(event, ui);")
					.SetSelectEvent("selectEvent(event, ui);")
					.SetCloseEvent("closeEvent(event, ui);")
					.SetChangeEvent("changeEvent(event, ui);")
				.Finish();
			}
			if (!this.prettyRender)
				ac.Rendering.Compress();
			if (this.renderCSS)
				ac.Rendering.ShowCSS();
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="ac">Autocomplete object to be called</param>
		public Methods(AutoComplete ac) 
			: base(ac)
		{
		}		
Ejemplo n.º 7
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.º 8
0
		public string JavaScriptCode(AutoComplete ac) {
			ac.Rendering.SetPrettyRender(true);
			return ac.GetStartUpScript();
		}
Ejemplo n.º 9
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="ac">AutoComplete object to set rendering options of</param>
		public Rendering(AutoComplete ac)
		 : base()
		{
			this.AutoComplete = ac;
		}
Ejemplo n.º 10
0
		public string JavaScriptCode(AutoComplete ac) {
			return ac.GetStartUpScript();
		}
Ejemplo n.º 11
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="ac">Autocomplete object to configure events for</param>
		public Events(AutoComplete ac)
		 : base()
		{
			this.AutoComplete = ac;
			this.Reset();
		}