org.apache.wicket
Class AccessStackPageMap

java.lang.Object
  extended by org.apache.wicket.PageMap
      extended by org.apache.wicket.AccessStackPageMap
All Implemented Interfaces:
Serializable, IClusterable, IPageMap

public class AccessStackPageMap
extends PageMap
implements IClusterable

A container for pages held in the session. IPageMap is a parameter to several methods in the Wicket API. You can get a IPageMap by name from a Session with Session.getPageMap(String pageMapName) or more conveniently with PageMap.forName(String pageMapName). But you should not hold onto a reference to the pagemap (just as you should not hold onto a reference to your Session but should get it each time you need it instead). Instead, create a strongly typed accessor method like this:

 public IPageMap getMyPageMap()
 {
        return IPageMap.forName("myPageMapName");
 }
 
If the page map with the given name is not found, one will be automatically created.

Author:
Jonathan Locke
See Also:
Serialized Form

Nested Class Summary
static class AccessStackPageMap.Access
          Holds information about a pagemap access
 
Field Summary
 
Fields inherited from class org.apache.wicket.PageMap
DEFAULT_NAME
 
Constructor Summary
AccessStackPageMap(String name)
          Constructor
 
Method Summary
 void clear()
          Removes all pages from this map
 boolean containsPage(int id, int versionNumber)
          Returns true if the PageMap contains page with given id and versonNumber
 Page get(int id, int versionNumber)
          Retrieves page with given id.
 ArrayListStack<AccessStackPageMap.Access> getAccessStack()
          Returns a stack of PageMap.Access entries pushed in the order that the pages and versions were accessed.
 int getVersions()
           
 IPageMapEntry lastAccessedEntry()
          Gets the most recently accessed page map entry off the top of the entry access stack.
 void put(Page page)
           
 void removeEntry(IPageMapEntry entry)
           
 
Methods inherited from class org.apache.wicket.PageMap
attributeForId, continueToOriginalDestination, dirty, forName, getEntry, getMetaData, getName, getSession, getSizeInBytes, isDefault, nextId, redirectToInterceptPage, redirectToInterceptPage, remove, remove, setMetaData, toString, visitEntries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AccessStackPageMap

public AccessStackPageMap(String name)
Constructor

Parameters:
name - The name of this page map
Method Detail

clear

public void clear()
Removes all pages from this map

Specified by:
clear in interface IPageMap
Overrides:
clear in class PageMap
See Also:
IPageMap.clear()

getAccessStack

public final ArrayListStack<AccessStackPageMap.Access> getAccessStack()
Returns a stack of PageMap.Access entries pushed in the order that the pages and versions were accessed.

Returns:
Stack containing ids of entries in access order.

getVersions

public final int getVersions()
Returns:
Number of page versions stored in this page map

lastAccessedEntry

public final IPageMapEntry lastAccessedEntry()
Gets the most recently accessed page map entry off the top of the entry access stack. This is guaranteed to be the most recently accessed entry IF AND ONLY IF the user just came from a stateful page. If the user could get to the current page from a stateless page, this method may not work if the user uses the back button.

Returns:
Previous pagemap entry in terms of access

removeEntry

public void removeEntry(IPageMapEntry entry)
Specified by:
removeEntry in interface IPageMap
Specified by:
removeEntry in class PageMap
Parameters:
entry - The entry to remove
See Also:
IPageMap.removeEntry(org.apache.wicket.session.pagemap.IPageMapEntry)

get

public Page get(int id,
                int versionNumber)
Retrieves page with given id.

Specified by:
get in interface IPageMap
Specified by:
get in class PageMap
Parameters:
id - The page identifier
versionNumber - The version to get
Returns:
Any page having the given id
See Also:
IPageMap.get(int, int)

put

public void put(Page page)
Specified by:
put in interface IPageMap
Specified by:
put in class PageMap
Parameters:
page - The page to put into this map
See Also:
IPageMap.put(org.apache.wicket.Page)

containsPage

public boolean containsPage(int id,
                            int versionNumber)
Description copied from interface: IPageMap
Returns true if the PageMap contains page with given id and versonNumber

Specified by:
containsPage in interface IPageMap
Returns:
true if the PageMap contains a page with the given id and versionNumber


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.