Visual Studio DSL 1

Source: Internet
Author: User

till now, we have only introduced model-related things and have not touched the presentation of DSL models. It is also feasible for a DSL to have no graphical presentation, however, for a development tool, we need to provide a way to operate on our metadata. Visual Studio DSL provides good support for graphic presentation, but for complicated DSL, the demand for graphic presentation is often very complex. To a certain extent, the current graphical support may not be able to meet certain requirements, but it is always better. We hope Microsoft will strengthen it in this respect.
let's take the mongoagesm project we created as an example. Let's briefly introduce the concepts on the interface and open dsldefinition. DSL file. This time, let's look at the right side of the lane (that is, the tree line):
1. chart
let's take a look at the bottom of the timeline agesmdigoal. This is a chart element. It is a container that stores shape and connector ing, representing the design interface itself, the root domain class mapped to the model (the Graphic Element dimo-elements corresponds to the model), that is, the examing to examplemodel in our example. Let's look at the attributes of a table:
here, we can set attributes for the chart appearance, code, document, public style attributes, and resources. dsl collects the set information, then, based on the T4 template, generate the digoal class under the generate code folder of the DSL project. We can also extend this class to customize charts, such as setting Set the background image to display the network. If you want to implement your own interface representation of the DSL model, you also need to implement your own chart element digoal class.

Ii. Editor
There are two types of Editors: (graphical) designer and custom editor. the definition of the editor is under the "Editor" node in DSL explorer. The attributes defined here are used to generate the editorfactory class (familiar with vsx should know, we will introduce it later), toolbox, etc. Let's take a look at the default designer attributes:

You need to note that during DSL design, there are many times that you need to use the DSL browser and Attribute-related operations. You can set the attributes by right-clicking them.
The chart elements of the Editor, The GUID of the editor, the root domain class, the file extension for storing the DSL model, and the icons associated with the file are set in the attribute. Maybe you don't quite understand what these attributes mean. It doesn't matter. You will understand them later.
As we mentioned in the first section, the DSL model does not have to have a graphic editor. We can also add our custom editor here. You can right-click to delete the default editor, right-click the root node mongoagesm to add a custom Editor, set the attributes mentioned above, and then implement your own docview. Here we have a detailed process, the specific method will be detailed later.

3. Shape
Shape is the focus of DSL graphical symbols. Because shapes correspond to model elements one by one (the exampleshape mentioned above is a geometric shape that corresponds to the root domain class), the model elements can be visualized, this is also. net DSL graphical DSL features. shapes are divided into the following five different types. These five shapes are available in the toolbox. You can drag them directly to the graphic area to create a corresponding shape. We recommend that you do not need to refine the shape, instead, you only need to remember their styles and be able to have them all as needed. How to set them or use them:
1. geometryshape)

The model is in shape on the left, and the display model is run after debugging on the right. The namedecorator in the shape is used to control the text in the graph. You can view the attributes of the decoration, controls the display of text, including text and position.

In addition to text decorators, you can also add icondecorator and expandcollapsedecorator)
2. Compartment shape)
The compartment shape is a geometric shape with a compartment. A compartment shape can have multiple compartments:

Similarly, you can add other decorations in the compartment shape as you do in the geometric shape.
3. Image shape (imageshape)
The image shape is a non-contour shape of the display image:

We can see that the image shape display is different from the ordinary geometric shape. We can set the displayed image and ICON resources for the image switch. Let's take a look at the image shape attributes above, at the bottom, we define the displayed icon:

4. Port (portshape)
A port is a special shape that is attached to a Shape Profile and can only move around the profile. In addition, it is no different from a common geometric shape.

5. Swimming Lane)
The swimming track is used to split charts into rows or examples. Let's look at the following status flowchart:

Reference resources
1. Development Guide for specific fields of visual stuido DSL tools
2. Using WPF as the Designer surface in DSL tools gokhan altinoren

Author: lone knight (like a year of water)
Source: http://lonely7345.cnblogs.com/
The copyright of this article is shared by the author and the blog. You are welcome to repost this article, but you must keep this statement without the author's consent andArticleThe original text connection is clearly displayed on the page. Otherwise, the legal liability is retained.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.