Difference between revisions of "PrF UG meta metaclass create"
(Automated import of articles) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
== Creating a Metaclass == | == Creating a Metaclass == | ||
− | {{PrF_UG_TOC_meta}}<div id='prf_ug'> | + | <noinclude>{{PrF_UG_TOC_meta}}<div id='prf_ug'></noinclude> |
− | Despite the power of metaclasses, | + | Despite the power of metaclasses, their basic interface is very simple. |
− | their basic interface is very simple. | ||
Creating a metaclass is almost identical to creating a class. | Creating a metaclass is almost identical to creating a class. | ||
You simply have to make sure that the class is created subordinate to <b>:CLASS</b>. | You simply have to make sure that the class is created subordinate to <b>:CLASS</b>. | ||
Every metaclass is subordinate to <b>:CLASS</b>. | Every metaclass is subordinate to <b>:CLASS</b>. | ||
− | By default, | + | By default, every class subordinate to <b>:CLASS</b> is a metaclass, |
− | every class subordinate to <b>:CLASS</b> is a metaclass, | ||
unless you change it. | unless you change it. | ||
− | Most often, | + | Most often, it is desirable to create a metaclass subordinate to <b>:STANDARD-CLASS</b>, |
− | it is desirable to create a metaclass subordinate to <b>:STANDARD-CLASS</b>, | + | so that the classes created using the metaclass will have the various properties defined |
− | so that the classes created using the metaclass will have the various properties defined by the <b>:STANDARD-CLASS</b> slots. | + | by the <b>:STANDARD-CLASS</b> slots. |
− | Without these properties, | + | Without these properties, you cannot name the class or add template slots. |
− | you cannot name the class or add template slots. | ||
To create a new class as a metaclass: | To create a new class as a metaclass: | ||
Line 25: | Line 22: | ||
Click on the desired superclass in the Class Browser. | Click on the desired superclass in the Class Browser. | ||
The selected superclass must itself be a metaclass. | The selected superclass must itself be a metaclass. | ||
− | As mentioned above, | + | As mentioned above, this will be true only if the selected superclass |
− | + | is subordinate to <b>:CLASS</b>. | |
− | |||
− | |||
</p> | </p> | ||
+ | <div>[[Image:PrF_UG_meta_select_standard_class.png|frame|none| | ||
+ | Class Browser, ":STANDARD-CLASS" selected]]</div> | ||
<li><p> | <li><p> | ||
Click the <b>Create Class</b> | Click the <b>Create Class</b> | ||
− | [[Image:PrF_UG_classes_class.create.gif|classes_class.create]] | + | ([[Image:PrF_UG_classes_class.create.gif|classes_class.create]]) button, |
− | |||
at the right of the Class Browser. | at the right of the Class Browser. | ||
The new class will be added under the highlighted class. | The new class will be added under the highlighted class. | ||
It will inherit the properties of the selected metaclass, | It will inherit the properties of the selected metaclass, | ||
including any template slots. | including any template slots. | ||
− | |||
− | |||
</p> | </p> | ||
+ | <div>[[Image:PrF_UG_meta_create_wines_metaclass.png|frame|none| | ||
+ | Class Browser, "wines_Class_0" selected]]</div> | ||
<li><p> | <li><p> | ||
− | Use the | + | Use the [[PrF_UG_classes_class_editor|Class Editor]] |
− | + | to name the class, create constraints, and attach and edit template slots. | |
− | to name the class, | + | Remember that the template slots you attach to the metaclass |
− | + | appear as entry fields on the Class Editor | |
− | + | for the classes you create using this metaclass. | |
− | Remember that the template slots you attach to the metaclass appear as entry fields on the Class Editor for the classes you create using this metaclass. | + | For example, the <b>:NAME</b> slot for <b>:STANDARD-CLASS</b> |
− | For example, | + | becomes the <b>Name</b> entry field when you create a class. |
− | |||
In the Wineries example, | In the Wineries example, | ||
there is an additional slot named <i>best_wineries</i>. | there is an additional slot named <i>best_wineries</i>. | ||
− | |||
− | |||
</p> | </p> | ||
+ | <div>[[Image:PrF_UG_meta_metaclass_editor.png|frame|none| | ||
+ | wines_Class_0 instance dialog]]</div> | ||
</ol> | </ol> | ||
− | </div> | + | <noinclude></div></noinclude> |
Latest revision as of 17:26, November 13, 2008
Creating a Metaclass
Despite the power of metaclasses, their basic interface is very simple. Creating a metaclass is almost identical to creating a class. You simply have to make sure that the class is created subordinate to :CLASS. Every metaclass is subordinate to :CLASS. By default, every class subordinate to :CLASS is a metaclass, unless you change it.
Most often, it is desirable to create a metaclass subordinate to :STANDARD-CLASS, so that the classes created using the metaclass will have the various properties defined by the :STANDARD-CLASS slots. Without these properties, you cannot name the class or add template slots.
To create a new class as a metaclass:
Click on the desired superclass in the Class Browser. The selected superclass must itself be a metaclass. As mentioned above, this will be true only if the selected superclass is subordinate to :CLASS.
Click the Create Class () button, at the right of the Class Browser. The new class will be added under the highlighted class. It will inherit the properties of the selected metaclass, including any template slots.
Use the Class Editor to name the class, create constraints, and attach and edit template slots. Remember that the template slots you attach to the metaclass appear as entry fields on the Class Editor for the classes you create using this metaclass. For example, the :NAME slot for :STANDARD-CLASS becomes the Name entry field when you create a class. In the Wineries example, there is an additional slot named best_wineries.