You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2011/03/13 22:35:11 UTC

Re: svn commit: r1080946 [1/2] - in /wicket/branches/wicket-1.4.x/wicket/src: main/java/org/apache/wicket/ main/java/org/apache/wicket/markup/ main/java/org/apache/wicket/markup/html/internal/ main/java/org/apache/wicket/markup/parser/filter/ main/ja

---
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
(original)
+++
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
Sat Mar 12 16:28:57 2011
@@ -698,7 +698,9 @@ public abstract class WebApplication ext
        */
       public AjaxRequestTarget newAjaxRequestTarget(final Page page)
       {
-               return new AjaxRequestTarget(page);
+               AjaxRequestTarget target = new AjaxRequestTarget(page);
+               target.addListener(new AjaxEnclosureListener());
+               return target;
       }

Maybe this should be left to the user.
Now on each Ajax request this new listener traverses the whole page tree to
look for InlineEnclosure children and auto-add them for Ajax repaint if
their controlling child is added earlier for repaint.

In 1.5 this can be done in InlineEnclosure's ctor with the new listeners
(org.apache.wicket.protocol.http.WebApplication.getAjaxRequestTargetListeners())
but in 1.4 there is no such easy way.

I think users of InlineEnclosure should care to add this listener.
What do you think ?

Re: svn commit: r1080946 [1/2] - in /wicket/branches/wicket-1.4.x/wicket/src: main/java/org/apache/wicket/ main/java/org/apache/wicket/markup/ main/java/org/apache/wicket/markup/html/internal/ main/java/org/apache/wicket/markup/parser/filter/ main/ja

Posted by Igor Vaynberg <ig...@gmail.com>.
i think the traversal is rather cheap and wont be a big deal. eg in
1.5 the same traversal happens for events as youve mentioned. however,
what i think we should have is code that after ajaxrequesttarget is
created adds the framework listeners to it, such as the one below.
otherwise, if someone has already overridden this method and
instantiated their own target instead of calling super will have their
inline enclosures broken.

-igor


On Sun, Mar 13, 2011 at 2:35 PM, Martin Grigorov <mg...@apache.org> wrote:
> ---
> wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
> (original)
> +++
> wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
> Sat Mar 12 16:28:57 2011
> @@ -698,7 +698,9 @@ public abstract class WebApplication ext
>        */
>       public AjaxRequestTarget newAjaxRequestTarget(final Page page)
>       {
> -               return new AjaxRequestTarget(page);
> +               AjaxRequestTarget target = new AjaxRequestTarget(page);
> +               target.addListener(new AjaxEnclosureListener());
> +               return target;
>       }
>
> Maybe this should be left to the user.
> Now on each Ajax request this new listener traverses the whole page tree to
> look for InlineEnclosure children and auto-add them for Ajax repaint if
> their controlling child is added earlier for repaint.
>
> In 1.5 this can be done in InlineEnclosure's ctor with the new listeners
> (org.apache.wicket.protocol.http.WebApplication.getAjaxRequestTargetListeners())
> but in 1.4 there is no such easy way.
>
> I think users of InlineEnclosure should care to add this listener.
> What do you think ?
>