Author: jcompagner
Date: Tue Oct 30 12:56:53 2007
New Revision: 590345

URL: http://svn.apache.org/viewvc?rev=590345&view=rev
Log:
a half fix for WICKET-734, it still will or can fail
improved the exception what to do then.

It is just that stateless components that has callbacks can't be really in 
repeaters that are generation items for which the index is growing (or if they 
are paging)

Modified:
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkableListenerInterfaceRequestTarget.java

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkableListenerInterfaceRequestTarget.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkableListenerInterfaceRequestTarget.java?rev=590345&r1=590344&r2=590345&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkableListenerInterfaceRequestTarget.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkableListenerInterfaceRequestTarget.java
 Tue Oct 30 12:56:53 2007
@@ -113,8 +113,20 @@
                Component component = page.get(pageRelativeComponentPath);
                if (component == null)
                {
-                       throw new WicketRuntimeException("unable to find 
component with path " +
-                                       pageRelativeComponentPath + " on page " 
+ page);
+                       // this is quite a hack to get components in repeater 
work.
+                       // But it still can fail if the repeater is a paging 
one or on every render
+                       // it will generate new index for the items...
+                       page.beforeRender();
+                       component = page.get(pageRelativeComponentPath);
+                       if (component == null)
+                       {
+                               throw new WicketRuntimeException(
+                                               "unable to find component with 
path " +
+                                                               
pageRelativeComponentPath +
+                                                               " on stateless 
page " +
+                                                               page +
+                                                               " it could be 
that the component is inside a repeater make your component return false in 
getStatelessHint()");
+                       }
                }
                RequestListenerInterface listenerInterface = 
RequestListenerInterface
                                .forName(interfaceName);


Reply via email to