View on GitHub

JetUML

A desktop application for fast UML diagramming.

Diagram Statement Management

Scope

Diagram state management concerns how the state of a diagram is managed by the UI and other objects that need access to it.

Design

The state of a diagram and the operations available to manipulate it are available via a layered architecture, wherein a simple diagram data model is aggregated by objects of increasing complexity. The important principle guiding this design is that each diagram tab manages a single diagram, which is supported by stateful wrappers that always remain consistent with it.

Object Diagram of the Diagram State

The objects involved in this design are:

To keep the diagram state management principled, references to the diagram should be obtained via the highest-level wrapper available and not aliased. Each class in the design provides getter methods for obtaining the lower wrappers in the layered architecture. This design feature is illustrated in the following diagram.

Class Diagram of the Diagram State

For example, within DiagramCanvas, the diagram is obtained by calling aDiagramBuilder.diagram(), and similarly for obtaining the renderer.