Re: [Wicket-user] Automatic repaint of component?
On 6/26/07, Timo Rantalaiho [EMAIL PROTECTED] wrote: On Tue, 26 Jun 2007, Igor Vaynberg wrote: interface IModelListener { onSet(IModel model) } class ModelMonitor implements IModel { private final IModel delegate; private ListIModelListener listeners; ... That's an interesting approach. Is it OK to keep references to Component instances like that? We've thought that it would be safer to always get the components dynamically, so that you wouldn't get the danger of stale references. - Timo I dont think there is an issue. You have to check if components are still on page in either case - whether they are there directly or you only keep their path. getpage.get(path); vs component.findparent(page.class) -igor -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - 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
Re: [Wicket-user] Automatic repaint of component?
Timo Rantalaiho wrote: On Tue, 26 Jun 2007, Igor Vaynberg wrote: interface IModelListener { onSet(IModel model) } class ModelMonitor implements IModel { private final IModel delegate; private ListIModelListener listeners; ... That's an interesting approach. Is it OK to keep references to Component instances like that? We've thought that it would be safer to always get the components dynamically, so that you wouldn't get the danger of stale references. I didn't know that. Is it unsafe to keep references to to Panels etc in a class variable of a Page? Why ? 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
Re: [Wicket-user] Automatic repaint of component?
On Wed, 27 Jun 2007, Thies Edeling wrote: I didn't know that. Is it unsafe to keep references to to Panels etc in a class variable of a Page? Why ? As Igor pointed out, there is not necessarily a problem. But if you replace existing components, either explicitly or by putting them in a Repeater that gets refreshed, you might end up with references to replaced components that should be garbage (because they are no longer on the page). - Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - 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
Re: [Wicket-user] Automatic repaint of component?
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
Re: [Wicket-user] Automatic repaint of component?
On Mon, 25 Jun 2007, Thies Edeling wrote: 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 ? If the update is just being done with ajax, I don't understand how the HTML of panel A could be updated without it being added to AjaxRequestTarget, refreshing model or not. Why don't you want to add panel A to the target? Often it is easy enough to find the component in the update, e.g. by using a marker interface and visitChildren / findParent. If you show us some code maybe we can give more specific help. - Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - 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
Re: [Wicket-user] Automatic repaint of component?
Timo Rantalaiho wrote: On Mon, 25 Jun 2007, Thies Edeling wrote: 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 ? If the update is just being done with ajax, I don't understand how the HTML of panel A could be updated without it being added to AjaxRequestTarget, refreshing model or not. Why don't you want to add panel A to the target? Often it is easy enough to find the component in the update, e.g. by using a marker interface and visitChildren / findParent. If you show us some code maybe we can give more specific help. That's what I'm doing now, redirecting the ajax request to the page the panel is embedded in. The page is then responsible for updating/replacing panels where appropiate. However with panels being reused on multiple pages and having multiple panels on a page, which all can generate an ajax event, this starts to feel a little clumsy. I'd rather have Panels monitor the data they're displaying and update accordingly. Listeners as Igor suggested might be a bit cleaner. 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
Re: [Wicket-user] Automatic repaint of component?
interface IModelListener { onSet(IModel model) } class ModelMonitor implements IModel { private final IModel delegate; private ListIModelListener 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
Re: [Wicket-user] Automatic repaint of component?
On Tue, 26 Jun 2007, Igor Vaynberg wrote: interface IModelListener { onSet(IModel model) } class ModelMonitor implements IModel { private final IModel delegate; private ListIModelListener listeners; ... That's an interesting approach. Is it OK to keep references to Component instances like that? We've thought that it would be safer to always get the components dynamically, so that you wouldn't get the danger of stale references. - Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - 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
[Wicket-user] Automatic repaint of component?
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
Re: [Wicket-user] Automatic repaint of component?
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