com.yworks.yfiles.server.graphml.support
Class LabelCompatOutputHandler

java.lang.Object
  extended byy.io.graphml.output.AbstractOutputHandler
      extended bycom.yworks.yfiles.server.graphml.support.DocumentFragmentOutputHandler
          extended bycom.yworks.yfiles.server.graphml.support.LabelCompatOutputHandler
All Implemented Interfaces:
java.util.EventListener, OutputHandler, OutputHandlerProvider

public class LabelCompatOutputHandler
extends com.yworks.yfiles.server.graphml.support.DocumentFragmentOutputHandler

An output handler that tries to commit the label model parameters for all labels in the graph that is being written to the xml fragments that were parsed when the graph was read.


Constructor Summary
LabelCompatOutputHandler(java.lang.Object dataProviderKey, KeyScope scope)
          Creates a new instance that uses the DocumentFragments stored in the data provider with the given key
 
Method Summary
protected  void commitLabelLayout(org.w3c.dom.Node labelElement, EdgeLabelLayout labelLayout, Graph graph, Edge edge)
          Commit the model parameters of the given label element to the corresponding XML fragment.
protected  void commitLabelLayout(org.w3c.dom.Node labelElement, NodeLabelLayout labelLayout, Graph graph, Node node)
          Commit the model parameters of the given label element to the corresponding XML fragment.
protected  void dumpNodes(GraphMLWriteContext context, org.w3c.dom.Node rootNode)
          Write all child nodes of the given root node to the xml writer.
 boolean getCommitLabelLayouts()
          Whether this output handler will call FlexIOTools.copyLabelLayouts(y.layout.LayoutGraph) before the labels are written.
protected  java.lang.Object getDataProviderKey()
           
 WritePrecedence getPrecedence()
          This output handler shall be called before its children.
protected  java.lang.Object getValue(GraphMLWriteContext context, java.lang.Object key)
           
 void setCommitLabelLayouts(boolean commitLabelLayouts)
          Whether this output handler will call FlexIOTools.copyLabelLayouts(y.layout.LayoutGraph) before the labels are written.
protected  void writeValueCore(GraphMLWriteContext context, java.lang.Object data)
           
 
Methods inherited from class y.io.graphml.output.AbstractOutputHandler
addNameToKeyDefinition, addScopeToKeyDefinition, addTypeToKeyDefinition, addUriToKeyDefinition, getDataTagAttributes, getDefaultValue, getKeyDefinitionAttributes, 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

LabelCompatOutputHandler

public LabelCompatOutputHandler(java.lang.Object dataProviderKey,
                                KeyScope scope)
Creates a new instance that uses the DocumentFragments stored in the data provider with the given key

Parameters:
dataProviderKey - The key of the data provider that contains the DocumentFragments that represent the labels of edges or nodes.
Method Detail

getCommitLabelLayouts

public boolean getCommitLabelLayouts()
Whether this output handler will call FlexIOTools.copyLabelLayouts(y.layout.LayoutGraph) before the labels are written.


setCommitLabelLayouts

public void setCommitLabelLayouts(boolean commitLabelLayouts)
Whether this output handler will call FlexIOTools.copyLabelLayouts(y.layout.LayoutGraph) before the labels are written.


writeValueCore

protected void writeValueCore(GraphMLWriteContext context,
                              java.lang.Object data)
                       throws GraphMLWriteException
Throws:
GraphMLWriteException

commitLabelLayout

protected void commitLabelLayout(org.w3c.dom.Node labelElement,
                                 NodeLabelLayout labelLayout,
                                 Graph graph,
                                 Node node)
Commit the model parameters of the given label element to the corresponding XML fragment. This will work only for a DiscreteNodeLabelModel.

Parameters:
labelElement - The current XML element
labelLayout - The label layout that should be committed back to the client.
graph - The graph the node belongs to.
node - The node that the label belongs to.

commitLabelLayout

protected void commitLabelLayout(org.w3c.dom.Node labelElement,
                                 EdgeLabelLayout labelLayout,
                                 Graph graph,
                                 Edge edge)
Commit the model parameters of the given label element to the corresponding XML fragment. This will work only for a SliderEdgeLabelModel, RotatedSliderEdgeLabelModel or FreeEdgeLabelModel.

Parameters:
labelElement - The current XML element
labelLayout - The label layout that should be committed back to the client.
graph - The graph the edge belongs to.
edge - The edge that the label belongs to.

getPrecedence

public WritePrecedence getPrecedence()
This output handler shall be called before its children.

Returns:
WritePrecedence.BEFORE_CHILDREN
See Also:
WritePrecedence

getDataProviderKey

protected java.lang.Object getDataProviderKey()

dumpNodes

protected void dumpNodes(GraphMLWriteContext context,
                         org.w3c.dom.Node rootNode)
Write all child nodes of the given root node to the xml writer.

Parameters:
context - The context.
rootNode - The parent node to be dumped

getValue

protected java.lang.Object getValue(GraphMLWriteContext context,
                                    java.lang.Object key)
                             throws GraphMLWriteException
Throws:
GraphMLWriteException


Copyright © 2000-2013 yWorks GmbH. All rights reserved