A pattern’s com.nomagic.magicdraw.patterns.Target encapsulates information about the classifier you want to apply the pattern for.
A Target owns:
- a classifier
- a classifier’s presentation element
- a diagram of a presentation element
A Target is passed to the pattern’s method com.nomagic.magicdraw.patterns.AbstractPattern.applyPattern(Target, AbstractPatternProperties). It is also accessible from pattern’s properties com.nomagic.magicdraw.patterns.AbstractPatternProperties.
Open API provides a helper class com.nomagic.magicdraw.patterns.PatternHelper with useful methods for patterns. For more details about methods of this class, see javadoc.
Every implementation of a specific pattern must provide:
- Pattern properties
- Pattern panels
- Pattern implementation
This information is encapsulated in the com.nomagic.magicdraw.patterns.PatternInfo class.
PatternInfo is used only for the pattern registration in the com.nomagic.magicdraw.patterns.PatternsManager. Other usages are internal and do not impact specific patterns.
Every pattern must provide main properties and optionally can have extended properties. Main properties are used for the user input from the first pattern wizard page. Extended properties may be used for storing the user input from other wizard pages.
A specific pattern must provide implementation of this abstract class and override the AbstractPatternProperties.configurePropertyManager() method. If a specific pattern has some extended properties, it must override the AbstractPatternProperties.configureExtendedPropertyManager() method. Both these methods must configure some property manager – add or remove properties from it.
Every pattern must provide one or more panels for the patterns wizard. The first wizard page is always used for displaying main pattern properties. Other pages are optional and may be the pattern specific. The com.nomagic.magicdraw.patterns.AbstractPanelContainer class is used for providing the pattern wizard information:
A specific pattern must provide a pattern implementation class. This class must extend AbstractPattern and implement AbstractPattern.applyPattern(Target, AbstractPatternProperties) and AbstractPattern.getCategorizedName() methods.