Difference between revisions of "PrF UG meta create class use meta"
(Automated import of articles) |
|||
Line 6: | Line 6: | ||
If you have non-standard metaclasses in your project, | If you have non-standard metaclasses in your project, | ||
you can select the metaclass you want to use when you create a class. | you can select the metaclass you want to use when you create a class. | ||
− | You can add metaclasses either by | + | You can add metaclasses either |
− | [[PrF_UG_meta_metaclass_create|creating]] | + | by [[PrF_UG_meta_metaclass_create|creating]] them directly, |
− | them directly, | + | or by [[PrF_UG_projects_including_a_project|including]] |
− | or by | ||
− | [[PrF_UG_projects_including_a_project|including]] | ||
a project that already has metaclasses. | a project that already has metaclasses. | ||
− | By default, | + | By default, when you create a class using the <b>Create Class</b> |
− | when you create a class using the <b>Create Class</b> | + | [[Image:PrF_UG_classes_class.create.gif|classes_class.create]] button, |
− | |||
− | button, | ||
you use the metaclass of the direct superclass as the metaclass for the new class. | you use the metaclass of the direct superclass as the metaclass for the new class. | ||
− | (Unless you have made changes, | + | (Unless you have made changes, this is the default <b>:STANDARD-CLASS</b>.) |
− | this is the default <b>:STANDARD-CLASS</b>.) | ||
If you have used a non-standard metaclass for a class, | If you have used a non-standard metaclass for a class, | ||
every new subclass you create for the class will also use the selected metaclass. | every new subclass you create for the class will also use the selected metaclass. | ||
Line 29: | Line 24: | ||
<ol class='a'> | <ol class='a'> | ||
<li><p> | <li><p> | ||
− | In the | + | In the [[PrF_UG_classes_class_window|Class Browser]], |
− | |||
select the class that you want as the superclass of the new class. | select the class that you want as the superclass of the new class. | ||
− | |||
− | |||
</p> | </p> | ||
+ | <div>[[Image:PrF_UG_meta_select_superclass.png| | ||
+ | metaclasses_select_superclass]]</div> | ||
<li><p> | <li><p> | ||
Click the right mouse button and select "Create subclass using metaclass..." | Click the right mouse button and select "Create subclass using metaclass..." | ||
− | |||
− | |||
</p> | </p> | ||
+ | <div>[[Image:PrF_UG_meta_menu_create_using_metaclass.png| | ||
+ | metaclasses_menu_create_using_metaclass]]</div> | ||
<li><p> | <li><p> | ||
Line 46: | Line 40: | ||
which are the classes you can use when creating a class. | which are the classes you can use when creating a class. | ||
You cannot create a class as an instance of an Abstract metaclass. | You cannot create a class as an instance of an Abstract metaclass. | ||
− | |||
− | |||
</p> | </p> | ||
+ | <div>[[Image:PrF_UG_meta_select_metaclass.png| | ||
+ | metaclasses_select_metaclass]]</div> | ||
<li><p> | <li><p> | ||
Line 60: | Line 54: | ||
The name of the metaclass you used will be displayed at the top of the Class Editor, | The name of the metaclass you used will be displayed at the top of the Class Editor, | ||
immediately after the name of the class. | immediately after the name of the class. | ||
− | |||
</p> | </p> | ||
+ | <div>[[Image:PrF_UG_meta_create_class_with_metaclass.png| | ||
+ | metaclasses_create_class_with_metaclass]]</div> | ||
<li><p> | <li><p> | ||
− | Use the | + | Use the [[PrF_UG_classes_class_editor|Class Editor]] |
− | + | to name the class, choose its role, create constraints, and create and edit slots. | |
− | to name the class, | ||
− | |||
− | |||
− | |||
</p> | </p> | ||
</ol> | </ol> |
Revision as of 11:33, October 16, 2008
Creating a Class Using a Metaclass
If you have non-standard metaclasses in your project, you can select the metaclass you want to use when you create a class. You can add metaclasses either by creating them directly, or by including a project that already has metaclasses.
By default, when you create a class using the Create Class button, you use the metaclass of the direct superclass as the metaclass for the new class. (Unless you have made changes, this is the default :STANDARD-CLASS.) If you have used a non-standard metaclass for a class, every new subclass you create for the class will also use the selected metaclass. When you create a class using a non-standard metaclass, the class is given the attributes specified by the selected metaclass.
To create a class using a specified metaclass:
In the Class Browser, select the class that you want as the superclass of the new class.
Click the right mouse button and select "Create subclass using metaclass..."
A dialog box will display the Concrete metaclasses, which are the classes you can use when creating a class. You cannot create a class as an instance of an Abstract metaclass.
Select the metaclass that has the properties that you want and click OK. The new class will be added under the highlighted class. It will have the Class Editor from the selected metaclass, with entry fields determined by the template slots of the metaclass. In the Wineries example, there is an extra entry field called Best Wineries, displayed below the Template Slots Pane in the Class Editor. The name of the metaclass you used will be displayed at the top of the Class Editor, immediately after the name of the class.
Use the Class Editor to name the class, choose its role, create constraints, and create and edit slots.