Customizing the metamodel : Keywords for USRPROPS : INIT_FROM_SYMBOL
  
INIT_FROM_SYMBOL
The INIT_FROM_SYMBOL keyword is used in a definition that defines a symbol. It specifies that a property in the definition initially inherits its value from a similarly named property in the symbol. This is used in cases where a property must exist in both symbol and definition, and should have the same value. A case where this is necessary is in specifying user-provided metafiles for a symbol based on a property such as Stereotype. The stereotype must be specified for the symbol (because this is what drives how the symbol is represented on the diagram) and in the corresponding definition.
Example 1
LIST "Class Stereotypes"
{
VALUE "actor" DEPICTIONS {diagram images\slctact.wmf menu images\slctact.bmp}
VALUE "boundary" DEPICTIONS {diagram images\slctbndy.wmf
menu images\slctbndy.bmp}
VALUE "case worker" DEPICTIONS {diagram images\slctcwkr.wmf menu images\slctcwkr.bmp}
}
SYMBOL "Class" in "Class"
{
PROPERTY "Stereotype" { INVISIBLE EDIT Text ListOnly List "Class Stereotypes" DEFAULT "" LENGTH 20}..}
DEFINITION "Class"
{
PROPERTY "Stereotype" { EDIT Text LIST "Class Stereotypes" INIT_FROM_SYMBOL Default "" LENGTH 20 } ..}
In the example above, the Stereotype property is declared in both the specification of the class symbol and the class definition. It must have the same value. The stereotype property in the SYMBOL causes the drop-down display of possible stereotype values to select from in System Architect’s Draw menu (which themselves are bitmaps specified by the DEPICTIONS clause in the LIST statement). Once you select a stereotyped class from the list in the Draw toolbar and place it on the diagram, the class’s definition is created and its stereotype property is automatically filled in by the stereotype you have chosen for the symbol. Note that if you change this value in the definition, it will change in the symbol. Note also that you do not see this stereotype value in the symbol tab of the class because it has been made INVISIBLE.
Example 2
DIAGRAM "Class"
{
PROPERTY "Programming Language" { EDIT Text Listonly LIST "Programming Languages" Default " CORBA" LENGTH 30 INITIAL USER REQUIRED }
}
SYMBOL "Class" in "Class"
{
PROPERTY "Package" { EDIT OneOf "Package" READONLY }
PROPERTY "Stereotype" { INVISIBLE EDIT Text ListOnly List "Class
Stereotypes" DEFAULT "" LENGTH 20}PROPERTY "Programming Language" { INVISIBLE EDIT Text ListOnly List "Programming Languages" DEFAULT "" LENGTH 30}
}
DEFINITION "Class"
{
PROPERTY "Package" { KEY EDIT OneOf "Package" RELATE BY "is keyed by" READONLY}
PROPERTY "Stereotype" { EDIT Text LIST "Class Stereotypes" INIT_FROM_SYMBOL Default "" LENGTH 20 }
PROPERTY "Programming Language" { EDIT Text ListOnly LIST
"Programming Languages" INIT_FROM_SYMBOL Default "CORBA"
LENGTH 30 INITIAL USER REQUIRED READONLY }
}
In the example above, the Programming Language property exists in the diagram, and the Class symbol inherits the value of this property from the diagram. The Class symbol’s definition also inherits the value of this property through the symbol, because of the INIT_FROM_SYMBOL keyword.
If a Class definition is created through the explorer, the required property MUST be supplied at the time of its creation because of the INITIAL USER REQUIRED keyword in the Class definition.