Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 202796 - WizardDescriptor.AsynchronousValidatingPanel is hard to use
WizardDescriptor.AsynchronousValidatingPanel is hard to use
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards
7.0
All All
: P3 with 1 vote (vote)
: 7.4
Assigned To: Stanislav Aubrecht
issues@platform
:
Depends on: 228411
Blocks:
  Show dependency treegraph
 
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
:


Attachments

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.

Thanks.
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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/327b8ee6ae4b
User: Tomas Mysik <tmysik@netbeans.org>
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()

Thanks.
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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo