Updated Branches: refs/heads/wicket-1.5.x 676265e45 -> f24f117ea
WICKET-4575 simplify onAfterFormSubmit to onAfterSubmit Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/f24f117e Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/f24f117e Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/f24f117e Branch: refs/heads/wicket-1.5.x Commit: f24f117eae9564fe2a0e407a19997d25cb9968a6 Parents: ff0d578 Author: Carl-Eric Menzel <cmen...@wicketbuch.de> Authored: Tue Jun 26 18:02:10 2012 +0200 Committer: Carl-Eric Menzel <cmen...@wicketbuch.de> Committed: Tue Jun 26 18:02:10 2012 +0200 ---------------------------------------------------------------------- .../wicket/ajax/form/AjaxFormSubmitBehavior.java | 10 ++-- .../wicket/ajax/markup/html/form/AjaxButton.java | 6 +- .../ajax/markup/html/form/AjaxFallbackButton.java | 10 ++-- .../ajax/markup/html/form/AjaxSubmitLink.java | 10 ++-- .../markup/html/form/AbstractSubmitLink.java | 2 +- .../org/apache/wicket/markup/html/form/Button.java | 4 +- .../org/apache/wicket/markup/html/form/Form.java | 4 +- .../markup/html/form/IAfterFormSubmitter.java | 32 +++++++++++++++ .../html/form/IBeforeAndAfterFormSubmitter.java | 32 --------------- .../apache/wicket/markup/html/form/SubmitLink.java | 2 +- .../markup/html/form/FormSubmitOrderTest.java | 2 +- .../markup/html/form/submitlink/HomePage.java | 2 +- .../markup/html/form/submitlink/TestHomePage.java | 6 +- 13 files changed, 61 insertions(+), 61 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 fc07f21..b73a081 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 @@ -21,7 +21,7 @@ import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.IBeforeAndAfterFormSubmitter; +import org.apache.wicket.markup.html.form.IAfterFormSubmitter; import org.apache.wicket.markup.html.form.IFormSubmittingComponent; import org.apache.wicket.util.string.AppendingStringBuffer; @@ -155,7 +155,7 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior @Override protected void onEvent(final AjaxRequestTarget target) { - getForm().getRootForm().onFormSubmitted(new IBeforeAndAfterFormSubmitter() + getForm().getRootForm().onFormSubmitted(new IAfterFormSubmitter() { public Form<?> getForm() { @@ -178,9 +178,9 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior } - public void onSubmitAfterForm() + public void onAfterSubmit() { - AjaxFormSubmitBehavior.this.onSubmitAfterForm(target); + AjaxFormSubmitBehavior.this.onAfterSubmit(target); } }); } @@ -189,7 +189,7 @@ 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>after</em> the form's onSubmit method. */ - protected void onSubmitAfterForm(AjaxRequestTarget target) + protected void onAfterSubmit(AjaxRequestTarget target) { } http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 bf02229..1a8bd60 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 @@ -108,9 +108,9 @@ public abstract class AjaxButton extends Button * @see org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onSubmit(org.apache.wicket.ajax.AjaxRequestTarget) */ @Override - protected void onSubmitAfterForm(AjaxRequestTarget target) + protected void onAfterSubmit(AjaxRequestTarget target) { - AjaxButton.this.onSubmitAfterForm(target, AjaxButton.this.getForm()); + AjaxButton.this.onAfterSubmit(target, AjaxButton.this.getForm()); } /** @@ -224,7 +224,7 @@ public abstract class AjaxButton extends Button * @param target * @param form */ - protected void onSubmitAfterForm(AjaxRequestTarget target, Form<?> form) + protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { } http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 7d056d9..6e61692 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 @@ -77,9 +77,9 @@ public abstract class AjaxFallbackButton extends Button } @Override - protected void onSubmitAfterForm(AjaxRequestTarget target) + protected void onAfterSubmit(AjaxRequestTarget target) { - AjaxFallbackButton.this.onSubmitAfterForm(target, AjaxFallbackButton.this.getForm()); + AjaxFallbackButton.this.onAfterSubmit(target, AjaxFallbackButton.this.getForm()); } @Override @@ -140,11 +140,11 @@ public abstract class AjaxFallbackButton extends Button * @see org.apache.wicket.markup.html.form.IFormSubmittingComponent#onSubmit() */ @Override - public final void onSubmitAfterForm() + public final void onAfterSubmit() { if (AjaxRequestTarget.get() == null) { - onSubmitAfterForm(null, getForm()); + onAfterSubmit(null, getForm()); } } @@ -178,7 +178,7 @@ public abstract class AjaxFallbackButton extends Button * ajax target if this linked was invoked using ajax, null otherwise * @param form */ - protected void onSubmitAfterForm(final AjaxRequestTarget target, final Form<?> form) + protected void onAfterSubmit(final AjaxRequestTarget target, final Form<?> form) { } http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 d5348d3..3b105c0 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 @@ -109,9 +109,9 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink } @Override - protected void onSubmitAfterForm(AjaxRequestTarget target) + protected void onAfterSubmit(AjaxRequestTarget target) { - AjaxSubmitLink.this.onSubmitAfterForm(target, getForm()); + AjaxSubmitLink.this.onAfterSubmit(target, getForm()); } }); @@ -121,7 +121,7 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink * 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) + protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { } @@ -176,9 +176,9 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink } /** - * Use {@link #onSubmitAfterForm(AjaxRequestTarget, Form)} instead. + * Use {@link #onAfterSubmit(AjaxRequestTarget, Form)} instead. */ - public final void onSubmitAfterForm() + public final void onAfterSubmit() { } http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSubmitLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSubmitLink.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSubmitLink.java index c25c49f..ce932ed 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSubmitLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSubmitLink.java @@ -28,7 +28,7 @@ import org.apache.wicket.model.IModel; public abstract class AbstractSubmitLink extends AbstractLink implements IFormSubmittingComponent, - IBeforeAndAfterFormSubmitter + IAfterFormSubmitter { /** * http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 0e40c99..a850ff7 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 @@ -52,7 +52,7 @@ public class Button extends FormComponent<String> implements IFormSubmitter, IFormSubmittingComponent, - IBeforeAndAfterFormSubmitter + IAfterFormSubmitter { private static final long serialVersionUID = 1L; @@ -236,7 +236,7 @@ public class Button extends FormComponent<String> * whenever the user clicks this particular button, except if validation fails. This method will * be called <em>after</em> {@link Form#onSubmit()}. */ - public void onSubmitAfterForm() + public void onAfterSubmit() { } } http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 9f91835..d41d4ae 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 @@ -1237,9 +1237,9 @@ public class Form<T> extends WebMarkupContainer implements IFormSubmitListener if (submittingComponent != null) { - if (submittingComponent instanceof IBeforeAndAfterFormSubmitter) + if (submittingComponent instanceof IAfterFormSubmitter) { - ((IBeforeAndAfterFormSubmitter)submittingComponent).onSubmitAfterForm(); + ((IAfterFormSubmitter)submittingComponent).onAfterSubmit(); } } } http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IAfterFormSubmitter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IAfterFormSubmitter.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IAfterFormSubmitter.java new file mode 100644 index 0000000..80b8966 --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IAfterFormSubmitter.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.html.form; + +/** + * Temporary interface to provide new methods for 1.5. Will be removed in 6.0, where these methods + * are in IFormSubmitter. + * + * @author Carl-Eric Menzel + */ +public interface IAfterFormSubmitter extends IFormSubmitter +{ + /** + * 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 onAfterSubmit(); +} http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 deleted file mode 100644 index e19e92d..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IBeforeAndAfterFormSubmitter.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.markup.html.form; - -/** - * Temporary interface to provide new methods for 1.5. Will be removed in 6.0, where these methods - * are in IFormSubmitter. - * - * @author Carl-Eric Menzel - */ -public interface IBeforeAndAfterFormSubmitter extends IFormSubmitter -{ - /** - * 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/f24f117e/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 d93761a..d342dbe 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 @@ -242,7 +242,7 @@ public class SubmitLink extends AbstractSubmitLink * 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. */ - public void onSubmitAfterForm() + public void onAfterSubmit() { } } http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 a3ca4a0..4590451 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 @@ -48,7 +48,7 @@ public class FormSubmitOrderTest extends WicketTestCase } @Override - public void onSubmitAfterForm() + public void onAfterSubmit() { super.onSubmit(); result += "after"; http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 319ae92..f603381 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 @@ -74,7 +74,7 @@ public class HomePage extends WebPage } @Override - public void onSubmitAfterForm() + public void onAfterSubmit() { assertTrue("onsubmit must have been called!", submittedViaLink); submittedViaLinkAfter = true; http://git-wip-us.apache.org/repos/asf/wicket/blob/f24f117e/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 8a53167..04764de 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,7 +36,7 @@ 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.onSubmitAfterForm() has not been called!", + assertTrue("SubmitLink.onAfterSubmit() has not been called!", home.isSubmittedViaLinkAfter()); } @@ -56,7 +56,7 @@ 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.onSubmitAfterForm() has not been called!", + assertTrue("SubmitLink.onAfterSubmit() has not been called!", home.isSubmittedViaLinkAfter()); } @@ -74,7 +74,7 @@ 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.onSubmitAfterForm() has not been called!", + assertTrue("SubmitLink.onAfterSubmit() has not been called!", home.isSubmittedViaLinkAfter()); }