# DiagramLayoutPersistenceService

DiagramLayoutPersistenceService is responsible for persisting layout of the diagram, such a location and size of nodes, connection bend points, etc.

Unlike other services, DiagramLayoutPersistenceService is not defined by methods that must be implemented, but rather by its expected behavior.

1. During service initialization, the implementation is expected to load layout information and transfer it to diagram parts using API such as DiagramNodePart.setNodeBounds().
2. After initialization, the implementation is expected to listen for changes to diagram parts and persist layout information. Persistence can happen immediately or be deferred until the save event is received.
3. If implementation defers layout persistence until save, it is expected to implement dirty() method and to issue DirtyStateEvent when this state changes.

Example

The architecture sample provides a comprehensive example of a custom implementation that persists layout in the same file as data.

Copyright (c) 2016 Oracle
Content made available under the terms of Eclipse Public License.