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.

View | Details | Raw Unified | Return to bug 154776
Collapse All | Expand All

(-)WizardSetDataAndIteratorTest.java (+90 lines)
Lines 29-34 Link Here
29
29
30
import java.awt.Component;
30
import java.awt.Component;
31
import java.io.IOException;
31
import java.io.IOException;
32
import java.util.Collections;
32
import java.util.Set;
33
import java.util.Set;
33
import javax.swing.JPanel;
34
import javax.swing.JPanel;
34
import javax.swing.event.ChangeListener;
35
import javax.swing.event.ChangeListener;
Lines 66-71 Link Here
66
         * */
67
         * */
67
    }
68
    }
68
69
70
    public void testInstantiatingIteratorWithStringBuilder() {
71
        SbInstantiatingIter it = new SbInstantiatingIter();
72
        StringBuilder sb = new StringBuilder();
73
        SbWizard w = new SbWizard (it, sb);
74
        w.setValue(SbWizard.FINISH_OPTION);
75
        assertEquals("Double store", "storeSettings storeSettings ", sb.toString());
76
    }
77
78
    private static class SbWizard extends WizardDescriptor {
79
        public SbWizard(WizardDescriptor.Iterator<StringBuilder> it, StringBuilder sb) {
80
            super();
81
            setPanelsAndSettings(it, sb);
82
        }
83
    }
84
69
    private static class MyWizard extends WizardDescriptor {
85
    private static class MyWizard extends WizardDescriptor {
70
        public MyWizard(WizardDescriptor.Iterator<MyWizard> it) {
86
        public MyWizard(WizardDescriptor.Iterator<MyWizard> it) {
71
            super();
87
            super();
Lines 126-132 Link Here
126
            initializedOnWD = null;
142
            initializedOnWD = null;
127
        }
143
        }
128
    }
144
    }
145
    private static class SbInstantiatingIter 
146
    implements WizardDescriptor.InstantiatingIterator<StringBuilder>,
147
    WizardDescriptor.Panel<StringBuilder> {
148
        StringBuilder sb;
149
        WizardDescriptor initialized;
129
150
151
        public Set instantiate () throws IOException {
152
            return Collections.singleton(sb);
153
        }
154
155
        public void initialize (WizardDescriptor wizard) {
156
            initialized = wizard;
157
            sb.append("initialize ");
158
        }
159
160
        public void uninitialize (WizardDescriptor wizard) {
161
            initialized = null;
162
            sb.append("uninitialize ");
163
        }
164
165
        public Panel<StringBuilder> current() {
166
            return this;
167
        }
168
169
        public String name() {
170
            return "Name";
171
        }
172
173
        public boolean hasNext() {
174
            return false;
175
        }
176
177
        public boolean hasPrevious() {
178
            return false;
179
        }
180
181
        public void nextPanel() {
182
            fail();
183
        }
184
185
        public void previousPanel() {
186
            fail();
187
        }
188
189
        public void addChangeListener(ChangeListener l) {
190
        }
191
192
        public void removeChangeListener(ChangeListener l) {
193
        }
194
195
        public Component getComponent() {
196
            sb.append("getComponent ");
197
            return new JPanel();
198
        }
199
200
        public HelpCtx getHelp() {
201
            return HelpCtx.DEFAULT_HELP;
202
        }
203
204
        public void readSettings(StringBuilder settings) {
205
            sb = settings;
206
            sb.append("readSettings ");
207
        }
208
209
        public void storeSettings(StringBuilder settings) {
210
            settings.setLength(0);
211
            sb.append("storeSettings ");
212
            settings.append(sb);
213
        }
214
215
        public boolean isValid() {
216
            return true;
217
        }
218
    }
219
130
    private static class MyPanel implements WizardDescriptor.Panel<MyWizard> {
220
    private static class MyPanel implements WizardDescriptor.Panel<MyWizard> {
131
        private static MyWizard set;
221
        private static MyWizard set;
132
        
222
        

Return to bug 154776