C# Class Castle.MonoRail.Framework.Views.NVelocity.NVelocityViewEngine

Implements a view engine using the popular Velocity syntax.

For details on the syntax, check the VTL Reference Guide http://jakarta.apache.org/velocity/docs/vtl-reference-guide.html

Inheritance: ViewEngineBase, IInitializable
Show file Open project: nats/castle-1.0.3-mono

Protected Properties

Property Type Description
velocity NVelocity.App.VelocityEngine

Public Methods

Method Description
CreateJSGenerator ( IRailsEngineContext context ) : object
GenerateJS ( TextWriter output, IRailsEngineContext context, Controller controller, string templateName ) : void
HasTemplate ( String templateName ) : bool

Evaluates whether the specified template exists.

Initialize ( ) : void
NVelocityViewEngine ( ) : NVelocity

Creates a new NVelocityViewEngine instance.

Process ( IRailsEngineContext context, Controller controller, String viewName ) : void

Processes the specified context.

Process ( TextWriter output, IRailsEngineContext context, Controller controller, String viewName ) : void

Processes the view - using the templateName to obtain the correct template and writes the results to the System.TextWriter. No layout is applied!

ProcessContents ( IRailsEngineContext context, Controller controller, String contents ) : void
ProcessPartial ( TextWriter output, IRailsEngineContext context, Controller controller, string partialName ) : void
Service ( IServiceProvider provider ) : void

Protected Methods

Method Description
BeforeApplyingLayout ( string layout, string &contents, Controller controller, IContext ctx, IRailsEngineContext context ) : void
BeforeMerge ( VelocityEngine velocityEngine, Template template, IContext context ) : void
InitializeVelocityProperties ( ExtendedProperties props ) : void

Initializes basic velocity properties. The main purpose of this method is to allow this logic to be overrided.

RenderLayout ( string layoutName, string contents, IContext ctx, IRailsEngineContext context, TextWriter output ) : void
ResolveJSTemplateName ( string templateName ) : string

Resolves the template name into a velocity JS template file name.

ResolveLayoutTemplateName ( string templateName ) : string

Resolves the layout template name into a velocity template file name.

ResolveTemplateName ( string templateName ) : string

Resolves the template name into a velocity template file name.

Private Methods

Method Description
CreateContext ( IRailsEngineContext context, Controller controller ) : IContext
LoadMacros ( ExtendedProperties props ) : void
ProcessLayout ( String contents, Controller controller, IContext ctx, IRailsEngineContext context ) : void
SendErrorDetails ( Exception ex, TextWriter writer ) : void

Method Details

BeforeApplyingLayout() protected method

protected BeforeApplyingLayout ( string layout, string &contents, Controller controller, IContext ctx, IRailsEngineContext context ) : void
layout string
contents string
controller Controller
ctx IContext
context IRailsEngineContext
return void

BeforeMerge() protected method

protected BeforeMerge ( VelocityEngine velocityEngine, Template template, IContext context ) : void
velocityEngine NVelocity.App.VelocityEngine
template NVelocity.Template
context IContext
return void

CreateJSGenerator() public method

public CreateJSGenerator ( IRailsEngineContext context ) : object
context IRailsEngineContext
return object

GenerateJS() public method

public GenerateJS ( TextWriter output, IRailsEngineContext context, Controller controller, string templateName ) : void
output System.IO.TextWriter
context IRailsEngineContext
controller Controller
templateName string
return void

HasTemplate() public method

Evaluates whether the specified template exists.
public HasTemplate ( String templateName ) : bool
templateName String
return bool

Initialize() public method

public Initialize ( ) : void
return void

InitializeVelocityProperties() protected method

Initializes basic velocity properties. The main purpose of this method is to allow this logic to be overrided.
protected InitializeVelocityProperties ( ExtendedProperties props ) : void
props Commons.Collections.ExtendedProperties The collection to populate.
return void

NVelocityViewEngine() public method

Creates a new NVelocityViewEngine instance.
public NVelocityViewEngine ( ) : NVelocity
return NVelocity

Process() public method

Processes the specified context.
public Process ( IRailsEngineContext context, Controller controller, String viewName ) : void
context IRailsEngineContext The context.
controller Controller The controller.
viewName String Name of the view.
return void

Process() public method

Processes the view - using the templateName to obtain the correct template and writes the results to the System.TextWriter. No layout is applied!
public Process ( TextWriter output, IRailsEngineContext context, Controller controller, String viewName ) : void
output System.IO.TextWriter
context IRailsEngineContext
controller Controller
viewName String
return void

ProcessContents() public method

public ProcessContents ( IRailsEngineContext context, Controller controller, String contents ) : void
context IRailsEngineContext
controller Controller
contents String
return void

ProcessPartial() public method

public ProcessPartial ( TextWriter output, IRailsEngineContext context, Controller controller, string partialName ) : void
output System.IO.TextWriter
context IRailsEngineContext
controller Controller
partialName string
return void

RenderLayout() protected method

protected RenderLayout ( string layoutName, string contents, IContext ctx, IRailsEngineContext context, TextWriter output ) : void
layoutName string
contents string
ctx IContext
context IRailsEngineContext
output System.IO.TextWriter
return void

ResolveJSTemplateName() protected method

Resolves the template name into a velocity JS template file name.
protected ResolveJSTemplateName ( string templateName ) : string
templateName string
return string

ResolveLayoutTemplateName() protected method

Resolves the layout template name into a velocity template file name.
protected ResolveLayoutTemplateName ( string templateName ) : string
templateName string
return string

ResolveTemplateName() protected method

Resolves the template name into a velocity template file name.
protected ResolveTemplateName ( string templateName ) : string
templateName string
return string

Service() public method

public Service ( IServiceProvider provider ) : void
provider IServiceProvider
return void

Property Details

velocity protected property

protected VelocityEngine,NVelocity.App velocity
return NVelocity.App.VelocityEngine