Customizing the metamodel : Symbols: Creating and modifying : Depicting a symbol with a bitmap or metafile : User-defined symbol presentation based on property value
  
User-defined symbol presentation based on property value
You may specify how a symbol gets drawn based on the value of a property of the symbol’s definition. In UML, this property is generally a stereotype. However, this functionality applies across the board to all symbol types, not just UML symbols, and not just to the stereotype property.
To enable this function, the DEPICTIONS clause is used directly within a LIST statement in USRPROPS.TXT.
LIST "New List Type"
{
VALUE "List Item One" DEPICTIONS {DIAGRAM imageone.wmf MENU imageone_toolbar.bmp}
...
}
Example
In the following example, a new list is specified for Node Stereotypes. These stereotypes are applied to a Node symbol on a UML deployment diagram, so that a user may draw a node symbol using graphic files imported into the FILES table of the encyclopedia database.
List "Node Stereotypes"
{
Value "Firewall" DEPICTIONS {DIAGRAM images\firewall.wmf MENU images\firewall.bmp}
Value "Cell_Phone" DEPICTIONS {DIAGRAM images\cell_phone.wmf MENU images\cell_phone.bmp}
Value "Database" DEPICTIONS {DIAGRAM images\data.wmf MENU images\data.bmp}
Value "Hub" DEPICTIONS {DIAGRAM images\hub.wmf MENU images\hub.bmp}
Value "Modem" DEPICTIONS {DIAGRAM images\modem.wmf MENU images\modem.bmp}
Value "Multiplexer" DEPICTIONS {DIAGRAM images\multiplexer.wmf MENU images\multiplexer.bmp}
Value "PDA" DEPICTIONS {DIAGRAM images\pda.wmf MENU images\pda.bmp}
Value "Printer" DEPICTIONS {DIAGRAM images\printer.wmf MENU images\printer.bmp}
Value "Projector" DEPICTIONS {DIAGRAM images\projector.wmf MENU images\projector.bmp}
Value "Radio Tower" DEPICTIONS { DIAGRAM images\radio_tower.wmf MENU images\radio_tower.bmp}
Value "Router" DEPICTIONS { DIAGRAM images\router.wmf MENU images\router.bmp}
Value "Satellite" DEPICTIONS { DIAGRAM images\satellite.wmf MENU images\satellite.bmp}
Value "Satellite Dish" DEPICTIONS { DIAGRAM images\dish.wmf MENU images\dish.bmp}
Value "Scanner" DEPICTIONS { DIAGRAM images\scanner.wmf MENU images\scanner.bmp}
Value "Server" DEPICTIONS { DIAGRAM images\server.wmf MENU images\server.bmp}
Value "Switch" DEPICTIONS { DIAGRAM images\kvm_switch.wmf MENU images\kvm_switch.bmp}
Value "Tablet_PC" DEPICTIONS { DIAGRAM images\tablet_pc.wmf MENU images\tablet_pc.bmp}
Value "Terminal" DEPICTIONS { DIAGRAM images\terminal.wmf MENU images\terminal.bmp}
}
SYMBOL "Node" in "Deployment"
{
PROPERTY "Stereotype" { INVISIBLE EDIT Text ListOnly
List "Node Stereotypes" DEFAULT "" LENGTH 32}
}
DEFINITION "Node"
{
PROPERTY "Stereotype"
{ EDIT Text LIST "Node Stereotypes" Default "" LENGTH 32 }
}
In the example USRPROPS.TXT above, note that the LIST of "Node Stereotypes" is referenced in both the SYMBOL and the DEFINITION of a node. In the SYMBOL, the property is made INVISIBLE. The SYMBOL maintains a reference to the stereotype that is specified for its underlying definition.
The USRPROPS.TXT code above changes the toolbar of a Deployment diagram, providing a drop-down list of available stereotypes (and the corresponding bitmap for each).
User-provided depiction files
The user may select a stereotype and draw it on the diagram, where it is represented by the corresponding .WMF file.
After drawing the symbol, you can right-click each symbol and choose to:
Display as <Node>, or
Adorn with Stereotype (in which a thumbnail of the metafile is placed to the right of the symbol’s name), or
Display According to Stereotype.
Once drawn, you may specify the colors of a metafile as you would any other symbol in System Architect, using the Symbol Style toolbar (or by selecting the symbol and choosing Format, Symbol Format, Symbol Style). This includes line coloring, fill coloring, font coloring, and so on.
Retain style
You may specify that metafiles that you provide retain their original graphical style and coloring when used in System Architect. You use the RETAIN STYLE keyword to specify this. For example:
LIST "Node Stereotypes" {
VALUE "Firewall" DEPICTIONS {DIAGRAM RETAIN STYLE images\firewall.wmf MENU images\firewall.bmp}
..
}
When drawn on the diagram, the user-provided metafile, firewall.wmf, is drawn with exactly the same colors as it is outside of System Architect, and cannot be changed by System Architect's color tools.
Displayable properties on depicted symbols
System Architect enables you to specify up to 37 properties to display on a symbol using the DISPLAY keyword. This is also true with symbols depicted by user-provided depiction files.
See also Specifying the display of values on symbols.