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
20 /// Depicts the contract for wizard controllers.
23 /// <seealso cref="WizardActionProvider"/>
24 /// <seealso cref="WizardStepPage"/>
27 /// The following code shows how to create a simple wizard with two pages.
29 /// [DynamicActionProvider(typeof(WizardActionProvider))]
30 /// public class MyWizardController : Controller, IWizardController
32 /// public void OnWizardStart()
35 /// public bool OnBeforeStep(String wizardName, String stepName, WizardStepPage step)
40 /// public void OnAfterStep(String wizardName, String stepName, WizardStepPage step)
43 /// public WizardStepPage[] GetSteps(IRailsEngineContext context)
45 /// return new WizardStepPage[] { new MyPage1(), new MyPage2() };
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.
56 public interface IWizardController
59 /// Called when the wizard starts.
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.
68 /// Called before processing a step. Returning <c>false</c> tells
69 /// the infrastructure to stop the processing the request.
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
);
78 /// Called after processing a step.
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
);
86 /// Implementors should return an array of steps that compose the wizard.
89 /// This should be deterministic per session -- ie.
90 /// always return the same instances for the same user session.
92 /// <param name="context">The web request context.</param>
93 /// <returns>An array of steps</returns>
94 WizardStepPage
[] GetSteps(IRailsEngineContext context
);