Search this API

y.io.graphml.graph2d
Class AbstractWriteNodePortHandler

java.lang.Object
  extended by y.io.graphml.output.AbstractOutputHandler
      extended by y.io.graphml.graph2d.AbstractWriteNodePortHandler
All Implemented Interfaces:
EventListener, OutputHandler, OutputHandlerProvider
Direct Known Subclasses:
NodePortGeometryWriter, NodePortGraphicsWriter, NodePortUserDataWriter

public abstract class AbstractWriteNodePortHandler
extends AbstractOutputHandler

Abstract output handler for NodePort data attributes in GraphML.


Constructor Summary
protected AbstractWriteNodePortHandler()
           
 
Method Summary
protected abstract  String getKey()
          Returns the data type key that identifies the data that is written by this handler.
 Collection getKeyDefinitionAttributes()
          Returns all XML attributes of the key element.
protected  Object getValue(GraphMLWriteContext context, Object key)
          Callback method that obtains the data for the given key.
protected abstract  void writePort(NodePort port, XmlWriter writer, GraphMLWriteContext context)
          Serializes port data to the specified writer.
protected  void writeValueCore(GraphMLWriteContext context, Object data)
          Core write that performs the actual writing of the data.
 
Methods inherited from class y.io.graphml.output.AbstractOutputHandler
addNameToKeyDefinition, addScopeToKeyDefinition, addTypeToKeyDefinition, addUriToKeyDefinition, getDataTagAttributes, getDefaultValue, getPrecedence, getScope, getValidScopes, hasDefaultValueAssigned, isDefaultValue, isValidScope, isWriteKeyDefault, onQueryOutputHandler, setDefaultValue, setDefaultValueAssigned, setPrecedence, setScope, setValidScopes, setWriteKeyDefault, writeKeyDefinitionContent, writeValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractWriteNodePortHandler

protected AbstractWriteNodePortHandler()
Method Detail

getKeyDefinitionAttributes

public Collection getKeyDefinitionAttributes()
Description copied from class: AbstractOutputHandler
Returns all XML attributes of the key element.

Key scope, Key type, name and uri are added by the corresponding addXXXToKeDefinition methods and should be added here.

Specified by:
getKeyDefinitionAttributes in interface OutputHandler
Overrides:
getKeyDefinitionAttributes in class AbstractOutputHandler
Returns:
All attributes of the key element.
See Also:
AbstractOutputHandler.addNameToKeyDefinition(String), AbstractOutputHandler.addScopeToKeyDefinition(y.io.graphml.KeyScope), AbstractOutputHandler.addTypeToKeyDefinition(y.io.graphml.KeyType), AbstractOutputHandler.addUriToKeyDefinition(String)

getKey

protected abstract String getKey()
Returns the data type key that identifies the data that is written by this handler.

Returns:
the data type key that identifies the data that is written by this handler.

getValue

protected Object getValue(GraphMLWriteContext context,
                          Object key)
                   throws GraphMLWriteException
Description copied from class: AbstractOutputHandler
Callback method that obtains the data for the given key.

Specified by:
getValue in class AbstractOutputHandler
Throws:
GraphMLWriteException
Parameters:
context - The context.
key - The key.
Returns:
The data that is associated with the key.

writeValueCore

protected void writeValueCore(GraphMLWriteContext context,
                              Object data)
                       throws GraphMLWriteException
Description copied from class: AbstractOutputHandler
Core write that performs the actual writing of the data.

Specified by:
writeValueCore in class AbstractOutputHandler
Throws:
GraphMLWriteException
Parameters:
context - The context.
data - The data.

writePort

protected abstract void writePort(NodePort port,
                                  XmlWriter writer,
                                  GraphMLWriteContext context)
                           throws GraphMLWriteException
Serializes port data to the specified writer.

Throws:
GraphMLWriteException - if the port data could not be serialized.
Parameters:
port - the port instance whose data has to be serialized.
writer - the writer used for writing the port data.
context - miscellaneous context information.

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.