Re: Ajax: Updating component outside Panel

2009-10-09 Thread Michael Mosmann
Hi,

> I have Index.java that displays a shopping cart from a custom shopping cart 
> panel (ShoppingCartPanel.java). This custom panel has a remove link for each 
> item, and clicking this removes the item from the list using Ajax. In 
> Index.java I also have a Checkout button that is set to visible when there's 
> items in the shopping cart. I need to refresh this component also using Ajax 
> when I press the remove link in the shopping cart panel, so that it is hidden 
> when the cart is empty. How do I update this component from my custom 
> shopping cart panel? Do I have to make the Checkout button a public variable 
> and refresh it using  target.addComponent(Index.checkout) in 
> ShoppingCartPanel.java, or is there an easier and more elegant way to do this?

.. you can visit each component on the current page and tell (interface)
it, that someone has changed something.. the component can now decide to
redraw itself.

Ignore the text, the code should tell the story:

http://books.google.de/books?id=9esdx8R-fJAC&lpg=PA104&ots=ajkIysVFup&dq=wicket%20AbstractAjaxEvent&pg=PA103#v=onepage&q=wicket%20AbstractAjaxEvent&f=false

mm:)



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



RE: Ajax: Updating component outside Panel

2009-10-06 Thread Magnus Haraldsen Amundsen
Thanks, I'll try that.

I'll be demoing the app for a crowd that is more into beer than cheese, so it's 
an easy trick to get their attention.

-Magnus


-Original Message-
From: jWeekend [mailto:jweekend_for...@cabouge.com]
Sent: Tue 06.10.2009 23:18
To: users@wicket.apache.org
Subject: Re: Ajax: Updating component outside Panel
 

Magnus,

One way, for example. is to pass in a component, or even a list of
components, to the ShoppingCartPanel's constructor and your onClick could
then do the necessary. Since your ShoppingCartPanel knows it going to use
AJAX, its constructor may also choose to setOutputMarkupId(true) on the
passed in components.

BTW, is "Beer" a special kind of Norwegian cheese then?

Regards - Cemal
jWeekend
OO & Java Technologies, Wicket Training and Development 
http://jWeekend.com



Magnus Haraldsen Amundsen wrote:
> 
> Hi,
> 
> I'm following the Cheesr examples in the "Wicket in Action" book and have
> met a problem when ajaxifying it.
> 
> I have Index.java that displays a shopping cart from a custom shopping
> cart panel (ShoppingCartPanel.java). This custom panel has a remove link
> for each item, and clicking this removes the item from the list using
> Ajax. In Index.java I also have a Checkout button that is set to visible
> when there's items in the shopping cart. I need to refresh this component
> also using Ajax when I press the remove link in the shopping cart panel,
> so that it is hidden when the cart is empty. How do I update this
> component from my custom shopping cart panel? Do I have to make the
> Checkout button a public variable and refresh it using 
> target.addComponent(Index.checkout) in ShoppingCartPanel.java, or is there
> an easier and more elegant way to do this?
> 
> Index.java - http://pastebin.com/m76c0eb71
> ShoppingCartPanel.java - http://pastebin.com/m70f20055
> 
> Regards,
> 
> Magnus
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Ajax%3A-Updating-component-outside-Panel-tp25776573p25776733.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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




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

Re: Ajax: Updating component outside Panel

2009-10-06 Thread jWeekend

Magnus,

One way, for example. is to pass in a component, or even a list of
components, to the ShoppingCartPanel's constructor and your onClick could
then do the necessary. Since your ShoppingCartPanel knows it going to use
AJAX, its constructor may also choose to setOutputMarkupId(true) on the
passed in components.

BTW, is "Beer" a special kind of Norwegian cheese then?

Regards - Cemal
jWeekend
OO & Java Technologies, Wicket Training and Development 
http://jWeekend.com



Magnus Haraldsen Amundsen wrote:
> 
> Hi,
> 
> I'm following the Cheesr examples in the "Wicket in Action" book and have
> met a problem when ajaxifying it.
> 
> I have Index.java that displays a shopping cart from a custom shopping
> cart panel (ShoppingCartPanel.java). This custom panel has a remove link
> for each item, and clicking this removes the item from the list using
> Ajax. In Index.java I also have a Checkout button that is set to visible
> when there's items in the shopping cart. I need to refresh this component
> also using Ajax when I press the remove link in the shopping cart panel,
> so that it is hidden when the cart is empty. How do I update this
> component from my custom shopping cart panel? Do I have to make the
> Checkout button a public variable and refresh it using 
> target.addComponent(Index.checkout) in ShoppingCartPanel.java, or is there
> an easier and more elegant way to do this?
> 
> Index.java - http://pastebin.com/m76c0eb71
> ShoppingCartPanel.java - http://pastebin.com/m70f20055
> 
> Regards,
> 
> Magnus
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Ajax%3A-Updating-component-outside-Panel-tp25776573p25776733.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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