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 58530 - Background wizard validation
Summary: Background wizard validation
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jiri Rechtacek
Depends on: 33467
Blocks: 54150
  Show dependency tree
Reported: 2005-05-03 14:48 UTC by _ pkuzel
Modified: 2008-12-22 23:56 UTC (History)
1 user (show)

See Also:
Exception Reporter:

Proposed WizardDesriptor API change (7.91 KB, patch)
2005-05-09 14:48 UTC, _ pkuzel
Details | Diff
a test which covers handling of new interface (5.83 KB, patch)
2005-05-11 13:17 UTC, Jiri Rechtacek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ pkuzel 2005-05-03 14:48:21 UTC
Wizard framework contains basic support for lazy validation - ValidatingPanel.
Unfortunately it's called synchronously from AWT.

I need to do heavy validation that takes several seconds (network connection).
This means that it can not block AWT. My code idea is:

  public validate() throws WizardValidationException() {
      if (heavyDone) return;
      new Thread(this).start();
      throw new ValidationException("", )

  public void run() {
     <heavy validation>
     fireValid();  // enables next button
     heavydone = true;
     heavydone = false;

However I miss public wizardDescriptor.doNextClick() method.

Another option is to introduce 

   * Marker interface, actual validation is done in non AWT thread. 
   * Cancel button signals background validation by thread.interrupt()
   * and closes wizard.
  public static interface AsynchronousValidation extends ValidatingPanel {
Comment 1 _ pkuzel 2005-05-03 14:52:50 UTC
I prefer the second style.
Comment 2 _ pkuzel 2005-05-09 13:49:13 UTC
I'll sketch impl and Jirka'll provide test.
Comment 3 _ pkuzel 2005-05-09 14:48:14 UTC
Created attachment 22043 [details]
Proposed WizardDesriptor API change
Comment 4 _ pkuzel 2005-05-09 14:53:34 UTC
Proposed contact and it's prototype implementation attached. It suits CVS use case. 

Jirka could you review, polish, provide unit tests and integrate into trunk, please?
Comment 5 _ pkuzel 2005-05-09 14:55:18 UTC
FYI, doClick() appoach has not worked reliably in CVS use case.
Comment 6 Jiri Rechtacek 2005-05-11 13:17:06 UTC
Created attachment 22092 [details]
a test which covers handling of new interface
Comment 7 Jiri Rechtacek 2005-05-11 13:33:20 UTC
Petr, the prototype looks fine. I propose only minor changes:
- remove the parameter 'origin' in lazyValidation, it's unused in that method
- correct spelling perfomar -> performer
- don't invokeLater WD.setValid(true), can be fired directly I think

Don't forget describe API change in apichanges.xml. Thanks
Comment 8 _ pkuzel 2005-05-11 13:48:46 UTC
OK i'll improve before integration.

BTW I miss test for background validation interruption. Something like

validate() throws ... {
   try {
   } (InterruptedEx e) {
      passed = true;
Comment 9 _ pkuzel 2005-05-11 13:50:32 UTC
Interuption test is crucial as it avoids regression possibly caused by
leveraging issue #33467.
Comment 10 _ pkuzel 2005-05-16 14:19:47 UTC
Implementation was integrated:

Checking in apichanges.xml;
/cvs/openide/dialogs/apichanges.xml,v  <--  apichanges.xml
new revision: 1.2; previous revision: 1.1
Checking in src/org/openide/;
/cvs/openide/dialogs/src/org/openide/,v  <--
new revision: 1.3; previous revision: 1.2

Jirka could you integrate tests and close the issue, please?

Comment 11 Jiri Rechtacek 2005-05-17 15:33:21 UTC
Added covered test AsynchronousValidatingPanelTest and fixed WizardDescriptor to
make all wizard tests passing.

Checking in dialogs/src/org/openide/;
/cvs/openide/dialogs/src/org/openide/,v  <--
new revision: 1.5; previous revision: 1.4
RCS file:
Checking in test/unit/src/org/openide/;
initial revision: 1.1