interface IModelListener { onSet(IModel model) }

class ModelMonitor implements IModel {
 private final IModel delegate;
 private List<IModelListener> listeners;

 // add/remove/notify listener methods go here
 // detach and getObject delegates to this.delegate

 public void setObject(Object o) {
    delegate.setObject(o);
    fireOnSetEvent(); <== notifies listeners
 }

-igor


On 6/26/07, Alex Objelean <[EMAIL PROTECTED]> wrote:


Igor, can you give a more elaborate example? I'm interested in such a
solution with a model that has listeners.

Thank you!


igor.vaynberg wrote:
>
> you can build a model that has listeners and a notify() method when
> setobject() is called. then inside the listener you can do
>
> { if (getRequestCycle().getRequestTarget() instanceof AjaxRequestTarget)
{
> AjaxRequestTarget t=...; t.add(panela); }
>
> -igor
>
>
> On 6/25/07, Thies Edeling <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> Say I have panel A and panel B each basing their output on the same
>> model. When panel B updates the model through an ajax request, is it
>> possible to have panel A refresh automatically without explicitly
adding
>> it to an AjaxRequestTarget ?
>>
>> gr,
>> Thies
>>
>>
>>
>>
>>
-------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>

--
View this message in context:
http://www.nabble.com/Automatic-repaint-of-component--tf3978849.html#a11300877
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to