[RSS]

UML Diagram Persistence:

File extensions:

NetBeans6.1 or Prior releases:

  • Model - *.etd *.etup *.ettm
  • Diagram - *.etlp + *.etld

UML-Meteora:

  • Model – same as 6.1
  • Diagram - *.diagram

Diagram File Format:

It is a "stripped-down" version of the OMG's Diagram-Interchange specification. The main elements are UML:GraphNode and UML:GraphEdge

Why are we changing?

  1. Tom Sawyer is a third-party tool, closed-source, and expensive (need to pay service contract charges every year)
  2. .Netbeans Visual Library is an in-house product, and is Open Source.

Implementation details:

Diagram Saving: The basic node/edge saving is done in UMLNodeWidget / UMLEdgeWidget. So, if you extend from UMLNodeWidget / UMLEdgeWidget, and don't have additional (special) properties to save for your widget, you don't have to worry about saving it. It will be automatically saved.

Important classes/interfaces:

  • PersistenceManager – Root class for persistence
    • First, it queries the scene for a list of all nodes,
    • finds all widgets associated with the nodes,
    • for each non-container widget, call save on that widget.
    • Now, query the scene for a list of all edges ,
    • find all associated widgets
    • for each connection widget, call save on that widget
  • DiagramNodeWriter – Interface to implement if you want to save your widget. This is already implemented by UMLNodeWidget, so if your widget extends from UMLNodeWidget, then you don't have to worry unless you have special information to save. All special node-related info is saved as properties.
  • DiagramEdgeWriter – Interfaces to implemet if you want to save your ConnectionWidget. This is already implemented by UMLEdgeWidget, so if you extend from UMLEdgeWidget, you don't have to worry unless you have special info to save.

Widget Developer tasks:

  • If you extend from UMLNodeWidget / UMLEdgeWidget, and have NO special properties to save, just don't worry about persistence. It is taken care of for you. Eg. UMLClassWidget
  • If you extend from UMLNodeWidget, and have some special properties, you have to override save(NodeWriter writer) method, and append your properties as key/value strings to nodewriter.properties, and then call super(). It will take care of writing the graphnode for you. Eg: SwitchableWidget
  • If you want a totally different implementation then you implement DiagramNodeWriter / DiagramEdgeWriter and write your own logic in the same format. Eg. AssociationConnector::save(**)

Diagram Loading:

The basic loading of your widgets is taken care of by DiagramLoader. All the default properties are also applied in UMLNodewidget / UMLEdgeWidget. So, if you extend from UMLNodeWidget / UMLEdgeWidget, and don't have any special properties to load, your widget will be loaded automatically.

Important classes/interfaces:

  • DiagramLoader -- Class responsible for parsing the *.diagram file, extracting the info and populating nodeInfo/edgeInfo objects, creating the scene, adding the nodes/edges to the scene, and calling the appropriate Widget's load(**) to apply any special properties.
  • DiagramNodeReader – Interface to implement if you want to load special properties of your widget. All default properties are loaded by UMLEdgeWidget. If your widget extends from UMLNodeWidget/UMLEdgeWidget, and you don't have anything special, your widget's loading is taken care of by the super class.