Wizard API supporting dynamic pages reimplementation

Hi folks,

I started writing some wizards for my tests using red deer and I got some troubles.
For example, my wizard consists of several pages and some "next" pages depend on the previous ones.

Page A (contains attribute name)
-> if name = "xyz" then go to the Page B1
-> if name = "zyx" then go to the Page B2

Note that pages B1 and B2 differ a lot, so my test wizard looks like

WizardDialog wizard = new MyImportWizardDialog();
wizard.open();
wizard.getFirstPage().setName("xyz");
wizard.next();
WizardPage pageB = wizard.getSecondPage();
if(pageB instanceof MyWizardPageB1) {
    MyWizardPageB1 pageB1 = (MyWizardPageB1) pageB;
    pageB1.setXyz();
}
if(pageB instanceof MyWizardPageB2) {
    MyWizardPageB2 pageB2 = (MyWizardPageB2) pageB;
    pageB1.setZyx();
}
...

So, here are my suggestions how to improve that

1) We should get a WizardPage using WizardDialog.next() or WizardDialog.back() + maybe ImportWizardDialog.open()
2) It's not necessary to have reference to WizardDialog in WizardPage (do we really need this?). The same for pageIndex in WizardPage (WizardDialog takes care about that)
3) Each WizardPage will have a method for filling the page, something like WizardPage.fillWizardPage("name", "xyz") and method setName("xyz") will be invoked on that page

You can find the changes at https://github.com/apodhrad/reddeer/commit/6b3bbd3fa625609a291b1fe71c00ad0d6cfd4f86

Using these changes we will get the following code

WizardDialog wizard = new MyImportWizardDialog();
wizard.open().setName("xyz");
WizardPage pageB = wizard.next();
pageB.fillWizardPage("attribute", "value")

So, what you think about that? 


-- Andrej Podhradsky