Re: Link to last version of a page of a given type/class.

2008-01-21 Thread Johan Compagner
Just remember  in a simple valuesholder class the page id and pagmap
for a page (and version if you want that) and then ask through the
session for that page. If many pages (or big pages) are created in
between, it could return nothing.. Depending on the size of the
diskpage session/pagmap file.

On 1/21/08, Ned Collyer [EMAIL PROTECTED] wrote:

 Hi,

 I may be overlooking something, however I am having a bit of trouble linking
 to the last current version of a page unless I use the method outlined by
 igor, which isn't practical for what I am trying to achieve (see his method
 below from
 http://www.nabble.com/pageMap-question---td13541168.html#a13554232)


 igor.vaynberg wrote:
 
  for scenarios like those simply pass the page instance to another page
 
  class secondsteppage extends webpage {
public secondsteppage(page first) {
  add(new link(go-back) { onclick() { setresponsepage(first); }});
}
  }
 
  -igor
 

 For example, say I have a page of search criteria (the form is in a reusable
 panel), and its filled and i navigate around a bit.  The next time I come to
 the search criteria page, I want it to remember the last search (ie, return
 the last version of the search criteria page).

 I have been able to do this in a rudimentary way by passing the page
 instance of the search criteria page through to the constructor of the
 destination page via a forms onSubmit().

 This means I can then call the
 setResponsePage(searchPage.getVersion(Page.LATEST_VERSION)); on the onClick
 of a link in the destination page.

 However this will only work from the destination page - not if i navigate
 around to other pages.  Without specifying a version  a new instance is
 being created.

  (ie PageLink(SearchPage.class) creates a new SearchPage instance).

 Surely there is a way of retrieving the latest existing version of a page
 given a class type.  I've trawled google and the examples and api - I'm
 feeling stupid - like i've missed something obvious, or inadvertently broken
 the expected behaviour.
 --
 View this message in context:
 http://www.nabble.com/Link-to-last-version-of-a-page-of-a-given-type-class.-tp14994042p14994042.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: Link to last version of a page of a given type/class.

2008-01-21 Thread Ned Collyer

Hi Johan,

Thank you for the reply.

This suggestion will work, but it seems like something that the framework
should do automatically.  The whole maintaining state thing is meant to
maintain state between requests without the extra dev overhead of manually
plugging stuff into, and pulling out of the session.  I'm happy to get a new
instance of the page if its been cleansed from the session - thats not a
problem, but I was under the impression that wicket should already be
maintaining this state - I just need a link generated.

I find it a bit bizarre that methods like Page.getVersion(int num) exist,
but because its not static.. i need an instance of the page to retrieve a
previously versioned instances of the page. (rather than
Page.getVersion(Class clazz, int version)).

Does wicket not support linking to the last version of a given class type? 
If not, I would find this quite useful.

Something like

new PageLink(search-criteria-link, SearchCriteriaPage.class,
Page.LATEST_VERSION)

Would be exactly what I'm after.  (I'm still optimistic that this feature
exists and its me being stupid not able to find it. ;))


Rgds

Ned


Johan Compagner wrote:
 
 Just remember  in a simple valuesholder class the page id and pagmap
 for a page (and version if you want that) and then ask through the
 session for that page. If many pages (or big pages) are created in
 between, it could return nothing.. Depending on the size of the
 diskpage session/pagmap file.
 

-- 
View this message in context: 
http://www.nabble.com/Link-to-last-version-of-a-page-of-a-given-type-class.-tp14994042p14994505.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: Link to last version of a page of a given type/class.

2008-01-21 Thread Johan Compagner
Wicket does maintain state, but what you want is something different
and currently not supported. We dont have 'static' pages for a
specific page class. You are in full control.

About pag.getversion those methods shouldnt be used by users of wicket
at all. If you want something like this because you dont want to keep
references to the pages itself use session.getPage method

On 1/21/08, Ned Collyer [EMAIL PROTECTED] wrote:

 Hi Johan,

 Thank you for the reply.

 This suggestion will work, but it seems like something that the framework
 should do automatically.  The whole maintaining state thing is meant to
 maintain state between requests without the extra dev overhead of manually
 plugging stuff into, and pulling out of, the session.  I'm happy to get a
 new instance of the page if its been cleansed from the session - thats not a
 problem, but I was under the impression that wicket should already be
 maintaining this state - I just need a link generated.

 I find it a bit bizarre that methods like Page.getVersion(int num) exist,
 but because its not static.. i need an instance of the page to retrieve a
 previously versioned instances of the page. (rather than
 Page.getVersion(Class clazz, int version)).

 Does wicket not support linking to the last version of a given class type?
 If not, I would find this quite useful.

 Something like

 new PageLink(search-criteria-link, SearchCriteriaPage.class,
 Page.LATEST_VERSION)

 Would be exactly what I'm after.  (I'm still optimistic that this feature
 exists and its me being stupid not able to find it. ;))


 Rgds

 Ned


 Johan Compagner wrote:
 
  Just remember  in a simple valuesholder class the page id and pagmap
  for a page (and version if you want that) and then ask through the
  session for that page. If many pages (or big pages) are created in
  between, it could return nothing.. Depending on the size of the
  diskpage session/pagmap file.
 

 --
 View this message in context:
 http://www.nabble.com/Link-to-last-version-of-a-page-of-a-given-type-class.-tp14994042p14994505.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]



-- 
Sent from Gmail for mobile | mobile.google.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]