GraphML Compatibility Modes

Since yFiles FLEX was designed for interoperability with a server running either yFiles for Java or yFiles.NET, reading and writing the extended yFiles Java GraphML format is supported to a certain extent by yFiles FLEX in addition to the native yFiles FLEX/.NET GraphML extension. yFiles for Java reads and writes so-called realizers that are responsible for the visual representation of graph items, similar to the notion of styles in yFiles FLEX. Please see Chapter 6, Using yFiles FLEX with a yFiles Server for details on when to use the different GraphML extensions.

Note that if a RoundtripHandler is used, the native yFiles FLEX and yFiles.NET format will be read and written correctly per default. No DefaultGraphMLIOHandler or DotnetGraphMLIOHandler needs to be created.

API Excerpt 4.3, “Using a GraphMLIOHandler for reading and writing yFiles Java GraphML data” shows how to create and configure a GraphMLIOHandler for writing the yFiles Java GraphML format.

API Excerpt 4.3. Using a GraphMLIOHandler for reading and writing yFiles Java GraphML data


// Create a GraphMLIOHandler that will use style implementations created 
// specificically for yFiles Java compatibility.
// It is recommended to use the JavaCompatGraphMLIOHandler like this.
var newJavaIOHandler:GraphMLIOHandler = new JavaCompatGraphMLIOHandler( true );

// Create a GraphMLIOHandler that will try to map yFiles Java realizers
// to exisiting yFiles FLEX style implementations. 
// It is recommended to use the special yFiles Java compatibility style 
// implementations instead (pass true as the useJavaStyle parameter).
var oldJavaIOHandler:GraphMLIOHandler = new JavaCompatGraphMLIOHandler();

API Excerpt 4.4, “Using a GraphMLIOHandler for reading and writing yFiles FLEX or yFiles.NET GraphML data” shows how to create and configure a GraphMLIOHandler for writing the yFiles FLEX and yFiles.NET native GraphML format.

API Excerpt 4.4. Using a GraphMLIOHandler for reading and writing yFiles FLEX or yFiles.NET GraphML data


// Create a GraphMLIOHandler instance that is preconfigured to read and write
// all default yFiles FLEX style implementations.
var ioHandler:GraphMLIOHandler = new DefaultGraphMLIOHandler();

// Create a GraphMLIOHandler instance that is preconfigured to read and write
// all default yFiles .NET style implementations.
var ioHandler:GraphMLIOHandler = new DotnetGraphMLIOHandler();

The methods offered by GraphMLIOHandler for enabling/disabling (de)serialization of yFiles Java realizer information altogether are listed in API Excerpt 4.5, “GraphMLIOHandler options for realizer support”.

API Excerpt 4.5. GraphMLIOHandler options for realizer support

// Enable support for parsing realizer data
readRealizers : Boolean
// Enable support for writing realizer data
writeRealizers : Boolean

Read/write support for style information can be controlled using the GraphMLIOHandler options defined in API Excerpt 4.6, “GraphMLIOHandler options for style support”.

API Excerpt 4.6. GraphMLIOHandler options for style support

// Enable support for parsing style data.
readStyles : Boolean
// Enable support for writing style data.
writeStyles : Boolean

The yFiles FLEX and yFiles.NET GraphML I/O architecture supports reading and writing of shared references. Reading of shared references is always supported by the yFiles FLEX GraphMLIOHandler. Writing of references that are shared by multiple style instances can be controlled using the options listed in API Excerpt 4.7, “GraphMLIOHandler options for reference sharing”.

API Excerpt 4.7. GraphMLIOHandler options for reference sharing

// Get and set whether multiple object references will be correctly represented 
// in the output document. 
// This property only applies to style serialization if the yFiles FLEX/.NET 
// format is used, i.e., if the writeStyles property is set to true.
function set writeSharedReferences( value:Boolean ):void
function get writeSharedReferences():Boolean