Minor changes to improve testability of helpers
[castle.git] / MonoRail / Castle.MonoRail.Framework / Attributes / ViewComponentDetailsAttribute.cs
blob5921ffccdde6091223a23dcec584e5c09e8c09dc
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;
19 /// <summary>
20 /// Decorates a <see cref="ViewComponent"/> to associate a custom name with it.
21 /// </summary>
22 /// <remarks>
23 /// Decorates a <see cref="ViewComponent"/> to associate a custom name with it.
24 /// <para>
25 /// Optionally you can associate the section names supported by the
26 /// <see cref="ViewComponent"/>.
27 /// </para>
28 /// </remarks>
29 /// <example>
30 /// In the code below, the class MyHeaderViewConponent will be referenced as just <c>Header</c>,
31 /// and it will support the subsections <c>header</c> and <c>footer</c>.
32 /// <code><![CDATA[
33 /// [ViewComponentDetails("Header", Sections="header,footer")
34 /// public class MyHeaderViewComponent : ViewComponent
35 /// {
36 /// // :
37 /// // :
38 /// }
39 /// ]]>
40 /// </code>
41 /// </example>
42 /// <seealso cref="ViewComponent"/>
43 /// <seealso cref="ViewComponentParamAttribute"/>
45 [AttributeUsage(AttributeTargets.Class), Serializable]
46 public class ViewComponentDetailsAttribute : Attribute
48 private readonly string name;
49 private string sections;
51 /// <summary>
52 /// Initializes a new instance of the <see cref="ViewComponentDetailsAttribute"/> class.
53 /// </summary>
54 /// <param name="name">The specified ViewComponent's Name</param>
55 public ViewComponentDetailsAttribute(String name)
57 this.name = name;
60 /// <summary>
61 /// The component's name
62 /// </summary>
63 public string Name
65 get { return name; }
68 /// <summary>
69 /// Sets the nested sections that this <see cref="ViewComponent"/> supports.
70 /// </summary>
71 /// <value>The nested sections names, comma separated.</value>
72 public string Sections
74 get { return sections; }
75 set { sections = value; }