How do I synchronize multiple ItemsGrid and Path components that bind to different EnterpriseItems beans?

Consider the following scenario: on a single JSP page, there are two ItemsGrid components and a Path component. The Path component, named path, and one of the ItemsGrid components, named foldersGrid, are both bound to the same EnterpriseItems bean, named folders. This EnterpriseItems bean represents a folder hierarchy within the BusinessObjects Enterprise system that the user can navigate through using path and foldersGrid. Because the two components are both bound to the same EnterpriseItems bean, they are automatically synchronized so that when the user navigates with one component, the other component reflects these changes.

However, the second ItemsGrid component, named reportsList, is bound to a second EnterpriseItems bean called reports, which represents a set of Crystal reports in any given folder. How can reportsList be made to work with the other components on the page? The solution is to synchronize the components in the correct order.

To have the second ItemsGrid component, reportsList, work together with the other components in a meaningful way within the page, the components must be synchronized so that when the user navigates to a certain folder level within foldersList or path, the reportsList displays reports that are present at that same folder level. That is, the parentItemID property of the reports EnterpriseItems bean must be set to the current value of the parentItemID property of the folders bean each time the user clicks a folder in the folders grid or Path component. The result is that the reports grid always shows the same level of information. To enable that co-ordination between components, you set the synchronization for the foldersList component and the path component.

To synchronize the components
  1. In the visual designer, select the path component.
  2. In the Properties view, click the Synchronization tab.
  3. Click Synchronize with the following components and then click Add.
  4. In the Select a Component to Synchronize dialog box, select the reportsList component to synchronize with the current component.
  5. Click OK.
  6. Note:    If you try to synchronize with a component that binds to the same EnterpriseItems bean as other components, a message is displayed that indicates that multiple components share the same itemSource property value (the EnterpriseItems bean), and that, if you add synchronization to the selected component, synchronization will be added to all components that are bound to this bean. Click OK to confirm the synchronization.

  7. In the visual designer, select the foldersList component and repeat steps 2 to 5 to synchronize with the reportsList component.

The act of synchronization adds two important pieces of code to the application. First, an action listener is added to the foldersList and path components:

actionListener="#{pc_<nameofpage>.doAction}"

In addition, in the code-behind java class for the page (created by RAD and usually named <nameofpage>.java), the action event handler method is added to perform the synchronization:

public void doAction() {

    reports.setParentItemID(folders.getParentItemID());

}

As you can see, the order of synchronization matters. In our example, we synchronized foldersList to reportsList and path to reportsList. So when foldersList or path is clicked, reportsList is synchronized. However, the opposite is not true. You did not synchronize reportsList to foldersList, therefore actions in reportsList do not affect foldersList. When you decide which component to select and set synchronization settings on, always keep in mind the behavior you wish to accomplish in your application.



Business Objects
http://www.businessobjects.com/
Support services
http://www.businessobjects.com/services/support/