Hello Timo, Thanks a lot...i have attach the files for sample webapp for events.you can play around with if you have time and forgive me if my codes were ugly :) i just want to test your patch...any feedback after...
Thanks a lot...Cheers http://www.nabble.com/file/p17791744/events_core.zip events_core.zip <br/> http://www.nabble.com/file/p17791744/pages_app.zip pages_app.zip Timo Rantalaiho wrote: > > On Wed, 11 Jun 2008, freak182 wrote: >> I already rip out your patch and run the testcase it worked but how can i >> implement/intgerate to my project...do you have a working example project >> for that? > > Unfortunately not, but just copy the classes to a suitable > package in your project and start using them in the same way > as in the test cases. > > E.g. something along these lines > > public class FooSelectionEvent implements Event { > private final IModel foo; > private final AjaxRequestTarget target; > > public FooSelectionEvent(IModel foo, AjaxRequestTarget target) { > this.foo = foo; > this.target = target; > } > > public Foo getFoo() { > return (Foo) foo.getObject(); > } > > public void addToTarget(Component c) { > target.addComponent(c); > } > } > > public interface FooSelectionReceiver extends EventReceiver { > void onEvent(FooSelectionEvent event); > } > > public class SelectedFooLabel extends Label implements > FooSelectionReceiver { > ... > public void onEvent(FooSelectionEvent event) { > setModelObject(event.getFoo()); > event.addToTarget(this); > } > } > > public class FooPanel extends Panel { > private EventBroadcaster broadcaster = new EventBroadcaster(this); > ... > add(new DropDownChoice("fooSelection", fooSelection, fooList) > .add(new AjaxFormComponentUpdatingBehavior("onchange") { > public void onEvent(AjaxRequestTarget target) { > broadcaster.broadcast(FooSelectionReceiver.class, new > FooSelectionEvent(target, fooSelection)); > } > }); > ... > } > > > Now SelectedFooLabel receives the events sent from the > DropDownChoice, provided that both component instances are on > the same page (you must be careful with repeater items and > other replaced components here). > > Best wishes, > Timo > > -- > Timo Rantalaiho > Reaktor Innovations Oy <URL: http://www.ri.fi/ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/How-to-update-parent-component-from-a-panel--tp17748294p17791744.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
