Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Usage



Creating a diagram

Main Article: GraphMLFactory

To create a diagram, you must use the GraphMLFactory class. For example:
      GraphmlFactory factory = GraphmlFactory.getInstance();
      GraphmlDiagram diagram = factory.newDiagram();
Note the you can set default values for the diagram elements parameters. See diagram defaults for more information.

Creating a node

Main Article: GraphMLNode

To create a node:
      GraphMLNode node = diagram.addNode();
To add a label for the node:
      node.setLabel(<the text>);
To add a description for the node:
      node.setDescription(<the text>);

Creating an edge

Main Article: GraphMLEdge

To create an edge between nodes:
      GraphMLEdge edge = diagram.addEdge(node1, node2);
To add a label for the edge:
      edge.setLabel(<the text>);
To add a description for the edge:
      edge.setDescription(<the text>);

Creating and using a template

Main Article: Templates

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

Diagrams default properties

Main Article: Diagram defaults

A diagram have several default parameters which allow to set default values for all nodes and edges created in this diagram.

For example:
      GraphmlFactory factory = GraphmlFactory.getInstance();
      GraphmlDiagram diagram = factory.newDiagram();

      DiagramDefaults defaults = diagram.getDefaults();
      defaults.nodeFillColor = "#FFFFFF";

Opening a diagram

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

Saving the diagram

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

Categories: general

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