yfiles.client.tiles.UndoManager
Class UndoManager

This class adds support for undo/redo to a graph.

 
Constructor Summary
UndoManager(/*Graph*/ graph)
           This class adds support for undo/redo to a graph.
 
Method Summary
  canUndoRedo(/*Object*/ caller, /*Function*/ success, /*Function*/ failure, /*anything*/ customData)
          queries the server whether an undo or a redo is currently possible.
 Graph getGraph()
          Returns the graph of this undo manager.
  redo(/*anything*/ customData)
          performs a change again which was undone before if possible.
  setGraph(/*Graph*/ graph, /*Object*/ caller, /*Function*/ callback, /*anything*/ customData)
          Changes the graph of this undo manager.
  undo(/*anything*/ customData)
          undoes the last update if possible.
 
Event Summary
  onRedo(/*Object*/ info, /*String*/ name, /*anything*/ customData)
          is called if redoing succeeded.
  onRedoFailed(/*String*/ name, /*anything*/ customData)
          is called if redoing failed.
  onUndo(/*Object*/ info, /*String*/ name, /*anything*/ customData)
          is called if undoing the last change succeeded.
  onUndoFailed(/*String*/ name, /*anything*/ customData)
          is called if undoing the last change failed.
 
Constructor Detail

UndoManager

UndoManager(/*Graph*/ graph)
This class adds support for undo/redo to a graph.
Parameters:
graph - the graph for which undo/redo should be performed
Method Detail

canUndoRedo

canUndoRedo(/*Object*/ caller, /*Function*/ success, /*Function*/ failure, /*anything*/ customData)
queries the server whether an undo or a redo is currently possible.
Since the undo/redo state is fetched from the server this is an asynchronous call. The result is provided by a callback. The callback is called with an object with "canUndo" and "canRedo" fields with boolean values, the graph name and the custom data. There is an optional callback for the failure case. It is called with the graph name and the custom data.
Parameters:
caller - the object for the callback
success - the callback in the success case, which is called with the undo state (Boolean), the name of the graph and the custom data
failure - the callback in the failure case, which is called with the name of the graph and the custom data
customData - is passed to the callback (also in the failure case)

getGraph

Graph getGraph()
Returns the graph of this undo manager.

redo

redo(/*anything*/ customData)
performs a change again which was undone before if possible.
A redo request is sent to the server. This is an asynchronous call. If the request succeeds onRedo() is called, otherwise onRedoFailed().
Parameters:
customData - is passed to the callback (also in the failure case)

setGraph

setGraph(/*Graph*/ graph, /*Object*/ caller, /*Function*/ callback, /*anything*/ customData)
Changes the graph of this undo manager.
The undo support for the current graph (if any) is disabled. Then the graph for this undo manager is changed to the given one. Then the undo/redo support for the new graph (if it is not null) is enabled on the server and finally the callback is called for the new graph with the new undo/redo state, the new graph name and the custom data.
Parameters:
graph - the graph for which undo/redo should be performed
caller - the object for the callback
callback - the callback, which is called with boolean flag indicating whether the request succeeded, the name of the graph and the custom data
customData - is passed to the callback (also in the failure case)

undo

undo(/*anything*/ customData)
undoes the last update if possible.
An undo request is sent to the server. This is an asynchronous call. If the request succeeds onUndo() is called, otherwise onUndoFailed().
Parameters:
customData - is passed to the callback (also in the failure case)
Event Detail

onRedo

onRedo(/*Object*/ info, /*String*/ name, /*anything*/ customData)
is called if redoing succeeded.
Parameters:
info - an object with "canUndo" and "canRedo" fields with boolean values
name - symbolic name of the graph
customData - custom data from the request

onRedoFailed

onRedoFailed(/*String*/ name, /*anything*/ customData)
is called if redoing failed.
Parameters:
name - symbolic name of the graph
customData - custom data from the request

onUndo

onUndo(/*Object*/ info, /*String*/ name, /*anything*/ customData)
is called if undoing the last change succeeded.
Parameters:
info - an object with "canUndo" and "canRedo" fields with boolean values
name - symbolic name of the graph
customData - custom data from the request

onUndoFailed

onUndoFailed(/*String*/ name, /*anything*/ customData)
is called if undoing the last change failed.
Parameters:
name - symbolic name of the graph
customData - custom data from the request

Copyright © 2006-2011 yWorks GmbH. All rights reserved.