1 // Copyright 2004-2007 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
19 using System
.Collections
;
22 /// Exposes the operations that can be performed by <see cref="ViewComponent"/>s
24 public interface IViewComponentContext
27 /// Gets the name of the component.
29 /// <value>The name of the component.</value>
30 String ComponentName { get; }
33 /// Determines whether the current component declaration on the view
34 /// has the specified section.
36 /// <param name="sectionName">Name of the section.</param>
38 /// <c>true</c> if the specified section exists; otherwise, <c>false</c>.
40 bool HasSection(String sectionName
);
43 /// Renders the view specified to the writer.
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
);
50 /// Renders the component body.
55 /// Renders the body into the specified <see cref="TextWriter"/>
57 /// <param name="writer">The writer.</param>
58 void RenderBody(TextWriter writer
);
61 /// Renders the the specified section.
62 /// No exception will the throw if the section cannot be found.
64 /// <param name="sectionName">Name of the section.</param>
65 void RenderSection(String sectionName
);
68 /// Renders the the specified section.
69 /// No exception will the throw if the section cannot be found.
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
);
76 /// Gets the writer used to render the view component
78 /// <value>The writer.</value>
79 TextWriter Writer { get; }
82 /// Gets the dictionary that holds variables for the
83 /// view and for the view component
85 /// <value>The context vars.</value>
86 IDictionary ContextVars { get; }
89 /// Gets the component parameters that the view has passed
92 /// <value>The component parameters.</value>
93 IDictionary ComponentParameters { get; }
96 /// Gets or sets the view to render.
98 /// <value>The view to render.</value>
99 String ViewToRender { get; set; }
102 /// Gets the view engine instance.
104 /// <value>The view engine.</value>
105 IViewEngine ViewEngine { get; }