Thanx guys... really good answers/feedback there.

/Kalle



Frank van Lankvelt wrote:
> 
> You could have a look at the "broadcaster" that is discussed in
> https://issues.apache.org/jira/browse/WICKET-1312
> 
> The solution that is proposed there uses a visitor instead of
> registration.  That has the advantage that you don't have to
> _unregister_ at the appropriate time.  Because Wicket does not have
> lifecycle management of components you would have to do this by hand.
> Of course, if your components are never replaced, this is not an issue.
> 
> cheers, Frank
> 
> On Thu, 2008-05-08 at 18:15 -0700, Scott Swank wrote:
>> e.g.
>> 
>> public class AjaxEvent
>> {
>>      private Set<Component> listeners = new HashSet<Component>();
>> 
>>      public void register(Component listener)
>>      {
>>              listeners.add(listener);
>>      }
>> 
>>      public void fire(AjaxRequestTarget request)
>>      {
>>              for (Component listener : listeners)
>>                      request.addComponent(listener);
>>      }
>> }
>> 
>> On Thu, May 8, 2008 at 6:07 PM, Scott Swank <[EMAIL PROTECTED]>
>> wrote:
>> > >  Ajax
>> >  >
>> >  >  3. Now im working with more Ajax. What is a good inter component
>> >  >  communication scheme? Swing has its listeners, but in wicket i tend
>> to call
>> >  >  methods on dependent components from ajax event handlers. Is this a
>> good
>> >  >  approach - (it atleast dont feel so good)?
>> >
>> >  I try to have my components just be a view of their model.  Then it's
>> >  just a matter of setting the model(s) appropriately and refreshing the
>> >  components.
>> >
>> >  Alternately, create a AjaxEvent class that you subclass to represent
>> >  each of the actions in which you're interested.  Put a collection of
>> >  those on your Page.  Then have allow each component to register itself
>> >  as a listener of an event.  Then an ajax call would result in
>> >  SomeAjaxEvent.fire(AjaxTargetRequest) and that would in turn call
>> >  addComponent() for each registered listener component.
>> >
>> >  - Scott
>> >
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
> -- 
> -------------------------------------------------------------
> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 
> San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
> 94952-3329 +1 (707) 773-4646
> -------------------------------------------------------------
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Good-wicket-patterns-tp17139005p17148622.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]

Reply via email to