Search this API

y.io.graphml.graph2d
Class EdgeLabelSerializer

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

public class EdgeLabelSerializer
extends java.lang.Object
implements SerializationHandler

Implementation of SerializationHandler that can write EdgeLabel elements.

 

Nested Class Summary
static class EdgeLabelSerializer.PreferredPlacementDescriptorSerializer
          Handles serialization of PreferredPlacementDescriptor instances.
static class EdgeLabelSerializer.RotatedDiscreteEdgeLabelModelSerializer
          Handles serialization of RotatedDiscreteEdgeLabelModel instances and their model parameters.
static class EdgeLabelSerializer.RotatedSliderEdgeLabelModelSerializer
          Handles serialization of RotatedSliderEdgeLabelModel instances and their model parameters.
static class EdgeLabelSerializer.SmartEdgeLabelModelSerializer
          Handles serialization of SmartEdgeLabelModel instances and their model parameters.
 
Constructor Summary
EdgeLabelSerializer()
           
 
Method Summary
protected  java.lang.String getModelName(EdgeLabel label, GraphMLWriteContext context)
          Gets the symbolic name of a label model for the modelName attribute of the EdgeLabel element.
protected  java.lang.String getModelPosition(EdgeLabel label, GraphMLWriteContext context)
          Gets the symbolic name of a label model for the modelPosition attribute of the EdgeLabel element.
protected  java.lang.Object getPreferredPlacement(EdgeLabel label, GraphMLWriteContext context)
          Gets the symbolic name of a label model for the preferredPlacement attribute of the EdgeLabel element.
 void onHandleSerialization(SerializationEvent event)
          Callback method to handle the serialization of the data contained in event.
protected  void serializeContent(EdgeLabel label, XmlWriter writer, GraphMLWriteContext context)
          Write the content of an EdgeLabel element.
protected  void writeCustomModelElements(EdgeLabel label, XmlWriter writer, GraphMLWriteContext context)
          Write the representation of a custom label model.
protected  void writeIconAttribute(EdgeLabel label, XmlWriter writer, GraphMLWriteContext context)
          Writes the attribute that references the label's icon resource.
protected  void writePreferredPlacementDescriptor(EdgeLabel label, XmlWriter writer, GraphMLWriteContext context)
          Write the representation of a PreferredPlacementDescriptor instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EdgeLabelSerializer

public EdgeLabelSerializer()
Method Detail

onHandleSerialization

public void onHandleSerialization(SerializationEvent event)
                           throws GraphMLWriteException
Description copied from interface: SerializationHandler
Callback method to handle the serialization of the data contained in event.

If this callback could serialize the data in event, it should set the SerializationEvent.setHandled(boolean) property to true to prevent further serialization code from processing this data.

Specified by:
onHandleSerialization in interface SerializationHandler
Parameters:
event - Event that contains all data that is needed for serialization.
Throws:
GraphMLWriteException

serializeContent

protected void serializeContent(EdgeLabel label,
                                XmlWriter writer,
                                GraphMLWriteContext context)
                         throws GraphMLWriteException
Write the content of an EdgeLabel element.

Parameters:
context - The current write context.
writer - The writer to use.
label - The label to write.
Throws:
GraphMLWriteException

writeIconAttribute

protected void writeIconAttribute(EdgeLabel label,
                                  XmlWriter writer,
                                  GraphMLWriteContext context)
                           throws GraphMLWriteException
Writes the attribute that references the label's icon resource.

Parameters:
context - The current write context.
writer - The writer to use.
label - The label to write.
Throws:
GraphMLWriteException

writeCustomModelElements

protected void writeCustomModelElements(EdgeLabel label,
                                        XmlWriter writer,
                                        GraphMLWriteContext context)
                                 throws GraphMLWriteException
Write the representation of a custom label model.

Parameters:
context - The current write context.
writer - The writer to use.
label - The label to write.
Throws:
GraphMLWriteException

writePreferredPlacementDescriptor

protected void writePreferredPlacementDescriptor(EdgeLabel label,
                                                 XmlWriter writer,
                                                 GraphMLWriteContext context)
                                          throws GraphMLWriteException
Write the representation of a PreferredPlacementDescriptor instance.

Parameters:
label - The label to write.
writer - The writer to use.
context - The current write context.
Throws:
GraphMLWriteException

getPreferredPlacement

protected java.lang.Object getPreferredPlacement(EdgeLabel label,
                                                 GraphMLWriteContext context)
Gets the symbolic name of a label model for the preferredPlacement attribute of the EdgeLabel element.

Parameters:
label - The label whose model is written.
context - The current write context.
Returns:
The symbolic name of the label model.

getModelName

protected java.lang.String getModelName(EdgeLabel label,
                                        GraphMLWriteContext context)
Gets the symbolic name of a label model for the modelName attribute of the EdgeLabel element.

Parameters:
label - The label whose model is written.
context - The current write context.
Returns:
The symbolic name of the label model.

getModelPosition

protected java.lang.String getModelPosition(EdgeLabel label,
                                            GraphMLWriteContext context)
Gets the symbolic name of a label model for the modelPosition attribute of the EdgeLabel element.

Parameters:
label - The label whose model is written.
context - The current write context.
Returns:
The symbolic name of the label model.

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