Search this API

y.io.graphml.graph2d
Class AbstractReadNodePortHandler

java.lang.Object
  extended by y.io.graphml.input.AbstractInputHandler
      extended by y.io.graphml.graph2d.AbstractReadNodePortHandler
All Implemented Interfaces:
InputHandler
Direct Known Subclasses:
NodePortGeometryReader, NodePortGraphicsReader, NodePortUserDataReader

public abstract class AbstractReadNodePortHandler
extends AbstractInputHandler

Abstract input handler for NodePort data attributes in GraphML.

 

Constructor Summary
protected AbstractReadNodePortHandler()
           
 
Method Summary
 boolean acceptKey(org.w3c.dom.Element keyDefinition)
           
 void applyDefault(GraphMLParseContext context)
          This method is invoked when no data tag is defined, and the default value should be applied.
protected abstract  java.lang.String getKey()
          Returns the data type key that identifies the data that is read by this handler.
protected  java.lang.Object parseDataCore(GraphMLParseContext context, org.w3c.dom.Node node)
          Abstract method callback that actually parses the data.
protected abstract  void readPort(NodePort port, org.w3c.dom.Node node, GraphMLParseContext context)
          Deserializes port data for the specified port from the given XML node.
protected  void setValue(GraphMLParseContext context, java.lang.Object key, java.lang.Object data)
          Abstract method callback that actually stores the value with the keys.
 
Methods inherited from class y.io.graphml.input.AbstractInputHandler
getDefaultValue, getPrecedence, getValidScopes, initializeFromKeyDefinition, isDefaultExists, isParseDefaultValue, parseData, setDefaultExists, setDefaultValue, setParseDefaultValue, setPrecedence, setValidScopes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractReadNodePortHandler

protected AbstractReadNodePortHandler()
Method Detail

acceptKey

public boolean acceptKey(org.w3c.dom.Element keyDefinition)

getKey

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

Returns:
the data type key that identifies the data that is read bu this handler.

parseDataCore

protected java.lang.Object parseDataCore(GraphMLParseContext context,
                                         org.w3c.dom.Node node)
                                  throws GraphMLParseException
Description copied from class: AbstractInputHandler
Abstract method callback that actually parses the data.

Specified by:
parseDataCore in class AbstractInputHandler
Parameters:
context - The context.
node - The node that contains the data. This is either the GraphML data element or the default element.
Returns:
The parsed data.
Throws:
GraphMLParseException

setValue

protected void setValue(GraphMLParseContext context,
                        java.lang.Object key,
                        java.lang.Object data)
                 throws GraphMLParseException
Description copied from class: AbstractInputHandler
Abstract method callback that actually stores the value with the keys.

Specified by:
setValue in class AbstractInputHandler
Parameters:
context - The context.
key - The key.
data - The data.
Throws:
GraphMLParseException

applyDefault

public void applyDefault(GraphMLParseContext context)
                  throws GraphMLParseException
Description copied from class: AbstractInputHandler
This method is invoked when no data tag is defined, and the default value should be applied.

This implementation delegates to AbstractInputHandler.setValue(GraphMLParseContext, Object, Object). if AbstractInputHandler.isDefaultExists()

Specified by:
applyDefault in interface InputHandler
Overrides:
applyDefault in class AbstractInputHandler
Parameters:
context - the current parse context.
Throws:
GraphMLParseException

readPort

protected abstract void readPort(NodePort port,
                                 org.w3c.dom.Node node,
                                 GraphMLParseContext context)
                          throws GraphMLParseException
Deserializes port data for the specified port from the given XML node.

Parameters:
port - the port instance whose data has to be deserialized.
node - XML node providing the data to deserialize.
context - miscellaneous context information.
Throws:
GraphMLParseException - if the port data could not be deserialized.

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