|
|||||
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.
Constructor Summary | |
---|---|
ServerAction(Object kwArgs)
This class is a wrapper for a server side action. |
Method Summary | |
---|---|
yfiles/client/tiles/widget/GraphCanvas |
getCanvas()
returns the canvas which is available for this instance. |
anyhting |
getClientContext()
returns what was set with setClientContext. |
undefined |
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(). |
yfiles/client/tiles/Graph |
getGraph()
returns the graph which is available for this instance. |
String |
getGraphName()
returns the graph name which is available for this instance. |
yfiles/client/tiles/HierarchyManager |
getHierarchyManager()
returns the hierarchy manager which is available for this instance. |
yfiles/client/tiles/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. |
yfiles/client/tiles/GraphSelection |
getSelection()
returns the selection which is available for this instance. |
String |
getUrl()
returns the URL used for server requests (default "./yFilesAction"). |
Object |
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(yfiles/client/tiles/widget/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(yfiles/client/tiles/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(yfiles/client/tiles/HierarchyManager hierarchy)
sets the hierarchy manager which is available for this instance. |
|
setHitTest(yfiles/client/tiles/HitTest hitTest)
sets the hit test which is available for this instance. |
|
setId(String id)
|
|
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(yfiles/client/tiles/GraphSelection selection)
sets the selection which is available for this instance. |
|
setUrl(String url)
|
Constructor Detail |
---|
ServerAction(Object kwArgs)
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
kwArgs
-
Method Detail |
---|
yfiles/client/tiles/widget/GraphCanvas getCanvas()
returns the canvas which is available for this instance.
If the canvas is available, it gets refreshed whenever run() was successfully called unless the server side action overrides this default behavior.
anyhting getClientContext()
returns what was set with setClientContext.
undefined 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().
yfiles/client/tiles/Graph getGraph()
returns the graph which is available for this instance.
The graph can be set directly using setGraph. A graph is also available, if it has not been set directly, but a canvas or a hierarchy manager has been set. In this case the graph of the canvas or hierarchy manager is available.
String getGraphName()
returns the graph name which is available for this instance.
The graph name can be set directly using setGraphName. If the graph name was not set directly, but a graph or a hit test is available, then the name of that graph or the graph name from the hit test is returned.
yfiles/client/tiles/HierarchyManager getHierarchyManager()
returns the hierarchy manager which is available for this instance.
If the hierarchy manager is available, it gets updated whenever run() was successfully called unless the server side action overrides this default behavior.
yfiles/client/tiles/HitTest getHitTest()
returns the hit test which is available for this instance.
The hit test can be set directly using setHitTest. A hit test is also available, if it has not been set directly, but a canvas has been set. In this case the hit test of the canvas is available. If the hit test is available, it gets updated whenever run() was successfully called unless the server side action overrides this default behavior.
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.
yfiles/client/tiles/GraphSelection getSelection()
returns the selection which is available for this instance.
If a selection is available, its contents is sent to the server when run() is called. If the server action returns successfully and the selection is available, it gets updated with the data sent from the server unless the server side action overrides this default behavior.
String getUrl()
returns the URL used for server requests (default "./yFilesAction").
Object 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(yfiles/client/tiles/widget/GraphCanvas canvas)
sets the canvas which is available for this instance.
canvas
-
setClientContext(anything clientContext)
stores clientContext at this instance.
The client context is not sent to the server. It can be retrieved with getClientContext. Its purpose is to associate extra client side information with a particular ServerAction instance.
clientContext
- anything you want to remember for this instance
setCustomParameter(String customParameter)
sets the custom parameter.
The custom parameter is sent to the server side action.
customParameter
-
setErrorHandler(Function errorHandler)
sets the callback which gets executed when a server error occurred for the request made by run().
errorHandler
-
setGraph(yfiles/client/tiles/Graph graph)
sets the graph which is available for this instance.
graph
-
setGraphName(String name)
sets the symbolic name for the graph to be used on the server side.
name
-
setHierarchyManager(yfiles/client/tiles/HierarchyManager hierarchy)
sets the hierarchy manager which is available for this instance.
hierarchy
-
setHitTest(yfiles/client/tiles/HitTest hitTest)
sets the hit test which is available for this instance.
hitTest
- The hit test instance
setId(String id)
id
-
setPostRun(Function postRun)
sets the callback which gets executed last when the request made run() was successful.
postRun
-
setPreRun(Function preRun)
sets the callback which gets executed first when run() is called.
The given function is called witout arguments and is expected to
return a boolean. If it returns false
, the server request will
be canceled.
preRun
-
setSelection(yfiles/client/tiles/GraphSelection selection)
sets the selection which is available for this instance.
selection
- yfiles/client/tiles/GraphSelection
setUrl(String url)
url
-