Framework / Editors / Designers / Designers and Editors
In This Topic

    Designers and Editors

    In This Topic

    Designers are used to define and create editors for the node children and members. When you want to specify what editor needs to be created for a specific property, or member category for example, you do that by specifying a factory function,  which essentially creates an editor of a specific type when needed (see Editor Factories for more info).

    Following is an overview of the editors that are defined by the designer. 

     Standalone and Embedded Editors

    The Standalone Editor is the editor which is created for the node, when the node is the root of the edited hierarchy. It is created by the factory method specified by the StandaloneEditorFactory property. If not explicitly specified, the returned default factory depends on the node schema type. If the node is a leaf node (does not have any child nodes), the NNodeMembersEditor.DefaultFactory is returned, otherwise the NNodeSubtreeEditor.DefaultFactory is returned.

    The Embedded Editor is the editor which is created, when  the node is embedded in the hierarchy editor of another node. It is created by the factory method specified by the EmbeddedEditorFactory property. If not explicitly specified, the returned default factory is the NNodeMembersEditor.DefaultFactory.

    The following image illustrates a Standalone Editor created for a NOV Diagram Shape, that aggregates the Embedded Editor for a control point:

    fig 1. Standalone Editor integrating the Embedded Editor of another node

    See General Node Editors for more information.

     Members Browsability

    Node schemas can generally contain two types of members - properties and child slots. For both of these member types, the designer defines their browsability - i.e. whether the specific member should be displayed or not.

    The NDesigner - GetMemberBrowsable and SetMemberBrowsable methods help you control the visibility of a certain member inside the NNodeMembersEditor (an editor that aggregates the editors for the specific node members).

    By default properties are browsable (controlled by the DefaultPropertyBrowseMode property), while child slots are not (controlled by the DefaultChildBrowseMode property). You can hide certain properties from editing by setting them as non-browsable like this:

    Hiding Properties from Editors
    Copy Code
    public class MyNode : NNode
    {
        ...
        public static readonly NProperty MyProperty;
        public class MyNodeDesigner : NDesigner
        {
            public MyNodeDesigner()
            {
                SetMemberBrowsable(MyNode.MyProperty, false);
            }
        }
    }
    

    Child slots are by default not browsable and will only appear in the hierarchy browser of hierarchy editors. Whether or not the child nodes of a node are by default visible in the hierarchy browsers is controlled by the DefaultChildrenHierachyBrowseMode property. You can also hide only certain child slots from the hierarchy browser by setting them as non-hierarchy browsable like this:

    Hiding Child Slots from Hierarchy Browsing
    Copy Code
    public class MyNode : NNode
    {
        ...
        public static readonly NChild MyChild;
        public class MyNodeDesigner : NDesigner
        {
            public MyNodeDesigner()
            {
                SetChildHierarchyBrowsable(MyNode.MyChild, false);
            }
        }
    }
    
     Members Editors

    The type of editor created for the different node members (properties and child slots) by default depends on their type. For properties, the editor created depends on their type (see Member Editors for more information); for child slots, the editor is by default the NEmbeddedChildEditor, which aggregates the Standalone Editor of the node.        

    You may be required to change the editor for certain properties - you do that with the help of the SetMemberEditorFactory method. This method accepts two arguments - the property/child-slot for which you want to define an editor, and a member editor factory function, which when invoked creates a member editor for the editing of the schema member. See Editor Factories for more information.

    Many of the editor types contain predefined editor factories, that you can use. Explore the Programmers Reference for each editor type to check for static members with Factory suffix - these are predefined editor factories with certain property modifications. The NEditorFactory class, which is discussed in the Editor Factories topic.