Re: Refreshing page / onBeforeRender() issue
not exactly everytime you click you would do: {contentpanel.replace(newpanel); contentpanel=newpanel; } the last line: contentpanel=newpanel; frees up the reference to the old panel which will be garbage collected -igor On Sun, Apr 12, 2009 at 8:55 PM, quiqueq wrote: > > > How can I be sure that there is only 1 instance of somepanel? If the user > clicks 10 times the link, 10 different panels would be created in memory. > > > igor.vaynberg wrote: >> >> you should only create the panels when the user clicks on the link >> >> add(new link(..) { >> onclick() { >> panel=new somepanel(...); >> ((mypage)getpage()).setcontentpanel(panel); >> } >> } >> >> -igor >> > > -- > View this message in context: > http://www.nabble.com/Refreshing-page---onBeforeRender%28%29-issue-tp23016450p23017567.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Refreshing page / onBeforeRender() issue
How can I be sure that there is only 1 instance of somepanel? If the user clicks 10 times the link, 10 different panels would be created in memory. igor.vaynberg wrote: > > you should only create the panels when the user clicks on the link > > add(new link(..) { > onclick() { >panel=new somepanel(...); >((mypage)getpage()).setcontentpanel(panel); > } > } > > -igor > -- View this message in context: http://www.nabble.com/Refreshing-page---onBeforeRender%28%29-issue-tp23016450p23017567.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Refreshing page / onBeforeRender() issue
you should only create the panels when the user clicks on the link add(new link(..) { onclick() { panel=new somepanel(...); ((mypage)getpage()).setcontentpanel(panel); } } -igor On Sun, Apr 12, 2009 at 5:56 PM, Henrique Boregio wrote: > I have a web page with a simple design where a NavigationPanel > contains a few links which replace the main panel with other panels. > > My problem is that when I initialize this web page, it creates all of > the panels which will eventually replace a main panel (according to > the link in the NavigationPanel that the user has clicked) by calling > their constructors. Since the constructors initialize a bunch of > components and also retrieve data from a database, it takes a "long" > time to render the web page since it is also loading all of the other > panels. > > Since I want to perform a kind of lazy loading (I only load the > components of the panels if the user has clicked on the corresponding > link in the NavigationPanel), I moved the code where I initialize the > components to the onBeforeRender() method instead of the constructor. > It worked fine for the first time I clicked a link but if I re-clicked > it, a wicket error would pop up since I was trying to add new > components that had already been added. > > My solution was something like: > > protected void onBeforeRender() { > super.onBeforeRender(); > > if(!firstTime) { > return; > } > > // create the components used in this panel > ... > firstTime = true > } > > > This way the components are created only if it is the first time I am > loading the panel. > > My question is, is there a better or automatic way of doing this through > wicket? > Thanks. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Refreshing page / onBeforeRender() issue
Thank you for your mail. I am presently on vacation and will return April 14th. If you need urgent assistance, please email supp...@bookingbooster.com. You can also reach our Support via Skype callto://premiersupport Thank you Best regards, Nick Wheeler Booking Booster.com t: +44 (0)1273 573851 e: integrat...@bookingbooster.com a: The Brighton Forum 95 Ditchling Road Brighton BN1 4ST East Sussex United Kingdom Booking Booster is the smarter, easier and more elegant way to update agent websites. Save time, Boost Bookings with: http://www.bookingbooster.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Refreshing page / onBeforeRender() issue
I have a web page with a simple design where a NavigationPanel contains a few links which replace the main panel with other panels. My problem is that when I initialize this web page, it creates all of the panels which will eventually replace a main panel (according to the link in the NavigationPanel that the user has clicked) by calling their constructors. Since the constructors initialize a bunch of components and also retrieve data from a database, it takes a "long" time to render the web page since it is also loading all of the other panels. Since I want to perform a kind of lazy loading (I only load the components of the panels if the user has clicked on the corresponding link in the NavigationPanel), I moved the code where I initialize the components to the onBeforeRender() method instead of the constructor. It worked fine for the first time I clicked a link but if I re-clicked it, a wicket error would pop up since I was trying to add new components that had already been added. My solution was something like: protected void onBeforeRender() { super.onBeforeRender(); if(!firstTime) { return; } // create the components used in this panel ... firstTime = true } This way the components are created only if it is the first time I am loading the panel. My question is, is there a better or automatic way of doing this through wicket? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org