Reloading component on each request.
I have the circumstance where I have a sidebar panel on the left hand side of my site that I want to reflect the current state of the system - regardless of the state of the components in the middle. It will do a data lookup based on an id given to the component in its constructor, and should perform this lookup on each request - in effect it is readonly, and stateless, but does require an id to perform the lookup. I'm confused as to how to do this (and appologise for quite possibly being stupid). From reading the docs - it looks like I could achieve this if I wrapped the adding of the panel in a ListView from the page, but this feels a bit dirty, as I'd like the logic isolated to the panel itself. -- View this message in context: http://www.nabble.com/Reloading-component-on-each-request.-tp15017178p15017178.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]
Re: Reloading component on each request.
you can try using a repeater like a listview, and also make sure you are using detachable models. perhaps if you gave more description of what the component looks like/what it does and a screenshot that could help us help you more. -igor On Jan 22, 2008 3:51 AM, Ned Collyer [EMAIL PROTECTED] wrote: I have the circumstance where I have a sidebar panel on the left hand side of my site that I want to reflect the current state of the system - regardless of the state of the components in the middle. It will do a data lookup based on an id given to the component in its constructor, and should perform this lookup on each request - in effect it is readonly, and stateless, but does require an id to perform the lookup. I'm confused as to how to do this (and appologise for quite possibly being stupid). From reading the docs - it looks like I could achieve this if I wrapped the adding of the panel in a ListView from the page, but this feels a bit dirty, as I'd like the logic isolated to the panel itself. -- View this message in context: http://www.nabble.com/Reloading-component-on-each-request.-tp15017178p15017178.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reloading component on each request.
igor.vaynberg wrote: you can try using a repeater like a listview, and also make sure you are using detachable models. perhaps if you gave more description of what the component looks like/what it does and a screenshot that could help us help you more. -igor Hi Igor, thanks for the reply :) Here is a basic screenshot of what i'm trying to achieve. (i'm not a creative ;) sorry for the colours). The panel on the left should be able to reload all its internal information each request based on a single call to the service layer (ie, not doing a call for each individual item in the list). This will show things like the extra child folders, or any attributes that may have changed (these could be calculated and set from the service call). It is expected that multiple users will be using the same models (ill worry about actual concurrent edits of the data later - i'm not too fussed by it right now). http://www.nabble.com/file/p15031759/component.png The panel in the middle should maintain state. Both use the same base model (a folder), so I'm not sure the detached model stuff is appropriate. There is some text in the attached image which will hopefully shed some light on what I am trying to achieve. Sorry if my example is vague - my domain model and its behaviour.. are pretty sensitive. Rgds Ned -- View this message in context: http://www.nabble.com/Reloading-component-on-each-request.-tp15017178p15031759.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]
Re: Reloading component on each request.
something like this should work public class MyPanel extends Panel { public MyPanel() { } protected void onBeforeRender() { removeAll(); populatePanel(); super.onBeforeRender(); } protected populatePanel() { add(new label(foo)); } } that way the panel will rebuild its components every request. this is the most inefficient way of doing it, you can start optimizing it as you go along by changing the way it works. for example instead of always removeall()+complete rebuild you can only remove some components that truelly cannot be updated, while reusing others that can be updated by utilizing a detachable model. -igor On Jan 22, 2008 3:54 PM, Ned Collyer [EMAIL PROTECTED] wrote: igor.vaynberg wrote: you can try using a repeater like a listview, and also make sure you are using detachable models. perhaps if you gave more description of what the component looks like/what it does and a screenshot that could help us help you more. -igor Hi Igor, thanks for the reply :) Here is a basic screenshot of what i'm trying to achieve. (i'm not a creative ;) sorry for the colours). The panel on the left should be able to reload all its internal information each request based on a single call to the service layer (ie, not doing a call for each individual item in the list). This will show things like the extra child folders, or any attributes that may have changed (these could be calculated and set from the service call). It is expected that multiple users will be using the same models (ill worry about actual concurrent edits of the data later - i'm not too fussed by it right now). http://www.nabble.com/file/p15031759/component.png The panel in the middle should maintain state. Both use the same base model (a folder), so I'm not sure the detached model stuff is appropriate. There is some text in the attached image which will hopefully shed some light on what I am trying to achieve. Sorry if my example is vague - my domain model and its behaviour.. are pretty sensitive. Rgds Ned -- View this message in context: http://www.nabble.com/Reloading-component-on-each-request.-tp15017178p15031759.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reloading component on each request.
Thank you :) I'll give it a try. - pretty busy on other things, but will try it out asap! -- View this message in context: http://www.nabble.com/Reloading-component-on-each-request.-tp15017178p15033866.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]