Search this API

y.io.graphml.graph2d
Class NodeLabelDeserializer

java.lang.Object
  extended by y.io.graphml.graph2d.NodeLabelDeserializer
All Implemented Interfaces:
java.util.EventListener, DeserializationHandler

public class NodeLabelDeserializer
extends java.lang.Object
implements DeserializationHandler

Implementation of DeserializationHandler that can read NodeLabel elements.

 

Nested Class Summary
static interface NodeLabelDeserializer.ConfigurationFactory
          Interface for dynamic creation and registration of configurations for NodeLabel.
static class NodeLabelDeserializer.SmartNodeLabelModelDeserializer
          Handles deserialization of SmartNodeLabelModel instances and their model parameters.
 
Constructor Summary
NodeLabelDeserializer()
           
 
Method Summary
protected  NodeLabel createLabel(GraphMLParseContext context, org.w3c.dom.Node root)
          Create a new label instance from the data in root.
 void onHandleDeserialization(DeserializationEvent event)
          Callback method to handle the deserialization of the data contained in event.
protected  void parseIconAttribute(GraphMLParseContext context, org.w3c.dom.Node root, NodeLabel label)
          Parses the attribute that references the label's icon resource.
protected  void parseLabelModel(GraphMLParseContext context, org.w3c.dom.Node root, NodeLabel label)
          Configure the label model of an existing label with the data in root.
protected  void parseNodeLabel(GraphMLParseContext context, org.w3c.dom.Node root, NodeLabel label)
          Configure an existing label with the data in root.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeLabelDeserializer

public NodeLabelDeserializer()
Method Detail

parseNodeLabel

protected void parseNodeLabel(GraphMLParseContext context,
                              org.w3c.dom.Node root,
                              NodeLabel label)
                       throws GraphMLParseException
Configure an existing label with the data in root.

Parameters:
context - The current parse context.
root - The DOM node to parse.
label - The label instance to configure.
Throws:
GraphMLParseException

parseIconAttribute

protected void parseIconAttribute(GraphMLParseContext context,
                                  org.w3c.dom.Node root,
                                  NodeLabel label)
                           throws GraphMLParseException
Parses the attribute that references the label's icon resource.

Parameters:
context - The current parse context.
root - The DOM node to parse.
label - The label instance to configure.
Throws:
GraphMLParseException

parseLabelModel

protected void parseLabelModel(GraphMLParseContext context,
                               org.w3c.dom.Node root,
                               NodeLabel label)
                        throws GraphMLParseException
Configure the label model of an existing label with the data in root.

Parameters:
context - The current parse context.
root - The DOM node to parse that contains the label model data.
label - The label instance to configure.
Throws:
GraphMLParseException

createLabel

protected NodeLabel createLabel(GraphMLParseContext context,
                                org.w3c.dom.Node root)
Create a new label instance from the data in root.

Parameters:
context - The current parse context.
root - The DOM node to parse that contains the label model data.
Returns:
A new NodeLabel instance.

onHandleDeserialization

public void onHandleDeserialization(DeserializationEvent event)
                             throws GraphMLParseException
Description copied from interface: DeserializationHandler
Callback method to handle the deserialization of the data contained in event.

If this callback could deserialize the data in event, it should assign the deserialization result to the event's DeserializationEvent.setResult(Object) property.

Specified by:
onHandleDeserialization in interface DeserializationHandler
Parameters:
event - Event that contains all data that is needed for deserialization.
Throws:
GraphMLParseException

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