You can easily extend a class structure with other classes, even when people have already added content to the project. Assume that after awhile users of the 'Encyclopedia: Encarta' require a FAQ for the 'Birds' and the 'Fishes' categories. Till now, the authors are only able to add 'Bird' and 'Fish' chapters. What they are missing here is the ability to add a folder hold FAQs. So, you will have to extend the Encyclopedia’s structure as follows:
Encyclopedia -> the main project folder |
|||
|
Birds -> category 1 |
||
|
|
One bird |
|
|
|
|
Topic that describes the bird |
|
|
Another bird |
|
|
|
|
Topic that describes the other bird |
|
|
FAQ for all birds |
|
|
Plants -> category 2 |
||
|
|
One plant |
|
|
|
|
Topic that describes the plant |
|
|
Another plant |
|
|
|
|
Topic that describes the other plant |
|
|
FAQ for all plants |
|
|
Fishes -> category 3 |
||
|
|
One fish |
|
|
|
|
Topic that describes the fish |
|
|
Another fish |
|
|
|
|
Topic that describes the other fish |
In our example here we require a FAQs at two different points in the hierarchy. You don not have to define two FAQ classes. You define just one FAQ class and then you can reuse it at different points in the hierarchy. And at each point you could assign a different behavior. This approach limits the number of new classes you need to define.
Furthermore you don’t really need to define a new class for a FAQ folder. You could reuse the predefined FAQ folder class and add it to your own ‘Birds’ and ‘Plants’ folder classes.
Opening the Object classes window
Popup the menu of the ‘Birds’ (not a ‘Bird') folder and select ‘Object classes’. You could also use the Workbench main menu item ‘Window > Object classes’.
The Object classes window
Click on ‘Organize folder classes’.
The Folder classes window
On the ‘Folder classes’ window that opens, the ‘Birds’ item should be pre selected in the list. If not then select it and click ‘Show details’ to continue.
Adding a class to the structure
On the left window you select the FAQ item from the ‘Available classes’ list. Then click on the ‘Add’ button. The item will appear in the ‘Added classes’ list. Now we can check or change some attributes of the 'FAQ' class that is now contained in the 'Birds' class.
Setting the class properties
First, only one FAQ folder is allowed in the 'Birds' class. So, make sure the option 'Birds can hold multiple FAQ objects' is deselected on the lower part of the left window. Next, because there will be only one FAQ we do not need the actual FAQ description, the term 'FAQ' is clear. So, make sure the option 'Show main description' is deselected in the 'Behaviour' section on the right window.
Click ‘Submit changes’ to save. Use the same approach to add the predefined ‘FAQ’ class to ‘Plants’ (not ‘Plant’).
Now people have the ability to add a FAQ to two of the Encyclopedia classes. We won’t go into detail about this here as it is described in creating a FAQ.
Adding objects of new classes to the structure