Element Windows

Element windows are special document windows which represent precisely one model element.

Element Window Properties

Element windows are special document windows which have precisely one model element assigned to them; the model element's components or properties are then shown in the element window.

Examples of element windows:

  • Diagrams

    Elements contained are shown as a graph.

  • Tables

    Subelements and their properties are shown in table form.

  • Specifications

    Assigned texts are shown.

Element windows are created in exactly the same way as document windows, the only difference being that the IElemWorkArea interface (a specialization of IDocWorkArea needs to be realized.

The following properties need to be implemented for the IElemWorkArea interface:

  • Element

    Model element represented by the window.

  • Info

    The model element's properties.

    These include e.g. display text and icon, respective lockable entity and its state (access and locking). "Lockable entity" refers to the next higher-level element that has the property to be lockable in the metamodel. e.g. a class is the respective lockable entity for its properties and methods.

    You can normally determine the data required using the ELElement.GetElementCache method.

  • DocumentIdentifier

    String representation for the model element.

    This representation is normally used if you need to reopen the window once it has been closed as e.g. it was selected in the most recently used elements menu. It needs to be possible to determine the model element from the string representation. Apart from a few exceptions, every model element is assigned a UUID which can be used for this purpose.

  • Title

    Title shown in the list of most recently used elements.

    The title must be made up of an identifier, e.g. Diagram and a placeholder for the name. The name is taken from the Info property by the framework and inserted in the title instead of the placeholder.

Note

See the MID.Innovator.Plugin.Sample.ElementWindow1 sample for creating an element window.

Element Window Behavior

Most element windows show the behavior described below when editing the assigned element:

  • The respective lockable entity needs to be locked when editing the element.

  • The lockable entity is locked when the document is opened if it is not already locked.

    The lockable entity is unlocked once the document is closed if no other documents with the same lockable object are open.

  • Changes made to the element are automatically or manually stored on the server e.g. using a button.

    Any changes made are saved when the lockable entity is unlocked or when the window is closed.

Note

See the MID.Innovator.Plugin.Sample.ElementWindow2 sample for describing behaviors of element windows.

The object does not necessarily have to be locked when modifying server commands are executed. It is normally sufficient to have access to the lockable entity and for the entity not to be locked by another user. This means that the process does not necessarily have to be carried out exactly as described above. However, it is a good idea to do it as described above if you have relatively extensive and time-consuming element modifications in the window. This is because the process ensures that no other users can overwrite your changes by working on the element at the same time.