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 102261
Collapse All | Expand All

(-)openide/dialogs/src/org/openide/WizardDescriptor.java (-3 / +3 lines)
Lines 380-386 Link Here
380
    *
380
    *
381
    * @param panels iterator over all {@link WizardDescriptor.Panel}s that can appear in the wizard
381
    * @param panels iterator over all {@link WizardDescriptor.Panel}s that can appear in the wizard
382
    */
382
    */
383
    public WizardDescriptor(Iterator<WizardDescriptor> panels) {
383
    public WizardDescriptor(Iterator<? extends WizardDescriptor> panels) {
384
        this(SettingsAndIterator.create(panels));
384
        this(SettingsAndIterator.create(panels));
385
    }
385
    }
386
386
Lines 2718-2725 Link Here
2718
            this.settings = settings;
2718
            this.settings = settings;
2719
            this.useThis = useThis;
2719
            this.useThis = useThis;
2720
        }
2720
        }
2721
        public static SettingsAndIterator<WizardDescriptor> create(Iterator<WizardDescriptor> iterator) {
2721
        public static <T extends WizardDescriptor> SettingsAndIterator<T> create(Iterator<T> iterator) {
2722
            return new SettingsAndIterator<WizardDescriptor>(iterator, null, true);
2722
            return new SettingsAndIterator<T>(iterator, null, true);
2723
        }
2723
        }
2724
2724
2725
        public Iterator<Data> getIterator(WizardDescriptor caller) {
2725
        public Iterator<Data> getIterator(WizardDescriptor caller) {
(-)ant/src/org/apache/tools/ant/module/wizards/shortcut/CustomizeScriptPanel.java (-5 / +3 lines)
Lines 98-104 Link Here
98
    // End of variables declaration//GEN-END:variables
98
    // End of variables declaration//GEN-END:variables
99
99
100
    
100
    
101
    public static class CustomizeScriptWizardPanel implements WizardDescriptor.Panel {
101
    public static class CustomizeScriptWizardPanel implements WizardDescriptor.Panel<ShortcutWizard> {
102
102
103
        private CustomizeScriptPanel panel = null;
103
        private CustomizeScriptPanel panel = null;
104
104
Lines 127-139 Link Here
127
        public final void addChangeListener (ChangeListener l) {}
127
        public final void addChangeListener (ChangeListener l) {}
128
        public final void removeChangeListener (ChangeListener l) {}
128
        public final void removeChangeListener (ChangeListener l) {}
129
129
130
        public void readSettings (Object settings) {
130
        public void readSettings(ShortcutWizard wiz) {
131
            ShortcutWizard wiz = (ShortcutWizard) settings;
132
            String contents = wiz.getContents();
131
            String contents = wiz.getContents();
133
            getPanel().scriptPane.setText(contents);
132
            getPanel().scriptPane.setText(contents);
134
        }
133
        }
135
        public void storeSettings (Object settings) {
134
        public void storeSettings(ShortcutWizard wiz) {
136
            ShortcutWizard wiz = (ShortcutWizard) settings;
137
            wiz.putContents(getPanel().scriptPane.getText());
135
            wiz.putContents(getPanel().scriptPane.getText());
138
        }
136
        }
139
    }
137
    }
(-)ant/src/org/apache/tools/ant/module/wizards/shortcut/IntroPanel.java (-4 / +3 lines)
Lines 151-157 Link Here
151
    private javax.swing.JCheckBox toolbarCheck;
151
    private javax.swing.JCheckBox toolbarCheck;
152
    // End of variables declaration//GEN-END:variables
152
    // End of variables declaration//GEN-END:variables
153
153
154
    public static class IntroWizardPanel implements WizardDescriptor.Panel {
154
    public static class IntroWizardPanel implements WizardDescriptor.Panel<ShortcutWizard> {
155
    
155
    
156
        private IntroPanel panel = null;
156
        private IntroPanel panel = null;
157
        private ShortcutWizard wiz = null;
157
        private ShortcutWizard wiz = null;
Lines 196-206 Link Here
196
            cs.fireChange();
196
            cs.fireChange();
197
        }
197
        }
198
198
199
        public void readSettings (Object settings) {
199
        public void readSettings(ShortcutWizard wiz) {
200
            // XXX should read checkboxes from settings... skip for now.
200
            // XXX should read checkboxes from settings... skip for now.
201
        }
201
        }
202
        public void storeSettings (Object settings) {
202
        public void storeSettings(ShortcutWizard wiz) {
203
            WizardDescriptor wiz = (WizardDescriptor) settings;
204
            wiz.putProperty(ShortcutWizard.PROP_SHOW_CUST, getPanel().customizeCheck.isSelected() ? Boolean.TRUE : Boolean.FALSE);
203
            wiz.putProperty(ShortcutWizard.PROP_SHOW_CUST, getPanel().customizeCheck.isSelected() ? Boolean.TRUE : Boolean.FALSE);
205
            wiz.putProperty(ShortcutWizard.PROP_SHOW_MENU, getPanel().menuCheck.isSelected() ? Boolean.TRUE : Boolean.FALSE);
204
            wiz.putProperty(ShortcutWizard.PROP_SHOW_MENU, getPanel().menuCheck.isSelected() ? Boolean.TRUE : Boolean.FALSE);
206
            wiz.putProperty(ShortcutWizard.PROP_SHOW_TOOL, getPanel().toolbarCheck.isSelected() ? Boolean.TRUE : Boolean.FALSE);
205
            wiz.putProperty(ShortcutWizard.PROP_SHOW_TOOL, getPanel().toolbarCheck.isSelected() ? Boolean.TRUE : Boolean.FALSE);
(-)ant/src/org/apache/tools/ant/module/wizards/shortcut/SelectFolderPanel.java (-5 / +3 lines)
Lines 228-234 Link Here
228
    private javax.swing.JTextArea hintsArea;
228
    private javax.swing.JTextArea hintsArea;
229
    // End of variables declaration//GEN-END:variables
229
    // End of variables declaration//GEN-END:variables
230
230
231
    public static class SelectFolderWizardPanel implements WizardDescriptor.Panel {
231
    public static class SelectFolderWizardPanel implements WizardDescriptor.Panel<ShortcutWizard> {
232
232
233
        private SelectFolderPanel panel;
233
        private SelectFolderPanel panel;
234
234
Lines 279-294 Link Here
279
            cs.fireChange();
279
            cs.fireChange();
280
        }
280
        }
281
281
282
        public void readSettings (Object settings) {
282
        public void readSettings(ShortcutWizard wiz) {
283
            WizardDescriptor wiz = (WizardDescriptor) settings;
284
            getPanel().setFolder((DataFolder)wiz.getProperty(getPanel().prop));
283
            getPanel().setFolder((DataFolder)wiz.getProperty(getPanel().prop));
285
            String dn = (String)wiz.getProperty(ShortcutWizard.PROP_DISPLAY_NAME);
284
            String dn = (String)wiz.getProperty(ShortcutWizard.PROP_DISPLAY_NAME);
286
            getPanel().displayNameField.setText(dn != null ? dn : ""); // NOI18N
285
            getPanel().displayNameField.setText(dn != null ? dn : ""); // NOI18N
287
        }
286
        }
288
        
287
        
289
        public void storeSettings (Object settings) {
288
        public void storeSettings(ShortcutWizard wiz) {
290
            DataFolder folder = getPanel().getFolder();
289
            DataFolder folder = getPanel().getFolder();
291
            WizardDescriptor wiz = (WizardDescriptor) settings;
292
            wiz.putProperty(getPanel().prop, folder);
290
            wiz.putProperty(getPanel().prop, folder);
293
            wiz.putProperty(ShortcutWizard.PROP_DISPLAY_NAME, getPanel().displayNameField.getText());
291
            wiz.putProperty(ShortcutWizard.PROP_DISPLAY_NAME, getPanel().displayNameField.getText());
294
        }
292
        }
(-)ant/src/org/apache/tools/ant/module/wizards/shortcut/SelectKeyboardShortcutPanel.java (-4 / +3 lines)
Lines 112-118 Link Here
112
        e.consume ();
112
        e.consume ();
113
    }
113
    }
114
    
114
    
115
    public static class SelectKeyboardShortcutWizardPanel implements WizardDescriptor.Panel {
115
    public static class SelectKeyboardShortcutWizardPanel implements WizardDescriptor.Panel<ShortcutWizard> {
116
116
117
        private SelectKeyboardShortcutPanel panel = null;
117
        private SelectKeyboardShortcutPanel panel = null;
118
        private FileObject shortcutsFolder = null;
118
        private FileObject shortcutsFolder = null;
Lines 151-161 Link Here
151
            cs.fireChange();
151
            cs.fireChange();
152
        }
152
        }
153
153
154
        public void readSettings (Object settings) {
154
        public void readSettings(ShortcutWizard wiz) {
155
            // XXX later...
155
            // XXX later...
156
        }
156
        }
157
        public void storeSettings (Object settings) {
157
        public void storeSettings(ShortcutWizard wiz) {
158
            WizardDescriptor wiz = (WizardDescriptor) settings;
159
            wiz.putProperty(ShortcutWizard.PROP_STROKE, getPanel().stroke);
158
            wiz.putProperty(ShortcutWizard.PROP_STROKE, getPanel().stroke);
160
        }
159
        }
161
    }
160
    }
(-)ant/src/org/apache/tools/ant/module/wizards/shortcut/ShortcutIterator.java (-19 / +21 lines)
Lines 20-25 Link Here
20
package org.apache.tools.ant.module.wizards.shortcut;
20
package org.apache.tools.ant.module.wizards.shortcut;
21
21
22
import java.awt.Component;
22
import java.awt.Component;
23
import java.util.ArrayList;
24
import java.util.List;
23
import java.util.NoSuchElementException;
25
import java.util.NoSuchElementException;
24
import javax.swing.JComponent;
26
import javax.swing.JComponent;
25
import javax.swing.event.ChangeListener;
27
import javax.swing.event.ChangeListener;
Lines 29-58 Link Here
29
import org.openide.util.ChangeSupport;
31
import org.openide.util.ChangeSupport;
30
import org.openide.util.NbBundle;
32
import org.openide.util.NbBundle;
31
33
32
final class ShortcutIterator implements WizardDescriptor.Iterator {
34
final class ShortcutIterator implements WizardDescriptor.Iterator<ShortcutWizard> {
33
35
34
    ShortcutIterator() {}
36
    ShortcutIterator() {}
35
37
36
    // You should define what panels you want to use here:
38
    // You should define what panels you want to use here:
37
39
38
    private WizardDescriptor.Panel[] createPanels () {
40
    private List<WizardDescriptor.Panel<ShortcutWizard>> createPanels() {
39
        return new WizardDescriptor.Panel[] {
41
        List<WizardDescriptor.Panel<ShortcutWizard>> panels = new ArrayList<WizardDescriptor.Panel<ShortcutWizard>>();
40
            new IntroPanel.IntroWizardPanel (),
42
        panels.add(new IntroPanel.IntroWizardPanel());
41
            new SelectFolderPanel.SelectFolderWizardPanel(
43
        panels.add(new SelectFolderPanel.SelectFolderWizardPanel(
42
                NbBundle.getMessage(ShortcutIterator.class, "SI_LBL_select_menu_to_add_to"),
44
                NbBundle.getMessage(ShortcutIterator.class, "SI_LBL_select_menu_to_add_to"),
43
                NbBundle.getMessage(ShortcutIterator.class, "SI_TEXT_menu_locn"),
45
                NbBundle.getMessage(ShortcutIterator.class, "SI_TEXT_menu_locn"),
44
                NbBundle.getMessage(ShortcutIterator.class, "SI_LBL_display_name_for_menu"),
46
                NbBundle.getMessage(ShortcutIterator.class, "SI_LBL_display_name_for_menu"),
45
                DataFolder.findFolder(Repository.getDefault().getDefaultFileSystem().findResource("Menu")), // NOI18N
47
                DataFolder.findFolder(Repository.getDefault().getDefaultFileSystem().findResource("Menu")), // NOI18N
46
                true, ShortcutWizard.PROP_FOLDER_MENU),
48
                true, ShortcutWizard.PROP_FOLDER_MENU));
47
            new SelectFolderPanel.SelectFolderWizardPanel(
49
        panels.add(new SelectFolderPanel.SelectFolderWizardPanel(
48
                NbBundle.getMessage(ShortcutIterator.class, "SI_LBL_select_toolbar"),
50
                NbBundle.getMessage(ShortcutIterator.class, "SI_LBL_select_toolbar"),
49
                NbBundle.getMessage(ShortcutIterator.class, "SI_TEXT_toolbar_locn"),
51
                NbBundle.getMessage(ShortcutIterator.class, "SI_TEXT_toolbar_locn"),
50
                NbBundle.getMessage(ShortcutIterator.class, "SI_LBL_display_name_for_toolbar"),
52
                NbBundle.getMessage(ShortcutIterator.class, "SI_LBL_display_name_for_toolbar"),
51
                DataFolder.findFolder(Repository.getDefault().getDefaultFileSystem().findResource("Toolbars")), // NOI18N
53
                DataFolder.findFolder(Repository.getDefault().getDefaultFileSystem().findResource("Toolbars")), // NOI18N
52
                false, ShortcutWizard.PROP_FOLDER_TOOL),
54
                false, ShortcutWizard.PROP_FOLDER_TOOL));
53
            new SelectKeyboardShortcutPanel.SelectKeyboardShortcutWizardPanel (),
55
        panels.add(new SelectKeyboardShortcutPanel.SelectKeyboardShortcutWizardPanel());
54
            new CustomizeScriptPanel.CustomizeScriptWizardPanel (),
56
        panels.add(new CustomizeScriptPanel.CustomizeScriptWizardPanel());
55
        };
57
        return panels;
56
    }
58
    }
57
59
58
    // And the list of step names:
60
    // And the list of step names:
Lines 68-74 Link Here
68
    }
70
    }
69
    
71
    
70
    private transient int index;
72
    private transient int index;
71
    private transient WizardDescriptor.Panel[] panels;
73
    private transient List<WizardDescriptor.Panel<ShortcutWizard>> panels;
72
    private transient ShortcutWizard wiz;
74
    private transient ShortcutWizard wiz;
73
75
74
    // You can keep a reference to the TemplateWizard which can
76
    // You can keep a reference to the TemplateWizard which can
Lines 81-91 Link Here
81
        panels = createPanels ();
83
        panels = createPanels ();
82
        // #44409: make sure IntroWizardPanel knows about wiz
84
        // #44409: make sure IntroWizardPanel knows about wiz
83
        // XXX workaround should no longer be necessary...
85
        // XXX workaround should no longer be necessary...
84
        ((IntroPanel.IntroWizardPanel) panels[0]).initialize(wiz);
86
        ((IntroPanel.IntroWizardPanel) panels.get(0)).initialize(wiz);
85
        // Make sure list of steps is accurate.
87
        // Make sure list of steps is accurate.
86
        String[] steps = createSteps ();
88
        String[] steps = createSteps ();
87
        for (int i = 0; i < panels.length; i++) {
89
        for (int i = 0; i < panels.size(); i++) {
88
            Component c = panels[i].getComponent ();
90
            Component c = panels.get(i).getComponent();
89
            if (steps[i] == null) {
91
            if (steps[i] == null) {
90
                // Default step name to component name of panel.
92
                // Default step name to component name of panel.
91
                // Mainly useful for getting the name of the target
93
                // Mainly useful for getting the name of the target
Lines 106-112 Link Here
106
108
107
    public String name () {
109
    public String name () {
108
        return NbBundle.getMessage (ShortcutIterator.class, "TITLE_x_of_y",
110
        return NbBundle.getMessage (ShortcutIterator.class, "TITLE_x_of_y",
109
            new Integer (index + 1), new Integer (panels.length));
111
            index + 1, panels.size());
110
    }
112
    }
111
113
112
    boolean showing(String prop) {
114
    boolean showing(String prop) {
Lines 130-136 Link Here
130
        }
132
        }
131
    }
133
    }
132
    public boolean hasNext () {
134
    public boolean hasNext () {
133
        for (int i = index + 1; i < panels.length; i++) {
135
        for (int i = index + 1; i < panels.size(); i++) {
134
            if (showing (i)) {
136
            if (showing (i)) {
135
                return true;
137
                return true;
136
            }
138
            }
Lines 158-165 Link Here
158
        index--;
160
        index--;
159
        while (! showing (index)) index--;
161
        while (! showing (index)) index--;
160
    }
162
    }
161
    public WizardDescriptor.Panel current () {
163
    public WizardDescriptor.Panel<ShortcutWizard> current() {
162
        return panels[index];
164
        return panels.get(index);
163
    }
165
    }
164
166
165
    private transient ChangeSupport cs = new ChangeSupport(this);
167
    private transient ChangeSupport cs = new ChangeSupport(this);

Return to bug 102261