Skip to main content

Extending the Document

The document model is a node tree. It is extended by adding new nodes.

Overview

Usually the custom document node will be designed for a specific purpose, which may greatly differ between nodes. You will inherit from the specialised classes CustomPanel, CustomVisual, CustomTool, CustomCalculation and the all-purpose CustomNode. In the end, all these classes inherit from DocumentNode. If your specialized node contains additional nodes, you can add nodes directly inheriting from DocumentNode.

Creating a document node

The general work order when adding a document node is as follows:

  1. Create a Document Node class.
    DocumentNode is the abstract base class for all types in the model. The document is extended by creating, attaching and configuring nodes. The class must derive from the DocumentNode base class or a subclass to it.
    The class must be marked with the Serializable and PersistenceVersion attributes.
  2. Create an inner PropertyNames class.
    Every property of a custom document node must have an associated identifier, a Property Name.
  3. Add Undoable Nodes.
    Document nodes must not be modified. Instead they may contain Undoable Nodes, a special, modifiable kind of nodes.
  4. Add Readonly Properties.
    Some properties stored in ordinary readonly fields never change after initialization. They nevertheless must be initialized in a special way for the Document Model Framework to keep track of them.
  5. Optionally, add the following entities to your node:
    • Runtime Properties.
      A runtime property is defined at runtime. It can be computed from other properties in the document.
    • Event Handlers for internal events.
      The Document Model Framework separates internal and external events. Internal events update the model to a consistent state. External events update the view to reflect the state of the model.
    • A configuration phase.
    • Public methods