Skip to content

DockLayoutSnapshot

Immutable snapshot representing the recursive docking layout tree and active pane selection for serialization and layout persistence.

Overview

DockLayoutSnapshot captures the complete recursive docking tree structure for persistence.

Persistence Flow

  1. Capture: DockLayoutSnapshot snapshot = dockingManager.snapshot();
  2. Serialize: String encoded = DockLayoutSnapshotCodec.encode(snapshot);
  3. Save: Persist encoded string into application settings or workspace file.
  4. Restore: dockingRoot.restoreLayout(snapshot, paneRegistry);

Capturing and Restoring Snapshots

DockLayoutSnapshot snapshot = DockLayoutSnapshot.from(dockingManager.rootNode(), "editor-1");
  • DockLayoutSnapshotCodec: Compact string serializer and deserializer (DLS1 format) for persisting docking layouts across application restarts.
  • DockingManager: Non-visual layout controller managing the hierarchical docking tree, pane additions, splits, tab reordering, and snapshot serialization/restoration.

API

DockLayoutSnapshot(Node)

Creates a layout snapshot with empty active pane.

Parameter Type Description
root Node Root serialized node.

DockLayoutSnapshot::from(DockNode)

Captures an immutable snapshot from a live DockNode hierarchy.

Parameter Type Description
root DockNode Live root dock node to snapshot.

Returns DockLayoutSnapshot: Immutable snapshot of the docking hierarchy..

DockLayoutSnapshot::from(DockNode, String)

Captures an immutable snapshot from a live DockNode hierarchy with active pane identifier.

Parameter Type Description
root DockNode Live root dock node to snapshot.
activePaneId String Identifier of the active dock pane.

Returns DockLayoutSnapshot: Immutable snapshot of the docking hierarchy..