Maybe we should write out a competition: who builds the best high-level reusable wizzard component :)

Eelco


Martijn Dashorst wrote:

I have put this on the wiki (http://wicket.sourceforge.net/wiki/doku.php?id=user:building_wizard_functionality), as this is a recurring question...

Martijn


Eelco Hillenius wrote:

There are generally two ways of doing this (I think):
1. Page oriented. Create a page for each step, and record your status by either passing it to the step pages as you construct them.
2. Panel oriented, using:
a. 'replace'. This way you have one panel (e.g. 'mywizPanel'), where your step part of the wizzard is in. On a next step, replace the current panel with the next one. The advantage of this is that it is flexible (doesn't matter how many steps you have, you can allways replace the panel with an arbitrairy other one. You let Wicket handle back-button support (Wicket will record undo's using a memento like pattern).
b. 'set/isVisible'. Here you create all instances of the panels you need beforehand, and put them all on the page (or wizzard panel), using different names (e.g. 'myWizStep1' and 'myWizStep2'). The trick here is the set only the one visible that is currently active (thus all others are not rendered). The advantage of this is that you only create the instances once, and that you don't have to record changes for backbutton support. However, it consumes more memory upfront, and you have to know your panel steps beforehand.


With 2, I would record the wizzard state with the parent (page or another panel).

Another thing that might be a good idea, is to use command patterns for navigation actions. For example, I use this for a project:

public interface INavigationAction
{
   void navigate(RequestCycle requestCycle);
}

/** action to navigate back to this page. */
private final INavigationAction backToThisPageNavigationAction = new INavigationAction()
{
public void navigate(RequestCycle requestCycle)
{
requestCycle.setResponsePage(VenueListPage.this);
}
};


and then have something like:

public VenueDetailsPage(Long venueId, INavigationAction backNavigationAction)
{
...
add(new Link("cancelButton")
{
public void onClick()
{
backNavigationAction.navigate(getRequestCycle());
}
});
....


Anyway, that's just an idea. You might come up with a more elegant pattern, or you might be happy with a tight coupling between the wizzard steps.

Regards,

Eelco


Matthew Watson wrote:

Hi,

I need to create a complicated wizard composed of numerous screens and
buttons to navigate arround them.

Using wicket whats the best approach to take? I know this is a fairly
general question but I'm not entire sure where to start.

Thanks in advance,
Matt





------------------------------------------------------- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to