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 - InstantiatingIterator.initialize not called when using WizardDescriptor default constructor
Summary: InstantiatingIterator.initialize not called when using WizardDescriptor defau...
Status: REOPENED
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on: 154375
Blocks: 102261
  Show dependency tree
 
Reported: 2008-11-21 21:42 UTC by Jesse Glick
Modified: 2010-10-07 10:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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