Author: ivaynberg
Date: Fri Jun 10 06:49:33 2011
New Revision: 1134211

URL: http://svn.apache.org/viewvc?rev=1134211&view=rev
Log:

Issue: WICKET-3764

Modified:
    wicket/trunk/wicket-core/src/main/java/org/apache/wicket/Behaviors.java
    
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java

Modified: 
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/Behaviors.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/Behaviors.java?rev=1134211&r1=1134210&r2=1134211&view=diff
==============================================================================
--- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/Behaviors.java 
(original)
+++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/Behaviors.java Fri 
Jun 10 06:49:33 2011
@@ -70,6 +70,10 @@ final class Behaviors implements IDetach
        private void internalAdd(final Behavior behavior)
        {
                component.data_add(behavior);
+               if (behavior.isStateless(component))
+               {
+                       getBehaviorId(behavior);
+               }
        }
 
        @SuppressWarnings("unchecked")

Modified: 
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java?rev=1134211&r1=1134210&r2=1134211&view=diff
==============================================================================
--- 
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java 
(original)
+++ 
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java 
Fri Jun 10 06:49:33 2011
@@ -178,6 +178,23 @@ public abstract class Behavior
        }
 
        /**
+        * Returns whether or not this behavior is stateless. Most behaviors 
should either not override
+        * this method or return {@code false} because most behavior are not 
stateless.
+        * 
+        * A small subset of behaviors are made specifically to be stateless 
and as such should override
+        * this method and return {@code true}. One sideeffect of this method 
is that the behavior id
+        * will be generated eagerly when the behavior is added to the 
component instead of before
+        * render when a method to create the url is called - this allows for 
stateless callback urls.
+        * 
+        * @param component
+        * @return whether or not this behavior is stateless
+        */
+       public boolean isStateless(Component component)
+       {
+               return false;
+       }
+
+       /**
         * Checks if a listener can be invoked on this behavior
         * 
         * @param component


Reply via email to