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.
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; wizardDescriptor.doNextClick(); 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 { }
I prefer the second style.
I'll sketch impl and Jirka'll provide test.
Created attachment 22043 [details] Proposed WizardDesriptor API change
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?
FYI, doClick() appoach has not worked reliably in CVS use case.
Created attachment 22092 [details] a test which covers handling of new interface
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
OK i'll improve before integration. BTW I miss test for background validation interruption. Something like validate() throws ... { try { forever.wait(); } (InterruptedEx e) { passed = true; } }
Interuption test is crucial as it avoids regression possibly caused by leveraging issue #33467.
Implementation was integrated: Checking in apichanges.xml; /cvs/openide/dialogs/apichanges.xml,v <-- apichanges.xml new revision: 1.2; previous revision: 1.1 done Checking in src/org/openide/WizardDescriptor.java; /cvs/openide/dialogs/src/org/openide/WizardDescriptor.java,v <-- WizardDescriptor.java new revision: 1.3; previous revision: 1.2 done Jirka could you integrate tests and close the issue, please?
Added covered test AsynchronousValidatingPanelTest and fixed WizardDescriptor to make all wizard tests passing. Checking in dialogs/src/org/openide/WizardDescriptor.java; /cvs/openide/dialogs/src/org/openide/WizardDescriptor.java,v <-- WizardDescriptor.java new revision: 1.5; previous revision: 1.4 done RCS file: /cvs/openide/test/unit/src/org/openide/AsynchronousValidatingPanelTest.java,v done Checking in test/unit/src/org/openide/AsynchronousValidatingPanelTest.java; /cvs/openide/test/unit/src/org/openide/AsynchronousValidatingPanelTest.java,v <-- AsynchronousValidatingPanelTest.java initial revision: 1.1 done