There are times when a wizard step contains data that
cannot be validated during isValid() because they are too
time consuming (for example, verify that a UDDI registry
key entered by user exists in external registry, or that a
URL is valid). These should be validated when the user
moves to the Next step or Finishes. But if there is a
validation error at that point, we need to be able to veto
the Next / Finish button press and keep the user in the
current step. Thus, this validation that needs to occur
on step exit (only on Next/Finish -- don't want it to run
on Back/Cancel) must be code that runs within the current
Currently to do this type of validation, we have to
validate these items on entry into the next step, and if a
validation error occurs, we have to give the user a
message that tells them about the validation error and
tell them to "Press the Back button" -- that makes for an
awkward interface, and worse yet, if they have pressed
Finish, then we can't even do this and the user has to
restart the wizard!
See also items 15267 and 11694.
See also item 7706.
Set target milestone to TBD
officially requested by S1S, put into plan for NB 4.0, upped prio to P1
add to API support for "off-line" validation
Attached the comments from issue 26880 (duplicate this issue)
Reported By: email@example.com
When user is creating new project or project group
in e.g. non-writeable folder error message is
poped after hitting Finish and wizard is canceled
and user has no chance to correct the mistake and
has to go through the whole wizard again. It
should be possible to correct the error in wizard
with all already entered values directly.
------- Additional Comments From David Konecny 2002-09-03 03:29 PDT
Current architecture of wizards framework does not allow this. We are
using in projects standard TemplateWizard from OpenIDE. How it works
is that it shows wizard of the template and after the wizard is
finished (means closed) the instantiation of the template is started.
If something wrong happens during the instantiation, the wizard which
is already gone cannot be shown for corections. Moving issue to
OpenIDE to resolve it there.
------- Additional Comments From Tor Norbye 2002-09-03 06:53 PDT -------
One way this could work is to validate the input on each
page when you hit the "Next" button. It's quite common
for wizards to put up a dialog which says
"/foo/bar does not exist. Create it now?"
[ Create ] [ Ignore]
when I hit Next on a page where I've entered /foo/bar/Baz.java
as the filename for my output file.
Of course it's possible that something will still fail
when the user hits Finish (for example, the directory may
have been deleted again) but it's a lot less likely.
------- Additional Comments From Vitezslav Stejskal 2002-09-03 11:36
Yes, but even if instantiate() fails the wizard should be redisplayed
allowing user to correct things and press Finish again or Cancel the
wizard. IMO communication between panels is OK, each panel has
isValid() which it can use to prevent user from submiting wrong
information, the problem is at the end, once Finish is pressed there
is no way how to resume wizard, repair thing or two and try it again.
*** Issue 26880 has been marked as a duplicate of this issue. ***
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.
Possible improvement with no API change: call isValid immediately upon
pressing Next/Finish, before updating wizard state. Then the WD.P can
implement isValid can be slower but more accurate, and not fire
stateChanged after every edit etc. If it returns false, beep (perhaps)
and do not advance the wizard; the WD.P implementation can e.g.
display red error text at the bottom explaining what is wrong, or open
a dialog, etc. (nbui recently seemed to agree that red error text was
the least intrusive UI, but I did not follow the whole discussion, so
this is just an FYI.)
*** Issue 11694 has been marked as a duplicate of this issue. ***
Created attachment 12109 [details]
Fix and testcase
I've just attached an example of a way how we could fix bugs in the
existing API. I've defined new interface that can be implemented by
Panels that want to do validation when Next/Finish button is pressed
and veto the move.
The changes in the WizardDescriptor include new code guarded by panel
instanceof ValidationPanel and that is why they cannot influence any
existing panels or wizards. They are completely safe.
I have written a test that demonstrates that the vetoing really works
(uses well known message as a failure, but that can be improved in
In similar way we could fix few other issues as well.
draft implementation was commited in wizards_36584 branch (use cvs
update -f -r wizarrd_36584 openide/src core/windows/src)
Created attachment 14082 [details]
patch for review
Dear reviews, please could you review the attached patch before merge
to maintrunk? Thanks
Consider making WizardValidationException final, definitively make
The implementation of getLocalizedMessage seems strange, as
this.getMessage() will always return null, because the only way how to
change the value (if not overriding getMessage) is to pass it in
constructor and this not happening. I would just return localized
message and require it to be there.
Maybe constructor taking (JComponent, String msg, String locMsg) would
be better because it would emphatize that there are two messages, but
I am not sure about this.
Thanks for review, the proposed change intergrated in maintrunk.
*** Issue 15267 has been marked as a duplicate of this issue. ***