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

(-)src/org/openide/explorer/view/TreeView.java (-2 / +82 lines)
Lines 115-120 Link Here
115
    transient TreeViewDropSupport dropSupport;
115
    transient TreeViewDropSupport dropSupport;
116
116
117
    transient boolean dropTargetPopupAllowed = true;
117
    transient boolean dropTargetPopupAllowed = true;
118
    transient private Container contentPane;
119
    transient private PropertyChangeListener waitListener;
120
    transient private Node waitingNode;
121
    transient private String PROP_INIT_CHILDREN_STARTED = "initChildrenStarted"; // NOI18N
122
    transient private String PROP_INIT_CHILDREN_FINISHED = "initChildrenFinished"; // NOI18N
118
123
119
    /** Constructor.
124
    /** Constructor.
120
    */
125
    */
Lines 180-185 Link Here
180
        // init listener & attach it to closing of
185
        // init listener & attach it to closing of
181
        managerListener = new TreePropertyListener();
186
        managerListener = new TreePropertyListener();
182
        tree.addTreeExpansionListener (managerListener);
187
        tree.addTreeExpansionListener (managerListener);
188
        tree.addTreeWillExpandListener (managerListener);
183
189
184
        // do not care about focus
190
        // do not care about focus
185
        setRequestFocusEnabled (false);
191
        setRequestFocusEnabled (false);
Lines 393-398 Link Here
393
    * @param n node 
399
    * @param n node 
394
    */
400
    */
395
    public void expandNode (Node n) {
401
    public void expandNode (Node n) {
402
396
        lookupExplorerManager ();
403
        lookupExplorerManager ();
397
        
404
        
398
        
405
        
Lines 483-489 Link Here
483
    public void removeNotify () {
490
    public void removeNotify () {
484
        super.removeNotify ();
491
        super.removeNotify ();
485
492
486
        //System.out.println ("Calling remove notify..."); // NOI18N
487
        tree.getSelectionModel().removeTreeSelectionListener(managerListener);
493
        tree.getSelectionModel().removeTreeSelectionListener(managerListener);
488
    }
494
    }
489
495
Lines 660-665 Link Here
660
        return tree.getSelectionModel ().getSelectionMode ();
666
        return tree.getSelectionModel ().getSelectionMode ();
661
    }
667
    }
662
    
668
    
669
    private void showWaitCursor () {
670
        if (contentPane == null) {
671
            contentPane = getRootPane ().getContentPane ();
672
        }
673
        if (SwingUtilities.isEventDispatchThread ()) {
674
            contentPane.setCursor (Utilities.createProgressCursor (contentPane));
675
        } else {
676
            SwingUtilities.invokeLater (new Runnable () {
677
                public void run () {
678
                    contentPane.setCursor (Utilities.createProgressCursor (contentPane));
679
                }
680
            });
681
        }
682
    }
683
    
684
    private void showNormalCursor () {
685
        if (contentPane == null) {
686
            contentPane = getRootPane ().getContentPane ();
687
        }
688
        if (SwingUtilities.isEventDispatchThread ()) {
689
            contentPane.setCursor (null);
690
        } else {
691
            SwingUtilities.invokeLater (new Runnable () {
692
                public void run () {
693
                    contentPane.setCursor (null);
694
                }
695
            });
696
        }
697
        if (waitingNode !=null) {
698
            removePropertyChangeListener (waitListener);
699
        }
700
    }
701
    
702
    private void prepareWaitCursor (final Node node) {
703
        // check type of node
704
        if (node == null) {
705
            showNormalCursor ();
706
        }
707
        waitingNode = node;
708
709
        // initialize wait listener
710
        if (waitListener == null) {
711
            waitListener = new PropertyChangeListener () {
712
                public void propertyChange (PropertyChangeEvent evt) {
713
                    if (PROP_INIT_CHILDREN_STARTED.equals (evt.getPropertyName ())) {
714
                        showWaitCursor ();
715
                    }
716
                    if (PROP_INIT_CHILDREN_FINISHED.equals (evt.getPropertyName ())) {
717
                        showNormalCursor ();
718
                    }
719
                }
720
            };
721
        }
722
        
723
        // remove wait listener
724
        node.addPropertyChangeListener (waitListener);
725
    }
726
    
663
    /** Synchronize the selected nodes from the manager of this Explorer.
727
    /** Synchronize the selected nodes from the manager of this Explorer.
664
    * The default implementation does nothing.
728
    * The default implementation does nothing.
665
    */
729
    */
Lines 691-696 Link Here
691
    class TreePropertyListener implements VetoableChangeListener,
755
    class TreePropertyListener implements VetoableChangeListener,
692
                PropertyChangeListener,
756
                PropertyChangeListener,
693
                TreeExpansionListener,
757
                TreeExpansionListener,
758
                TreeWillExpandListener,
694
                TreeSelectionListener, Runnable {
759
                TreeSelectionListener, Runnable {
695
		
760
		
696
        private RequestProcessor.Task scheduled;
761
        private RequestProcessor.Task scheduled;
Lines 721-727 Link Here
721
786
722
        public synchronized void treeExpanded (TreeExpansionEvent ev) {
787
        public synchronized void treeExpanded (TreeExpansionEvent ev) {
723
            final TreePath path = ev.getPath ();
788
            final TreePath path = ev.getPath ();
724
            
789
725
            RequestProcessor.Task t = scheduled;
790
            RequestProcessor.Task t = scheduled;
726
            if (t != null) {
791
            if (t != null) {
727
                t.cancel ();
792
                t.cancel ();
Lines 733-743 Link Here
733
                public void run () {
798
                public void run () {
734
		    if (!SwingUtilities.isEventDispatchThread()) {
799
		    if (!SwingUtilities.isEventDispatchThread()) {
735
			SwingUtilities.invokeLater (this);
800
			SwingUtilities.invokeLater (this);
801
                        
736
			return;
802
			return;
737
		    }
803
		    }
738
804
739
                    if (!tree.isVisible(path)) {
805
                    if (!tree.isVisible(path)) {
740
                        // if the path is not visible - don't check the children
806
                        // if the path is not visible - don't check the children
807
                        
741
                        return;
808
                        return;
742
                    }
809
                    }
743
		    
810
		    
Lines 755-760 Link Here
755
                        // System.out.println("different roots.");
822
                        // System.out.println("different roots.");
756
                        return;
823
                        return;
757
                    }
824
                    }
825
                    
826
                    // show wait cursor
827
                    //showWaitCursor ();
758
		    
828
		    
759
                    int lastChildIndex = myNode.getChildCount()-1;
829
                    int lastChildIndex = myNode.getChildCount()-1;
760
                    if (lastChildIndex >= 0) {
830
                    if (lastChildIndex >= 0) {
Lines 775-780 Link Here
775
845
776
        public synchronized void treeCollapsed (final TreeExpansionEvent ev) {
846
        public synchronized void treeCollapsed (final TreeExpansionEvent ev) {
777
            final TreePath path = ev.getPath ();
847
            final TreePath path = ev.getPath ();
848
            showNormalCursor ();
778
            
849
            
779
            RequestProcessor.Task t = scheduled;
850
            RequestProcessor.Task t = scheduled;
780
            if (t != null) {
851
            if (t != null) {
Lines 871-876 Link Here
871
            callSelectionChanged ((Node[])ll.toArray (new Node[ll.size ()]));
942
            callSelectionChanged ((Node[])ll.toArray (new Node[ll.size ()]));
872
        }
943
        }
873
944
945
        public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
946
        }
947
        
948
        public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
949
            // prepare wait cursor and optionally show it
950
            TreePath path = event.getPath ();
951
            prepareWaitCursor (DragDropUtilities.secureFindNode (path.getLastPathComponent ()));
952
        }
953
        
874
    } // end of TreePropertyListener
954
    } // end of TreePropertyListener
875
955
876
956
(-)src/org/openide/loaders/DataFolder.java (+14 lines)
Lines 1038-1043 Link Here
1038
    /** Node for a folder.
1038
    /** Node for a folder.
1039
    */
1039
    */
1040
    public class FolderNode extends DataNode {
1040
    public class FolderNode extends DataNode {
1041
        
1042
        private String PROP_INIT_CHILDREN_STARTED = "initChildrenStarted"; // NOI18N
1043
        private String PROP_INIT_CHILDREN_FINISHED = "initChildrenFinished"; // NOI18N
1044
        
1041
        /** Create a folder node with some children.
1045
        /** Create a folder node with some children.
1042
        * @param ch children to use for the node
1046
        * @param ch children to use for the node
1043
        */
1047
        */
Lines 1059-1064 Link Here
1059
            } else {
1063
            } else {
1060
                return super.getCookie (clazz);
1064
                return super.getCookie (clazz);
1061
            }
1065
            }
1066
        }
1067
        
1068
        /** Helper method informs TreeView about start of calucation the folder children. */
1069
        void fireChildrenStarted () {
1070
            firePropertyChange (PROP_INIT_CHILDREN_STARTED, null, Boolean.TRUE);
1071
        }
1072
1073
        /** Helper method informs TreeView about the calucation of folder children was finished. */
1074
        void fireChildrenFinished () {
1075
            firePropertyChange (PROP_INIT_CHILDREN_FINISHED, null, Boolean.TRUE);
1062
        }
1076
        }
1063
1077
1064
        /* Adds properties for sorting.
1078
        /* Adds properties for sorting.
(-)src/org/openide/loaders/FolderChildren.java (-1 / +12 lines)
Lines 208-213 Link Here
208
    * @param force true if the content should be filled immediatelly
208
    * @param force true if the content should be filled immediatelly
209
    */
209
    */
210
    private Task initialize (boolean force, boolean waitFirst) {
210
    private Task initialize (boolean force, boolean waitFirst) {
211
        // fire event that initialization children started
212
        if (folder.getNodeDelegate () instanceof DataFolder.FolderNode) {
213
            ((DataFolder.FolderNode)folder.getNodeDelegate ()).fireChildrenStarted ();
214
        }
211
        
215
        
212
        Task t = initTask;
216
        Task t = initTask;
213
217
Lines 249-255 Link Here
249
    }
253
    }
250
254
251
    /** time delay between two inserts of nodes */
255
    /** time delay between two inserts of nodes */
252
    private static final int TIME_DELAY = 256;
256
    private static final int TIME_DELAY = 1024;
253
257
254
    /** Private req processor for Addition's refresh tasks */
258
    /** Private req processor for Addition's refresh tasks */
255
    private static RequestProcessor refRP = 
259
    private static RequestProcessor refRP = 
Lines 418-423 Link Here
418
                    }
422
                    }
419
                }
423
                }
420
            }
424
            }
425
            if (processingFinished) {
426
                // fire event that initialization children finished
427
                if (folder.getNodeDelegate () instanceof DataFolder.FolderNode) {
428
                    ((DataFolder.FolderNode)folder.getNodeDelegate ()).fireChildrenFinished ();
429
                }
430
            }
431
421
        }
432
        }
422
    }
433
    }
423
434

Return to bug 30014