WizardDescriptor.Panel.storeSettings() appears to be called when:
user presses Previous or Next.
user presses Finish.
user presses Cancel.
And the instantiate() method on the wizard iterator appears to be called when
the user presses Finish.
I would like to be able to detect the Cancel case so I can close a connection
to an external resource (I don't want to close it in the other cases, except
Finish, where I can do it ok with the current API). I would like to be able to
tell via the API (in either the wizard iterator, or in the step) that the user
Cancelled out of the wizard.
Can't you check for NotifyDescriptor.CANCEL_OPTION as the wizard value?
in this case, the wizard was called by a mf-layer entry, so I'm not
sure how I could check the OK/Cancel result. Also, even if I had
called this wizard from Java code, the wizard is the place where this
information is known (what external resources we are connected to),
so it makes more sense to do cleanup processing from there rather
from whoever invoked the wizard, so I would prefer it if the wizard
could tell that the user pressed Cancel.
Set target milestone to TBD
officially requested by S1S, planned for 4.0, upped prio to P1
seems easy, add getExitStatus() method
I added getExitStatus to WizardDescriptor, it returns a status of
wizard with has been closed. For example; if wizard was canceled then
returned NotifyDescriptor.CANCEL_OPTION, until not closed than
returned null. The method is designed as public.
Was committed in wizards_redesign_2002Sep branch.
Pete, could you consider if it makes sense for you? Is it useful way
how to solve? Thanks
These issues have been reported to be part of Sun's "should have" contribution
to NetBeans 4.0 and be "high level" issues. That is why I am changing them to be
FEATUREs with P2. If you think I've done wrong change, please update the issue
and internal documents.
Please publically justify proposed API changes. I didn't get a real
response to my previous comment.
TW.I.initialize(TW) permits the iterator to get the TW. Then you can
ask for its current value. You can listen to changes in the wizard
too. So what's the problem? Look at the template for Wizard Action in
apisupport (can work with TW.I just as easily I think). Or you could
probably use TW.I.uninitialize to cleanup - I have not tried that but
it may be even simpler.
Propose closing this INVALID and reverting whatever API change was
made on the branch, pending a complete analysis of why a change is
As Jesse pointed out, you could query WD.getValue() in
WD.P.storeSettings() or TW.I.uninitialize() to decide what to do (e.g.
unlink resources). I close as INVALID. If I'm wrong, describe where is
a problem I'm ready to participate in solving.
Pete, please could you verify that you are consent with it's closed as
invalid? If yes, we'll quit this. If no, please describe some test
case requires a change. Thanks