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 202796 - WizardDescriptor.AsynchronousValidatingPanel is hard to use
Summary: WizardDescriptor.AsynchronousValidatingPanel is hard to use
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Stanislav Aubrecht
Depends on: 228411
  Show dependency tree
Reported: 2011-09-28 20:54 UTC by David Konecny
Modified: 2013-04-10 09:29 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description David Konecny 2011-09-28 20:54:36 UTC
I have a wizard panel which "implements WizardDescriptor.AsynchronousValidatingPanel<WizardDescriptor>" and as a result I have two validation methods:

* isValid
* validate

Javadoc should clarify relationship of these two methods. I for example assumed that isValid() can do quick panel checks and validate() should be used for time consuming check which needs to run on background. Based on that I would also expect that if isValid returns false then validate would never be called. But that's not the case. 

Btw. it would be nice to have an ability to show a progress bar when async check is running and autotically disable whole panel.

Comment 1 David Konecny 2011-09-28 21:32:39 UTC
I can also see following strange behaviour: if my valid() throws WizardValidationException then isValid seems to be called immediatelly after that. Why? In my scenario this results into error message being hidden because isValid passes. If I decide to fix this by storing error from validate() then another question raises: when should my wizard panel start paying attention to isValid results instead of validate()??
Comment 2 Tomas Mysik 2012-09-18 08:50:53 UTC
Yes, I can confirm that AsynchronousValidatingPanel is nearly impossible to use.

Please, could you look at it? So clients do not need to do horrible work arounds... Thanks a lot in advance.
Comment 3 Tomas Mysik 2012-09-18 08:51:24 UTC
Better summary.
Comment 4 Quality Engineering 2012-09-19 03:01:53 UTC
Integrated into 'main-golden', will be available in build *201209190001* on (upload may still be in progress)
User: Tomas Mysik <>
Log: #217759 cont'd - failed download should prevent wizard's Next/Finish button

AsynchronousValidatingPanel issues work arounded - see #202796.
Comment 5 Tomas Mysik 2012-09-19 07:54:41 UTC
Here are my suggestions/complains:

(1) if one throws WizardValidationException from the validate() method, do not call isValid() method (so clients do not need to have any property whether an error in a background validation occured or not)
(2) add method finishValidation() (or similar) that would be called in the UI thread after background validation finishes - here one could "unfreeze" the panel (it would be similar as method prepareValidation() and it completes the workflow); now, every client must "unfreeze" his panel in the validate() method using EventQueue.invokeLater()

Comment 6 Tomas Mysik 2012-09-19 09:07:31 UTC
(3) If one clicks the Back button, it seems to me that the background thread is not interrupted (but it should be, it is the same case as for the Cancel button). Moreover, the error message should not be displayed I guess.
Comment 7 Stanislav Aubrecht 2013-04-09 15:13:00 UTC
I fixed the problem with disappearing error messages. So now there's no need to hack isValid() method. It is still being called right after background validation but the actual and correct error message will be set later on.

I will create a new enhancement issue to introduce some sort of "finishValidation()" method.

core-main b42e53fc29ca
Comment 8 Tomas Mysik 2013-04-10 08:48:49 UTC
Thanks a lot Stando! This is perfect!
Comment 9 Tomas Mysik 2013-04-10 09:29:24 UTC
I somehow changed the TM? Sorry.