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.
In New File Wizard, if the second panel is a ValidatingPanel and throws ValidationException in the beginning then wizard dialog requires two clicks of nextButton to switch to 3rdPanel
Created attachment 21511 [details] nbm file to reproduce this bug
I have attached a module using which you can reproduce the bug. o install the module in Netbeans IDE 4.0 Beta1 o open any j2se project. o open new file wizard. o in Other category, you will find "bug.xml" select it and press "next"; o now comes panel named "step1" it requires some value to be entered in textfield enter some text in textfield and press Next; wizard doesn't go to switch nextstep ----> bug press Next again, now it goes to nextstep; analysis: step1 panel of "bugs.xml" is a validating panel which throws validation exception if value in textfiled is empy. now the work around is: o open new file wizard. o in Other category, you will find "workarounForBug.xml" select it and press "next"; o now comes panel named "step1" here the textfield is filled by some value by default. now press Next. wizard goes to nextstep; Analysis: workaround is to ensue that step1 doesn't throw validation exception in the beginning by filling values in initialize method of InstantiatingIterator thus, the final conclusion is: In New File Wizard, if the second panel is a ValidatingPanel and throws ValidationException in the beginning then wizard dialog requires two clicks of nextButton to switch to 3rdPanel
Created attachment 21512 [details] source code of the module used to reproduce the bug
sorry mistyped the netbeans version in 3rd comment. use netbeans 4.1 beta1 (mistyped as 4.0 beta1 in 3rd comment) can I hope that fix will be available in netbeans 4.1.
Jirka can you investigate? BTW it is probably too late for a fix in 4.1, but TBD - depends on actual severity of bug, availability of workarounds, complexity of fix.
Santhosh, it looks as faulty usage of validate() method in WizardDescriptor.ValidatingPanel. The validate() methos has been designed as offline panel validation invoked only when Next/Finish button click. For 'online' validation use the method isValid() which is called on every panel state change. This method also control state of Next/Finish buttons. The validate() can be useful for time consuming check i.e. for possibility to an new object deploy or something like this. Check WizardDescriptor javadoc. If you use isValid() for check of name of new object then it should avoid useless two clicks to go to next panel. For example NewJavaFileWizardIterator works after this manner. Hope it helps to you achieve it.
i know the usage of ValidatingPanel.... to reproduce the issue, i made the code simple. BTW, wizard has nothing to do with whether a Panel does time consuming job or not. it should work whatever be the implementation of validate() method is. let me clearly tell you where the bug is: when you press [next] button the validate() method of current panel is supposed to be called. but here what happening is "when you press [next] button next panel's validate() method is being called" ---> bug. o put a System.out.println("validate called") in Step.validate() method o lauch the wizard. it shows "Choose FileType" panel. o press next. you will see "validate called" on console. this is clearly bug. to be more clear, the NewFileWizard's iterator returns wrong panel in current() method.
Probably really bug in wizard framework, wrong method invoking. Workaround exists, will be delivered.
Created attachment 21671 [details] possible workaround
I attached an workaround which makes your example working w/o wasted clicks. What I did: - validate() should pass on init values (validate() must get over first wrong invocation! it's the matter of this bug) - so, move name checking from validate() to isValid() - added a support Change Listeners, don't forget that wizard framework registers own change listener in each panel which helps to update state of Back/Next/Finish buttons - added document listener of the text field which fires the state changes on every document change. Hope it helps you to achieve your goal. Thanks for feedback. The defact should be fixed in NB4.2.
this is best workaround. org.netbeans.modules.xml.core.wizard.XMLWizardIterator already uses this workaround. better to create a class named "WorkAroundIterator" so that it can be used at many places .... I really appreciate if current wizard framework is replaced by https://wizard.dev.java.net (lot cleaner API)
> better to create a class named "WorkAroundIterator" so that it can be used > at many places .... > > I really appreciate if current wizard framework is > replaced by https://wizard.dev.java.net (lot cleaner API) Yes, new Wizard API is needed, it's in consideration for next release.
Cannot reproduce in Product Version: NetBeans IDE 7.3 (Build 201302132200) Java: 1.7.0_15; Java HotSpot(TM) 64-Bit Server VM 23.7-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b03 System: Windows 7 version 6.1 running on amd64; Cp1250; en (nb) If the issue is still valid please provide new steps to reproduce and reopen, thanks.