Diagram / Diagram DOM / Abilities, Protection and Permissions
In This Topic
    Abilities, Protection and Permissions
    In This Topic
     Diagram Items

    In NOV Diagram for .NET page items (i.e. shapes and guidelines) and library items derive from the base NDiagramItem class. It exposes three common properties of all essential items in NOV Diagram - the diagram item Abilities, Protection and Permissions (discussed below). In this way batches can operate with collections of diagram items and consistently verify whether they can perform certain operations upon the items they contain.

     Diagram Item Abilities

    In NOV Diagram for .NET each diagram item exposes a set of abilities (i.e. informs the diagram what operations the end user can perform with it). An item must have the respective ability in order for some operation to be performed on it. For example: you cannot select an item, which does not have a Select ability.

    The items abilities are defined by the ENDiagramItemOperationMask enumeration mask. You can get the abilities of each diagram element, through it's GetAbilitiesMask() method. For example:

    Get the abilities of a diagram item
    Copy Code
    ENDiagramItemOperationMask abilities = item.GetAbilitiesMask();
    
     Diagram Item Protection

    The item protection defines the subset of the item abilities, which are explicitly disabled. For example: even though a shape has the ability to be selected, the end user will still not be able to select a shape, if it is protected from selection.

    You can get and set the element protection, through it's GetProtectionMask() method. For example:

    C#
    Copy Code
    ENDiagramItemOperationMask protection = item.GetProtectionMask();
    

    The shape properties that define the different types of item protection are typically starting with the "Allow" prefix - for example: when you set the shape AllowResizeX property to true, you are protecting the shape from X resize that can be performed by the user.

    The code below shows how to protect a shape from inplace editing, which is editing of the shape text on double click:

    Disable shape inplace editing
    Copy Code
    shape.AllowInplaceEdit = false;
    

    To set or clear multiple or all protections of a shape at once, use the SetProtectionMask method of the shape.

    Set the protection of a diagram item
    Copy Code
    shape.SetProtectionMask(ENDiagramItemOperationMask.All);  // Sets all shape protections
    shape.SetProtectionMask(ENDiagramItemOperationMask.None); // Clears all shape protections
    
     Diagram Item Permissions

    The item permissions defines a subset of the item abilities, which are allowed to the end user. The item permissions are by default computed by getting the item abilities and removing from them the item protection - Abilities minus Protection. You can get the item permissions, through it's GetPermissionsMask() method.

    Items can decide to extend the basic permissions calculation and drop additional permissions as they see fit. From a programmers point of view, it is enough to check whether an element has the respective permission in order to perform some operation with it. If the developer wants to explicitly disable some element ability all that is needed is to raise the respective element protection flag.

    In Nevron Diagram for .NET the permissions of the elements are checked by batches.