Author: jdonnerstag
Date: Sat Sep 26 11:04:49 2009
New Revision: 819111
URL: http://svn.apache.org/viewvc?rev=819111&view=rev
Log:
fixed: AjaxFormSubmitBehavior cannot be applied to Form
Issue: WICKET-2398
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java?rev=819111&r1=819110&r2=819111&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
Sat Sep 26 11:04:49 2009
@@ -86,13 +86,21 @@
{
// try to find form in the hierarchy of owning component
Component component = getComponent();
- __form = component.findParent(Form.class);
+ if (component instanceof Form<?>)
+ {
+ __form = (Form<?>)component;
+ }
+ else
+ {
+ __form = component.findParent(Form.class);
+ }
+
if (__form == null)
{
throw new IllegalStateException(
- "form was not specified in the
constructor and cannot "
- + "be found in the hierarchy of
the component this behavior "
- + "is attached to");
+ "form was not specified in the
constructor and cannot " +
+ "be found in the hierarchy of
the component this behavior " +
+ "is attached to: Component=" +
component.toString(false));
}
}
return __form;
@@ -126,7 +134,6 @@
}
/**
- *
* @see
org.apache.wicket.ajax.AjaxEventBehavior#onEvent(org.apache.wicket.ajax.AjaxRequestTarget)
*/
@Override
@@ -168,12 +175,10 @@
* Listener method invoked when the form has been processed and errors
occurred
*
* @param target
- *
*/
protected abstract void onError(AjaxRequestTarget target);
/**
- *
* @see
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#getPreconditionScript()
*/
@Override