Diagram for .NET / User's Guide / Conceptual Overview / Model - View - Controller

In This Topic
    Model - View - Controller
    In This Topic
    Nevron Diagram for .NET uses Model - View - Controller architecture. It provides the necessary logical separation between the core model functionality from the presentation and control logic that uses this functionality. Such separation allows multiple views to share the same model, which makes it easy to support multiple clients of a single model. The following image represents the Model - View - Controller design pattern:

     

     Model

    In Nevron Diagram for .NET the model part is represented by the NDocument abstract class. The set of objects, which can be hosted in a diagram document represent the Diagram Document Object Model. The NDocument class inherits from System.ComponentModel.Component, which means that it is not directly visible to the user and its existence is not dependant on whether it is used under WinForm or WebForm platform. Documents are responsible for notifying the views, when some aspects of the document has changed.

    The DOM currently implements two types of documents - NDrawingDocument and NLibraryDocument . See Diagram Documents for more information.

     View

    In Nevron Diagram for .NET documents are designed to be displayed and edited in WinForm and WebForm contexts. That is why the core abstraction of the view part is represented by the INView interface, which provides the document with the necessary means to notify the view, if any document changes have occurred.

    Views are designed to display the content of a single document, however multiple views can display and edit a single document simultaneously. Views are also responsible for keeping a set of the currently manipulated document elements (i.e. selection). Different views can have a different selection, which means that one view can be used for the editing of some document parts and another view can simultaneously edit the same or different document parts.

    A view can process user actions (mouse, keyboard and drag drop events etc.) in a different way, which primary depends on the current configuration of its controller. There is a single controller attached to every view.

    • WinForm Views - in Windows Forms the core implementation of the INView interface can be found in the NView abstract class (derived from System.Windows.Forms.Control). Currently implemented are two types of WinForm views - NDrawingView and NLibraryView. See Views for more information.
    • WebForm Views - in Web Forms the core implementation of the INView interface can be found in NDrawingView class.
     Controller

    The controller is an extendable and highly configurable part of every view, the purpose of which is to process the user input and convert it to some actions, which can be applied to the model or the view. The controller holds a collection of tools, which represent the atomic actions, which the controller can perform. The controller behavior is defined by the configuration of its tools.

    • WinForm Controller - in Windows Forms the controller is represented by an instance of the NController class. All tools, which can reside in the controller collection of tools, derive from the base NTool class. See the Controller topic for more information.
    • WebForm Controller - in Web Forms the controller is actually implemented on the client side. It is again a collection of tools, which perform client side actions, or execute AJAX callbacks to the drawing view hosted on the server. See the Nevron AJAX Overview topic for more information.
    See Also