wicket
Class PageMap

java.lang.Object
  extended by wicket.PageMap
All Implemented Interfaces:
java.io.Serializable

public final class PageMap
extends java.lang.Object
implements java.io.Serializable

A container for pages held in the session. PageMap is a parameter to several methods in the Wicket API. You can get a PageMap 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 PageMap getMyPageMap()
 {
        return PageMap.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 PageMap.Access
          Holds information about a pagemap access
 
Field Summary
static java.lang.String DEFAULT_NAME
          Name of default pagemap
 
Method Summary
 void clear()
          Removes all pages from this map
static PageMap forName(java.lang.String pageMapName)
          Gets a page map for a page map name, automatically creating the page map if it does not exist.
 ArrayListStack getAccessStack()
          Returns a stack of PageMap.Access entries pushed in the order that the pages and versions were accessed.
 IPageMapEntry getEntry(int id)
          Retrieves entry with given id.
 java.lang.String getName()
           
 Session getSession()
           
 long getSizeInBytes()
           
 int getVersions()
           
 boolean isDefault()
           
 IPageMapEntry lastAccessedEntry()
          Gets the most recently accessed page map entry off the top of the entry access stack.
 void remove()
          Removes this PageMap from the Session.
 void remove(Page page)
          Removes the page from the pagemap
 void removeEntry(IPageMapEntry entry)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NAME

public static final java.lang.String DEFAULT_NAME
Name of default pagemap

Method Detail

forName

public static PageMap forName(java.lang.String pageMapName)
Gets a page map for a page map name, automatically creating the page map if it does not exist. If you do not want the pagemap to be automatically created, you can call Session.pageMapForName(pageMapName, false).

Parameters:
pageMapName - The name of the page map to get
Returns:
The PageMap with the given name from the current session

clear

public final void clear()
Removes all pages from this map


getAccessStack

public final ArrayListStack 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.

getEntry

public final IPageMapEntry getEntry(int id)
Retrieves entry with given id.

Parameters:
id - The page identifier
Returns:
Any entry having the given id

getName

public final java.lang.String getName()
Returns:
Returns the name.

getSession

public final Session getSession()
Returns:
The session that this PageMap is in.

getSizeInBytes

public final long getSizeInBytes()
Returns:
Size of this page map in bytes, including a sum of the sizes of all the pages it contains.

getVersions

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

isDefault

public final boolean isDefault()
Returns:
True if this is the default 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. For a detailed explanation of this issue, see getAccessStack().

Returns:
Previous pagemap entry in terms of access
See Also:
getAccessStack()

remove

public final void remove()
Removes this PageMap from the Session.


remove

public final void remove(Page page)
Removes the page from the pagemap

Parameters:
page - page to be removed from the pagemap

removeEntry

public final void removeEntry(IPageMapEntry entry)
Parameters:
entry - The entry to remove

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2004-2007 Wicket developers. All Rights Reserved.