Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Wizard: Manipulating the flow
Wizard: Manipulating the flow [message #931503] Wed, 03 October 2012 09:11 Go to next message
Patrick Baenziger is currently offline Patrick BaenzigerFriend
Messages: 96
Registered: September 2011
Member
Hello everyone

Because I have to re-read the implementation every time I do it and the wiki is still sparse in the wizard area, I'd like to ask to ask you the following:

If I wish to implement a wizard that can do loops, branch or simply have a non-standard flow of steps, where is the right place for such customizations?


  • If I wish to have a loop: How (and when/where) do I tell to the last step to return to the first loop step? (Assuming the default would be to end the loop)

  • If I wish to have a branch and want to go back to the branch point and choose the other branch direction, do I have to reset the wizard in any way? (Apart from possible effects on the data that is being processed by the wizard.)

  • If I wish to jump to an arbitrary step Y, after finishing step X, where is the proper place to implement that? In the step, wizard, ...?


Is there a proper way to do this?

Kind regards, Patrick
Re: Wizard: Manipulating the flow [message #931529 is a reply to message #931503] Wed, 03 October 2012 09:36 Go to previous messageGo to next message
Patrick Baenziger is currently offline Patrick BaenzigerFriend
Messages: 96
Registered: September 2011
Member
Perhaps I should add what I am currently doing for a loop/branch.
Assuming my wizard flow looks like this (C-D being the loop) and the loop is skipped by default : A -> B -> [ C -> D ] -> E

  • I use getConfiguredEnabled to disable the loop steps by default.
  • I override execNextStep and execPreviousStep to calculate the next/previous step with getNextEnabledStep/getPreviousEnabledStep as default. And for all special cases (like returning from the loop end to the loop start), if have to check and handle them. ( This needs a if elseif... constructs for all special steps. ). I.e.: If the active step is D, the next step must be C again.
  • The default step order is configured using the Order-Annotation.
  • The wizard step B activates the loop if the user clicks on a special button. It explicitly calls a custom wizard function which uses activateStep(IWizardStep) to go to the normally skipped loop.
  • The step D has an option to exit the loop, which explicitly tells the wizard to finish the loop.
Re: Wizard: Manipulating the flow [message #938357 is a reply to message #931503] Tue, 09 October 2012 20:06 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 205
Registered: November 2010
Senior Member
Hi Patrick

Scout's IWizard/AbstractWizard is a client-only wizard implementation that is kept very simple. Basically it provides a way to sequentially step through a bunch of forms. There is very little logic included out-of-the-box, so there are no default "loop" or "branch" functions.

It's not too hard to create the desired behaviour by yourself, though. (If you check out the code of AbstractWizard, you can see that it's not that complicated.) The wizard holds a list of "steps" that you may freely manipulate, i.e. add, remove or reorder steps. One of those steps is the "active step". The default "execNext" implementation just gets the next step from the step list and sets it as the new active step. But of course, you may change that behaviour by adding or removing steps or activating a step that is "out of the usual order". Steps do not necessarily have to be contained in the set of "available steps", you may introduce new instances at runtime.

If I wish to have a loop: How (and when/where) do I tell to the last step to return to the first loop step? (Assuming the default would be to end the loop)

If your wizard is very specific and is not reused for other purposes, you may code such a logic directly in the wizard. Override the "execNext" method and dynamically add a copy of the first step. For the user this looks like he got "back" to the beginning of the loop, but actually he just got a second time on the same step. The step list would look like this (A = current or past step, b = future step) during the execution of the wizard:

1. A-b-e
2. A-B-e
3. A-B-C-d-e
4. A-B-C-D-e
5. A-B-C-D-B-e
6. A-B-C-D-B-E
7. (finished)


On line 3, steps C and D are inserted dynamically because of some condition of step B. In step 6 this condition does not hold, so step E is finally activated.

For a more generic approach you could create your own abstract subclasses of AbstractWizard and AbstractWizardStep that support the programmer in creating loops and the like.

If I wish to have a branch and want to go back to the branch point and choose the other branch direction, do I have to reset the wizard in any way? (Apart from possible effects on the data that is being processed by the wizard.)

Just update your step list accordingly, i.e. remove the steps that should be discarded.

If I wish to jump to an arbitrary step Y, after finishing step X, where is the proper place to implement that? In the step, wizard, ...?

This depends on your needs and implementation. Both the wizard and the steps (for example in the execDeactivate() method) may alter the wizard state.

Regards,
Beat
Re: Wizard: Manipulating the flow [message #939226 is a reply to message #938357] Wed, 10 October 2012 14:45 Go to previous message
Patrick Baenziger is currently offline Patrick BaenzigerFriend
Messages: 96
Registered: September 2011
Member
Thanks Beat for your extensive answer!
I'll try it out!

Patrick
Previous Topic:Problem in Webservices with JAX-WS of Scout Tutorials
Next Topic:Cancellation of parallel queries on server
Goto Forum:
  


Current Time: Fri Apr 26 11:06:46 GMT 2024

Powered by FUDForum. Page generated in 0.03555 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top