usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/control/Navigator.java
changeset 157 f4316b998c95
parent 156 ad266190d7e6
child 190 555203a2de79
--- a/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/control/Navigator.java	Mon Nov 10 14:20:25 2008 -0500
+++ b/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/control/Navigator.java	Tue Nov 11 09:59:40 2008 -0500
@@ -44,19 +44,9 @@
     //
 
     private Thread dispatchThread;
-
-    // Use a thread pool with a single core thread to autmatically handle
-    // uncaught exceptions and queued requests
     private ThreadPoolExecutor threadPool;
-
     private StackList<Control> stack = new StackList<Control>();
-
-    private List<NavigationListener> listeners =
-	new ArrayList<NavigationListener>();
-
-    private List<NavigationListener> roListeners =
-	Collections.unmodifiableList(listeners);
-
+    private NavigationListeners listeners = new NavigationListeners(false);
     private String name;
 
     //
@@ -81,6 +71,8 @@
 	// Unbounded
 	BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
 
+	// Use a thread pool with a single core thread to autmatically handle
+	// uncaught exceptions and queued requests
 	threadPool = new ThreadPoolExecutor(
 	    1, 1, 10, TimeUnit.MINUTES, queue, factory);
 
@@ -196,10 +188,7 @@
      * begun.
      */
     protected void fireNavigationStarted(NavigationEvent e) {
-	// Iterate backwards to allow listener removal during iteration
-	for (int i = listeners.size() - 1; i >= 0; i--) {
-	    listeners.get(i).navigationStarted(e);
-	}
+	listeners.navigationStarted(e);
     }
 
     /**
@@ -207,10 +196,7 @@
      * stopped.
      */
     protected void fireNavigationStopped(NavigationEvent e) {
-	// Iterate backwards to allow listener removal during iteration
-	for (int i = listeners.size() - 1; i >= 0; i--) {
-	    listeners.get(i).navigationStopped(e);
-	}
+	listeners.navigationStopped(e);
     }
 
     /**
@@ -227,10 +213,6 @@
 	return name;
     }
 
-    public List<NavigationListener> getNavigationListeners() {
-	return roListeners;
-    }
-
     /**
      * Gets the current path.  This method is not thread-safe; it is up to
      * callers to ensure the that navigation is not currently modifying this