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

(-)openide/dialogs/nbproject/project.xml (-2 / +11 lines)
Lines 24-38 Link Here
24
            <code-name-base>org.openide.dialogs</code-name-base>
24
            <code-name-base>org.openide.dialogs</code-name-base>
25
            <module-dependencies>
25
            <module-dependencies>
26
                <dependency>
26
                <dependency>
27
                    <code-name-base>org.openide.util</code-name-base>
27
                    <code-name-base>org.netbeans.api.progress</code-name-base>
28
                    <build-prerequisite/>
28
                    <build-prerequisite/>
29
                    <compile-dependency/>
29
                    <compile-dependency/>
30
                    <run-dependency>
30
                    <run-dependency>
31
                        <specification-version>6.2</specification-version>
31
                        <release-version>1</release-version>
32
                        <specification-version>1.6</specification-version>
32
                    </run-dependency>
33
                    </run-dependency>
33
                </dependency>
34
                </dependency>
34
                <dependency>
35
                <dependency>
35
                    <code-name-base>org.openide.awt</code-name-base>
36
                    <code-name-base>org.openide.awt</code-name-base>
37
                    <build-prerequisite/>
38
                    <compile-dependency/>
39
                    <run-dependency>
40
                        <specification-version>6.2</specification-version>
41
                    </run-dependency>
42
                </dependency>
43
                <dependency>
44
                    <code-name-base>org.openide.util</code-name-base>
36
                    <build-prerequisite/>
45
                    <build-prerequisite/>
37
                    <compile-dependency/>
46
                    <compile-dependency/>
38
                    <run-dependency>
47
                    <run-dependency>
(-)openide/dialogs/src/org/openide/WizardDescriptor.java (-3 / +90 lines)
Lines 24-29 Link Here
24
import java.awt.Component;
24
import java.awt.Component;
25
import java.awt.Container;
25
import java.awt.Container;
26
import java.awt.Cursor;
26
import java.awt.Cursor;
27
import java.awt.Dialog;
27
import java.awt.Dimension;
28
import java.awt.Dimension;
28
import java.awt.FocusTraversalPolicy;
29
import java.awt.FocusTraversalPolicy;
29
import java.awt.Font;
30
import java.awt.Font;
Lines 57-62 Link Here
57
import javax.swing.JLabel;
58
import javax.swing.JLabel;
58
import javax.swing.JList;
59
import javax.swing.JList;
59
import javax.swing.JPanel;
60
import javax.swing.JPanel;
61
import javax.swing.JProgressBar;
60
import javax.swing.JScrollPane;
62
import javax.swing.JScrollPane;
61
import javax.swing.JSeparator;
63
import javax.swing.JSeparator;
62
import javax.swing.JTabbedPane;
64
import javax.swing.JTabbedPane;
Lines 76-81 Link Here
76
import org.openide.util.RequestProcessor;
78
import org.openide.util.RequestProcessor;
77
import org.openide.util.Utilities;
79
import org.openide.util.Utilities;
78
import org.openide.util.WeakListeners;
80
import org.openide.util.WeakListeners;
81
import org.netbeans.api.progress.ProgressHandle;
82
import org.netbeans.api.progress.ProgressHandleFactory;
83
import org.openide.awt.StatusDisplayer;
79
84
80
/**
85
/**
81
 * Implements a basic "wizard" GUI system.
86
 * Implements a basic "wizard" GUI system.
Lines 285-290 Link Here
285
290
286
    private boolean validationRuns;
291
    private boolean validationRuns;
287
292
293
    private ProgressHandle handle;
294
288
    {
295
    {
289
        // button init
296
        // button init
290
        ResourceBundle b = NbBundle.getBundle("org.openide.Bundle"); // NOI18N
297
        ResourceBundle b = NbBundle.getBundle("org.openide.Bundle"); // NOI18N
Lines 758-763 Link Here
758
765
759
        nextButton.setEnabled (next && valid);
766
        nextButton.setEnabled (next && valid);
760
        previousButton.setEnabled (prev);
767
        previousButton.setEnabled (prev);
768
        cancelButton.setEnabled (true);
761
        
769
        
762
        if (current instanceof FinishablePanel) {
770
        if (current instanceof FinishablePanel) {
763
            // check if isFinishPanel
771
            // check if isFinishPanel
Lines 1188-1194 Link Here
1188
1196
1189
    private void callInstantiate() throws IOException {
1197
    private void callInstantiate() throws IOException {
1190
        assert panels != null;
1198
        assert panels != null;
1191
1199
        
1200
        err.log (Level.FINE, "Is AsynchronousInstantiatingIterator? " + (panels instanceof AsynchronousInstantiatingIterator));
1201
        err.log (Level.FINE, "Is ProgressInstantiatingIterator? " + (panels instanceof ProgressInstantiatingIterator));
1202
        if (panels instanceof ProgressInstantiatingIterator) {
1203
            handle = ProgressHandleFactory.createHandle ("instantiate");
1204
            
1205
            JComponent progressComp = ProgressHandleFactory.createProgressComponent (handle);
1206
            wizardPanel.setProgressComponent (progressComp, ((ProgressInstantiatingIterator)panels).getProgressLabel ());
1207
            
1208
            err.log (Level.FINE, "Show progressPanel controlled by iterator later.");
1209
        } else if (panels instanceof AsynchronousInstantiatingIterator) {
1210
            ProgressHandle handle = ProgressHandleFactory.createHandle ("instantiate");
1211
            
1212
            JComponent progressComp = ProgressHandleFactory.createProgressComponent (handle);
1213
            wizardPanel.setProgressComponent (progressComp, null);
1214
            
1215
            handle.start ();
1216
            err.log (Level.FINE, "Show progressPanel later.");
1217
        }
1218
         
1192
        // bugfix #44444, force store settings before do instantiate new objects
1219
        // bugfix #44444, force store settings before do instantiate new objects
1193
        panels.current().storeSettings(settings);
1220
        panels.current().storeSettings(settings);
1194
1221
Lines 1197-1204 Link Here
1197
1224
1198
            try {
1225
            try {
1199
                assert ! (panels instanceof AsynchronousInstantiatingIterator) || ! SwingUtilities.isEventDispatchThread () : "Cannot invoked within EDT if AsynchronousInstantiatingIterator!";
1226
                assert ! (panels instanceof AsynchronousInstantiatingIterator) || ! SwingUtilities.isEventDispatchThread () : "Cannot invoked within EDT if AsynchronousInstantiatingIterator!";
1200
                err.log (Level.FINE, "Calls instantiate() on iterator: " + panels.getClass ().getName ());
1227
                
1201
                newObjects = ((InstantiatingIterator) panels).instantiate();
1228
                if (panels instanceof ProgressInstantiatingIterator) {
1229
                    assert handle != null : "ProgressHandle must be not null.";
1230
                    err.log (Level.FINE, "Calls instantiate(ProgressHandle) on iterator: " + panels.getClass ().getName ());
1231
                    newObjects = ((ProgressInstantiatingIterator) panels).instantiate (handle);
1232
                } else {
1233
                    err.log (Level.FINE, "Calls instantiate() on iterator: " + panels.getClass ().getName ());
1234
                    newObjects = ((InstantiatingIterator) panels).instantiate ();
1235
                }
1202
            } finally {
1236
            } finally {
1203
1237
1204
                // set cursor back to normal
1238
                // set cursor back to normal
Lines 1495-1505 Link Here
1495
         * instantating of newly created objects.
1529
         * instantating of newly created objects.
1496
         *
1530
         *
1497
         * @throws IOException when instantiate fails
1531
         * @throws IOException when instantiate fails
1532
         * @return a set of objects created (the exact type is at the discretion of the caller)
1498
         */
1533
         */
1499
        public Set /*<Object>*/ instantiate () throws IOException;
1534
        public Set /*<Object>*/ instantiate () throws IOException;
1500
1535
1501
    }
1536
    }
1502
1537
1538
    /**
1539
     * Iterator for a wizard that wants to notify users while instantiate is running by a progress bar.
1540
     * The method <code>instantiate</code> is called outside ATW queue.
1541
     * (This interface can replace
1542
     * <a href="@OPENIDE/LOADERS@/org/openide/loaders/TemplateWizard.Iterator.html"><code>TemplateWizard.Iterator</code></a>
1543
     * in a template's declaration.)
1544
     * @since org.openide/1 7.0
1545
     */
1546
    public interface ProgressInstantiatingIterator extends AsynchronousInstantiatingIterator {
1547
1548
        /**
1549
         * Is called in separate thread when the Finish button
1550
         * are clicked and allows implement asynchronous
1551
         * instantating of newly created objects.
1552
         * 
1553
         * @param handle progress bar handle
1554
         * @throws IOException when instantiate fails
1555
         * @return a set of objects created (the exact type is at the discretion of the caller)
1556
         */
1557
        public Set /*<Object>*/ instantiate (ProgressHandle handle) throws IOException;
1558
        
1559
        /** Returns a label of progress bar.
1560
         * This method is called when progress bar is being displayed.
1561
         * 
1562
         * @return name of running task
1563
         */
1564
        public JLabel getProgressLabel ();
1565
1566
    }
1567
1503
    /** Special iterator that works on an array of <code>Panel</code>s.
1568
    /** Special iterator that works on an array of <code>Panel</code>s.
1504
    */
1569
    */
1505
    public static class ArrayIterator extends Object implements Iterator {
1570
    public static class ArrayIterator extends Object implements Iterator {
Lines 1668-1673 Link Here
1668
                        previousButton.setEnabled (false);
1733
                        previousButton.setEnabled (false);
1669
                        nextButton.setEnabled (false);
1734
                        nextButton.setEnabled (false);
1670
                        finishButton.setEnabled (false);
1735
                        finishButton.setEnabled (false);
1736
                        cancelButton.setEnabled (false);
1671
                        
1737
                        
1672
                        // write something to errorMessage (e.g. Wait to finishing.)
1738
                        // write something to errorMessage (e.g. Wait to finishing.)
1673
                        if (wizardPanel != null) wizardPanel.setErrorMessage (NbBundle.getMessage (WizardDescriptor.class, "MSG_WizardDescriptor_FinishInProgress"), Boolean.TRUE); // NOI18N
1739
                        if (wizardPanel != null) wizardPanel.setErrorMessage (NbBundle.getMessage (WizardDescriptor.class, "MSG_WizardDescriptor_FinishInProgress"), Boolean.TRUE); // NOI18N
Lines 2050-2055 Link Here
2050
2116
2051
        /** Label of steps pane */
2117
        /** Label of steps pane */
2052
        private JLabel label;
2118
        private JLabel label;
2119
        
2120
        private JPanel progressBarPanel;
2053
2121
2054
        /** Selected index of content */
2122
        /** Selected index of content */
2055
        private int selectedIndex;
2123
        private int selectedIndex;
Lines 2128-2133 Link Here
2128
            m_lblMessage = new FixedHeightLabel ();
2196
            m_lblMessage = new FixedHeightLabel ();
2129
            m_lblMessage.setForeground (nbErrorForeground);
2197
            m_lblMessage.setForeground (nbErrorForeground);
2130
            errorPanel.add(m_lblMessage, BorderLayout.CENTER);
2198
            errorPanel.add(m_lblMessage, BorderLayout.CENTER);
2199
            
2200
            progressBarPanel = new JPanel (new BorderLayout ());
2201
            // placeholder for progress bar components
2202
            progressBarPanel.add (new JLabel (), BorderLayout.NORTH);
2203
            progressBarPanel.add (new JProgressBar (), BorderLayout.CENTER);
2204
            progressBarPanel.setVisible (false);
2205
            
2206
            progressBarPanel.setBorder (BorderFactory.createEmptyBorder (4, 0, 0, 0));
2207
            errorPanel.add (progressBarPanel, BorderLayout.SOUTH);
2131
2208
2132
            JPanel fullRightPanel = new JPanel(new BorderLayout());
2209
            JPanel fullRightPanel = new JPanel(new BorderLayout());
2133
            fullRightPanel.add(labelPanel, BorderLayout.NORTH);
2210
            fullRightPanel.add(labelPanel, BorderLayout.NORTH);
Lines 2158-2163 Link Here
2158
            }
2235
            }
2159
            
2236
            
2160
            m_lblMessage.setText(msg);
2237
            m_lblMessage.setText(msg);
2238
        }
2239
        
2240
        private void setProgressComponent (JComponent progressComp, JLabel progressLabel) {
2241
            progressBarPanel.removeAll ();
2242
            if (progressLabel != null) {
2243
                progressBarPanel.add (progressLabel, BorderLayout.NORTH);
2244
            }
2245
            progressBarPanel.add (progressComp, BorderLayout.CENTER);
2246
            progressBarPanel.setVisible (true);
2247
            progressBarPanel.revalidate ();
2161
        }
2248
        }
2162
2249
2163
        /** Creates content panel.
2250
        /** Creates content panel.

Return to bug 58889