|
||||||||||
| 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
This servlet performs updates on server side graphs. See
handlePostRequest(HttpServletRequest, HttpServletResponse) and
BaseServlet.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.
The appaerance of created graph elements can be influenced by setting the defaults, e.g.
setDefaultNodeRealizer(NodeRealizer), or by registering custom node realizers
(registerNodeRealizer(String, NodeRealizer)).
| 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. |
static EdgeRealizer |
getDefaultEdgeRealizer()
gets the default realizer used to create new edges. |
static NodeRealizer |
getDefaultFolderNodeRealizer()
gets the default realizer used to create new folder nodes. |
static NodeRealizer |
getDefaultGroupNodeRealizer()
gets the default realizer used to create new group nodes. |
static NodeRealizer |
getDefaultNodeRealizer()
gets the default realizer used to create new nodes. |
static NodeRealizer |
getNodeRealizer(String type)
Returns the node realizer registered for the given symbolic name or null. |
static String[] |
getNodeRealizerTypes()
Returns the symbolic names of all registered node realizers. |
protected void |
handlePostRequest(HttpServletRequest request,
HttpServletResponse response)
handles update requests. |
protected void |
moveNodes(Graph2D graph,
NodeList nodeList,
double deltaX,
double deltaY,
int route)
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. |
static void |
registerNodeRealizer(String type,
NodeRealizer defaultNodeRealizer)
Registers the given node realizers for the given symbolic name. |
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. |
static void |
setDefaultEdgeRealizer(EdgeRealizer edgeRealizer)
sets the default realizer used to create new edges. |
static void |
setDefaultFolderNodeRealizer(NodeRealizer nodeRealizer)
sets the default realizer used to create new folder nodes. |
static void |
setDefaultGroupNodeRealizer(NodeRealizer nodeRealizer)
sets the default realizer used to create new group nodes. |
static 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). |
| Methods inherited from class com.yworks.yfiles.server.tiles.servlet.BaseServlet |
addViewConfigurator, cachedGraphs, cacheGraph, doGet, doPost, getEdgeDescription, getEdgeURL, getForId, getGraph, getGraphBounds, getId, getId, getId, getId, getNodeDescription, getNodeURL, getViewConfigurators, getWriter, handleGetRequest, hasDescriptions, hasURLs, init, initialize, newGraph, removeViewConfigurator, 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, init, 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 static NodeRealizer getDefaultNodeRealizer()
setDefaultNodeRealizer(NodeRealizer)public static void setDefaultNodeRealizer(NodeRealizer nodeRealizer)
nodeRealizer - the default node realizergetDefaultNodeRealizer()public static EdgeRealizer getDefaultEdgeRealizer()
setDefaultEdgeRealizer(EdgeRealizer)public static void setDefaultEdgeRealizer(EdgeRealizer edgeRealizer)
edgeRealizer - the default edge realizergetDefaultEdgeRealizer()public static NodeRealizer getDefaultFolderNodeRealizer()
setDefaultFolderNodeRealizer(NodeRealizer)public static void setDefaultFolderNodeRealizer(NodeRealizer nodeRealizer)
nodeRealizer - the default folder node realizergetDefaultFolderNodeRealizer()public static NodeRealizer getDefaultGroupNodeRealizer()
setDefaultGroupNodeRealizer(NodeRealizer)public static void setDefaultGroupNodeRealizer(NodeRealizer nodeRealizer)
nodeRealizer - the default group node realizergetDefaultGroupNodeRealizer()
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,
int route)
graph - the current graphnodeList - the nodes to be moveddeltaX - x-coordinate of movement vector (world units)deltaY - y-coordinate of movement vector (world units)route - whether to route the affected edges
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 Node createNode(Graph2D graph,
double x,
double y,
String nodeType)
null the default node
realizer is used. Subclasses can overwrite this method.
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)
getDefaultNodeRealizer(),
registerNodeRealizer(String, NodeRealizer),
getNodeRealizerTypes()
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
public static void registerNodeRealizer(String type,
NodeRealizer defaultNodeRealizer)
createNode(Graph2D, double, double, String). No node realizers are registered
initially.
type - a symbolic namedefaultNodeRealizer - a node realizercreateNode(Graph2D, double, double, String),
getNodeRealizer(String),
getNodeRealizerTypes()public static NodeRealizer getNodeRealizer(String type)
null.
type - a symbolic name
nullregisterNodeRealizer(String, NodeRealizer)public static String[] getNodeRealizerTypes()
registerNodeRealizer(String, NodeRealizer)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||