# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home/jarda/src/netbeans/fixes/openide.dialogs/test/unit/src/org/openide # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: WizardSetDataAndIteratorTest.java --- WizardSetDataAndIteratorTest.java Base (BASE) +++ WizardSetDataAndIteratorTest.java Locally Modified (Based On LOCAL) @@ -29,6 +29,7 @@ import java.awt.Component; import java.io.IOException; +import java.util.Collections; import java.util.Set; import javax.swing.JPanel; import javax.swing.event.ChangeListener; @@ -66,6 +67,21 @@ * */ } + public void testInstantiatingIteratorWithStringBuilder() { + SbInstantiatingIter it = new SbInstantiatingIter(); + StringBuilder sb = new StringBuilder(); + SbWizard w = new SbWizard (it, sb); + w.setValue(SbWizard.FINISH_OPTION); + assertEquals("Double store", "storeSettings storeSettings ", sb.toString()); + } + + private static class SbWizard extends WizardDescriptor { + public SbWizard(WizardDescriptor.Iterator it, StringBuilder sb) { + super(); + setPanelsAndSettings(it, sb); + } + } + private static class MyWizard extends WizardDescriptor { public MyWizard(WizardDescriptor.Iterator it) { super(); @@ -126,7 +142,81 @@ initializedOnWD = null; } } + private static class SbInstantiatingIter + implements WizardDescriptor.InstantiatingIterator, + WizardDescriptor.Panel { + StringBuilder sb; + WizardDescriptor initialized; + public Set instantiate () throws IOException { + return Collections.singleton(sb); + } + + public void initialize (WizardDescriptor wizard) { + initialized = wizard; + sb.append("initialize "); + } + + public void uninitialize (WizardDescriptor wizard) { + initialized = null; + sb.append("uninitialize "); + } + + public Panel current() { + return this; + } + + public String name() { + return "Name"; + } + + public boolean hasNext() { + return false; + } + + public boolean hasPrevious() { + return false; + } + + public void nextPanel() { + fail(); + } + + public void previousPanel() { + fail(); + } + + public void addChangeListener(ChangeListener l) { + } + + public void removeChangeListener(ChangeListener l) { + } + + public Component getComponent() { + sb.append("getComponent "); + return new JPanel(); + } + + public HelpCtx getHelp() { + return HelpCtx.DEFAULT_HELP; + } + + public void readSettings(StringBuilder settings) { + sb = settings; + sb.append("readSettings "); + } + + public void storeSettings(StringBuilder settings) { + settings.setLength(0); + sb.append("storeSettings "); + settings.append(sb); + } + + public boolean isValid() { + return true; + } + } + private static class MyPanel implements WizardDescriptor.Panel { private static MyWizard set;