Thursday, November 28, 2013

Re: Multipath/Branch Workflow Wizard

I searched for it some time ago and didn't find anything so I started thinking about the basic design of a wizard that supports multiple paths, optional steps and eventually loops (e.g. "Do you want to create another Item?" -> Yes -> Jump back to step x in branch y).

From an API point of view I would like to have something declarative so I can see the wizard structure and all the decisions for each branch at one place and not scattered around in all wizard steps, e.g.

void initFlow() {
  startWith(page1)
     .then(page2)
     .thenOptional(<predicate>, page3)
     .then(
         newBranch(<predicate>, page4A, page5A),
         newBranch(<predicate>, page4B, page5B, page6B)
      )
      .then(finalPage)
}

But its not fully thought out yet (some cases only work by duplicating some declarative code but these cases are relatively rare I would guess) and does not contain loops (may be possible by "tagging" a page with an id and then being able to jump to id's based on predicates). The <predicate> stuff will be nice with Java 8 when you can use lambda's which could result in something like:

startWith(personPage)
   .thenOptional(page1::isAskForDetailsSelected, detailsPage);



-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment