inside the listener you have access to the page. move the creation of inner panels to the onInitialize() method, where you are also guaranteed access to the page object.
problem solved. -igor On Mon, Mar 7, 2011 at 3:33 PM, Robin Shine <[email protected]> wrote: > In the listener method, I had to replace some panels (and those panels in > turn creates other panels). Since getPage() can not be invoked in component > constructors, it will be necessary to pass the page instance retrieved in > listener method as one of component constructor param in order to access page > instance there. > This might not be a common use case. Anyway, thanks for the extensive > infrastructure of Wicket, I can call the onPageAttahched() method by myself > by subclassing PersistentManagementPage. > Regards > Robin > > --- On Tue, 3/8/11, Igor Vaynberg <[email protected]> wrote: > > From: Igor Vaynberg <[email protected]> > Subject: Re: Page.onPageAttached() never gets called in 1.5? > To: [email protected] > Cc: "Robin Shine" <[email protected]> > Date: Tuesday, March 8, 2011, 12:02 AM > > i dont seem to understand the entire usecase here, if you are running > code inside a listener then you can get page via getpage()... > > -igor > > On Mon, Mar 7, 2011 at 12:33 AM, Robin Shine <[email protected]> wrote: >> Hi Igor, >> Thanks for the response. "onConfigure" gets called only when the page has to >> be rendered. Previously "onPageAttached" can serve as a hook point when page >> is loaded from page store even if it is not rendered, for example, when >> invoking listener interface on components contained in the page. Although I >> can override PagePersistentManager to call the hook by myself, but keeping >> this in Wicket 1.5 would be very convenient for some use cases, for example >> to get current page instance in component constructor without passing page >> instance as a constructor param. >> Robin >> --- On Mon, 3/7/11, Igor Vaynberg <[email protected]> wrote: >> >> From: Igor Vaynberg <[email protected]> >> Subject: Re: Page.onPageAttached() never gets called in 1.5? >> To: [email protected] >> Cc: "Robin Shine" <[email protected]> >> Date: Monday, March 7, 2011, 1:27 PM >> >> i think this method should be removed from Page, for code that needs >> access to a page you can use onInitialize() for one-time code and >> onConfigure() for every request. >> >> -igor >> >> On Sun, Mar 6, 2011 at 7:33 PM, Robin Shine <[email protected]> wrote: >>> Hi All, >>> We rely on this method to store the page instance being processed into a >>> thread local so that we can easily get current page even from component >>> constructors. In 1.4 this method is invoked after page is retrieved from >>> session store for example when click an ajax link on the page. However in >>> 1.5 it never gets called. Is this expected behavior or should I go ahead to >>> create a bug? >>> ThanksRobin >> > > --------------------------------------------------------------------- > 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]
