< prev index next >

src/com/sun/javatest/exec/TestTree.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 154         if (tsm == null)
 155             return;
 156 
 157         // add or set ???
 158         tsm.addSelectionPaths(selectedPaths);
 159     }
 160 
 161 
 162     /**
 163      * Record which tree nodes are currently visible.
 164      * @see #restorePaths
 165      */
 166     TreePath[] snapshotOpenPaths() {
 167         // currModel.getRoot()==null may indicate that the GUI has been
 168         // disposed already (?).  We have seen exceptions in the code
 169         // below because this situation occurs.
 170         if (currModel == null || currModel.getRoot() == null)
 171             return null;
 172 
 173         TreePath[] paths = new TreePath[0];
 174         Enumeration e = getDescendantToggledPaths(new TreePath(currModel.getRoot()));
 175 
 176         while (e != null && e.hasMoreElements()) {
 177             TreePath tp = (TreePath)(e.nextElement());
 178             if (!isVisible(tp))     // if we can't see it, we don't care
 179                 continue;
 180             if (!isExpanded(tp))    // if it's not expanded, we don't need it
 181                 continue;
 182 
 183             paths = DynamicArray.append(paths, tp);
 184         }   // while
 185 
 186         return paths;
 187     }
 188 
 189     /**
 190      * Restore open paths in the tree.  Should be called on the event thread.
 191      * @param openUrls The path urls to restore.
 192      * @param queue True if the request should be put into the event queue at the
 193      *  end - this can be important for proper queuing of operations.
 194      */
 195     void restorePaths(final String[] openUrls, boolean queue) {
 196         if (openUrls == null || openUrls.length == 0)
 197             return;




 154         if (tsm == null)
 155             return;
 156 
 157         // add or set ???
 158         tsm.addSelectionPaths(selectedPaths);
 159     }
 160 
 161 
 162     /**
 163      * Record which tree nodes are currently visible.
 164      * @see #restorePaths
 165      */
 166     TreePath[] snapshotOpenPaths() {
 167         // currModel.getRoot()==null may indicate that the GUI has been
 168         // disposed already (?).  We have seen exceptions in the code
 169         // below because this situation occurs.
 170         if (currModel == null || currModel.getRoot() == null)
 171             return null;
 172 
 173         TreePath[] paths = new TreePath[0];
 174         Enumeration<TreePath> e = getDescendantToggledPaths(new TreePath(currModel.getRoot()));
 175 
 176         while (e != null && e.hasMoreElements()) {
 177             TreePath tp = (e.nextElement());
 178             if (!isVisible(tp))     // if we can't see it, we don't care
 179                 continue;
 180             if (!isExpanded(tp))    // if it's not expanded, we don't need it
 181                 continue;
 182 
 183             paths = DynamicArray.append(paths, tp);
 184         }   // while
 185 
 186         return paths;
 187     }
 188 
 189     /**
 190      * Restore open paths in the tree.  Should be called on the event thread.
 191      * @param openUrls The path urls to restore.
 192      * @param queue True if the request should be put into the event queue at the
 193      *  end - this can be important for proper queuing of operations.
 194      */
 195     void restorePaths(final String[] openUrls, boolean queue) {
 196         if (openUrls == null || openUrls.length == 0)
 197             return;


< prev index next >