Author: ivaynberg
Date: Tue Mar  3 03:04:16 2009
New Revision: 749519

URL: http://svn.apache.org/viewvc?rev=749519&view=rev
Log:
WICKET-2090

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java?rev=749519&r1=749518&r2=749519&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java 
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java Tue 
Mar  3 03:04:16 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.wicket;
 
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -239,7 +240,48 @@
 
        /** holds the stack of set {...@link IRequestTarget}, the last set op 
top. */
        private transient final ArrayListStack<IRequestTarget> requestTargets = 
new ArrayListStack<IRequestTarget>(
-               3);
+               3)
+       {
+
+               private static final long serialVersionUID = 1L;
+
+               @Override
+               public void add(int arg0, IRequestTarget arg1)
+               {
+                       onRequestTargetSet(arg1);
+                       super.add(arg0, arg1);
+               }
+
+               @Override
+               public boolean add(IRequestTarget arg0)
+               {
+                       onRequestTargetSet(arg0);
+                       return super.add(arg0);
+               }
+
+               @Override
+               public boolean addAll(Collection<? extends IRequestTarget> c)
+               {
+                       Iterator<? extends IRequestTarget> it = c.iterator();
+                       while (it.hasNext())
+                       {
+                               onRequestTargetSet(it.next());
+                       }
+                       return super.addAll(c);
+               }
+
+               @Override
+               public boolean addAll(int index, Collection<? extends 
IRequestTarget> c)
+               {
+                       Iterator<? extends IRequestTarget> it = c.iterator();
+                       while (it.hasNext())
+                       {
+                               onRequestTargetSet(it.next());
+                       }
+                       return super.addAll(index, c);
+               }
+
+       };
 
        /**
         * Any page parameters. Only set when the request is resolving and the 
parameters are passed
@@ -1491,6 +1533,16 @@
        }
 
        /**
+        * Called when a request target is set on the request cycle
+        * 
+        * @param requestTarget
+        */
+       protected void onRequestTargetSet(IRequestTarget requestTarget)
+       {
+       }
+
+
+       /**
         * Sets the metadata for this request cycle using the given key. If the 
metadata object is not
         * of the correct type for the metadata key, an 
IllegalArgumentException will be thrown. For
         * information on creating MetaDataKeys, see {...@link MetaDataKey}.


Reply via email to