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.

The form contains a grid pane to display the fields inherited from the base Address class and the details pane contains a separate pane per Address class. As before, the form configures itself dynamically to accommodate inbound addresses that are instances of Address or instances of a subclass thereof.

Procedure

  1. In the Form Designer, use Form > Properties view > Preview Data > Custom to select the MixedAddressTypes test data, which include an Address, a CanadianAddress, a UKAddress, and a USAddress.
  2. Observe the results under the GWT Preview tabs.

    The form displays the address detail pane appropriate to the subclass of the currently selected row in the grid pane.

    Result

    This example uses an address pane pattern whereby the Address (addressBook_address) pane always provides the fields inherited from the base class Address and the subclass-specific Xx Address (addressBook_xxAddress) panes provide only the additional fields defined by the subclass. One could regard this as a UI inheritance pattern.

    Note: The address pane labels are not visible in the canvas, so use the Outline view to locate them.

Result

  • The Address Master (addressBook_address__master) grid pane provides a means to create a new address of a user-selected class.
  • The Change Address Selection rule is triggered by a change in the grid pane selection. It contains a Configure Address Panes action much like the previous example.