You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by peer <be...@hs-karlsruhe.de> on 2010/06/18 15:43:48 UTC

Autoupdate Components of a ParentPage within a Ajax Request

Hi Wickets,

My initial situation:
A ParentPage which contains a TabbedPanel with tabs. On the Parent Page is a
Feedbackpanel which works globally and displays every error message.
The tabs in the TabbedPanel don't know anything about the Feedbackpanel of
the parent and all request on the tab are done by ajax.

Problem:
As fare as I know I always have to add the components to the target to get
them changed by the wicket engine. The problem is I can't add the
Feedbackpanel to the target because the tabs don't know about it.

Approach:
I tried to add a listener to the AjaxRequestTaget, but the target was null
since there was no AjaxRequest.

Question: 
How can I add a Listener to every AjaxRequest done by the ParentPage or any
child of it to update my Feedbackpanel.

Regards,
peer

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Autoupdate-Components-of-a-ParentPage-within-a-Ajax-Request-tp2260223p2260223.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Autoupdate Components of a ParentPage within a Ajax Request

Posted by Martin Grigorov <mc...@e-card.bg>.
On Fri, 2010-06-18 at 07:31 -0700, peer wrote:
> 
> Martin Grigorov wrote:
> > 
> > On Fri, 2010-06-18 at 06:43 -0700, peer wrote:
> >> Hi Wickets,
> >> 
> >> My initial situation:
> >> A ParentPage which contains a TabbedPanel with tabs. On the Parent Page
> >> is
> >> a
> >> Feedbackpanel which works globally and displays every error message.
> >> The tabs in the TabbedPanel don't know anything about the Feedbackpanel
> >> of
> >> the parent and all request on the tab are done by ajax.
> >> 
> >> Problem:
> >> As fare as I know I always have to add the components to the target to
> >> get
> >> them changed by the wicket engine. The problem is I can't add the
> >> Feedbackpanel to the target because the tabs don't know about it.
> >> 
> >> Approach:
> >> I tried to add a listener to the AjaxRequestTaget, but the target was
> >> null
> >> since there was no AjaxRequest.
> >> 
> >> Question: 
> >> How can I add a Listener to every AjaxRequest done by the ParentPage or
> >> any
> >> child of it to update my Feedbackpanel.
> > The most simple solution:
> > target.addChildren(getPage(), FeedbackPanel.class)
> >> 
> >> Regards,
> >> peer
> >> 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> > 
> > 
> > 
> Thank you for your quick answer.
> This solution would be great if would have the ParentPage within my tabs. I
> know that i could iterate over getParent but that doesn't sound like a sweet
> solution.
> 
> The best thing I can imagine right know is that I can tell my ParentPage to
> listen on it's AjaxRequests and also on those of it's children. 
> Is there a way to do it like this?
Check https://issues.apache.org/jira/browse/WICKET-1312
There are some patches for event mechanism.
> 
> regards,
> peer
> 
> 
> Quoted from: 
> http://apache-wicket.1842946.n4.nabble.com/Autoupdate-Components-of-a-ParentPage-within-a-Ajax-Request-tp2260223p2260276.html
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Autoupdate Components of a ParentPage within a Ajax Request

Posted by peer <be...@hs-karlsruhe.de>.

Martin Grigorov wrote:
> 
> On Fri, 2010-06-18 at 06:43 -0700, peer wrote:
>> Hi Wickets,
>> 
>> My initial situation:
>> A ParentPage which contains a TabbedPanel with tabs. On the Parent Page
>> is
>> a
>> Feedbackpanel which works globally and displays every error message.
>> The tabs in the TabbedPanel don't know anything about the Feedbackpanel
>> of
>> the parent and all request on the tab are done by ajax.
>> 
>> Problem:
>> As fare as I know I always have to add the components to the target to
>> get
>> them changed by the wicket engine. The problem is I can't add the
>> Feedbackpanel to the target because the tabs don't know about it.
>> 
>> Approach:
>> I tried to add a listener to the AjaxRequestTaget, but the target was
>> null
>> since there was no AjaxRequest.
>> 
>> Question: 
>> How can I add a Listener to every AjaxRequest done by the ParentPage or
>> any
>> child of it to update my Feedbackpanel.
> The most simple solution:
> target.addChildren(getPage(), FeedbackPanel.class)
>> 
>> Regards,
>> peer
>> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 
Thank you for your quick answer.
This solution would be great if would have the ParentPage within my tabs. I
know that i could iterate over getParent but that doesn't sound like a sweet
solution.

The best thing I can imagine right know is that I can tell my ParentPage to
listen on it's AjaxRequests and also on those of it's children. 
Is there a way to do it like this?

regards,
peer


Quoted from: 
http://apache-wicket.1842946.n4.nabble.com/Autoupdate-Components-of-a-ParentPage-within-a-Ajax-Request-tp2260223p2260276.html

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Autoupdate-Components-of-a-ParentPage-within-a-Ajax-Request-tp2260223p2260290.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Autoupdate Components of a ParentPage within a Ajax Request

Posted by Martin Grigorov <mc...@e-card.bg>.
On Fri, 2010-06-18 at 06:43 -0700, peer wrote:
> Hi Wickets,
> 
> My initial situation:
> A ParentPage which contains a TabbedPanel with tabs. On the Parent Page is a
> Feedbackpanel which works globally and displays every error message.
> The tabs in the TabbedPanel don't know anything about the Feedbackpanel of
> the parent and all request on the tab are done by ajax.
> 
> Problem:
> As fare as I know I always have to add the components to the target to get
> them changed by the wicket engine. The problem is I can't add the
> Feedbackpanel to the target because the tabs don't know about it.
> 
> Approach:
> I tried to add a listener to the AjaxRequestTaget, but the target was null
> since there was no AjaxRequest.
> 
> Question: 
> How can I add a Listener to every AjaxRequest done by the ParentPage or any
> child of it to update my Feedbackpanel.
The most simple solution:
target.addChildren(getPage(), FeedbackPanel.class)
> 
> Regards,
> peer
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Autoupdate Components of a ParentPage within a Ajax Request

Posted by Michael O'Cleirigh <mi...@rivulet.ca>.
On 06/18/2010 09:43 AM, peer wrote:
> Hi Wickets,
>
> My initial situation:
> A ParentPage which contains a TabbedPanel with tabs. On the Parent Page is a
> Feedbackpanel which works globally and displays every error message.
> The tabs in the TabbedPanel don't know anything about the Feedbackpanel of
> the parent and all request on the tab are done by ajax.
>
> Problem:
> As fare as I know I always have to add the components to the target to get
> them changed by the wicket engine. The problem is I can't add the
> Feedbackpanel to the target because the tabs don't know about it.
>
> Approach:
> I tried to add a listener to the AjaxRequestTaget, but the target was null
> since there was no AjaxRequest.
>
> Question:
> How can I add a Listener to every AjaxRequest done by the ParentPage or any
> child of it to update my Feedbackpanel.
>
> Regards,
> peer
>
>    
Hello,

You can either pass the feedback panel through to the tabs so they can 
target.addComponent (feedbackPanel) or create an interface callback like:

public interface IOnAjaxUpdate {

     public void onAjaxUpdate (AjaxRequestTarget target);

}


parent.add (new Tab ("tab1", new IOnAjaxUpdate () {
     public void onAjaxUpdate (AjaxRequestTarget target) {
             target.addComponent (feedbackPanel);
     }
});

Then the tab will do its update over ajax and also call the 
parentCallback.onAjaxUpdate (...) method of the interface to trigger the 
callback logic in the parent component.

I prefer the  interface based approach since the tabs still don't need 
to know about the feedback panel and the feedback panel updates can be 
seen at the same level in the component hierarchy.

Regards,

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org