Portlet Factory, Version 6.1.2


 

About building views

To show two collections on one page, add two Bean Master Detail builders.

You can place multiple Bean Master Detail builders on a single page to allow an object and its associated collections to be displayed together. For example, if the application has a collection of A objects and an A object has an associated collection of B objects, the Bean Master Detail builder responsible for showing B objects can draw its view from the currently selected A object. When the page renders the view of the selected A object, the correct associated B objects are displayed as well. For example, you have two collections, Acollection and Bcollection. The first one (Acollection) refers to the variable holding that collection. The second one (Bcollection) has as its collection the following value.

${MethodCall/Acollection_viewObject.getBcollection}

The getBcollection() method in the Acollection object returns a collection of Bcollection objects. The following inputs in the builder call editor for Acollection can specify two different tags on the same page in the model.

  • Page in Model input in the View Detail Options group

  • Page in Model input in the Master / Table View group
Similarly, the same inputs in the builder call editor for Bcollection can also specify two different tags on the same page in the model.

When that page is rendered, the current Acollection_viewObject is used to populate the Acollection view. The getBcollection method is invoked to get the collection of Bcollection objects to display in the Bcollection view. The following ways can show different information in the table and the view.

  • You can use the Use Detail-specific class input in the View Detail Options group but have the object implement a (thin) interface and specify the interface name for the table view. The accessor class and method can return the same physical object, eliminating the need for instantiating a new object. Another advantage is that the object in the main collection is being updated automatically with values from the detail object.

    This is the most efficient way to show different information in the table and the view.

  • If the Use Detail-specific class input is not used, you can use Data Field Modifier builders to make certain columns or fields invisible.

  • If the Use Detail-specific class input is used, you can instantiate a physically different object.

Parent topic: Bean Master Detail builder


Library | Support |