Combination of TOGETHER and Visual.studio.net (2)

xiaoxiao2021-03-06  44

3. Apply to instances to TOGETHER (2) is mainly used to establish a static class diagram. Open the default map (), select Class () in the toolbox, then create a class "Store" in the figure. Select this object, press F4 to open the property window, click the button on the right side of Stereotype to select the prototype "Place" (place, indicate the nature of the video store), repeat the above steps, set the Clerk "Role", will " Item "is set" Description ". Alternatively, you can click right click directly, select Add-> Class, or in the Model view, right-click the root point, then select Add-> Class. The static class diagram is completed, as shown in Figure 15: Figure 15: Initial static class map is a class Create member: Right-click the Store, and select Add-> Field, add a new property and assign it: address: string . Click the F4 key to pop up the properties editing window, click on the Visibility field in which the private property is selected from the drop-down list. In the default, TOGETHER VS.NET creates public int domains and public void methods. Add a method for the Store, right-click the Store class and select Add-> Method, and use the embedded editor to name: findbytitle. Refer to Table 1 for the properties and methods of the various classes filled. The final Store is shown in Figure 16:

Figure 6: Composition of the Store class

ClassfieldSmethodsstoreaddressFindbyTitle StorenumberfindbyKeywords HoursfindByItemNumbercleMnumbergetItemNumber TitleSetItemNumber GetTitle Settitle

Table 1: Attributes and methods of various types

Figure 17: Set the gender name

You can add an attribute to the Ctrl W key to add a method to add a method and use the F2 key to make a naming or rename work. Select the StoreNumber property, you can set its alias in Alias ​​in the properties window, such as "Store Number", as shown in Figure 17. Of course, you can also set a Chinese alias to facilitate communication. Click Right click to select Goto Definition You can view the code generated by Together (Figure 18) Figure 18: TOGETHER Automatically generate code and aliases create relationships and connections. There are two relationships in this example: First, Clerk is associated with the Store, and the Store includes several items. The relationship between Clerk and the Store is similar to the relationship between "customers" and "vendors", and for Store and Items are obviously a aggregation relationship. Click the Association Link button, then click Store and drag to Clerk, this behavior will establish a relationship between the so-called customer and suppliers (Figure 19):

19: Building a relationship between Store and Clerk Another new association between Store and Item, using the Properties window to define the type of connection, define the aggregation property from the Type property. Create a hyperlink. Video Store There is a method FindbyKeywords to find a tape. By using a hyperlink, you can quickly determine the relationship type of the chart and the element and record it in the model for other use cases. Open the case, right-click "Find Item By Keywords" case, select Hyperliks-> Edit, a dialog box appears (Figure 20), select Video Store-> Store-> FindbyKeywords from the "Available Content" panel, then click The Add button adds the selected element to the right panel, click OK, at this point, the newly established Symposium is displayed in blue font (Figure 21). Figure 20: Super Link Dialog Figure 21: Creating a sequence diagram of the use case to create after completing the hyperlink. The sequence diagram is used to design the dynamic effect of the object model. In the Model view, right-click the Video Store root node, add-> Other Diagram, select "Sequence Diagram" in the pop-up dialog, rename "Rent Movie Sqquern" and click OK. Select "UML Interaction Diagram" from Toolbox, click the actor button, place it to the figure, rename "Clerk", click the Object button, and click on the right side of the Actor Timeline to rename the object "thisstore". Click on the "Message" button in the tool box to add a message connection and drag the timeline from the Time line of the Actor to complete the sequence diagram (Figure 22):

Figure 22: Sequence diagram Right-click the Theestore object, select the Choose Class-> Store, the final sequence diagram will be displayed, pay attention to the object name at this time has been associated with the corresponding class. Click the message chain, choose Choose Method-> FindBytitle (): Void, link the message chain with a method (Figure 23):

Figure 23: Message Chain and Method Connecting between Sequence Charts and Collaboration Charts. Right-click on the sequence diagram, select the "Show as Collaboration" menu command, open the collaboration map, at which point, the mapping tool related to the collaboration diagram is displayed in the toolbox. On the collaborative figure, right mouse, you can convert to the sequence diagram via the context menu. 4, one of TOGETHER extension applications: Support to support together to support common mode, like "Four Help" (this word may only think about our Chinese program, huh, huh, huh, huh, huh). The famous 23 design model. Designers can use patterns to create or modify existing connections and classes. In the following example, assuming that ITEM requires a dynamic system, then an ITEM is returned, the counter is updated and other systems are notified. These features can be implemented using OBServer to the Item class. Right-click the Video Store class diagram, select "Apply Pattern", a mode wizard dialog open (Figure 24): Figure 24: Pattern Wizard dialog from the left Patterns panel, select Gof-> BehavioR-> Observer Mode, in the right pattern attribute, change the Class Subject name to Item, accept the default attribute settings, click OK, then change to Figure 25:

Figure 25: Applying Observer Mode The class map Item is updated, including notification messages and observation methods (Attach and Detach), and other desired classes and interfaces are also created. TOGETHER organizes this mode and other visual elements with an elliptical, listing the participants and connections, and can observe the participants by expanding Participants in the elliptical OBServer element. Right-click on the Observer element and select ADD to observe the effective action of special mode. 5, TOGETHER's extension application 2: Generate Document TOGETHER to generate a standard HTML document for the project. In the Model view, right-click the root node of the project, select Generate Documentation, find a dialog (Figure 26: Document generation dialog is default, the document generation wizard is the entire project Generate a document that limits the generation range of the document by selecting a different range option. Including the following: CURRENT NAMESPACE: The generated document output includes only the namespace selected in the Model view; the Current Namespace with DescendNT Namespaces: The generated document input includes the namespace selected in the Model view; CURRENT DIAGRAM: The generated document is output to the current focus view in the chart view; all: The generated document output overwrites all items. The selection includes: Output Folder: The target path output for the generated document; INCLUDE DIAGRAMS: Whether the generated document output includes an image; include Navigation Tree: Whether the generated document output includes a navigation tree; Launch HTML Browser: Whether in Visaul Studio. A document is loaded in the NET web browser. If you do not select this, you can open an index.html file in the directory of the document to browse the generated output document. The generated document example (Figure 27): Figure 27: The generated document output example can browse all your work through the navigation tree in the lower left corner. It should be said that the output of this document is quite complete. If it is more than the designs when designing, as the design is completed, a system's document has been generated, and there is a lot of strength of developers, it is the strongest function. And one of the most distinctive parts of Together. 6, TOGETHER's extension application 3: Import, export the XMI project file export XML project file. In the Model view, right-click the Video Store project, select the Export Project to Xmi command, pop up an XMI export dialog (Figure 28): Figure 28: Export items in XMI format You can set the type of XMI file And path. By default, ".. / out / xmi / video store.xmi". The situation is similar to some, and will not be described again. Next article will review some of TOGETHER's setup options, time is very late (already more in the morning), first this. Inappropriate, please Hai Han.

转载请注明原文地址:https://www.9cbs.com/read-71434.html

New Post(0)