|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.graphdrawing.graphml.writer.DirectGraphMLWriter
This class is an output driver class for GraphML.
It uses XmlWriter and GraphElementProvider instances
for the actual low level writing process
| Constructor Summary | |
DirectGraphMLWriter()
Create a new writer instance |
|
| Method Summary | |
void |
addEdgeOutputHandler(OutputHandler handler)
Add an output handler for edge scope |
void |
addGraphElementProvider(GraphElementProvider provider)
Add a new GraphElementProvider instance that is used to access
the elements of the graph. |
void |
addGraphOutputHandler(OutputHandler handler)
Add an output handler for graph scope |
void |
addNamespace(String URI,
String prefix)
|
void |
addNodeOutputHandler(OutputHandler handler)
Add an output handler for node scope |
void |
addOutputHandler(OutputHandler handler,
int scopeType)
Add an output handler for the specified scope |
void |
addSchemaLocation(String URI,
String location)
Add a new schema location that can be optionally written |
void |
addXMLAttributeProvider(XMLAttributesProvider provider)
Add a XMLAttributesProvider instance that will be used to write additional XML attributes to standard GraphML elements |
void |
clearGraphElementProviders()
Clear the list of all GraphElementProviders for this writer |
protected GraphMLWriteContext |
createGraphMLWriteContext()
Create a new write context that stores the current state of the writing process. |
String |
getDtd()
Return the optional DTD SYSID |
String |
getGraphmlCoreNS()
Get the namespace URI where the core GraphML elements live. |
protected String |
getHandlerIds(OutputHandler oh)
Return the list of ids that a handler will handle for the current document |
IdProvider |
getIdProvider()
Return the IdProvider implementation that will be used by this
instance. |
GraphMLWriteErrorHandler |
getWriteErrorHandler()
Get the error handler that is used currently. |
boolean |
isWriteXMLSchemaEnabled()
Return whether the XML schema attribute at the document root should be written. |
void |
setContextLookup(Class c,
Object impl)
Set a key/value pair that shoud be used for the current write context |
void |
setContextProperty(String name,
Object o)
Set special properties for the context. |
void |
setDtd(String sysId)
Set the optional DTD SYSID. |
void |
setGraphElementProvider(GraphElementProvider provider)
Set a new GraphElementProvider instance that is used to access
the elements of the graph.
|
void |
setGraphmlCoreNS(String graphmlCoreNS)
Set the namespace URI where the core GraphML elements live. |
void |
setIdProvider(IdProvider idProvider)
Set the IdProvider implementation that will be used by this
instance. |
void |
setWriteErrorHandler(GraphMLWriteErrorHandler customWriteErrorHandler)
Set a custom error handler |
void |
setWriteXMLSchemaEnabled(boolean writeXMLSchemaEnabled)
Set whether the XML schema attribute at the document root should be written. |
void |
write(XmlWriter coreWriter)
Start the writing process. |
protected void |
writeData(XmlWriter writeOutput,
GraphMLWriteContext context)
This method is called whenever a new write process is started. |
protected void |
writeDataElement(OutputHandler oh,
XmlWriter writeOutput,
GraphMLWriteContext context)
Write a single data element with the given output handler. |
protected void |
writeEdge(GraphElementProvider provider,
Object edge,
XmlWriter writeOutput,
GraphMLWriteContext context)
Writes an edge element. |
protected void |
writeGraphElement(GraphElementProvider provider,
XmlWriter writeOutput,
boolean topLevel,
GraphMLWriteContext context)
Write the <graph> elemenmt that represents the graph that is accessed through the
GraphElementProvider provider. |
protected void |
writeHyperEdge(GraphElementProvider provider,
Object hyperedge,
XmlWriter writeOutput,
GraphMLWriteContext context)
Writes a hyperedge element. |
protected void |
writeKeyDefinition(OutputHandler oh,
XmlWriter writeOutput,
int scope,
GraphMLWriteContext context)
Writes a single key definition for the given OutputHandler. |
protected void |
writeKeyDefinitions(XmlWriter writeOutput,
GraphMLWriteContext context)
Writes all key definitions. |
protected void |
writeNode(GraphElementProvider provider,
Object node,
XmlWriter writeOutput,
GraphMLWriteContext context)
Writes a node element. |
protected void |
writePort(GraphElementProvider provider,
Object port,
XmlWriter writeOutput,
GraphMLWriteContext context)
Writes a port element. |
protected void |
writeRootElement(XmlWriter writeOutput,
GraphMLWriteContext context)
Method that writes the <graphml> element and everything contained to the output stream. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DirectGraphMLWriter()
| Method Detail |
public void setWriteXMLSchemaEnabled(boolean writeXMLSchemaEnabled)
true
writeXMLSchemaEnabled - true if the the XML schema attribute should be written.public boolean isWriteXMLSchemaEnabled()
true
true if the the XML schema attribute should be written.public IdProvider getIdProvider()
IdProvider implementation that will be used by this
instance. If no custom instance has been set, a default implementation that writes in canonical format will be returned.
IdProvider implementation that will be used by this
instancepublic void setIdProvider(IdProvider idProvider)
IdProvider implementation that will be used by this
instance. If no custom instance is been set, a default implementation that writes in canonical format will be used.
idProvider - the IdProvider implementation that will be used by this
instance, or null to use the default implementationpublic String getDtd()
public void setDtd(String sysId)
null (the default), no DTD reference will be written.
sysId - the optional DTD SYSIDpublic void setWriteErrorHandler(GraphMLWriteErrorHandler customWriteErrorHandler)
customWriteErrorHandler - the custom error handler, or null to use a defaultgetWriteErrorHandler()public GraphMLWriteErrorHandler getWriteErrorHandler()
setWriteErrorHandler(GraphMLWriteErrorHandler)
public void addSchemaLocation(String URI,
String location)
URI - namespace for the schemalocation - the schemasetWriteXMLSchemaEnabled(boolean),
isWriteXMLSchemaEnabled()
public void addNamespace(String URI,
String prefix)
public String getGraphmlCoreNS()
"http://graphml.graphdrawing.org/xmlns/graphml"
public void setGraphmlCoreNS(String graphmlCoreNS)
"http://graphml.graphdrawing.org/xmlns/graphml"
graphmlCoreNS - the namespace URI where the core GraphML elements livepublic void setGraphElementProvider(GraphElementProvider provider)
GraphElementProvider instance that is used to access
the elements of the graph.
This is equivalent to calling clearGraphElementProviders() and addGraphElementProvider(GraphElementProvider)
provider - new provider instancepublic void clearGraphElementProviders()
public void addGraphElementProvider(GraphElementProvider provider)
GraphElementProvider instance that is used to access
the elements of the graph. The new provider will be accessed last.
This can be used to write
provider - new provider instanceprotected String getHandlerIds(OutputHandler oh)
oh - the handler
public void addNodeOutputHandler(OutputHandler handler)
handler - the new output handlerpublic void addEdgeOutputHandler(OutputHandler handler)
handler - the new output handlerpublic void addGraphOutputHandler(OutputHandler handler)
handler - the new output handler
public void addOutputHandler(OutputHandler handler,
int scopeType)
handler - the new output handlerscopeType - the scope for the handler, one of GraphMLConstants.SCOPE_ALL,
GraphMLConstants.SCOPE_GRAPHML, GraphMLConstants.SCOPE_EDGE,
GraphMLConstants.SCOPE_NODE, GraphMLConstants.SCOPE_HYPEREDGE,public void addXMLAttributeProvider(XMLAttributesProvider provider)
provider -
public void write(XmlWriter coreWriter)
throws IOException
GraphElementProvider
instances set on this instances with the help of the coreWriter that handles the low level XML
write process.
coreWriter - the low level XMLWriter instance that handles all xml write requests
IOException - if the document could not be written.
protected void writeData(XmlWriter writeOutput,
GraphMLWriteContext context)
throws GraphMLWriteException
writeOutput - the low level XMLWriter instance that handles all xml write requestscontext - the current write context
GraphMLWriteException - if an error occured
protected void writeRootElement(XmlWriter writeOutput,
GraphMLWriteContext context)
throws GraphMLWriteException
writeOutput - the low level XMLWriter instance that handles all xml write requestscontext - the current write context
GraphMLWriteException - if an error occured
protected void writeKeyDefinitions(XmlWriter writeOutput,
GraphMLWriteContext context)
throws GraphMLWriteException
writeKeyDefinition(OutputHandler,XmlWriter,int,GraphMLWriteContext)
writeOutput - the low level XMLWriter instance that handles all xml write requestscontext - the current write context
GraphMLWriteException - if an error occured
protected void writeKeyDefinition(OutputHandler oh,
XmlWriter writeOutput,
int scope,
GraphMLWriteContext context)
throws GraphMLWriteException
oh - the OutputHandler for which the key defintion is writtenwriteOutput - the low level XMLWriter instance that handles all xml write requestsscope - the scope of the attributecontext - the current write context
GraphMLWriteException - if an error occured
protected void writeDataElement(OutputHandler oh,
XmlWriter writeOutput,
GraphMLWriteContext context)
oh
to write the content of the data tag.
oh - the OutputHandler that writes the tagwriteOutput - the low level XMLWriter instance that handles all xml write requestscontext - the current write context
GraphMLWriteException - if an error occured
protected void writeGraphElement(GraphElementProvider provider,
XmlWriter writeOutput,
boolean topLevel,
GraphMLWriteContext context)
<graph> elemenmt that represents the graph that is accessed through the
GraphElementProvider provider.
provider - the GraphElementProvider that represents the current graphwriteOutput - the low level XMLWriter instance that handles all xml write requeststopLevel - true iff this is a toplevel graph element.context - the current write context
GraphMLWriteException - if an error occured
protected void writeEdge(GraphElementProvider provider,
Object edge,
XmlWriter writeOutput,
GraphMLWriteContext context)
edge - the edge object to write.provider - the GraphElementProvider that represents the current graphwriteOutput - the low level XMLWriter instance that handles all xml write requestscontext - the current write context
GraphMLWriteException - if an error occured
protected void writeNode(GraphElementProvider provider,
Object node,
XmlWriter writeOutput,
GraphMLWriteContext context)
node - the node object to write.provider - the GraphElementProvider that represents the current graphwriteOutput - the low level XMLWriter instance that handles all xml write requestscontext - the current write context
GraphMLWriteException - if an error occured
protected void writePort(GraphElementProvider provider,
Object port,
XmlWriter writeOutput,
GraphMLWriteContext context)
port - the port object to write.provider - the GraphElementProvider that represents the current graphwriteOutput - the low level XMLWriter instance that handles all xml write requestscontext - the current write context
GraphMLWriteException - if an error occured
protected void writeHyperEdge(GraphElementProvider provider,
Object hyperedge,
XmlWriter writeOutput,
GraphMLWriteContext context)
hyperedge - the hyperedge object to write.provider - the GraphElementProvider that represents the current graphwriteOutput - the low level XMLWriter instance that handles all xml write requestscontext - the current write context
GraphMLWriteException - if an error occuredprotected GraphMLWriteContext createGraphMLWriteContext()
write(XmlWriter) whenever a new writing process starts,
so each write process has a new associated context
public void setContextLookup(Class c,
Object impl)
c - the class that serves as lookup keyimpl - an object that should provide a suitable implementation of cGraphMLWriteContext.setLookup(Class,Object)
public void setContextProperty(String name,
Object o)
name - o - GraphMLWriteContext.setProperty(String,Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||