When thinking about such things like this, I tend to think in terms of
'classic' OO strategies like inheritance and polymorphism. T5 is really
big on services and annotations, which may actually provide a more
flexible solution for this problem. At first the obvious two solutions
occurred to me:
1) Have each page that is part of the process explicitly check for
completion of the previous step, and redirect back if incomplete. This
is easy to implement for a small case, but not at all scalable.
2) Have some base interfaces/classes that the pages composing the wizard
implement/extend. This would be better than #1 but introduces dependencies.
Then I considered the way that T5 uses simple configuration (via
annotations) to ascertain things like components and event handlers, and
the somewhat unclear role (to me) services play. In looking through the
IoC docs, it seems like one could contribute a a dispatcher to the
MasterDispatcher service that could do some pre-processing of the
requested page. If that's possible, then implementing a wizard could be
done seamlessly with this service and a small set of annotations on the
page classes composing the forms. So if I had page classes Page1 - Page3
that made up a simple wizard, my code might be:
@WizardPage( id = "registrationWiz", index = 1 )
public class Page1 { ... }
@WizardPage( id = "registrationWiz", index = 2 )
public class Page2 { ... }
@WizardPage( id = "registrationWiz", index = 3 )
public class Page3 { ... }
Any thoughts on this? I don't even know if its possible to intercept the
page, but if it is then perhaps this could work.
chris
Nick Westgate (Work) wrote:
Read the docs for onActivate().
Cheers,
Nick.
Chris Lewis-5 wrote:
Hello,
I'm redeveloping an application in T5 that will have several wizard-like
form sequences. Basically a few forms on a few pages that must be
followed in order, with the ability to revisit/jump around in steps
already completed. A wizard should prevent steps (pages) from being
accessed out of sequence unless they have already completed that step.
Ultimately the completion of a wizard will result in 1 ore more objects
being created and most likely persisted.
The first one I'm implementing is fairly small - 2 forms on 2 pages. Its
obviously easy to verify and handle the input from the first page, and
then render the second page as needed. I simply have an
onSuccessFromRegister handler return an instance of the second page.
Before it returns this instance, it calls a setter on the second page to
indicate the decision(s) made on the first (bucket brigade?). This is
working, but what it doesn't do is prevent the 2nd page from being
accessed out of sequence. So I thought implementing one of the early
render methods in the page to check for the valid sequence would be
good, but I don't know how to redirect the user if needed, since I can't
just return a page instance (its not an action handler)!
If anyone has input on how to achieve this I'd appreciate input.
PS Form components must always trigger a method in that page class, as
opposed to a different one, right?
thanks :)
chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Chris Lewis wrote:
Hello,
I'm redeveloping an application in T5 that will have several
wizard-like form sequences. Basically a few forms on a few pages that
must be followed in order, with the ability to revisit/jump around in
steps already completed. A wizard should prevent steps (pages) from
being accessed out of sequence unless they have already completed that
step. Ultimately the completion of a wizard will result in 1 ore more
objects being created and most likely persisted.
The first one I'm implementing is fairly small - 2 forms on 2 pages.
Its obviously easy to verify and handle the input from the first page,
and then render the second page as needed. I simply have an
onSuccessFromRegister handler return an instance of the second page.
Before it returns this instance, it calls a setter on the second page
to indicate the decision(s) made on the first (bucket brigade?). This
is working, but what it doesn't do is prevent the 2nd page from being
accessed out of sequence. So I thought implementing one of the early
render methods in the page to check for the valid sequence would be
good, but I don't know how to redirect the user if needed, since I
can't just return a page instance (its not an action handler)!
If anyone has input on how to achieve this I'd appreciate input.
PS Form components must always trigger a method in that page class, as
opposed to a different one, right?
thanks :)
chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]