WICKET-4575 drop onSubmitBeforeForm in favor of keeping onSubmit
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/ff0d5784 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/ff0d5784 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/ff0d5784 Branch: refs/heads/wicket-1.5.x Commit: ff0d5784f4a03cc1d8cb06ced45a98ac0d5daa92 Parents: 676265e Author: Carl-Eric Menzel <cmen...@wicketbuch.de> Authored: Tue Jun 26 17:49:49 2012 +0200 Committer: Carl-Eric Menzel <cmen...@wicketbuch.de> Committed: Tue Jun 26 17:49:49 2012 +0200 ---------------------------------------------------------------------- .../wicket/ajax/form/AjaxFormSubmitBehavior.java | 14 ------ .../wicket/ajax/markup/html/form/AjaxButton.java | 23 ---------- .../ajax/markup/html/form/AjaxFallbackButton.java | 34 --------------- .../ajax/markup/html/form/AjaxSubmitLink.java | 27 ------------ .../org/apache/wicket/markup/html/form/Button.java | 12 ----- .../org/apache/wicket/markup/html/form/Form.java | 6 +-- .../html/form/IBeforeAndAfterFormSubmitter.java | 6 --- .../wicket/markup/html/form/IFormSubmitter.java | 5 -- .../apache/wicket/markup/html/form/SubmitLink.java | 10 ---- .../markup/html/form/FormSubmitOrderTest.java | 2 +- .../markup/html/form/submitlink/HomePage.java | 24 ++--------- .../markup/html/form/submitlink/TestHomePage.java | 6 --- 12 files changed, 6 insertions(+), 163 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java index 27d988e..fc07f21 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java @@ -177,10 +177,6 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior AjaxFormSubmitBehavior.this.onError(target); } - public void onSubmitBeforeForm() - { - AjaxFormSubmitBehavior.this.onSubmitBeforeForm(target); - } public void onSubmitAfterForm() { @@ -197,23 +193,13 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior { } - /** - * Override this method to provide special submit handling in a multi-button form. This method - * will be called <em>before</em> the form's onSubmit method. - */ - protected void onSubmitBeforeForm(AjaxRequestTarget target) - { - } /** * Listener method that is invoked after the form has been submitted and processed without * errors * * @param target - * @deprecated Will be removed in 6.0. Use {@link #onSubmitBeforeForm(AjaxRequestTarget)} and/or - * link #onSubmitAfterForm(AjaxRequestTarget)} instead. */ - @Deprecated protected void onSubmit(AjaxRequestTarget target) { } http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java index dcffebb..bf02229 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java @@ -23,7 +23,6 @@ import org.apache.wicket.ajax.IAjaxCallDecorator; import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.IFormSubmitter; import org.apache.wicket.model.IModel; import org.apache.wicket.util.string.AppendingStringBuffer; import org.apache.wicket.util.string.Strings; @@ -109,16 +108,6 @@ public abstract class AjaxButton extends Button * @see org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onSubmit(org.apache.wicket.ajax.AjaxRequestTarget) */ @Override - protected void onSubmitBeforeForm(AjaxRequestTarget target) - { - AjaxButton.this.onSubmitBeforeForm(target, AjaxButton.this.getForm()); - } - - /** - * - * @see org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onSubmit(org.apache.wicket.ajax.AjaxRequestTarget) - */ - @Override protected void onSubmitAfterForm(AjaxRequestTarget target) { AjaxButton.this.onSubmitAfterForm(target, AjaxButton.this.getForm()); @@ -224,9 +213,7 @@ public abstract class AjaxButton extends Button * * @param target * @param form - * @deprecated see {@link IFormSubmitter#onSubmit()} */ - @Deprecated protected void onSubmit(AjaxRequestTarget target, Form<?> form) { } @@ -237,16 +224,6 @@ public abstract class AjaxButton extends Button * @param target * @param form */ - protected void onSubmitBeforeForm(AjaxRequestTarget target, Form<?> form) - { - } - - /** - * Listener method invoked on form submit with no errors - * - * @param target - * @param form - */ protected void onSubmitAfterForm(AjaxRequestTarget target, Form<?> form) { } http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java index e945f9a..7d056d9 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java @@ -23,7 +23,6 @@ import org.apache.wicket.ajax.IAjaxCallDecorator; import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.IFormSubmitter; import org.apache.wicket.model.IModel; import org.apache.wicket.util.string.AppendingStringBuffer; @@ -78,13 +77,6 @@ public abstract class AjaxFallbackButton extends Button } @Override - protected void onSubmitBeforeForm(AjaxRequestTarget target) - { - AjaxFallbackButton.this.onSubmitBeforeForm(target, - AjaxFallbackButton.this.getForm()); - } - - @Override protected void onSubmitAfterForm(AjaxRequestTarget target) { AjaxFallbackButton.this.onSubmitAfterForm(target, AjaxFallbackButton.this.getForm()); @@ -148,18 +140,6 @@ public abstract class AjaxFallbackButton extends Button * @see org.apache.wicket.markup.html.form.IFormSubmittingComponent#onSubmit() */ @Override - public final void onSubmitBeforeForm() - { - if (AjaxRequestTarget.get() == null) - { - onSubmitBeforeForm(null, getForm()); - } - } - - /** - * @see org.apache.wicket.markup.html.form.IFormSubmittingComponent#onSubmit() - */ - @Override public final void onSubmitAfterForm() { if (AjaxRequestTarget.get() == null) @@ -185,9 +165,7 @@ public abstract class AjaxFallbackButton extends Button * @param target * ajax target if this linked was invoked using ajax, null otherwise * @param form - * @deprecated see {@link IFormSubmitter#onSubmit()} */ - @Deprecated protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { } @@ -200,18 +178,6 @@ public abstract class AjaxFallbackButton extends Button * ajax target if this linked was invoked using ajax, null otherwise * @param form */ - protected void onSubmitBeforeForm(final AjaxRequestTarget target, final Form<?> form) - { - } - - /** - * Callback for the onClick event. If ajax failed and this event was generated via a normal - * submission, the target argument will be null - * - * @param target - * ajax target if this linked was invoked using ajax, null otherwise - * @param form - */ protected void onSubmitAfterForm(final AjaxRequestTarget target, final Form<?> form) { } http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java index 2176b43..d5348d3 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java @@ -22,7 +22,6 @@ import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.html.form.AbstractSubmitLink; import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.IFormSubmitter; import org.apache.wicket.util.string.AppendingStringBuffer; /** @@ -114,26 +113,12 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink { AjaxSubmitLink.this.onSubmitAfterForm(target, getForm()); } - - @Override - protected void onSubmitBeforeForm(AjaxRequestTarget target) - { - AjaxSubmitLink.this.onSubmitBeforeForm(target, getForm()); - } }); } /** * Override this method to provide special submit handling in a multi-button form. This method - * will be called <em>before</em> the form's onSubmit method. - */ - protected void onSubmitBeforeForm(AjaxRequestTarget target, Form<?> form) - { - } - - /** - * Override this method to provide special submit handling in a multi-button form. This method * will be called <em>after</em> the form's onSubmit method. */ protected void onSubmitAfterForm(AjaxRequestTarget target, Form<?> form) @@ -198,23 +183,11 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink } /** - * Use {@link #onSubmitBeforeForm(AjaxRequestTarget, Form)} instead. - */ - public final void onSubmitBeforeForm() - { - } - - /** * Listener method invoked on form submit * * @param target * @param form - * @deprecated This method will be removed in 6.0. Use - * {@link #onSubmitBeforeForm(AjaxRequestTarget, Form)} and/or - * {@link #onSubmitAfterForm(AjaxRequestTarget, Form)} instead. See - * {@link IFormSubmitter#onSubmit()}. */ - @Deprecated protected void onSubmit(AjaxRequestTarget target, Form<?> form) { } http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java index 0b01935..0e40c99 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java @@ -218,11 +218,7 @@ public class Button extends FormComponent<String> * Override this method to provide special submit handling in a multi-button form. It is called * whenever the user clicks this particular button, except if validation fails. This method will * be called <em>before</em> {@link Form#onSubmit()}. - * - * @deprecated This method will be removed in 6.0. Use {@link #onSubmitBeforeForm()} and/or - * {@link #onSubmitAfterForm()} instead. See {@link IFormSubmitter#onSubmit()}. */ - @Deprecated public void onSubmit() { } @@ -234,14 +230,6 @@ public class Button extends FormComponent<String> { } - /** - * Override this method to provide special submit handling in a multi-button form. It is called - * whenever the user clicks this particular button, except if validation fails. This method will - * be called <em>before</em> {@link Form#onSubmit()}. - */ - public void onSubmitBeforeForm() - { - } /** * Override this method to provide special submit handling in a multi-button form. It is called http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java index 57b78d7..9f91835 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java @@ -1218,11 +1218,7 @@ public class Form<T> extends WebMarkupContainer implements IFormSubmitListener if (submittingComponent != null) { // invoke submit on component - if (submittingComponent instanceof IBeforeAndAfterFormSubmitter) - { - ((IBeforeAndAfterFormSubmitter)submittingComponent).onSubmitBeforeForm(); - } - submittingComponent.onSubmit(); // remove this for 6.0 + submittingComponent.onSubmit(); } // invoke Form#onSubmit(..) going from innermost to outermost http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IBeforeAndAfterFormSubmitter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IBeforeAndAfterFormSubmitter.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IBeforeAndAfterFormSubmitter.java index 0c49c74..e19e92d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IBeforeAndAfterFormSubmitter.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IBeforeAndAfterFormSubmitter.java @@ -26,12 +26,6 @@ public interface IBeforeAndAfterFormSubmitter extends IFormSubmitter { /** * Override this method to provide special submit handling in a multi-button form. This method - * will be called <em>before</em> the form's onSubmit method. - */ - void onSubmitBeforeForm(); - - /** - * Override this method to provide special submit handling in a multi-button form. This method * will be called <em>after</em> the form's onSubmit method. */ void onSubmitAfterForm(); http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IFormSubmitter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IFormSubmitter.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IFormSubmitter.java index 6460b01..3f4f85e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IFormSubmitter.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IFormSubmitter.java @@ -44,12 +44,7 @@ public interface IFormSubmitter /** * Override this method to provide special submit handling in a multi-button form. It is called * whenever the user clicks this particular button, <em>before</em> {@link Form#onSubmit()}. - * - * @deprecated Use {@link IBeforeAndAfterFormSubmitter#onSubmitAfterForm()} and/or - * {@link IBeforeAndAfterFormSubmitter#onSubmitBeforeForm()} instead. This method - * will be removed in 6.0. */ - @Deprecated void onSubmit(); /** http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java index db69f28..d93761a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java @@ -225,10 +225,8 @@ public class SubmitLink extends AbstractSubmitLink } /** - * @deprecated * @see org.apache.wicket.markup.html.form.IFormSubmittingComponent#onSubmit() */ - @Deprecated public void onSubmit() { } @@ -247,12 +245,4 @@ public class SubmitLink extends AbstractSubmitLink public void onSubmitAfterForm() { } - - /** - * Override this method to provide special submit handling in a multi-button form. This method - * will be called <em>before</em> the form's onSubmit method. - */ - public void onSubmitBeforeForm() - { - } } http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/test/java/org/apache/wicket/markup/html/form/FormSubmitOrderTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/FormSubmitOrderTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/FormSubmitOrderTest.java index 23fd812..a3ca4a0 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/FormSubmitOrderTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/FormSubmitOrderTest.java @@ -41,7 +41,7 @@ public class FormSubmitOrderTest extends WicketTestCase form.add(new Button("button") { @Override - public void onSubmitBeforeForm() + public void onSubmit() { super.onSubmit(); result += "before"; http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/HomePage.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/HomePage.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/HomePage.java index 9f8c4ed..319ae92 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/HomePage.java +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/HomePage.java @@ -29,8 +29,7 @@ import org.apache.wicket.model.PropertyModel; public class HomePage extends WebPage { boolean submitted = false; - boolean submittedViaLinkDeprecated = false; - boolean submittedViaLinkBefore = false; + boolean submittedViaLink = false; boolean submittedViaLinkAfter = false; String text; /** @@ -66,30 +65,20 @@ public class HomePage extends WebPage */ private static final long serialVersionUID = 1L; - @Override - public void onSubmitBeforeForm() - { - submittedViaLinkBefore = true; - assertFalse("before must be the first!", submittedViaLinkAfter); - assertFalse("before must be the first!", submittedViaLinkDeprecated); - } @Override public void onSubmit() { - assertTrue("before must have been called!", submittedViaLinkBefore); - submittedViaLinkDeprecated = true; + submittedViaLink = true; assertFalse("after must not yet have been called", submittedViaLinkAfter); } @Override public void onSubmitAfterForm() { - assertTrue("before must have been called!", submittedViaLinkBefore); - assertTrue("onsubmit must have been called!", submittedViaLinkDeprecated); + assertTrue("onsubmit must have been called!", submittedViaLink); submittedViaLinkAfter = true; } - }); add(form); @@ -124,12 +113,7 @@ public class HomePage extends WebPage */ public boolean isSubmittedViaLink() { - return submittedViaLinkDeprecated; - } - - boolean isSubmittedViaLinkBefore() - { - return submittedViaLinkBefore; + return submittedViaLink; } boolean isSubmittedViaLinkAfter() http://git-wip-us.apache.org/repos/asf/wicket/blob/ff0d5784/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/TestHomePage.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/TestHomePage.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/TestHomePage.java index c2b5639..8a53167 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/TestHomePage.java +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/submitlink/TestHomePage.java @@ -36,8 +36,6 @@ public class TestHomePage extends WicketTestCase assertEquals("Hello", home.getText()); assertTrue("Form.onSubmit() has not been called!", home.isSubmitted()); assertTrue("SubmitLink.onSubmit() has not been called!", home.isSubmittedViaLink()); - assertTrue("SubmitLink.onSubmitBeforeForm() has not been called!", - home.isSubmittedViaLinkBefore()); assertTrue("SubmitLink.onSubmitAfterForm() has not been called!", home.isSubmittedViaLinkAfter()); @@ -58,8 +56,6 @@ public class TestHomePage extends WicketTestCase assertEquals("Hello", home.getText()); assertTrue("Form.onSubmit() has not been called!", home.isSubmitted()); assertTrue("SubmitLink.onSubmit() has not been called!", home.isSubmittedViaLink()); - assertTrue("SubmitLink.onSubmitBeforeForm() has not been called!", - home.isSubmittedViaLinkBefore()); assertTrue("SubmitLink.onSubmitAfterForm() has not been called!", home.isSubmittedViaLinkAfter()); } @@ -78,8 +74,6 @@ public class TestHomePage extends WicketTestCase assertEquals("Hello", home.getText()); assertTrue("Form.onSubmit() has not been called!", home.isSubmitted()); assertTrue("SubmitLink.onSubmit() has not been called!", home.isSubmittedViaLink()); - assertTrue("SubmitLink.onSubmitBeforeForm() has not been called!", - home.isSubmittedViaLinkBefore()); assertTrue("SubmitLink.onSubmitAfterForm() has not been called!", home.isSubmittedViaLinkAfter()); }