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 153672

Summary: InstantiatingIterator.initialize not called when using WizardDescriptor default constructor
Product: platform Reporter: Jesse Glick <jglick>
Component: Dialogs&WizardsAssignee: Stanislav Aubrecht <saubrecht>
Status: REOPENED ---    
Severity: blocker    
Priority: P4    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 154375    
Bug Blocks: 102261    

Description Jesse Glick 2008-11-21 21:42:40 UTC
If you use the no-arg constructor of WizardDescriptor and then call setPanelsAndSettings in your subclass' constructor,
initialize(WizardDescriptor) will not be called on the iterator. That is because callInitialize is only called in the WD
constructor, before the iterator is actually available. It needs to be called by setPanelsAndSettings (and by the
deprecated setPanels), which should probably also do callUninitialize on the former iterator.

BTW, SettingsAndIterator.getIterator ignores its caller arg. It could in fact be replaced by a simple field.
Comment 1 Jesse Glick 2008-11-21 21:47:08 UTC
Makes it not obvious how to use the recommended (warning-free) style of wizard construction as in issue #102261. Just

class W extends WizardDescriptor {
  W() {
    setPanelsAndSettings(new I(), this);
  }
}
class I implements WizardDescriptor.Iterator<W> {
  W w;
  public void initialize(WizardDescriptor w) {this.w = (W) w;}
  public void uninitialize(WizardDescriptor w) {this.w = null;}
}

does not work; initialize is never called and the field is left null. You need to do

class W extends WizardDescriptor {
  W() {
    setPanelsAndSettings(new I(this), this);
  }
}
class I implements WizardDescriptor.Iterator<W> {
  W w;
  I(W w) {this.w = w;}
  public void initialize(WizardDescriptor w) {}
  public void uninitialize(WizardDescriptor w) {}
}

which is fine (and means one less cast) but means that the initialize/uninitialize methods become useless, which is
potentially confusing.
Comment 2 Jiri Rechtacek 2008-12-02 10:19:36 UTC
2055bdcb4db3
Comment 3 Quality Engineering 2008-12-03 05:58:03 UTC
Integrated into 'main-golden', will be available in build *200812030201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/2055bdcb4db3
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #153672: InstantiatingIterator.initialize not called when using WizardDescriptor default constructor
Comment 4 Jiri Rechtacek 2008-12-03 14:37:12 UTC
Rollback due to issue 154375