|
|||||
| SUMMARY: FIELD | CONSTR | METHOD| EVENT | DETAIL: FIELD | CONSTR | METHOD| EVENT | ||||
This class is a wrapper for a server side action.
An instance of this class specifies an action on the server side and the
client side environment in which it gets executed. The run function calls the server
side using an AJAX POST request. If the server side call was successful, the client side is
updated to reflect the changes on the server side.
The constructor creates a new instance from the given parameter object.
Recognized parameters names are the following. All entries are optional except for
the id entry. There are also getters and setters for the parameters.
See the comments for the setters for more information.
id the id of the server side action
url the URL of the ActionServlet (default ./yFilesAction)
graphName the name of the graph for the action
graph the graph for the action
canvas a GraphCanvas to be refreshed
hitTest a HitTest to be updated
hierarchy a HierarchyManager to be updated
selection a selection to be updated
clientContext can be used as a "marker" to identify a particular ServerAction
customParameter is sent to the server side action
preRun a function, which is called in the scope of this ServerAction instance before the request is sent to the server
postRun a function, which is called in the scope of this ServerAction instance after the response arrived from the server
error a function, which is called in the scope this ServerAction instance, if the request resulted in a server side error
| Constructor Summary | |
|---|---|
ServerAction(/*Object*/ kwArgs)
This class is a wrapper for a server side action. |
|
| Method Summary | |
|---|---|
GraphCanvas |
getCanvas()
returns the canvas which is available for this instance. |
anything |
getClientContext()
returns what was set with setClientContext. |
String |
getCustomParameter()
returns the custom parameter. |
String |
getCustomResponse()
returns the custom response from the server side action, if there is one. |
Function |
getErrorHandler()
returns the callback which gets executed when a server error occurred for the request made by run(). |
Graph |
getGraph()
returns the graph which is available for this instance. |
String |
getGraphName()
returns the graph name which is available for this instance. |
HierarchyManager |
getHierarchyManager()
returns the hierarchy manager which is available for this instance. |
HitTest |
getHitTest()
returns the hit test which is available for this instance. |
String |
getId()
returns the id used for server requests. |
Function |
getPostRun()
returns the callback which gets executed last when the request made run() was successful. |
Function |
getPreRun()
returns the callback which gets executed first when run() is called. |
GraphSelection |
getSelection()
returns the selection which is available for this instance. |
String |
getUrl()
returns the URL used for server requests (default "./yFilesAction"). |
|
getWorldBounds()
returns the new world bounds of the graph the action dealt with on the server side. |
|
run()
performs the action specified by this instance. |
|
setCanvas(/*GraphCanvas*/ canvas)
sets the canvas which is available for this instance. |
|
setClientContext(/*anything*/ clientContext)
stores clientContext at this instance. |
|
setCustomParameter(/*String*/ customParameter)
sets the custom parameter. |
|
setErrorHandler(/*Function*/ errorHandler)
sets the callback which gets executed when a server error occurred for the request made by run(). |
|
setGraph(/*Graph*/ graph)
sets the graph which is available for this instance. |
|
setGraphName(/*String*/ name)
sets the symbolic name for the graph to be used on the server side. |
|
setHierarchyManager(/*HierarchyManager*/ hierarchy)
sets the hierarchy manager which is available for this instance. |
|
setHitTest(/*HitTest*/ hitTest)
sets the hit test which is available for this instance. |
|
setId(/*String*/ id)
sets the id used for server requests. |
|
setPostRun(/*Function*/ postRun)
sets the callback which gets executed last when the request made run() was successful. |
|
setPreRun(/*Function*/ preRun)
sets the callback which gets executed first when run() is called. |
|
setSelection(/*GraphSelection*/ selection)
sets the selection which is available for this instance. |
|
setUrl(/*String*/ url)
sets the URL used for server requests. |
| Constructor Detail |
|---|
ServerAction(/*Object*/ kwArgs)
id entry. There are also getters and setters for the parameters.
See the comments for the setters for more information.id the id of the server side actionurl the URL of the ActionServlet (default ./yFilesAction)graphName the name of the graph for the actiongraph the graph for the actioncanvas a GraphCanvas to be refreshedhitTest a HitTest to be updatedhierarchy a HierarchyManager to be updatedselection a selection to be updatedclientContext can be used as a "marker" to identify a particular ServerActioncustomParameter is sent to the server side actionpreRun a function, which is called in the scope of this ServerAction instance before the request is sent to the serverpostRun a function, which is called in the scope of this ServerAction instance after the response arrived from the servererror a function, which is called in the scope this ServerAction instance, if the request resulted in a server side errorkwArgs -
| Method Detail |
|---|
GraphCanvas getCanvas()
anything getClientContext()
String getCustomParameter()
String getCustomResponse()
Function getErrorHandler()
Graph getGraph()
String getGraphName()
HierarchyManager getHierarchyManager()
HitTest getHitTest()
String getId()
Function getPostRun()
Function getPreRun()
GraphSelection getSelection()
String getUrl()
getWorldBounds()
run()
setCanvas(/*GraphCanvas*/ canvas)
canvas -
setClientContext(/*anything*/ clientContext)
clientContext - you want to remember for this instance
setCustomParameter(/*String*/ customParameter)
customParameter -
setErrorHandler(/*Function*/ errorHandler)
errorHandler -
setGraph(/*Graph*/ graph)
graph -
setGraphName(/*String*/ name)
name -
setHierarchyManager(/*HierarchyManager*/ hierarchy)
hierarchy -
setHitTest(/*HitTest*/ hitTest)
hitTest -
setId(/*String*/ id)
id -
setPostRun(/*Function*/ postRun)
postRun -
setPreRun(/*Function*/ preRun)
false, the server request will
be canceled.preRun -
setSelection(/*GraphSelection*/ selection)
selection -
setUrl(/*String*/ url)
url -