org.apache.wicket
Class PageMap

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

public abstract class PageMap
extends java.lang.Object
implements IClusterable, IPageMap

Author:
Jonathan Locke, jcompagner
See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_NAME
          Name of default pagemap
 
Constructor Summary
PageMap(java.lang.String name)
          Constructor
 
Method Summary
 java.lang.String attributeForId(int id)
           
 void clear()
          Removes all pages from this map
 boolean continueToOriginalDestination()
          Redirects to any intercept page previously specified by a call to redirectToInterceptPage.
protected  void dirty()
           
static IPageMap forName(java.lang.String pageMapName)
          Gets a page map for a page map name, automatically creating the page map if it does not exist.
abstract  Page get(int id, int versionNumber)
          Retrieves page with given id.
 IPageMapEntry getEntry(int id)
          Retrieves entry with given id.
 java.io.Serializable getMetaData(MetaDataKey key)
          Gets metadata for this PageMap using the given key.
 java.lang.String getName()
           
 Session getSession()
           
 long getSizeInBytes()
           
 boolean isDefault()
           
 int nextId()
           
abstract  void put(Page page)
           
 void redirectToInterceptPage(java.lang.Class pageClazz)
          Redirects browser to an intermediate page such as a sign-in page.
 void redirectToInterceptPage(Page page)
          Redirects browser to an intermediate page such as a sign-in page.
 void remove()
          Removes this PageMap from the Session.
 void remove(Page page)
          Removes the page from the pagemap
abstract  void removeEntry(IPageMapEntry entry)
           
 void setMetaData(MetaDataKey key, java.io.Serializable object)
          Sets the metadata for this PageMap using the given key.
 java.lang.String toString()
           
protected  void visitEntries(org.apache.wicket.PageMap.IVisitor visitor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.wicket.IPageMap
containsPage
 

Field Detail

DEFAULT_NAME

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

Constructor Detail

PageMap

public PageMap(java.lang.String name)
Constructor

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

forName

public static IPageMap 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

attributeForId

public final java.lang.String attributeForId(int id)
Specified by:
attributeForId in interface IPageMap
Parameters:
id - The page id to create an attribute for
Returns:
The session attribute for the given page (for replication of state)
See Also:
IPageMap.attributeForId(int)

clear

public void clear()
Description copied from interface: IPageMap
Removes all pages from this map

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

continueToOriginalDestination

public final boolean continueToOriginalDestination()
Redirects to any intercept page previously specified by a call to redirectToInterceptPage.

Specified by:
continueToOriginalDestination in interface IPageMap
Returns:
True if an original destination was redirected to
See Also:
redirectToInterceptPage(Page)

get

public abstract Page get(int id,
                         int versionNumber)
Description copied from interface: IPageMap
Retrieves page with given id.

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

getEntry

public final IPageMapEntry getEntry(int id)
Description copied from interface: IPageMap
Retrieves entry with given id.

Specified by:
getEntry in interface IPageMap
Parameters:
id - The page identifier
Returns:
Any entry having the given id
See Also:
IPageMap.getEntry(int)

getName

public final java.lang.String getName()
Specified by:
getName in interface IPageMap
Returns:
Returns the name.
See Also:
IPageMap.getName()

getSession

public final Session getSession()
Returns:
Session this page map is in

getSizeInBytes

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

isDefault

public final boolean isDefault()
Specified by:
isDefault in interface IPageMap
Returns:
True if this is the default page map
See Also:
IPageMap.isDefault()

nextId

public final int nextId()
Specified by:
nextId in interface IPageMap
Returns:
The next id for this pagemap
See Also:
IPageMap.nextId()

put

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

redirectToInterceptPage

public final void redirectToInterceptPage(java.lang.Class pageClazz)
Redirects browser to an intermediate page such as a sign-in page. The current request's URL is saved exactly as it was requested for future use by continueToOriginalDestination(); Only use this method when you plan to continue to the current URL at some later time; otherwise just use setResponsePage or, when you are in a constructor, redirectTo.

Specified by:
redirectToInterceptPage in interface IPageMap
Parameters:
pageClazz - The page clazz to temporarily redirect to

redirectToInterceptPage

public final void redirectToInterceptPage(Page page)
Redirects browser to an intermediate page such as a sign-in page. The current request's URL is saved exactly as it was requested for future use by continueToOriginalDestination(); Only use this method when you plan to continue to the current URL at some later time; otherwise just use setResponsePage or, when you are in a constructor, redirectTo.

Specified by:
redirectToInterceptPage in interface IPageMap
Parameters:
page - The page to temporarily redirect to
See Also:
Component.continueToOriginalDestination()

remove

public final void remove()
Description copied from interface: IPageMap
Removes this PageMap from the Session.

Specified by:
remove in interface IPageMap
See Also:
IPageMap.remove()

remove

public final void remove(Page page)
Description copied from interface: IPageMap
Removes the page from the pagemap

Specified by:
remove in interface IPageMap
Parameters:
page - page to be removed from the pagemap
See Also:
IPageMap.remove(org.apache.wicket.Page)

removeEntry

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

toString

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

dirty

protected final void dirty()

visitEntries

protected final void visitEntries(org.apache.wicket.PageMap.IVisitor visitor)
Parameters:
visitor - The visitor to call at each Page in this PageMap.

setMetaData

public final void setMetaData(MetaDataKey key,
                              java.io.Serializable object)
Sets the metadata for this PageMap using the given key. If the metadata object is not of the correct type for the metadata key, an IllegalArgumentException will be thrown. For information on creating MetaDataKeys, see MetaDataKey.

Parameters:
key - The singleton key for the metadata
object - The metadata object
Throws:
java.lang.IllegalArgumentException
See Also:
MetaDataKey

getMetaData

public final java.io.Serializable getMetaData(MetaDataKey key)
Gets metadata for this PageMap using the given key.

Parameters:
key - The key for the data
Returns:
The metadata or null of no metadata was found for the given key
See Also:
MetaDataKey


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