|
|||||
SUMMARY: FIELD | CONSTR | METHOD| EVENT | DETAIL: FIELD | CONSTR | METHOD| EVENT |
This class adds support for undo/redo to a graph.
Constructor Summary | |
---|---|
UndoManager(yfiles/client/tiles/Graph graph)
This class adds support for undo/redo to a graph. |
Method Summary | |
---|---|
Boolean |
canUndoRedo(Object caller, Function success, Function failure, anything customData)
queries the server whether an undo or a redo is currently possible. |
undefined |
getGraph()
Returns the graph of this undo manager. |
|
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. |
|
redo(anything customData)
performs a change again which was undone before if possible. |
|
setGraph(yfiles/client/tiles/Graph graph, Object caller, Function callback, anything customData)
Changes the graph of this undo manager. |
|
undo(anything customData)
undoes the last update if possible. |
Constructor Detail |
---|
UndoManager(yfiles/client/tiles/Graph graph)
This class adds support for undo/redo to a graph.
graph
- the graph for which undo/redo should be performed
Method Detail |
---|
Boolean 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.
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)
undefined getGraph()
Returns the graph of this undo manager.
onRedo(Object info, String name, anything customData)
is called if redoing succeeded.
info
- an object with "canUndo" and "canRedo" fields with boolean values
name
- symbolic name of the graph
customData
- custom data from the request
onRedoFailed(String name, anything customData)
is called if redoing failed.
name
- symbolic name of the graph
customData
- custom data from the request
onUndo(Object info, String name, anything customData)
is called if undoing the last change succeeded.
info
- an object with "canUndo" and "canRedo" fields with boolean values
name
- symbolic name of the graph
customData
- custom data from the request
onUndoFailed(String name, anything customData)
is called if undoing the last change failed.
name
- symbolic name of the graph
customData
- custom data from the request
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().
customData
- is passed to the callback (also in the failure case)
setGraph(yfiles/client/tiles/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.
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(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().
customData
- is passed to the callback (also in the failure case)