How to: Add a Compartment Shape (DSL Explorer)
You can use compartment shapes to specify how domain classes appear in a generated designer. Compartment shapes add categorical sections to a domain class. These sections are called compartments, and they can be expanded and collapsed. Each compartment is itself represented by a domain class, and you establish a compartment with compartment maps by using the DSL Details window. For more information, see Compartment Shape (Domain-Specific Language Designer). You can find an example of a compartment shape in the Class Diagram sample. For more information, see Class Diagram Sample (Domain-Specific Langauge Tools).
To add a compartment shape by using DSL Explorer
In DSL Explorer, right-click the Dsl node, and click Add New Compartment Shape.
A compartment shape that is named CompartmentShape1 appears in the Diagram Elements swimlane.
Optionally, add decorators, such as text and an icon, to the compartment shape. For more information, see How to: Add a Decorator.
Optionally, add domain properties to the compartment shape. For more information, see How to: Add a Domain Property.
Set any properties in the Properties window.
For example, you can change the default value of the OutlineColor property from black to gray.
To add compartments to the compartment shape, right-click the CompartmentShape node to which you want to add a compartment, click Add New Compartment, and type a unique name for the compartment.
Set any properties in the Properties window for the compartment.
For example, you can change the value of the Default Expand Collapse State property from expanded to collapsed.
Map the compartment shape to the domain class or the named domain class by using the Diagram Element Map tool or from the Diagram node in DSL Explorer.
For more information, see How to: Add a Domain Class to a Domain-Specific Language Definition, How to: Map Elements By Using the Diagram Element Map Tool, or How to: Add a Compartment Shape Map (DSL Explorer).
Click the mapping line between the compartment shape and the domain class to which it is mapped, and map the individual compartments in the DSL Details window.
For more information, see How to: Define Compartment Settings of Diagram Element Maps.
Click Transform All Templates in Solution Explorer, and start a Visual Studio experimental build to verify that you have defined the compartment shape and mapped it to a domain class.
See Also
Concepts
Defining the Domain-Specific Language in Domain-Specific Language Explorer
How to: Add a Compartment Shape to a Domain-Specific Language Definition