Nevron .NET Vision
Diagram for .NET / User's Guide / Conceptual Overview / Diagram Hierarchies

In This Topic
    Diagram Hierarchies
    In This Topic

    In Nevron Diagram for .NET documents and views are hierarchically organized. Hierarchies are actually modeled as trees in which each object is treated as a tree node. This means that every structural object, which resides in a document or a view can easily be obtained and knows its exact place in the hierarchy (e.g it's parent object, root object, it's children etc.).

     Document Object Model Overview

    Nevron has built a product independent framework for modeling object hierarchies - the Nevron DOM, which is widely used in the Nevron Diagram for .NET product. It lays on top of the following fundamental abstractions:

    • Node - the term node refers to any object, which can reside in a hierarchy (tree). A node knows about its parent and root. A node, which has child nodes is a container node. A container node to which you can insert or remove nodes (e.g. modify its children) is a composite node. In Nevron Diagram for .NET the base class for all nodes is the NDiagramNode class (implements the INNode interface).
    • Element - the element is a node, which has attributes and can be uniquely identified, or locally identified in the scope of a document. Only elements can reside in the hierarchy of a document. In the Nevron Diagram for .NET the base class for all elements is the NDiagramElement class (implements the INElement interface).
    • Document - the document is the root element of an elements hierarchy. Documents provide you with the means to obtain any element inside it. In the Nevron Diagram for .NET the base class for all documents is the NDocument class (implements the INDocument interface).
    • Attribute - the term attribute refers to an object, which is used to encapsulate some related properties and/or functionality. Attributes are primary used by elements, but you should know that not only elements can have attributes.
    • Services - services are bridges between the nodes and the context in which they reside. Services are used to outsource some nodes (and hence elements) context specific functionality. See the Diagram Services topic for more information.

    See DOM Overview for more information. Following is more detailed information about diagram nodes and elements.

     Diagram Nodes

    In Nevron Diagram for .NET all nodes derive from the base NDiagramNode class (implements the Nevron DOM INNode interface). In this way all diagram objects, which reside in document or view scenes directly or indirectly derive from NDiagramNode.

    Diagram nodes try to connect themselves to two services:

    • Event Sink Service - provides the node with the ability to fire events. The base service type to which the NDiagramNode class tries to connect is NDiagramEventSinkService.
    • Smart Paint Service - provides the node with the ability to request a repaint of the view area in which it is displayed. The base service type to which the NDiagramNode class tries to connect is NDiagramSmartPaintService.

    The NDiagramNode class implements the INZOrderable interface, which means that you can change the Z-Order of all objects, which reside in document or view scene. For example:

    C#
    Copy Code
    // bring the node to front most position (make it the last node in its container)
    if (node.CanBringForward())
    {
       node.BringToFront();
    }
    
    // send the node to back most position (make it the first node in its container)
    if (node.CanSendBackward())
    {
        node.SendToBack();
    }
    
    Visual Basic
    Copy Code
    ' bring the node to front most position (make it the last node in its container)
    If (node.CanBringForward()) Then
        node.BringToFront()
    End If
    
    ' send the node to back most position (make it the first node in its container)
    
    If (node.CanSendBackward()) Then
        node.SendToBack()
    End If
    
    Important: In Nevron Diagram for .NET the term node refers to an item in the document or view hierarchy and must not be mistaken for a graph node.
     Diagram Elements

    In Nevron Diagram for .NET all elements derive from the base NDiagramElement class (implements the Nevron DOM INElement interface and derives from NDiagramNode). In this way all diagram objects, which can reside in document scenes directly or indirectly derive from NDiagramElement.

    Diagram elements try to connect themselves to the following additional service:

    • History Service - provides the element with the ability to record undoable/redoable actions. The base service type to which the NDiagramElement class tries to connect is NElementHistoryService. The NDiagramElement class provides a complete set of helpers method, which safely call the respective methods of the history service. They can be of great help if you want to make any custom elements history aware.

    Beside the ability to record history, NDiagramElement adds core support for the following diagram element features: 

    • Verbs and Context Menus - diagram elements can expose one or more verbs and be edited by context menus.
    • Measurements - diagram elements can store measurements in the current logical measurement unit of the scene and be properly notified to convert them when the logical measurement unit has changed.
    • Abilities, Protection and Permissions - diagram elements consistently expose the actions, which an end user can perform with them (abilities) and provide you with the necessary means to protect them from some actions (protection), as well as to query which actions are currently allowed (permissions).
    See Also