wicket.version.undo
Class UndoPageVersionManager

java.lang.Object
  extended bywicket.version.undo.UndoPageVersionManager
All Implemented Interfaces:
IPageVersionManager, java.io.Serializable

public class UndoPageVersionManager
extends java.lang.Object
implements IPageVersionManager

A version manager implemented by recording component changes as undo records which can later be reversed to get back to a given version of the page being managed.

Author:
Jonathan Locke
See Also:
Serialized Form

Constructor Summary
UndoPageVersionManager(Page page, int maxVersions)
          Constructor
 
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.
 int getCurrentVersionNumber()
           
 Page getVersion(int versionNumber)
          Retrieves a given Page version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UndoPageVersionManager

public UndoPageVersionManager(Page page,
                              int maxVersions)
Constructor

Parameters:
page - The page that we're tracking changes to
maxVersions - The maximum number of versions to maintain before expiring the old versions
Method Detail

beginVersion

public void beginVersion()
Description copied from interface: IPageVersionManager
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.

Specified by:
beginVersion in interface IPageVersionManager
See Also:
IPageVersionManager.beginVersion()

componentAdded

public void componentAdded(Component component)
Description copied from interface: IPageVersionManager
Indicates that the given component was added.

Specified by:
componentAdded in interface IPageVersionManager
Parameters:
component - The component that was added.
See Also:
IPageVersionManager.componentAdded(wicket.Component)

componentModelChanging

public void componentModelChanging(Component component)
Description copied from interface: IPageVersionManager
Indicates that the model for the given component is about to change.

Specified by:
componentModelChanging in interface IPageVersionManager
Parameters:
component - The component whose model is about to change
See Also:
IPageVersionManager.componentModelChanging(wicket.Component)

componentStateChanging

public void componentStateChanging(Change change)
Description copied from interface: IPageVersionManager
Indicates an internal state for the given component is about to change.

Specified by:
componentStateChanging in interface IPageVersionManager
Parameters:
change - The change which represents the internal state
See Also:
IPageVersionManager.componentStateChanging(wicket.version.undo.Change)

componentRemoved

public void componentRemoved(Component component)
Description copied from interface: IPageVersionManager
Indicates that the given component was removed.

Specified by:
componentRemoved in interface IPageVersionManager
Parameters:
component - The component that was removed.
See Also:
IPageVersionManager.componentRemoved(wicket.Component)

endVersion

public void endVersion()
Description copied from interface: IPageVersionManager
Called when changes to the page have ended.

Specified by:
endVersion in interface IPageVersionManager
See Also:
IPageVersionManager.endVersion()

getCurrentVersionNumber

public int getCurrentVersionNumber()
Specified by:
getCurrentVersionNumber in interface IPageVersionManager
Returns:
Returns the current (newest) version number available through this version manager.
See Also:
IPageVersionManager.getCurrentVersionNumber()

getVersion

public Page getVersion(int versionNumber)
Description copied from interface: IPageVersionManager
Retrieves a given Page version.

Specified by:
getVersion in interface IPageVersionManager
Parameters:
versionNumber - The version of the page to get
Returns:
The page or null if the version requested is not available
See Also:
IPageVersionManager.getVersion(int)


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