If you store the id/version of a page when it is renderd in your session (in
a list/stack object)
then you are doing exactly the same as the AccessStackPageMap would do.

You should only store the id/version not the page itself, because you don't
have to hold on to a reference of it you can always restore any page of the
current session.

So pagex.onRender -> store the id/version in your session: now has an entry
of 1
pagey.onRender -> add the id/version of this one now has an entry of 2
pagez.onRender ->  add the id/version of this one now has an entry of 3

then you want to go back and take the id/version of pagey and restore that
page for rendering.
if you then want to completely do the same thing remove the pagez entry so
that you now have 2 entries again after pagey rendered for the second time

johan


On 6/21/07, Ivo van Dongen <[EMAIL PROTECTED]> wrote:

Hi,

Sorry, but I don't get exactly what to do here. As I understand it you're
advising me to store a separate map of Pages in the Session and then lookup
the previous Page there? Otherwise I wouldn't see how to implement the
YourSession.get().getPage() method as I still can't get to the PageMap's
size to use that to calculate the previous PageEntry's id. I'm probably
totally missing something here :)

Thanks,
Ivo

On 6/20/07, Johan Compagner <[EMAIL PROTECTED]> wrote:
>
> What i would do is a bit different.
>
> You want a stack of the last rendered pages?
>
> if you have a common BasePage then override:
>
>     protected void onBeforeRender()
>
>
> in that method you take your session and add a object that stores the
> page id and the current version number entry.
>
> YourSession.get().addPageEntry(getPageMapName(), getNumericId(),
> getCurrentPageVersion());
>
> then if you want go back:
>
> YourSession.get().getPage(-1)
>
> -1 (is the previous page) -2 skip 2
>
>
> in that method you can get the page then:
>
> return PageMap.forName(pagemapname).get(pageid,versionid)
>
> johan
>
>
>
> On 6/20/07, Ivo van Dongen <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > We're in the middle of upgrading one of our apps from wicket 1.2.6 to
> > 1.3 (finally :)). Sadly, we're running into a small problem which we
> > don't know how to get around.
> > In our 1.2.6 version we had an utility class to set up previous page
> > links based on the PageMap. It went something like this:
> >
> >     public static PreviousPageLink getInstance(String markupId) {
> >         PageMap pageMap = (PageMap) Session.get().getDefaultPageMap();
> >         int size = pageMap.getAccessStack().size();
> >         if(size > 0) {
> >             PageMap.Access access = (PageMap.Access)
> > pageMap.getAccessStack().get(size-1);
> >             Page previousPage = pageMap.getEntry(access.getId
> > ()).getPage();
> >             ...
> >     }
> >
> > But in 1.3 the AccessStack isn't available in PageMap, only in
> > AccessStackPageMap. But the PageMap used in our application is the
> > SecondLevelCachePageMap which doesn't have any means to access the list of
> > PageMapEntries.
> >
> > Any ideas on how to work arround this? We've tried to use the numeric
> > id from the page, but that seems to be zero every time.
> >
> > Thanks in advance,
> > Ivo and Rommert
> >
> > --
> > Ivo van Dongen
> > Func. Internet Integration
> > W http://www.func.nl
> > T +31 20 4230000
> > F +31 20 4223500
> >
> > -------------------------------------------------------------------------
> > 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
>
>


--
Ivo van Dongen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500

-------------------------------------------------------------------------
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