|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.yworks.yfiles.server.graphml.support.AbstractGraphRoundtripSupport
Common base class for the server-side roundtrip support classes.
| Field Summary | |
static String |
EDGE_2_ID_DPKEY
Key for storing the current edge id EdgeMap in the graph. |
protected List |
mappers
|
static String |
NODE_2_ID_DPKEY
Key for storing the current node id NodeMap in the graph. |
static String |
PARAM_GRAPH
Parameter name of the request parameter that contains graphml sent by the client. |
static String |
RESPONSE_DOCUMENT_TAG
The xml element name that is used as the outermost tag for all non-graphml server responses. |
| Constructor Summary | |
AbstractGraphRoundtripSupport()
|
|
| Method Summary | |
void |
addMapper(Object tag,
String name,
int graphMLType,
int graphMLScope)
Adds integrated support for the roundtripping of data associated with graph elements. |
protected void |
configureRoundtripGraph(LayoutGraph layoutGraph)
Configure the layout graph. |
abstract LayoutGraph |
createRoundtripGraph()
Creates the graph that should be used for roundtripping. |
XmlWriter |
createXmlWriter(OutputStream os)
Create A XMLWriter instance that can be used for sending xml formatted responses to the client. |
protected GraphDecoder |
getGraphDecoder()
Get the decoder that is used to decode the data received from the client. |
abstract boolean |
readGraph(javax.servlet.http.HttpServletRequest request,
Graph graph)
If the request contains the PARAM_GRAPH parameter, the parameter value is used for updating the graph
instance currently stored in the session.
|
abstract void |
readGraph(InputStream is,
Graph graph)
Reads the graph from the given stream using the current handler. |
abstract void |
readGraph(URL url,
Graph graph)
Reads the graph from the given url using the current handler. |
void |
sendError(String message,
javax.servlet.http.HttpServletResponse response)
Send an error to the client. |
void |
sendError(Throwable e,
javax.servlet.ServletOutputStream outputStream)
Send an error to the client. |
abstract void |
sendGraph(Graph graph,
javax.servlet.http.HttpServletResponse response)
Send the current graph to the client in GraphML format using UTF-8 encoding. |
abstract void |
sendGraph(Graph graph,
OutputStream os,
String outputEncoding)
Writes the current graph to the stream in GraphML format using the provided encoding. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected List mappers
public static final String NODE_2_ID_DPKEY
public static final String EDGE_2_ID_DPKEY
public static final String PARAM_GRAPH
public static final String RESPONSE_DOCUMENT_TAG
| Constructor Detail |
public AbstractGraphRoundtripSupport()
| Method Detail |
protected GraphDecoder getGraphDecoder()
public abstract void readGraph(InputStream is,
Graph graph)
throws IOException
is - the stream to use - the encoding should be UTF-8graph - the graph to read the result in.
IOException - if an io exception occured.
public abstract boolean readGraph(javax.servlet.http.HttpServletRequest request,
Graph graph)
throws IOException
PARAM_GRAPH parameter, the parameter value is used for updating the graph
instance currently stored in the session.
To decide whether the value of the PARAM_GRAPH parameter has to be decoded and decompressed,
the "graphEncoding" parameter is used. For example, to indicate base64-encoded, zlib-compressed and URI-encoded
data, the value has to be "base64/deflate/encodeURIComponent".
request - The servlet request
IOException - If parsing goes wrong.
public abstract void readGraph(URL url,
Graph graph)
throws IOException
url - the URL to usegraph - the graph to read the result in.
IOException - if an io exception occured.
public abstract void sendGraph(Graph graph,
javax.servlet.http.HttpServletResponse response)
throws IOException
UTF-8 encoding. This method will close
the response stream.
The response content type is set to "text/xml".
graph - The current graph.response - The response that will be sent to the client.
IOException - If something goes wrong during GraphML export.
public abstract void sendGraph(Graph graph,
OutputStream os,
String outputEncoding)
throws IOException
graph - The current graph.os - The stream to write the graph to.
IOException - If something goes wrong during GraphML export.public abstract LayoutGraph createRoundtripGraph()
public void addMapper(Object tag,
String name,
int graphMLType,
int graphMLScope)
DataMap will be automatically registered using the provided
key on the graph instances created by createRoundtripGraph().
tag - The tag to use for the DataMap that can be queried from the graph's instance
using Graph.getDataProvider(Object) .name - The name to use for the data in the GraphML file.graphMLType - A constant from the AttributeConstants describing the
type of the data.graphMLScope - A constant from the list of scope constants defined in GraphMLConstants.public XmlWriter createXmlWriter(OutputStream os)
os - An output stream to write xml to
public void sendError(Throwable e,
javax.servlet.ServletOutputStream outputStream)
throws IOException
<?xml version="1.0" encoding="UTF-8"?>
<response>
<errors>
<error>
<![CDATA[
error message
]]>
<error>
</errors>
</response>
e - The error.outputStream - the stream to write the error to - this stream will not be closed.
IOException - If writing to the response writer fails.protected void configureRoundtripGraph(LayoutGraph layoutGraph)
The default implementation adds the data providers that are required for
client-server roundtripping and the data providers for any custom mappers
that were added using addMapper(Object, String, int, int).
layoutGraph - the layout graph instance that is used for roundtripping.
public void sendError(String message,
javax.servlet.http.HttpServletResponse response)
throws IOException
<?xml version="1.0" encoding="UTF-8"?>
<response>
<errors>
<error>
<![CDATA[
error message
]]>
<error>
</errors>
</response>
message - The error message.response - The response.
IOException - If writing to the response writer fails.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||