Minor style changes
[castle.git] / MonoRail / Castle.MonoRail.Framework / IWizardController.cs
blob286bdf3f7363559160d0ef0f399198b035743d72
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 /// Depicts the contract for wizard controllers.
21 /// </summary>
22 ///
23 /// <seealso cref="WizardActionProvider"/>
24 /// <seealso cref="WizardStepPage"/>
25 ///
26 /// <example>
27 /// The following code shows how to create a simple wizard with two pages.
28 /// <code>
29 /// [DynamicActionProvider(typeof(WizardActionProvider))]
30 /// public class MyWizardController : Controller, IWizardController
31 /// {
32 /// public void OnWizardStart()
33 /// { }
34 ///
35 /// public bool OnBeforeStep(String wizardName, String stepName, WizardStepPage step)
36 /// {
37 /// returtn true;
38 /// }
39 ///
40 /// public void OnAfterStep(String wizardName, String stepName, WizardStepPage step)
41 /// { }
42 ///
43 /// public WizardStepPage[] GetSteps(IRailsEngineContext context)
44 /// {
45 /// return new WizardStepPage[] { new MyPage1(), new MyPage2() };
46 /// }
47 /// }
48 /// </code>
49 /// </example>
50 ///
51 /// <remarks>
52 /// The interface members allow you to perform some logic on important
53 /// events from a wizard lifecycle. The <see cref="GetSteps"/> must be used
54 /// to return the steps the wizard has.
55 /// </remarks>
56 public interface IWizardController
58 /// <summary>
59 /// Called when the wizard starts.
60 /// </summary>
61 /// <remarks>
62 /// This is invoked only once per wizard lifecycle, but can
63 /// happen again if the data added by the infrastructure was not found on the session.
64 /// </remarks>
65 void OnWizardStart();
67 /// <summary>
68 /// Called before processing a step. Returning <c>false</c> tells
69 /// the infrastructure to stop the processing the request.
70 /// </summary>
71 /// <param name="wizardName">Name of the wizard.</param>
72 /// <param name="stepName">Name of the step.</param>
73 /// <param name="step">The step instance.</param>
74 /// <returns><c>true</c> if the process should proceed, otherwise, <c>false</c></returns>
75 bool OnBeforeStep(String wizardName, String stepName, WizardStepPage step);
77 /// <summary>
78 /// Called after processing a step.
79 /// </summary>
80 /// <param name="wizardName">Name of the wizard.</param>
81 /// <param name="stepName">Name of the step.</param>
82 /// <param name="step">The step instance.</param>
83 void OnAfterStep(String wizardName, String stepName, WizardStepPage step);
85 /// <summary>
86 /// Implementors should return an array of steps that compose the wizard.
87 /// </summary>
88 /// <remarks>
89 /// This should be deterministic per session -- ie.
90 /// always return the same instances for the same user session.
91 /// </remarks>
92 /// <param name="context">The web request context.</param>
93 /// <returns>An array of steps</returns>
94 WizardStepPage[] GetSteps(IRailsEngineContext context);