1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
18 using System
.Collections
.Generic
;
22 #region JSCodeGeneratorInfo
27 public class JSCodeGeneratorInfo
29 private IJSCodeGenerator codeGenerator
;
30 private IJSGenerator libraryGenerator
;
31 private object[] extensions
;
32 private object[] elementExtensions
;
35 /// Initializes a new instance of the <see cref="JSCodeGeneratorInfo"/> class.
37 /// <param name="codeGenerator">The code generator.</param>
38 /// <param name="libraryGenerator">The library generator.</param>
39 /// <param name="extensions">The extensions.</param>
40 /// <param name="elementExtensions">The element extensions.</param>
41 public JSCodeGeneratorInfo(IJSCodeGenerator codeGenerator
, IJSGenerator libraryGenerator
, object[] extensions
, object[] elementExtensions
)
43 this.codeGenerator
= codeGenerator
;
44 this.libraryGenerator
= libraryGenerator
;
45 this.extensions
= extensions
;
46 this.elementExtensions
= elementExtensions
;
50 /// Gets or sets the code generator.
52 /// <value>The code generator.</value>
53 public IJSCodeGenerator CodeGenerator
55 get { return codeGenerator; }
56 set { codeGenerator = value; }
60 /// Gets or sets the library generator.
62 /// <value>The library generator.</value>
63 public IJSGenerator LibraryGenerator
65 get { return libraryGenerator; }
66 set { libraryGenerator = value; }
70 /// Gets or sets the extensions.
72 /// <value>The extensions.</value>
73 public object[] Extensions
75 get { return extensions; }
76 set { extensions = value; }
80 /// Gets or sets the element extensions.
82 /// <value>The element extensions.</value>
83 public object[] ElementExtensions
85 get { return elementExtensions; }
86 set { elementExtensions = value; }
93 /// Sits between the controller and the view engines (multiples)
94 /// to decide which view engine should render a specific content
96 public interface IViewEngineManager
99 /// Creates the JS code generator info. Temporarily on IViewEngineManager
101 /// <param name="engineContext">The engine context.</param>
102 /// <param name="controller">The controller.</param>
103 /// <param name="controllerContext">The controller context.</param>
104 /// <returns></returns>
105 JSCodeGeneratorInfo
CreateJSCodeGeneratorInfo(IEngineContext engineContext
, IController controller
,
106 IControllerContext controllerContext
);
109 /// Evaluates whether the specified template exists.
111 /// <returns><c>true</c> if it exists</returns>
112 bool HasTemplate(String templateName
);
115 /// Processes the view - using the templateName
116 /// to obtain the correct template
117 /// and writes the results to the System.TextWriter.
119 void Process(string templateName
, TextWriter output
, IEngineContext context
, IController controller
, IControllerContext controllerContext
);
122 /// Processes the view - using the templateName
123 /// to obtain the correct template
124 /// and writes the results to the System.TextWriter.
126 void Process(string templateName
, string layoutName
, TextWriter output
, IDictionary
<string,object> parameters
);
129 /// Processes a partial view using the partialName
130 /// to obtain the correct template and writes the
131 /// results to the System.TextWriter.
133 /// <param name="partialName">The partial name.</param>
134 /// <param name="output">The output.</param>
135 /// <param name="context">The context.</param>
136 /// <param name="controller">The controller.</param>
137 /// <param name="controllerContext">The controller context.</param>
138 void ProcessPartial(String partialName
, TextWriter output
, IEngineContext context
, IController controller
, IControllerContext controllerContext
);
140 // Holding it a little more as it would be a breaking change (meaning all partials view would break)
143 // /// Processes a partial view using the partialName
144 // /// to obtain the correct template and writes the
145 // /// results to the System.TextWriter.
147 // /// <param name="partialName">The partial name.</param>
148 // /// <param name="output">The output.</param>
149 // /// <param name="context">The context.</param>
150 // /// <param name="parameters">The parameters.</param>
151 // void ProcessPartial(String partialName, TextWriter output, IEngineContext context, IDictionary<string, object> parameters);
154 /// Wraps the specified content in the layout using
155 /// the context to output the result.
157 void RenderStaticWithinLayout(String contents
, IEngineContext context
, IController controller
, IControllerContext controllerContext
);