Client-Side Event Model Introduction to Events and Event Handling

Handling Events 5-5 setSelectedFileItemdata; } 2. To register an event listener method on a component, in the Structure window, select the component that will invoke the event. In the Property Inspector, use the dropdown menu next to the event listener property, and choose Edit. 3. Use the Edit Property dialog to select the managed bean and method created in Step 1. Example 5–2 shows sample code for registering a selection event listener method on a table component. Example 5–2 Registering an Event Listener Method af:table id=folderTable var=file . . . rowSelection=single selectionListener={explorer.tableContentView.tableSelectFileItem} . . . af:table

5.3 Using JavaScript for ADF Faces Client Events

Most components can also work with client-side events. Handling events on the client saves a roundtrip to the server. When you use client-side events, instead of having managed beans contain the event handler code, you use JavaScript, which can be contained either on the calling page or in a JavaScript library. By default, client events are processed only on the client. However, some event types are also delivered to the server, for example, AdfActionEvent events, which indicate a button has been clicked. Other events may be delivered to the server depending on the component state. For example, AdfValueChangeEvent events will be delivered to the server when the autoSubmit attribute is set to true. You can cancel an event from being delivered to the server if no additional processing is needed. However, some client events cannot be canceled. For example, because the popupOpened event type is delivered after the popup window has opened, this event delivery to the server cannot be canceled. Tip: If the event listener code is likely to be used by more than one page in your application, consider creating an event listener implementation class that all pages can access. All server event listener class implementations must override a processEvent method, where Event is the event type. For example, the LaunchListener event listener accepts an instance of LaunchEvent as the single argument. In an implementation, you must override the event processing method, as shown in the following method signature: public void processLaunch LaunchEvent evt { your code here }