wicket.version
Interface IPageVersionManager

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
UndoPageVersionManager

public interface IPageVersionManager
extends java.io.Serializable

Interface to code that manages versions of a Page. Initially a page has a version number of 0, indicating that it is in its original state. When one or more changes are made to the page, we arrive at version 1.

During a request cycle, just before a change is about to occur, beginVersion() is called, followed by one or more calls to componentAdded(), componentRemoved() or componentModelChanging(). If beginVersion() is called by the framework during a given request cycle, a balancing endVersion() call will occur at the end of the request cycle. However, if no changes occur to a page during a request cycle, none of these methods will be called.

Once version information has been added to a version manager, versions can be retrieved by number using getVersion(int). Since version 0 is the first version of a page, calling getVersion(0) will retrieve that version.

The current version number (the number of the newest available version) of a page can be retrieved by calling getCurrentVersionNumber().

Author:
Jonathan Locke

Method Summary
 void beginVersion()
          Called when changes are immediately impending to the Page being managed.
 void componentAdded(Component component)
          Indicates that the given component was added.
 void componentModelChanging(Component component)
          Indicates that the model for the given component is about to change.
 void componentRemoved(Component component)
          Indicates that the given component was removed.
 void componentStateChanging(Change change)
          Indicates an internal state for the given component is about to change.
 void endVersion()
          Called when changes to the page have ended.
 void expireOldestVersion()
          Expires oldest version
 int getCurrentVersionNumber()
           
 Page getVersion(int versionNumber)
          Retrieves a given Page version.
 int getVersions()
           
 

Method Detail

beginVersion

void beginVersion()
Called when changes are immediately impending to the Page being managed. The changes to the page between the call to this method and the call to endVersion() create a new version of the page.

In requests where a Page is not changed at all, beginVersion will never be called, nor will any of the other methods in this interface.


componentAdded

void componentAdded(Component component)
Indicates that the given component was added.

Parameters:
component - The component that was added.

componentModelChanging

void componentModelChanging(Component component)
Indicates that the model for the given component is about to change.

Parameters:
component - The component whose model is about to change

componentStateChanging

void componentStateChanging(Change change)
Indicates an internal state for the given component is about to change.

Parameters:
change - The change which represents the internal state

componentRemoved

void componentRemoved(Component component)
Indicates that the given component was removed.

Parameters:
component - The component that was removed.

endVersion

void endVersion()
Called when changes to the page have ended.

See Also:
beginVersion()

expireOldestVersion

void expireOldestVersion()
Expires oldest version


getVersion

Page getVersion(int versionNumber)
Retrieves a given Page version.

Parameters:
versionNumber - The version of the page to get
Returns:
The page or null if the version requested is not available

getVersions

int getVersions()
Returns:
The number of versions stored in this version manager

getCurrentVersionNumber

int getCurrentVersionNumber()
Returns:
Returns the current (newest) version number available through this version manager.


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