I see that it is not such an obvious win here as with fat client but how
about another of my use cases:
* Large page with small parts being updated by Ajax
* Two components sitting long way apart in the tree (context sensitive
button that responds to items in rest of the page)

So having an almost declaritive style "this button is enabled = fn(x)" only
works if I know when to re-render that button. 

I seem to be leaving OO behind by having lots of procedural "when x happens
update a, b and c" rather than a subscribing to events from another
component.

Using some sort of event model seems to me to improve OO -> encapsulation ->
reuse. For large trees of components with only tiny parts that need sending
to the client it also seems more efficient.

btw We are very pleased with our Wicket app as with JS it does nice partial
updates and without JS it chugs along. We only alter the HTML for our modal
window :)




Eelco Hillenius wrote:
> 
>> Has anybody used something like javax.swing.ListModel.addListDataListener
>> or
>> java.util.Observable to setup a nice way for components to respond to
>> changes in other components?
>>
>> My use case is that I have a "basket" of items a user has selected. While
>> they are searching/browsing if an item already in the basket appears
>> again I
>> want it to be disabled/greyed out. With hand coding that is a bit ugly
>> and
>> seems like a candidate for some sort listening to changes in another
>> component.
> 
> This is where Wicket really works different from a desktop framework
> like Swing though. In swing you would generally push changes to
> observers. In Wicket, you have the request/ response cycle. 'Pulling'
> works better for Wicket, which typically means that you should make
> sure you update relevant state during requests (e.g. via models) so
> that other components use the updated state. So here, you wouldn't
> call setEnabled on the basket via some observer, but rather you would
> do something like override isEnabled and query the relevant state.
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Inter-component-events--tf4508127.html#a12875360
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