Added non-generic registration interface to IKernel and IWindsor to accommodate dynam...
[castle.git] / MonoRail / Castle.MonoRail.Framework / ViewComponents / IViewComponentContext.cs
blob7dd91f1e00a8f79d479e82a8d8b67e75cc8fc0a4
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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
17 using System;
18 using System.IO;
19 using System.Collections;
21 /// <summary>
22 /// Exposes the operations that can be performed by <see cref="ViewComponent"/>s
23 /// </summary>
24 public interface IViewComponentContext
26 /// <summary>
27 /// Gets the name of the component.
28 /// </summary>
29 /// <value>The name of the component.</value>
30 String ComponentName { get; }
32 /// <summary>
33 /// Determines whether the current component declaration on the view
34 /// has the specified section.
35 /// </summary>
36 /// <param name="sectionName">Name of the section.</param>
37 /// <returns>
38 /// <c>true</c> if the specified section exists; otherwise, <c>false</c>.
39 /// </returns>
40 bool HasSection(String sectionName);
42 /// <summary>
43 /// Renders the view specified to the writer.
44 /// </summary>
45 /// <param name="name">The view template name</param>
46 /// <param name="writer">A writer to output</param>
47 void RenderView(String name, TextWriter writer);
49 /// <summary>
50 /// Renders the component body.
51 /// </summary>
52 void RenderBody();
54 /// <summary>
55 /// Renders the body into the specified <see cref="TextWriter"/>
56 /// </summary>
57 /// <param name="writer">The writer.</param>
58 void RenderBody(TextWriter writer);
60 /// <summary>
61 /// Renders the the specified section.
62 /// No exception will the throw if the section cannot be found.
63 /// </summary>
64 /// <param name="sectionName">Name of the section.</param>
65 void RenderSection(String sectionName);
67 /// <summary>
68 /// Renders the the specified section.
69 /// No exception will the throw if the section cannot be found.
70 /// </summary>
71 /// <param name="sectionName">Name of the section.</param>
72 /// <param name="writer">The writer to output the section content.</param>
73 void RenderSection(String sectionName, TextWriter writer);
75 /// <summary>
76 /// Gets the writer used to render the view component
77 /// </summary>
78 /// <value>The writer.</value>
79 TextWriter Writer { get; }
81 /// <summary>
82 /// Gets the dictionary that holds variables for the
83 /// view and for the view component
84 /// </summary>
85 /// <value>The context vars.</value>
86 IDictionary ContextVars { get; }
88 /// <summary>
89 /// Gets the component parameters that the view has passed
90 /// to the component
91 /// </summary>
92 /// <value>The component parameters.</value>
93 IDictionary ComponentParameters { get; }
95 /// <summary>
96 /// Gets or sets the view to render.
97 /// </summary>
98 /// <value>The view to render.</value>
99 String ViewToRender { get; set; }
101 /// <summary>
102 /// Gets the view engine instance.
103 /// </summary>
104 /// <value>The view engine.</value>
105 IViewEngine ViewEngine { get; }