Updated Branches: refs/heads/WICKET-5297-ajax-repaint-with-animation e85a8b3cd -> 00cbf54d8
WICKET-5297 Animate ajax DOM manipulation smoothly Add javadoc to Effects helper class Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/00cbf54d Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/00cbf54d Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/00cbf54d Branch: refs/heads/WICKET-5297-ajax-repaint-with-animation Commit: 00cbf54d8b95664d4235ba32bc201757230d8ba5 Parents: e85a8b3 Author: Martin Tzvetanov Grigorov <mgrigo...@apache.org> Authored: Tue Oct 1 12:24:45 2013 +0200 Committer: Martin Tzvetanov Grigorov <mgrigo...@apache.org> Committed: Tue Oct 1 12:24:45 2013 +0200 ---------------------------------------------------------------------- .../org/apache/wicket/ajax/effects/Effects.java | 34 +++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/00cbf54d/wicket-core/src/main/java/org/apache/wicket/ajax/effects/Effects.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/effects/Effects.java b/wicket-core/src/main/java/org/apache/wicket/ajax/effects/Effects.java index 7020332..c40ffad 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/effects/Effects.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/effects/Effects.java @@ -5,27 +5,51 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.time.Duration; +/** + * Helper class to replace component in Ajax responses with JavaScript animation effects.. + */ public class Effects { + /** + * Replaces a component by using 'slideUp' effect to hide the component + * and 'slideDown' to show it. + * + * @param target + * The Ajax request handler + * @param component + * The component to re-render + */ public static void replace(AjaxRequestTarget target, Component component) { replace(target, component, new SlideUp(), new SlideDown()); } - public static void replace(AjaxRequestTarget target, Component component, Effect in, Effect out) + /** + * Replaces a component by using the provided effects to hide and show the component + * + * @param target + * The Ajax request handler + * @param component + * The component to re-render + * @param hide + * The effect that will hide the old component + * @param show + * The effect that will show the new component + */ + public static void replace(AjaxRequestTarget target, Component component, Effect hide, Effect show) { Args.notNull(target, "target"); Args.notNull(component, "component"); - Args.notNull(in, "in"); - Args.notNull(out, "out"); + Args.notNull(hide, "hide"); + Args.notNull(show, "show"); component.add(new DisplayNoneBehavior()); - target.prependJavaScript(in.toJavaScript(component)); + target.prependJavaScript(hide.toJavaScript(component)); target.add(component); - target.appendJavaScript(out.toJavaScript(component)); + target.appendJavaScript(show.toJavaScript(component)); } /*