Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Factory



The GraphMLFactory is a singleton which is able to parse, create, or serialize a graphml diagram.

Access the unique factory

To access the unique instance of the factory:
      GraphmlFactory factory = GraphmlFactory.getInstance();

Creating a template

Main Article: templates

It is possible to create nodes and edges templates to reuse their characteristics.

Create a new diagram

You can create a new diagram through the factory:
      GraphmlFactory factory = GraphmlFactory.getInstance();
      GraphmlDiagram diagram = factory.newDiagram();
If you want to use custom defaults when creating the diagram, you can perform either:
      GraphmlDiagram diagram = factory.newDiagram(defaults);
or:
      GraphmlDiagram diagram = factory.newDiagram();
      diagram.setDefaults(defaults);

Opening a diagram

To open a diagram file:
      GraphmlFactory factory = GraphmlFactory.getInstance();
      GraphmlDiagram diagram = factory.openDiagram(file);

Saving the diagram

To save the diagram as a graphml file:
      GraphmlFactory factory = GraphmlFactory.getInstance();
      factory.saveDiagram(diagram, file);

Categories: general

Copyright 2021 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence