C# Class Castle.MonoRail.Framework.Helpers.PrototypeHelper.JSGenerator

Pendent
Inheritance: DynamicDispatchSupport, IJSGenerator
ファイルを表示 Open project: nats/castle-1.0.3-mono

Public Methods

Method Description
Alert ( object message ) : void

Shows a JS alert

AppendLine ( String content ) : void

Writes the content specified to the generator instance

This is for advanced scenarios and for the infrastructure. Usually not useful.

Assign ( String variable, String expression ) : void

Assigns a javascript variable with the expression.

BuildJSArguments ( object args ) : string

Builds the JS arguments.

Call ( object function ) : void

Calls the specified function with the optional arguments.

CreateCollectionGenerator ( string root ) : IJSCollectionGenerator

Creates a generator for a collection.

CreateElementGenerator ( string root ) : IJSElementGenerator

Creates a generator for an element.

Declare ( string variable ) : void

Declares the specified variable as null.

Hide ( ) : void

Hides the specified elements.

The elements must exist.

InsertHtml ( string position, string id, object renderOptions ) : void

Inserts a content snippet relative to the element specified by the id

The supported positions are Top, After, Before, Bottom

JSGenerator ( IRailsEngineContext context ) : System

Initializes a new instance of the JSGenerator class.

ReApply ( ) : void

Re-apply Behaviour css' rules.

Only makes sense if you are using the Behaviour javascript library.

Record ( IJSGenerator gen, string line ) : void

Records the specified line on the generator.

RedirectTo ( object url ) : void

Redirects to an url using the location.href. This is required as most ajax libs don't care for the redirect status in the http reply.

Remove ( ) : void

Remove the specified elements from the DOM.

The elements must exist.

RemoveTail ( IJSGenerator generator ) : void

Removes the tail.

Render ( object renderOptions ) : object

Outputs the content using the renderOptions approach.

If the renderOptions is a string, the content is escaped and quoted.

If the renderOptions is a dictionary, we extract the key partial and evaluate the template it points to. The content is escaped and quoted.

Replace ( String id, object renderOptions ) : void

Replaces the entire target element -- and not only its innerHTML -- by the content evaluated.

ReplaceHtml ( String id, object renderOptions ) : void

Replaces the content of the specified target element.

ReplaceTailByPeriod ( IJSGenerator generator ) : void

Replaces the tail by period.

Show ( ) : void

Shows the specified elements.

The elements must exist.

ToString ( ) : string

Returns a that represents the current .

Toggle ( ) : void

Toggles the display status of the specified elements.

The elements must exist.

VisualEffect ( String name, String element, IDictionary options ) : void

Generates a call to a scriptaculous' visual effect.

VisualEffectDropOut ( String element, IDictionary options ) : void

Generates a call to a scriptaculous' drop out visual effect.

Write ( String content ) : void

Writes the content specified to the generator instance

This is for advanced scenarios and for the infrastructure. Usually not useful.

Private Methods

Method Description
JSGenerator ( ) : System

Collects the public methods

JsEscape ( string content ) : string
JsEscapeWithSQuotes ( string content ) : string

Method Details

Alert() public method

Shows a JS alert
public Alert ( object message ) : void
message object The message to display.
return void

AppendLine() public method

Writes the content specified to the generator instance
This is for advanced scenarios and for the infrastructure. Usually not useful.
public AppendLine ( String content ) : void
content String The content.
return void

Assign() public method

Assigns a javascript variable with the expression.
public Assign ( String variable, String expression ) : void
variable String The target variable
expression String The right side expression
return void

BuildJSArguments() public static method

Builds the JS arguments.
public static BuildJSArguments ( object args ) : string
args object The args.
return string

Call() public method

Calls the specified function with the optional arguments.
public Call ( object function ) : void
function object The function name.
return void

CreateCollectionGenerator() public method

Creates a generator for a collection.
public CreateCollectionGenerator ( string root ) : IJSCollectionGenerator
root string The root expression.
return IJSCollectionGenerator

CreateElementGenerator() public method

Creates a generator for an element.
public CreateElementGenerator ( string root ) : IJSElementGenerator
root string The root expression.
return IJSElementGenerator

Declare() public method

Declares the specified variable as null.
public Declare ( string variable ) : void
variable string The variable name.
return void

Hide() public method

Hides the specified elements.
The elements must exist.
public Hide ( ) : void
return void

InsertHtml() public method

Inserts a content snippet relative to the element specified by the id

The supported positions are Top, After, Before, Bottom

public InsertHtml ( string position, string id, object renderOptions ) : void
position string The position to insert the content relative to the element id
id string The target element id
renderOptions object Defines what to render
return void

JSGenerator() public method

Initializes a new instance of the JSGenerator class.
public JSGenerator ( IRailsEngineContext context ) : System
context IRailsEngineContext The request context
return System

ReApply() public method

Re-apply Behaviour css' rules.
Only makes sense if you are using the Behaviour javascript library.
public ReApply ( ) : void
return void

Record() public static method

Records the specified line on the generator.
public static Record ( IJSGenerator gen, string line ) : void
gen IJSGenerator The gen.
line string The line.
return void

RedirectTo() public method

Redirects to an url using the location.href. This is required as most ajax libs don't care for the redirect status in the http reply.
public RedirectTo ( object url ) : void
url object The URL.
return void

Remove() public method

Remove the specified elements from the DOM.
The elements must exist.
public Remove ( ) : void
return void

RemoveTail() public static method

Removes the tail.
public static RemoveTail ( IJSGenerator generator ) : void
generator IJSGenerator The generator.
return void

Render() public method

Outputs the content using the renderOptions approach.

If the renderOptions is a string, the content is escaped and quoted.

If the renderOptions is a dictionary, we extract the key partial and evaluate the template it points to. The content is escaped and quoted.

public Render ( object renderOptions ) : object
renderOptions object The render options.
return object

Replace() public method

Replaces the entire target element -- and not only its innerHTML -- by the content evaluated.
public Replace ( String id, object renderOptions ) : void
id String The target element id
renderOptions object Defines what to render
return void

ReplaceHtml() public method

Replaces the content of the specified target element.
public ReplaceHtml ( String id, object renderOptions ) : void
id String The target element id
renderOptions object Defines what to render
return void

ReplaceTailByPeriod() public static method

Replaces the tail by period.
public static ReplaceTailByPeriod ( IJSGenerator generator ) : void
generator IJSGenerator The generator.
return void

Show() public method

Shows the specified elements.
The elements must exist.
public Show ( ) : void
return void

ToString() public method

Returns a that represents the current .
public ToString ( ) : string
return string

Toggle() public method

Toggles the display status of the specified elements.
The elements must exist.
public Toggle ( ) : void
return void

VisualEffect() public method

Generates a call to a scriptaculous' visual effect.
public VisualEffect ( String name, String element, IDictionary options ) : void
name String The effect name.
element String The target element.
options IDictionary The optional options.
return void

VisualEffectDropOut() public method

Generates a call to a scriptaculous' drop out visual effect.
public VisualEffectDropOut ( String element, IDictionary options ) : void
element String The target element.
options IDictionary The optional options.
return void

Write() public method

Writes the content specified to the generator instance
This is for advanced scenarios and for the infrastructure. Usually not useful.
public Write ( String content ) : void
content String The content.
return void