Hello, this is my first post to this list, so I apologize if this is going to the wrong place (the wizard support being in wicket-extensions, not in wicket itself.)

I have a use case where I would like to be able to splice wizard sequences together, possibly injecting one wizard into another under certain conditions. Here is an example. Say that I have a wizard process which creates Widgets, and every Widget must be associated with a Doohickey. I want to allow the user to proceed down one of two paths: he may select an existing Doohickey, or he may choose to create the Doohickey on the fly. If he chooses the latter, I would like to "splice" the "Create Doohickey" wizard sequence into the "Create Widget" sequence. I want to share as much code as possible between the standalone Create Doohickey wizard and the embedded-in-Create-Widget Create Doohickey wizard.

This use case basically requires two things: first, the WizardModels must be defined in a standalone manner, so that Create Widget has the ability to create a Create Doohickey sequence and inject it into its own sequence. Second, the spliced-in wizard must only appear under certain conditions. In this case, the condition would be that the user did not select an existing Doohickey earlier in the wizard sequence.

My current solution to this problem involves a new class which maintains a list of IWizardSteps outside of any IWizardModel; that object has a method which can be called to "inject" those wizard steps into any given IWizardModel. As it injects those steps, it also applies a single condition across all of them...possibly merging it (using "and" semantics) with the ICondition implementation on the step itself. While this setup works, and it does allow a single condition to cover several steps in a single model, it just feels "clunky." I can't help but feel that a better way to do this would be to allow WizardModels to be nested, possibly linked with IConditions. This would afford complete (I think?) reusability of models in this "splicing in" scenario.

Am I completely off base here? Is there a better way to do what I am trying to do? IDynamicWizardStep is obviously not an option because the "nested" wizards would not be aware of the steps/models before and after them. IConditions alone won't do it because I'd rather not expose all of the steps in each sub-sequence to whatever super-sequence may contain it--and the conditions will change on a wizard-by-wizard basis.

If this does sound like a reasonable solution, or if somebody has a better solution, I'd like to know about it. I would be willing to try to implement this and contribute it back to the project.
--Matt Jensen

Reply via email to