This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 23116 - [2004-03-31] Need to be able to veto user press of Next or Finish button in Wizard step
Summary: [2004-03-31] Need to be able to veto user press of Next or Finish button in W...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P2 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords: API, API_REVIEW_FAST
: 11694 15267 26880 (view as bug list)
Depends on: 26552
Blocks: 11694 15267 28466
  Show dependency tree
 
Reported: 2002-05-03 16:27 UTC by pete eakle
Modified: 2008-12-22 23:37 UTC (History)
9 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Fix and testcase (5.91 KB, patch)
2003-11-11 18:33 UTC, Jaroslav Tulach
Details | Diff
patch for review (18.99 KB, patch)
2004-03-22 16:33 UTC, Jiri Rechtacek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pete eakle 2002-05-03 16:27:22 UTC
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 
step panel.
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.
Comment 1 pete eakle 2002-05-03 16:45:01 UTC
See also item 7706.
Comment 2 Marek Grummich 2002-07-22 11:25:46 UTC
Set target milestone to TBD
Comment 3 Marek Grummich 2002-07-22 11:28:01 UTC
Set target milestone to TBD
Comment 4 _ ttran 2002-07-30 15:54:18 UTC
officially requested by S1S, put into plan for NB 4.0, upped prio to P1
Comment 5 Jiri Rechtacek 2002-09-06 09:25:32 UTC
add to API support for "off-line" validation
Comment 6 Jiri Rechtacek 2002-09-13 10:09:56 UTC
Attached the comments from issue 26880 (duplicate this issue)

Reported By: mkubec@netbeans.org

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
PDT -------

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. 

Comment 7 Jiri Rechtacek 2002-09-13 10:10:22 UTC
*** Issue 26880 has been marked as a duplicate of this issue. ***
Comment 8 Jaroslav Tulach 2002-09-30 12:58:42 UTC
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.
Comment 9 Jesse Glick 2002-11-22 06:08:08 UTC
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.)
Comment 10 Jiri Rechtacek 2003-08-26 13:38:18 UTC
*** Issue 11694 has been marked as a duplicate of this issue. ***
Comment 11 Jaroslav Tulach 2003-11-11 18:33:13 UTC
Created attachment 12109 [details]
Fix and testcase
Comment 12 Jaroslav Tulach 2003-11-11 18:37:55 UTC
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
future).

In similar way we could fix few other issues as well.
Comment 13 Jiri Rechtacek 2004-03-11 17:27:25 UTC
draft implementation was commited in wizards_36584 branch (use cvs
update -f -r wizarrd_36584 openide/src core/windows/src)
Comment 14 Jiri Rechtacek 2004-03-22 16:33:50 UTC
Created attachment 14082 [details]
patch for review
Comment 15 Jiri Rechtacek 2004-03-22 16:38:05 UTC
Dear reviews, please could you review the attached patch before merge
to maintrunk? Thanks
Comment 16 Jaroslav Tulach 2004-03-24 09:05:53 UTC
Consider making WizardValidationException final, definitively make
getSource final.

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.
Comment 17 Jiri Rechtacek 2004-03-29 13:26:16 UTC
Thanks for review, the proposed change intergrated in maintrunk.
Comment 18 Jiri Rechtacek 2004-03-29 13:26:42 UTC
Thanks for review, the proposed change intergrated in maintrunk.
Comment 19 Jiri Rechtacek 2004-05-13 09:28:54 UTC
*** Issue 15267 has been marked as a duplicate of this issue. ***