Using a Business Object Model with Multiple Sub-types
You can use forms with extended classes in a business object model.
You can create a complex business object model that has extended classes, containing multiple sub-types, to be used with associated forms.
Sample Project
To view the sample for this task, import the advanced sample projects as described in Importing the Forms Advanced Samples. The sample forms and business object model for the task described in this section are contained in the forms.samples.bom sample project.
There are two forms for this task:
The forms are in subfolders, each corresponding to the form name, at:
forms.samples.bom/Forms/BOMHowTo/BOMHowToProcess
The business object model (FormsSamplesBOM.bom) is at:
forms.samples.bom/Business Objects/
You can double-click the forms and business object model filenames (as well as those of other project resources) in the Project Explorer to open them in the editor. There, you can examine their contents and use them as models for your own projects.
Explanation
The business object model FormsSamplesBOM.bom models a Person class, an Address class, and three extensions thereof: CanadianAddress, UKAddress, and USAddress.
There is a composition aggregation Person::address : Address[1]. There is also AddressBook class with a composition aggregation AddressBook::address : Address[*]. (There are also some other types in the business object model that are not used in the present task, but pertain to other advanced task examples that also use this business object model.)
- Illustrating the Use of Subclasses with the CapturePerson Form
The CapturePerson form shows an instance of a Person together with his or her address. The form contains a separate pane per Address class. The form configures itself dynamically to accommodate inbound address that are instances of Address or instances of a subclass thereof. - Illustrating the Use of Subclasses with the DisplayAddressBook Form
The DisplayAddressBook form shows an instance of an AddressBook together with the addresses within it, using a master-detail configuration.