Nevron .NET Vision Documentation
Abilities, Protection and Permissions

In Nevron Diagram for .NET common for all diagram elements and diagram documents is that they implement the INDiagramElement interface. It exposes three common properties of all elements in Nevron Diagram - the diagram element Abilities, Protection and Permissions.

Abilities

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

The element abilities are defined by the AbilitiesMask enumeration mask. In order to facilitate the common bitwise operations associated with masks, Nevron Diagram for .NET implements the NAbilities structure.

You can get the abilities of each diagram element, through it's Abilities property. For example:

C#
Copy Code
// get the abilities of a drawing
NAbilities drawingAbilities = drawing.Abilities; 
// get the abilities of a shape
NAbilities shapeAbilities = shape.Abilities;
Visual Basic
Copy Code
' get the abilities of a drawing
Dim drawingAbilities As NAbilities = drawing.Abilities;
' get the abilities of a shape
Dim shapeAbilities As NAbilities = shape.Abilities;
Protection

The element protection defines the subset of the element 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 Protection property. For example:

C#
Copy Code
// protect a shape from selection
NAbilities protection = shape.Protection;
protection.Select = true;
shape.Protection = protection;
Visual Basic
Copy Code
' protect a shape from selection
Dim protection As NAbilities = shape.Protection
protection.Select = True
shape.Protection = protection
Permissions

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

Elements can decide to extend the basic permissions calculation and drop additional permissions as they see fit. For example: a shape will automatically drop its delete permission if it is the last shape of a group, which cannot be empty (e.g. the group CanBeEmpty property is set to false). In this way the user will not be able to delete the shape, although the shape has the ability to be deleted and is not protected from delete.

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, which serve as a functionality layer between the DOM and the Views.

Related Examples
Windows Forms: Document Object Model - Document - Abilities, Protection and Permissions  
See Also

 

 


©2017. Nevron Software LLC.

Send Feedback