The pattern author can add one or more patterns to the pattern
library. Each pattern is independent in function and application. However,
a pattern can only be distributed with its library in a pattern plug-in.
Before you can perform these steps, you must create a pattern library.
The New Pattern wizard enables you to define
the properties for the pattern and add all of its template parameters. After
the pattern is added to the library, you can modify the pattern's properties
and add, redefine, or remove its parameters. Many of the steps are optional.
You can create a simple pattern by accepting all of the defaults.
To
add a pattern and its parameters to the pattern library:
- In the Pattern Authoring view, right-click
the library node and click New Pattern. The General page
of theNew Pattern wizard is displayed.
- Define the basic pattern properties by completing the following
steps:
- Type a name for the pattern in the Pattern Name field. This is the name that will be listed in the Pattern Explorer view to
identify the pattern.
- Accept the generated class and package names as generated from
the pattern name or modify them in the Class Name and
the Package fields.
- From the Pattern Type list, select elect
the type of pattern (Class, Collaboration,
or Package) you are creating.
- Click the Add button next to the Groups field
to open the Add Group window and add group names to the
pattern. Patterns must be assigned to at least one group and can
be assigned to multiple groups. All patterns are listed in groups in the Pattern
Explorer view. The default group, Miscellaneous Patterns,
can be deleted.
- In the Version field, modify the version
number. The number must be in an nn
nn nn format where n is a number.
- Click the Detail tab to open the Detail page
of the New Pattern wizard.
- Type your name in the Author field.
- Type a brief pattern synopsis in the Short Description field. This short description is displayed on the Short Description page
of the Pattern Explorer view.
- Click the Add button next to the Keywords field
and add keywords for the pattern. Add keywords that a pattern
applier would use to find a match to your specific pattern. The metafiles
in the pattern are also searched for matches so you do not need to duplicate
any of the contents of such properties as descriptions or names.
- Add parameters by doing the following steps:
- Click the General tab to return to the General page
of the New Pattern wizard.
- Click the Add button next to the Parameters field
to display the General page of the New Pattern
Parameter wizard. You can always add or modify parameters
after you finish using the wizard.
- Type a name for the parameter in the Name field. The class name is automatically derived from the parameter name.
- Accept the class name as generated or modify it in the Class
Name field.
- Type a short description of the parameter that can assist the
pattern applier to specify arguments for the pattern. This description
is displayed on the Short Description page of the Pattern
Explorer view and as hover help when the pattern applier hovers
over the template parameter in the diagram editor.
- In the Type field, accept the default
UML 2.0 type of Class for the parameter's type or click Browse and
select another UML 2.0 type.
- If the Allowable Subtypes field is enabled,
accept the default, to have all subtypes available to the pattern applier
as possible kinds of arguments, or click Browse, to
select a limited set of subtypes.
- Accept or clear the Allow text entry of argument
value check box that permits specifying or creating arguments
by typing an argument name.
Note: For parameters that you
create with multiple subtype options, the subtype that is created from the
pattern applier's text entry is controlled by the code you supply in the parameter's
update method. If you do not supply this code, a default subtype from your
allowable subtypes list is selected.
- If you are adding the pattern's first parameter or do not want
to add a parameter dependency, go to step 3.k. To
add a dependency, click the Parameter Dependency tab.
- On the Parameter Dependency page, in the Existing
Parameters field, click one or more parameter names and then click
the right-arrow button to position the parameter names in the Client
Parameters field or the Supplier Parameters field. When you assign another parameter as a client or supplier parameter,
it dynamically adds the reciprocal assignment to the parameter you are adding.
Thus, moving an existing parameter into the Supplier Parameters field
assigns the role of client to the parameter you are adding.
- Click OK to return to the New
Pattern wizard.
- To add additional parameters, repeat steps 3.b through 3.k.
- Click OK to close the New Pattern wizard
and complete the addition of the pattern.
The new pattern is added as a node to the pattern library in the Pattern
Authoring view and the supporting RAS metafile for the pattern
asset and the Java™ classes for both the pattern and each parameter
are created.