Use together with visual. Studio. NET (2)

Source: Internet
Author: User
Tags xmi file

The following describes how to create a static class chart. Open the default graph () and select class (
), And then create a class "Store" in the figure ". Select this object, press F4 to open the Properties window, and click the button on the Right of stereotype to select the prototype as "place" (location, indicating the recording
Such as the nature of the store), repeat the above steps, set clerk to "role", and set "item" to "Description ).

In addition, you can right-click the graph, select Add-> class, or right-click the root node in the model view, and select Add-> class.

Static class diagram created, 15th:

Figure 15: initial static class diagram

Create a member for a class: Right-click store and select Add-> field to add a new attribute.
Value assignment: Address: string. Click the F4 key to bring up the attribute editing window. Click the visibility field and select private attribute from the drop-down list. Missing
In case of saving, together vs. NET will create the public int domain and the Public void method.

Add a method for store, right-click the store class, and select Add-> method. Use the embedded editor to name the method findbytitle. For more information about the attributes and methods of each class, see table 1. The final store sixteen is shown as follows:

figure 16: composition of the store class

class fields methods
store address findbytitle
storenumber findbykeywords
hours findbyitemnumber
clerk employee ID
name
item itemnumber getitemnumber
title setitemnumber
gettitle
settitle
Table 1: attributes and Methods
  Figure 17: Set an attribute alias

You can use Ctrl + W to add an attribute, CTRL + m to add a method, and use f2 to name or rename the attribute.

Select the storenumber attribute and set its alias in the attribute window, for example, "Store
Number ", 17. Of course, you can also set a Chinese alias to facilitate communication. Right-click and choose GOTO
Definition can be used to viewCode(18th)

Figure 18: automatically generated code and alias of together

Create a link and a connection. There are two relationships in this instance: one is that clerk is associated with the store, and the other is that the store contains several
Items. The relationship between clerk and store is similar to that between "customer" and "supplier", while for store and items, it is obviously an aggregation relationship.
(Aggragation ). Click Association.
Click the link button, and then click store and drag it to clerk. This action establishes a relationship between the customer and the supplier (Figure 19 ):

Figure 19: establishing a relationship between store and Clerk

In another new association between store and item, the attribute window is used to define the connection type and the aggregation attribute is defined from the type attribute.

Create a hyperlink. Video
Store has a method called findbykeywords to find the videotape. By using hyperlink, you can quickly determine the relationship type between the graph and the element and record it in the model for its
In this example. Open the use case diagram and right-click "find item ".
Keywords "Use Case, select hyperliks-> edit, a dialog box (Figure 20) appears, starting from" available
Select video in the content panel
Store-> store-> findbykeywords, click Add to add the selected elements to the right panel, and click OK. In this case, the newly created use case exceeds
The level link is displayed in blue (Figure 21 ).

Figure 20: hyperlink dialog box

Figure 21: use case diagram after creating a hyperlink

Create a sequence diagram. Sequence diagrams are used to design the dynamic effects of object models. In the model view, right-click the video
Store the root node, add-> Other digoal. In the displayed dialog box, select "sequence digoal" and rename it as "Rent
Movie sqquence, and click OK. Select "UML interaction" from toolbox
Digoal, click the actor button, place it in the figure, rename it to "clerk", click the object button, and click the right side of the actor timeline to rename the object
"Thestore ". Click the "message" button in the toolbox to add a message connection and drag the actor timeline to thestore timeline to complete the sequence diagram.
(Figure 22 ):

Figure 22: sequence diagram

Right-click thestore object and select choose
Class-> store. The Final sequence diagram is displayed. Note that the object name is already associated with the corresponding class. Click message chain and select choose
Method-> findbytitle (): void, which associates the message chain with a method (figure 23 ):

Figure 23: associate a message chain with a method

Converts a sequence diagram to a collaboration diagram. Right-click the sequence diagram and select "show ".
As
Collaboration menu command to open the collaboration diagram. In this case, the plotting tool related to the collaboration diagram is displayed in the toolbox. Right-click on the collaboration diagram to convert the context menu to the order
In the column chart.

4. One of together's extended applications: Support for the Mode

Together supports common models, such as the "four-person gang" (This word may only be used in China.ProgramCan be figured out, huh, huh) the famous 23 design patterns proposed. Designers can use the mode to create or modify existing connections and classes.

In the following example, assume that an item requires a dynamic system. After an item is returned, the counter is updated and other systems are notified. Apply the observer (observation mode) to the item class to implement these functions.

Right-click the video store class diagram and select "Apply pattern". A mode wizard dialog box is displayed (figure 24 ):

Figure 24: Mode wizard dialog box

From the patterns panel on the left, select gof->
Behavioral-> observer mode. In the pattern attribute on the right, change the class
The subject name is "item". Accept the default attribute settings. Click "OK" to change the class chart to the format shown in Figure 25:

Figure 25: class diagram after the application observer Mode

Item is updated, including notification messages and observation methods (attach and detach). Other required classes and interfaces are also created.
Together organizes the mode and its visual elements with an elliptical shape, lists the participants and connections of the mode, and can expand
You can view the information of a participant. Right-click the observer element and select Add to observe the effective action in special mode.

5. Extended Application 2 of together: generate a document

together can generate standard HTML documents for the project. In the model view, right-click the project's root node, select generate documentation, and open a dialog box (figure 26 ):

figure 26: document generation dialog box

by default, the document generation wizard generates documents for the entire project, you can select different range options to limit the scope of document generation. Includes
the following items: Current namespace: The generated document output only includes the namespace selected in the model view; current namespace
with descendent namespaces: the generated document input includes the selected namespace in the model view and its descendant namespace; current
digoal: The generated document output is the current focus view in the chart view; all: the generated document output overwrites all projects.

options include Output Folder: the output path of the generated document, and include
diagrams: whether the generated document output contains images; include navigation tree: whether the generated document output contains the navigation tree; Launch
HTML Browser: whether it is in VISAUL studio
. net web browser. If you do not select this option, you can open an index.html file in the directory of the generated document to view the generated output document. Example of the generated document
(figure):

figure: sample output of generated documents

you can view all your work in the navigation tree in the lower left corner. It should be said that the
output of this document is quite complete. If it is well-designed, a system document has been generated with the completion of the design, it saves developers a lot of effort and is one of the most powerful functions and the most distinctive parts of together.

6. Extended Application 3 of together: Import and Export XMI project files

Export the XML project file. In the model view, right-click the video store project and select the export project to XMI command to bring up an XMI Export Dialog Box (figure 28 ):

Figure 28: export a project in XMI format

You can set the type and path of the exported XMI file. The default value is ".. <project_directory> \ out \ XMI \ video store. XMI ". The import is similar and will not be repeated.

Next articleArticleI will review some of together's settings. It's very late (a little more early in the morning. Hai Han, please.

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.