|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.yworks.yfiles.server.tiles.servlet.BaseServlet
com.yworks.yfiles.server.tiles.servlet.UpdateServlet
public class UpdateServlet
This servlet performs updates on server side graphs. See
handlePostRequest(HttpServletRequest, HttpServletResponse) and
handleGetRequest(HttpServletRequest, HttpServletResponse) for details.
There are several protected methods acting on the graph level which are called for handling requests,
e.g. createNode(Graph2D, double, double, String). These can be customized in a subclass.
| Constructor Summary | |
|---|---|
UpdateServlet()
|
|
| Method Summary | |
|---|---|
protected void |
closeGroup(Graph2D graph,
Node node)
converts the given group node to a folder node. |
protected Edge |
createEdge(Graph2D graph,
Node source,
Node target,
int route)
is called for creating a new edge. |
protected String |
createFolderName(Graph2D graph,
Node groupNode)
is used to provide a an initial name for a newly created folder node. |
protected Node |
createFolderNode(Graph2D graph,
double x,
double y,
String nodeType,
String parentNodeId)
creates a new folder node. |
protected String |
createGroupName(Graph2D graph,
Node groupNode)
is used to provide a an initial name for a newly created group node. |
protected Node |
createGroupNode(Graph2D graph,
double x,
double y,
String nodeType,
String parentNodeId)
creates a new group node. |
protected Node |
createNode(Graph2D graph,
double x,
double y,
String nodeType)
is called for creating a node. |
protected EdgeRealizer |
getDefaultEdgeRealizer()
gets the default realizer used to create new edges. |
protected NodeRealizer |
getDefaultFolderNodeRealizer()
gets the default realizer used to create new folder nodes. |
protected NodeRealizer |
getDefaultGroupNodeRealizer()
gets the default realizer used to create new group nodes. |
protected NodeRealizer |
getDefaultNodeRealizer()
gets the default realizer used to create new nodes. |
protected void |
handleGetRequest(HttpServletRequest request,
HttpServletResponse response)
handles "getRealizers" and "getRealizerImage" requests which do not change a server side graph, but are related to requests changing a server side graph. |
protected void |
handlePostRequest(HttpServletRequest request,
HttpServletResponse response)
handles update requests. |
void |
init(ServletConfig servletConfig)
|
protected void |
moveNodes(Graph2D graph,
NodeList nodeList,
double deltaX,
double deltaY)
moves a set of nodes by the given vector. |
protected void |
moveToSubgraph(Graph2D graph,
Node parentNode,
NodeList subNodes)
moves a set of nodes to the inner graph of the given parent folder or group node. |
protected void |
openFolder(Graph2D graph,
Node node)
converts the given folder node to a group node. |
protected void |
removeEdge(Graph2D graph,
Edge edge)
removes the given edge from the graph. |
protected void |
removeEdgeLabel(Graph2D graph,
EdgeLabel edgeLabel)
removes the given edge label from the graph. |
protected void |
removeNode(Graph2D graph,
Node node)
removes the given node from the graph. |
protected void |
removeNodeLabel(Graph2D graph,
NodeLabel nodeLabel)
removes the given node label from the graph. |
protected void |
setDefaultEdgeRealizer(EdgeRealizer edgeRealizer)
sets the default realizer used to create new edges. |
protected void |
setDefaultFolderNodeRealizer(NodeRealizer nodeRealizer)
sets the default realizer used to create new folder nodes. |
protected void |
setDefaultGroupNodeRealizer(NodeRealizer nodeRealizer)
sets the default realizer used to create new group nodes. |
protected void |
setDefaultNodeRealizer(NodeRealizer nodeRealizer)
sets the default realizer used to create new nodes. |
protected void |
setLabelText(Graph2D graph,
Node node,
String text)
sets the text of the first label of the given node. |
protected void |
setText(Graph2D graph,
NodeLabel nl,
String text)
sets the text of the given node label. |
protected void |
switchToSubgraph(HttpSession session,
String graphName,
Graph2D newGraph,
Graph2D oldGraph)
switches from an old subgraph to a new subgraph in the same hierarchically organized graph (structure). |
protected void |
writeRealizerImage(String nodeType,
HttpServletResponse response)
writes an example image for the requested node type to the given response. |
protected void |
writeRealizers(HttpServletResponse response)
writes a list of available node realizers (node types) to the given response. |
| Methods inherited from class com.yworks.yfiles.server.tiles.servlet.BaseServlet |
|---|
cachedGraphs, cacheGraph, doGet, doPost, getEdgeDescription, getEdgeURL, getForId, getGraph, getGraphBounds, getId, getId, getId, getId, getNodeDescription, getNodeURL, getWriter, hasDescriptions, hasURLs, init, initialize, newGraph, setEdgeDescription, setEdgeURL, setNodeDescription, setNodeURL, uncacheGraph, writeWorldBounds |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UpdateServlet()
| Method Detail |
|---|
public void init(ServletConfig servletConfig)
throws ServletException
init in interface Servletinit in class GenericServletServletExceptionprotected NodeRealizer getDefaultNodeRealizer()
protected void setDefaultNodeRealizer(NodeRealizer nodeRealizer)
nodeRealizer - the default node realizerprotected EdgeRealizer getDefaultEdgeRealizer()
protected void setDefaultEdgeRealizer(EdgeRealizer edgeRealizer)
edgeRealizer - the default edge realizerprotected NodeRealizer getDefaultFolderNodeRealizer()
protected void setDefaultFolderNodeRealizer(NodeRealizer nodeRealizer)
nodeRealizer - the default folder node realizerprotected NodeRealizer getDefaultGroupNodeRealizer()
protected void setDefaultGroupNodeRealizer(NodeRealizer nodeRealizer)
nodeRealizer - the default group node realizer
protected void handlePostRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
createNode(Graph2D, double, double, String).
handlePostRequest in class BaseServletrequest - the requestresponse - the response to write to
ServletException
IOException
protected void moveNodes(Graph2D graph,
NodeList nodeList,
double deltaX,
double deltaY)
graph - the current graphnodeList - the nodes to be moveddeltaX - x-coordinate of movement vector (world units)deltaY - y-coordinate of movement vector (world units)
protected void setText(Graph2D graph,
NodeLabel nl,
String text)
graph - the current graphnl - the node labeltext - the new text for the label
protected void setLabelText(Graph2D graph,
Node node,
String text)
graph - the current graphnode - the nodetext - the new text for the first node label
protected void handleGetRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
handleGetRequest in class BaseServletrequest - the requestresponse - the response to write to
ServletException
IOExceptionwriteRealizers(HttpServletResponse),
writeRealizerImage(String, HttpServletResponse)
protected void writeRealizerImage(String nodeType,
HttpServletResponse response)
throws IOException
nodeType - the type of node (node realizer to be used)response - the response to write to
IOException - if there are problems writing the responsecreateNode(Graph2D, double, double, String),
writeRealizers(HttpServletResponse)
protected void writeRealizers(HttpServletResponse response)
throws IOException
{nodeRealizers:['yellow square','blue square','red circle','blue diamond']}
Subclasses can overwrite this method.
response - output is written to this
IOException - if there are problems writing the responsecreateNode(Graph2D, double, double, String),
writeRealizerImage(String, HttpServletResponse)
protected Node createNode(Graph2D graph,
double x,
double y,
String nodeType)
graph - the graph to add a node tox - the x coordinate of the new node in world coordinatesy - the y coordinate of the new node in world coordinatesnodeType - the type of node to be created (may be null)
writeRealizers(HttpServletResponse),
writeRealizerImage(String, HttpServletResponse)
protected Node createGroupNode(Graph2D graph,
double x,
double y,
String nodeType,
String parentNodeId)
graph - the current subgraphx - x-coordinate of the center of the new group nodey - y-coordinate of the center of the new group nodenodeType - a symbolic name for a type of node to create, if null the default is usedparentNodeId - id of the parent node of the new group node (may be null)
getDefaultGroupNodeRealizer()
protected Node createFolderNode(Graph2D graph,
double x,
double y,
String nodeType,
String parentNodeId)
graph - the current subgraphx - x-coordinate of the center of the new folder nodey - y-coordinate of the center of the new folder nodenodeType - a symbolic name for a type of node to create, if null the default is usedparentNodeId - the id of the parent node for the new folder node (may be null)
getDefaultFolderNodeRealizer()
protected String createGroupName(Graph2D graph,
Node groupNode)
graph - the current subgraphgroupNode - the node to be named
protected String createFolderName(Graph2D graph,
Node groupNode)
graph - the current subgraphgroupNode - the node to be named
protected void openFolder(Graph2D graph,
Node node)
graph - the current subgraph.node - the folder to be opened
protected void closeGroup(Graph2D graph,
Node node)
graph - the current subgraph.node - the group to be closed
protected void switchToSubgraph(HttpSession session,
String graphName,
Graph2D newGraph,
Graph2D oldGraph)
session - the session for the requestgraphName - the symbolic name of the whole hierarchically organized graphnewGraph - the subgraph to switch tooldGraph - the subgraph before serving the request
protected void moveToSubgraph(Graph2D graph,
Node parentNode,
NodeList subNodes)
graph - the current graphparentNode - the new parent for the nodes to be moved, null for the root graphsubNodes - the nodes to be moved
protected Edge createEdge(Graph2D graph,
Node source,
Node target,
int route)
graph - the graph to add an edge tosource - the source node for the edgetarget - the target node for the edgeroute - if this is not equal to zero, the new edge should be routed
protected void removeNode(Graph2D graph,
Node node)
graph - the current graphnode - the node to be removed
protected void removeEdge(Graph2D graph,
Edge edge)
graph - the current graphedge - the edge to be removed
protected void removeNodeLabel(Graph2D graph,
NodeLabel nodeLabel)
graph - the current graphnodeLabel - the node label to be removed
protected void removeEdgeLabel(Graph2D graph,
EdgeLabel edgeLabel)
graph - the current graphedgeLabel - the node label to be removed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||