Author: jdonnerstag
Date: Sun Jan 11 02:52:46 2009
New Revision: 733447

URL: http://svn.apache.org/viewvc?rev=733447&view=rev
Log:
fixed wicket-2018: Buttom subclasses getForm with a different sematic

Modified:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java?rev=733447&r1=733446&r2=733447&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
 Sun Jan 11 02:52:46 2009
@@ -16,7 +16,6 @@
  */
 package org.apache.wicket.markup.html.form;
 
-import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.version.undo.Change;
@@ -105,24 +104,6 @@
        }
 
        /**
-        * 
-        * @see org.apache.wicket.markup.html.form.FormComponent#getForm()
-        */
-       @Override
-       public Form<?> getForm()
-       {
-               try
-               {
-                       return super.getForm();
-               }
-               catch (WicketRuntimeException wre)
-               {
-                       // ignore this and return null. 
(Form.findSubmittingComponent expects this)
-               }
-               return null;
-       }
-
-       /**
         * Gets the defaultFormProcessing property. When false (default is 
true), all validation and
         * formupdating is bypassed and the onSubmit method of that button is 
called directly, and the
         * onSubmit method of the parent form is not called. A common use for 
this is to create a cancel

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java?rev=733447&r1=733446&r2=733447&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java 
(original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java 
Sun Jan 11 02:52:46 2009
@@ -592,20 +592,23 @@
                                {
                                        // Get submitting component
                                        final IFormSubmittingComponent 
submittingComponent = (IFormSubmittingComponent)component;
+                                       Form<?> form = 
Form.findForm((Component)submittingComponent);
 
                                        // Check for component-name or 
component-name.x request string
-                                       if (submittingComponent.getForm() != 
null &&
-                                               
submittingComponent.getForm().getRootForm() == Form.this &&
-                                               
(getRequest().getParameter(submittingComponent.getInputName()) != null || 
getRequest().getParameter(
-                                                       
submittingComponent.getInputName() + ".x") != null))
+                                       if ((form != null) && 
(form.getRootForm() == Form.this))
                                        {
-                                               if (!component.isVisible())
+                                               String name = 
submittingComponent.getInputName();
+                                               if 
((getRequest().getParameter(name) != null) ||
+                                                       
(getRequest().getParameter(name + ".x") != null))
                                                {
-                                                       throw new 
WicketRuntimeException("Submit Button " +
-                                                               
submittingComponent.getInputName() + " (path=" +
-                                                               
component.getPageRelativePath() + ") is not visible");
+                                                       if 
(!component.isVisible())
+                                                       {
+                                                               throw new 
WicketRuntimeException("Submit Button " +
+                                                                       
submittingComponent.getInputName() + " (path=" +
+                                                                       
component.getPageRelativePath() + ") is not visible");
+                                                       }
+                                                       return 
submittingComponent;
                                                }
-                                               return submittingComponent;
                                        }
                                        return CONTINUE_TRAVERSAL;
                                }


Reply via email to